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
- Rotate SVG text around a circle then around itself using d3
- NVD3 Toggle Streams
- How to change the tick value in d3, javascript from "1900" to "January"?
- Zoomable icicle d3 right to left
- Working with Vuex with Vue and displaying data
- Multi Object JSON containing static and dynamic data
- How to use CSV data in d3
- Projecting relative positions of graph nodes to absolute coordinates
- How can I get my two d3 graphs to appear next to one another?
- D3 text as leaflet label?
- d3 - data - how to iterate over nested objects
- adding class names to arcs from data in d3.layout.pie()
- D3.js selectors and functions on a jQuery object
- How does d3 V4 d3.stratify work with a tree?
- How do I create D3.js projection for South African topojsson data?
- Three.js ugly rendering effect
- How to group multiple values in nested D3 to create multiple rollup sum chart ?
- Fit the d3js graph in a simple html page
- Chess moves in D3
- SVG markers don't orient properly on a d3.svg.diagonal curve used as a D3 force layout link
- How to load 30 csv files in parallel using queuejs with d3js?
- Grid-lines are being recreated and overlaid on each other
- What format polygon does D3plus largest rectangle require?
- trouble with D3js world map and svg group element width
- What's the easy way to load d3-selection-multi along with d3 v4 in RequireJS?
- Using D3-Geo to plot a shape
- Parsing csv with javascript or d3js: how to skip a column?
- Using D3 selection functions to properly align SVG in HTML layout
- simple d3.js pie chart transitions *without* data joins?
- D3: skip null values in line graph with several lines