score:1
The quick and dirty way to do this is to define a second line generator that extracts the data for the other line.
var line2 = d3.svg.line()
.x(function(d,i) {
return x(d.created_at);
})
.y(function(d) {
return y(d.ranking[1][1]);
});
Then all you need to do to draw the line is something like this.
graph.append("svg:path").attr("d", line2(json)).style("stroke", "red");
Complete example here.
Source: stackoverflow.com
Related Query
- How do i plot multiple lines in the same line graph using the D3 framework?
- How to Create different kinds of grid lines using D3 in the same graph
- How to group by multiple keys at the same time using D3?
- How to plot animated line chart using d3 while the data table is required to be updated every 1 second?
- how can i get a label on my lines in a line graph using d3.js
- How do I graph an individual line for each the groups within a Javascript map object using D3.js
- How do you add multiple lines to a D3JS line chart where the depedent variable data sources start at different positions along the range?
- How to normalize data in d3 and plot the lines in the axis independent of other line ranges
- How do I plot multiple rectangles on the same plot in d3
- How can I properly aggregate / group multiple line graphs into one overall graph with d3.js when the x-values aren't matching exactly?
- How can I put a space between the lines of a line chart using d3.js
- How to count events using year and plot line graph in d3.js v3
- How to read multiple files to plot on one line graph in D3.js
- How to link multiple graph networks in d3js so that an event in one calls the same event in other networks
- How to Create/Show Multiple Iterations of Charts with the same data in One Area with Buttons using D3.js
- How to register multiple external listeners to the same selection in d3?
- Can d3.js draw two scatterplots on the same graph using data from the same source?
- How to show a tooltip with value when mouseover a svg line graph using d3.js?
- How can I achieve the R kernel density estimate plot using D3.js?
- How to get the same node positions in d3's force layout graph
- How to use tool tip in Line bar graph using D3 js
- D3 - How to bind the same data to multiple object?
- How to add a line graph to a scatterplot using d3?
- How to visualize the graph using d3Network in R
- how to add mouse events to force directed graph using the d3 canvas renderer?
- How to destroy multiple C3 graphs that were built from the same original function
- How to plot different line patterns for different lines in DC.js series chart?
- How to reuse the same pattern on multiple svg circles in d3.js
- how to make the x axis scrollable in a d3 line chart graph
- How do I split labels for my donut chart to multiple lines using d3.js?
More Query from same tag
- How to understand `constant(_), histogram` in `histogram.value` which is part of `d3.histogram` source code?
- Adding mouseover popups to d3 tree leaves
- How to chain a function call in D3?
- Best d3 scale for mapping integers range
- This in Datum() of d3 version 4 cannot access the bound element
- D3 sankey diagram - enforce node position
- How to limit max width in D3 bar chart
- d3: unable to send mouse events to another svg element (event.target.__data__ is null)
- D3 bar chart by date with context brushing
- D3 Line chart using category name (string) in x-axis
- Using D3.xml to plot a tree layout
- d3 rect in one group interfering with rect in another group
- radar chart with boxplot/ Violin plot
- Painting different vertical segments under curve using d3
- D3.js ordinal multi-series line chart: Nan at path
- Adding a drop down causes an undefined error
- D3.js Chart Transition Erroring
- wrapping text on circular textpath
- Javascript / D3.js - draw large data set - improve the speed of zoom and pan in svg chart ploted by d3.js
- d3 v5 use nested values when scaling axis
- Is there a way to avoid code repetition in d3.js?
- How i can move the gridline behind the bar chart ( D3)
- NVD3 Multi Bar Chart - Add in grid lines and make sure every y axis value shows up
- How to fill a single value in the 'Donut Chart'
- Not sure how to interpret D3 API
- How to render data to chart in email
- How can I position rotated x-axis labels on column chart using nvd3?
- D3.js: Exteding the y-axis without making any changes to the existing chart
- d3.js - only add circle element not update existing
- D3 Coordinates of mousedover circle