score:2
Accepted answer
you should draw the lines based on data. that's the whole point of d3 (and it's usually faster).
i'm not sure how you draw the chart, there's no relevant code in the question, but...
if you were able to display individual stacks (i'm assuming you want to display lines on top of stacks, which are collections of rectangles), then you should have no problem displaying lines on top of them.
without looking at your data, i can only guess... but here's the basic algorithm:
- iterate over the number of stacks
- calculate the sum of values of individual elements within each stack
- draw lines with
y
values at those sums (scaled with your chart'syscale
)
Source: stackoverflow.com
Related Query
- How to add a line at top of stacked bar chart with d3.js?
- How to line up x axis on stacked bar chart with a line overlay in d3.js
- D3 How to add rounded top border to a stacked bar chart
- How to add a line on x-axis on a horizontal bar chart in d3
- D3 : How to add labels top of in each bar in grouped bar chart
- 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 add live data to stacked bar chart
- Angular-NVD3 Stacked Bar Chart With Line
- How to display total count on top of the stacked bar chart
- How to add tooltip with eclipse in legend in line chart in D3.js
- D3.js - How to add the general update pattern to a stacked bar chart
- How to build stacked bar chart overlapping with d3js
- How to add a properly scaled y axis to a stacked d3 bar chart
- How to update d3.js bar chart with new data
- How to create stacked row chart with one row with dc.js?
- d3.js How to add lines to a bar chart
- d3.js bar chart sorting: can't figure out how to sort x-axis labels along with bars
- How to add a fixed range vertical line to a D3.js chart
- How to use x and width in a bar chart with scaleTime?
- How to add space between bars in a grouped bar chart in a nvd3 grouped multibar chart?
- d3.js stacked bar chart with positive and negative values
- How do I add an "average" line to an nvd3.js Stacked Area Chart?
- How to Make a bar chart with rounded corners with extended grid in d3.js?
- 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
- How to create Stacked Line Chart D3, Multiple Y Axis and common X Axis
- NVD3.js: Stacked and grouped bar chart with two y-axis
- D3 - How to loop through an object with keys for a bar chart
- NVD3 Stacked Bar Chart Plus Line Overlapped
- d3.js Stacked bar chart with Logarithmic Scaling
More Query from same tag
- Data processing with Dimple.js
- Add lines from bubble to popup template on a datamap
- Lost flow chart lines after upgrading from 3.5.5 to 4.2.8
- Avoid data caching when using d3.text
- D3 Sankey Diagram: Changing Node Position
- D3 date range by hour; day repeats every 7 days
- How to reduce Y-Axis scale values in d3 bar chart?
- Why the bars are on top of each other
- d3js tree chart not fitting on canvas
- Amend position of D3 axes labels
- How do you create a treemap in D3 with custome colors
- Is it possible to assign all module imports as a return type?
- Making charts clickable
- How does D3 node selection work in D3 force graph?
- Unable to select <linearGradient> with D3.js in Chrome
- Calling specific data in an array created with rollup with d3.js
- ISO8601 Date Time format D3
- D3 updating bar chart with new data set cause update issue
- d3.js tooltips on path
- d3 v4 line chart data
- Do AngularJS Directives for D3JS exist?
- D3 apply conditional formatting to Line element
- d3.js Tree link not showing
- Trying to use chaining to create wrapped text
- D3 - legend won't visualize
- d3 get element or object under current mousepointer?
- Legend placement D3
- D3.js - Working with major and minor gridlines
- D3 - Zooming with D3's SVG Symbols
- How to show only limited number of records in box plot dc.js