Skip to main content
100%

Pie chart for line chart

✓ Published0🌍 Public
EElisaDnr
Last edited Jan 9, 2018
Created on Jan 9, 2018

This example overlays a pie chart on top of a line chart, showing the distribution of accident causes (categories nb_0 through nb_9) at a selected time, specifically 0015. The pie chart is generated from a local JSON file, `trajet_accident.json`, and rendered using D3 v4’s `d3.arc`, `d3.pie`, and `d3.scaleOrdinal` APIs. The SVG is appended to a dedicated `#pie` div, positioned absolutely over the chart. Values are displayed as percentages with two decimal places, omitting zero-value slices. The chart uses conventional margins and standard D3 utilities like `d3.json` for asynchronous data loading.

AI-generated description

This simple line chart is constructed from a TSV file storing the closing value of AAPL stock over the last few years. The chart employs conventional margins and a number of D3 features:

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/3883245'>Line Chart</a>

forked from <a href='http://bl.ocks.org/ElisaDnr/'>ElisaDnr</a>'s block: <a href='http://bl.ocks.org/ElisaDnr/4fdaa27d7b1914fce00122bcc4dde37d'>Line Chart with pie chart</a>

forked from <a href='http://bl.ocks.org/ElisaDnr/'>ElisaDnr</a>'s block: <a href='http://bl.ocks.org/ElisaDnr/d0d72cdd2d5443f9a93d4a31f6904e0a'>Line Chart with pie chart json</a>

forked from <a href='http://bl.ocks.org/ElisaDnr/'>ElisaDnr</a>'s block: <a href='http://bl.ocks.org/ElisaDnr/2f318e04bb95c3952741ab4e5681131c'></a>

gpl-3.0 Licensed

Similar vizzes