Skip to content
Back to skills

1 Use Proper Margins Convention

ASecurity

Sub-skill of d3js: 1. Use Proper Margins Convention (+3).

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 9, 2026
developmentjavascriptgojavanode

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add vamseeachanta/workspace-hub --skill 1-use-proper-margins-convention --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 1 Use Proper Margins Convention?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 1 Use Proper Margins Convention
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vamseeachanta-1-use-proper-margins-convention/badge)](https://www.skillsdirectory.com/skills/vamseeachanta-1-use-proper-margins-convention)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: d3js-1-use-proper-margins-convention
description: 'Sub-skill of d3js: 1. Use Proper Margins Convention (+3).'
version: 1.0.0
category: data-visualization
type: reference
scripts_exempt: true
---

# 1. Use Proper Margins Convention (+3)

## 1. Use Proper Margins Convention

```javascript
const margin = { top: 20, right: 20, bottom: 30, left: 40 };
const width = 960 - margin.left - margin.right;
const height = 500 - margin.top - margin.bottom;

const svg = d3.select('body').append('svg')
  .attr('width', width + margin.left + margin.right)
  .attr('height', height + margin.top + margin.bottom)
  .append('g')
  .attr('transform', `translate(${margin.left},${margin.top})`);
```


## 2. Use Method Chaining

```javascript
// Good - readable chaining
svg.selectAll('circle')
  .data(data)
  .enter()
  .append('circle')
  .attr('cx', d => xScale(d.x))
  .attr('cy', d => yScale(d.y))
  .attr('r', 5);
```


## 3. Separate Data from Presentation

```javascript
// Load data separately
d3.json('../data/data.json').then(data => {
  visualize(data);
});

function visualize(data) {
  // Visualization logic here
}
```


## 4. Use Responsive Design

```javascript
// Make chart responsive
function resize() {
  const container = d3.select('#chart').node();
  const width = container.getBoundingClientRect().width;

  xScale.range([0, width]);
  svg.attr('width', width);
  // Update chart elements
}

window.addEventListener('resize', resize);
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.