score:1
Accepted answer
Minor change/typo:
You're assigning height
and width
to the body
and not the svg
. Interchanging those 2 lines:
let svg = d3.select("body")
.append("svg")
.attr("width", fullWidth)
.attr("height", fullHeight)
And adding some CSS to the paths:
path.line {
fill: none;
stroke: #000;
}
Here's a fork: https://codepen.io/shashank2104/pen/GwqjVK
Source: stackoverflow.com
Related Query
- d3 line chart - object digging
- D3 : non continuous line chart with null values inside an object
- line chart using arrays of an object using d3
- D3: draw interactive hover line in multiple line chart for array object
- nvd3 line chart with string values on x-axis
- Draggable line chart in R/Shiny
- D3.JS time-series line chart with real-time data, panning and zooming
- d3 Line Chart Filling at Arbitrary Line
- Multiseries line chart with mouseover tooltip
- D3 line chart axis text labels in multi line
- NVD3 - line chart NaN on safari using latest versions
- NVD3 line chart with realtime data
- javascript charting - nvd3 line chart with two Y-axis
- D3.js: Line chart - tooltip and vertical line of hover
- NVD3 Line Chart Uncaught TypeError: Cannot read property 'x' of undefined
- Solid and dashed line in D3 line chart
- d3 Line Chart with enter-update-exit logic
- D3 multi-series line chart from pivoted JSON
- Draw a vertical line representing the current date in d3 gantt chart
- typescript line chart d3
- d3js line chart error - drawing weird area
- NVD3 line chart with vertical line
- dc.js Series Chart multi line
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- NVD3 Line Chart X Axis Ticks Are Missing
- D3.js combining bar and line chart
- dc.js line chart with range of colors
- Force a d3 line chart to ignore null values
- how to style style line chart points in c3js
- line chart of json data in d3
More Query from same tag
- SVG: Moving mouse to <image> element triggers mouseout event of parent <g> element (d3.js)
- XAxis time scale from csv data
- Parse json string stored in database to render D3 tree layout
- d3.js nvd3 issue: different charts on the same HTML page look the same (even though they have different IDs)
- y0 naming convention in d3.js - what are these variables used for? How best to explain it?
- Dynamically change an input field's placeholder?
- How to zoom around an svg
- How can D3 read csv from url?
- Single horizontal stacked bar
- D3.js table not refreshing when data changes
- Making An HTML element inside a D3-Tip Trigger Click Event
- D3 Selection Highlight (efficiency?)
- d3.js updating visual
- Reusable D3 chart with common code separated out
- Getting TypeError: .selectAll(...).enter is not a function with d3.js
- Updating D3 circle pack layout
- getting rid of <canvas> to display polygons on top of image with .tif extension
- Access scale factor in d3's pack layout
- Add border-radius property to D3js Donut Chart
- d3.js : re-inserting elements during dragstart/mousedown interferes with click events in Chrome and Safari but not Firefox
- How to add numbers to bars with D3.js?
- Pie layout produces different ordering on Firefox and Chrome for the same dataset
- D3. How do I act on the selected node and all parent nodes
- enlarge / animate map or change viewBox
- D3.js Heatmap: How to read from a nested json and create a Heatmap using D3
- d3 v5 axis transition
- How to tell when a D3 force layout has stopped
- Issues with Javascript closures and scope
- D3.js chart responsive behavior
- How to define a scale with intervals with d3js