score:9
in d3, no matter what axis generator you use...
- axisbottom();
- axistop();
- axisright();
- axisleft();
... the axes are always rendered at the origin, that is, (0,0)
. it's the very first line in the api:
regardless of orientation, axes are always rendered at the origin.
therefore, you have to translate the axis.
have a look at this demo. the first axis has no translate, the second one does:
var svg = d3.select("svg");
var scale = d3.scalelinear().range([10, 140]);
var axis = d3.axisright(scale);
var g1 = svg.append("g").call(axis);
var g2 = svg.append("g").attr("transform", "translate(270,0)").call(axis);
<script src="https://d3js.org/d3.v4.min.js"></script>
<svg></svg>
Source: stackoverflow.com
Related Query
- D3 only one Y-axis on right for plotting line chart
- brush in multiline chart is working for only one line
- C3js - combination chart with data labels only for line
- Getting the scale right for a line chart for a simple CSV in D3 v4
- how to display data from 1st point on words on y axis for line chart in d3.js
- Zoom left and right axis for dual scaled chart in d3
- dimple - make line dotted for only part of the chart
- How to zoom only on the X axis in a line chart in d3.js (v7)
- D3 Line Chart not having proper X & Y axis plotting with Labels
- NVD3 Cumulative Line Chart : How to set different back ground color for specific X axis
- D3 line chart plotting backwards despite y axis being incremental in nature
- How to rotate the text labels for the x Axis of a nvd3.js line chart
- How to change color only for data grid or x and y axis in chart in D3.js
- dc.js Stacked Bar Chart having only one column and with elastic X Axis is not rendered properly
- Right Axis not displaying on Dual Axis Grouped Bar and Line Chart D3
- d3 tooltip bar for multi line chart on mouseover on Y Axis (code supplied)
- why Only one line is getting extended while using brushed() in interactive multiseries line chart
- D3: Is it possible to zoom+pan one axis and only pan the other?
- MultiBar chart with nvd3 / d3 only shows labels for every other tick on the x-axis. How can I get them all to show up?
- D3 line chart axis text labels in multi line
- d3js timeline chart - with one rectangle block for a scrub
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- NVD3 Line Chart X Axis Ticks Are Missing
- what scale to use for representing years only on x axis in d3 js
- Change range for one y axis nvd3/d3
- D3 force layout: Straight line instead of curve for links (but only for some links)
- D3: How to use exit().remove() for Multi-Series Line Chart
- Error in A Simple D3 Line chart with Legend and Tooltips for D3v 3.5.13
- How can I create a doughnut chart with rounded edges only on one end of each segment?
- custom x axis tooltip for nvd3 scatter chart
More Query from same tag
- Changing Ticks values to text using D3
- How to create an interaction between charts in d3
- Present same D3 Charts multiple times on a same html page
- d3 animated map: after zooming in, how to correctly project points when animation begins?
- Font style of text in svg not propagating to png on download
- Updating only those SVG elements where the underlying bound data has been modified
- Custom layouts using D3
- In D3.js, how to only add a comma on numbers with 5+ digits?
- adding mouseover event to d3.js bar chart
- Points on an Arc using D3
- Selection does not work if "too exact"
- D3.js Collapsible tree: Adding a label for each level
- d3 plot missing the first item in an array
- d3.js only the root and its childs should be opened
- Randomize and animate multiple Start and End Angles of Arc
- Realtime graph in D3.js and javascript
- Dj3 rotation how can i merge?
- How to load two external files in D3?
- scale size donut in d3.js
- Drawing multipe items in svg g elements using d3
- 'Autofocus' attribute works once, but not twice, on input elements
- Client side topojson rendering seemingly incorrect paths
- How to Deploy D3 in Heroku (Django App)?
- Return thresholds from quantized colorscale d3
- How to map node objects to node Ids in d3 tutorial?
- Any good client-side open-source dashboard framework?
- Adjusting node position in force-directed graph
- .onmousedown executing on page load
- How to add a header text for svg legends
- How to use only one d3.json().then promisse to many different barcharts?