Quite simply: Just draw 2 charts but only append one x-axis, here's a fiddle to get you started: http://jsfiddle.net/henbox/fg18eru3/1/
In this example, I've assumed that the two different datasets have different y-domains but the same x-domain. If that's not the case, you should just get the max and min from the combined x-domains of both sets.
If you start by defining 2
g elements that will contain the two charts, and transforming the bottom chart down so they don't overlap:
var topchart = svg.append("g").attr("class", "topchart"); var bottomchart = svg.append("g").attr("class", "bottomchart") .attr("transform", "translate(0," + height/2 + ")");
... then append the
path and y-axis to the appropriate
g, but only add the x-axis to the bottom chart:
bottomchart.append("g") .attr("class", "axis x-axis") .attr("transform", "translate(0," + (height/2 - padding) + ")") .call(xAxis);
- How to create Stacked Line Chart D3, Multiple Y Axis and common X Axis
- How to line up x axis on stacked bar chart with a line overlay in d3.js
- How do you get JSON data and create a line chart with d3.js?
- How to create a d3 stacked bar chart that only iterates through columns 1 and 2 of data file?
- How can I create a basic bar chart with unique counts on the y axis and a category on the x axis?
- How to create a line chart with vertical line and different backgrounds?
- How to put data on line chart when x axis and data has a time range
- How to extract data from a csv file and create a line chart from it in D3.js
- How to create stacked row chart with one row with dc.js?
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- How to modify axis labels in d3 for a stacked bar chart when the axis labels are mapped as part of the scale's domain
- dc.js - how to create a row chart from multiple columns
- d3/dc.js - How to create a stacked bar chart while telling crossfilter to treat elements in an array as separate records?
- d3.js, how can i create an axis with custom labels and customs ticks?
- How to create a stacked bar chart using dc.js?
- How to group multiple values in nested D3 to create multiple rollup sum chart ?
- d3 bar chart with fixed bar width and fixed spacing to align in center axis line
- How to show values stacked bar chart utilizing dc.js and d3.js?
- D3 Bar and Linear Chart With Multiple Axis
- how to create a stacked bar chart with images in d3
- How to create a % difference arrow line with value in a bar chart using D3.js
- How to create left axis with variable tick interval in tick values and has same distance between tick value
- how to make the x axis scrollable in a d3 line chart graph
- D3 v6: How to zoom stacked bar by selected segment to stretch only selected segment and shrink rest segments (and keep initial chart width)?
- How to make a mouseover interactive line graph with multiple data series and 2 y axes?
- How to create a multi-series line chart with series for each unique item in 1st column?
- How to create a drop down in a HTML table and d3 bar chart
- how to display data from 1st point on words on y axis for line chart in d3.js
- How to add space between axis and line in D3 line chart?
- D3.js V4 : How to create X axis with time and %H:%M:%S format
More Query from same tag
- tooltip on chart not working
- How to display images on nodes of a react-d3-graph?
- d3js panning with middle mouse button
- D3 map SVG performance
- Get all xy coordinates of 4 corners of svg image - D3
- Possible d3 Bug: dragend fires without any drag event
- Constructed SVG does not work where HTML-drawn does
- Update d3 graph with new data
- How to limit the text of polygons in Voronoi diagram with D3.js?
- How do I change symbol type colors on D3js?
- Dynamically new dimensions with D3 JS parallel sets
- d3 remove decimal values from chart
- inner html from d.properties from 2 different data sources (d3.js)
- How to integrate D3.js to jasper soft community version
- Problems with IndexedFaceSet in X3Dom + D3
- modifying the d3 force-directed graph example
- How to show only filtered entries dc.js?
- d3 dynamic data in bar graph
- D3: keeping position of SVG's relative while panning and zooming
- D3.js Circles on Map
- D3.js Transition issue
- d3.js appending two labels from a dataset on the Y axis
- How do I place my self-made triangle on a specific location with my ordinal scale in D3?
- How to move connecting path/lines in D3 to edges of shape
- d3 returns incorrect week start
- How do I influence link distance in 3d-force-graph?
- When i click on the marker, the pop up doesn't appear. I get the following error
- How to turn a hclust-object into JSON for D3?
- Annotation connectors blocking tooltips