score:0
Accepted answer
you will have to add the axis using d3.scale function. see this plnkr for working example.
//add x and y axis
var x = d3.scale.linear()
.range([0, 950]);
var y = d3.scale.linear()
.range([200, 0]);
var xaxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yaxis = d3.svg.axis()
.scale(y)
.orient("left");
x.domain([0, 950]);
y.domain([0, 7]);
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(20,250)")
.call(xaxis);
svg.append("g")
.attr("class", "y axis")
.attr("transform", "translate(20,30)")
.call(yaxis);
Source: stackoverflow.com
Related Query
- How to Add X and Y axis in the pre existing graph using D3
- how to add legend to a pie chart using D3js? And how to centralise the pie chart?
- How can I add images in the nodes of a D3 Sankey diagram, using the rcv and networkD3 packages in R?
- how to add mouse events to force directed graph using the d3 canvas renderer?
- How to properly transpose X and Y axes using the D3 axis commands?
- How to add intervals in the X axis using d3.js?
- How to get a dashed line on Y axis and how to display the value beside the graph in d3
- How do I prevent graph elements from reaching the axis of my graph in D3 and scale properly?
- How to control the space between the start of a bar and the axis in a bar-chart constructed using d3?
- How can I get the D3.js axis ticks and positions as an array?
- how to set the domain and scale on an axis on a nvd3.js multiBarChart
- How can I show a graph using d3 force layout with initial positions set and no movement at all?
- c3 graph in a dark background; how to change axis and tick value color
- How can i get the startAngle and endAngle of each arc in the sunburst example using d3.js?
- how do i add a zoom in and zoom out button in a graph on d3
- How do I create a minimap of an SVG using D3 v5 and show the current viewport dimensions?
- How to add a line graph to a scatterplot using d3?
- How to add a legend and labels to the pie chart?
- D3: How to remove tick marks at the top and bottom of Y axis
- How to visualize the graph using d3Network in R
- How to add a force drag event in D3 and make the node stay where i leave it?
- How to add all but a few columns using javascript and d3
- How do I make a d3.js force directed graph interactive using ajax and python?
- How do I add a click event to a directed graph using dagre d3.js(javascript library)?
- How can I offset the source and target points of a bezier curve using D3's link generator?
- How to remove the comma in D3 axis ticks and remove the last tick?
- D3.js how to get the position/offset of x and y axis
- how to make the x axis scrollable in a d3 line chart graph
- How to increase the space between axis and axis label?
- How do I add a title attribute to the nodes of my force-directed graph generated by d3?
More Query from same tag
- D3 world-50m.json projection filling incorrectly
- Extract a slice of a large multi-dimensional array in Javascript
- Conflict between d3.forceCollide() and d3.forceX/Y() with high strength() value
- Repeated (chained) transitions D3js
- In D3 chart, On Click is not working on circle as expected
- Custom animation in plottable.js line chart
- compare class of path elements to a dataset
- How to zoom a d3 chart correctly?
- d3 Date Axis "Rounding"
- Rebinding exports in d3.js v4
- unable to scale yaxis in d3.js according to the data
- D3, is there any way to transition through an existing graph point by point?
- How to create elements depending on data in D3?
- Panning/Dragging of nodes restricts the Viewport
- d3.js Force layout only applied vertically
- Does Vega-Lite provide all the features that Vega provides?
- Accessing data values in c3js in data events
- show live updates in d3 sankey chart
- IE10/IE11 does not display unicode characters inside of SVG
- ReferenceError: d3 is not defined free code camp
- How do I set the X values for a singled stacked horizontal bar chart using d3.js?
- tool tip for half donut or half pie chart
- D3.js - Transitions on a Streamgraph using CSV data
- d3 zoom listener does not take into account programmatic zoom
- d3.js alternative to axis.tickSubdivide?
- How to add two buttons to a div with D3.js?
- Fixed font-size from an array - D3 Jason Davies Example
- D3 pie chart element popout
- change color of nodes by click on
- d3js: Pairing CSV rows into "g" elements