Skip to main content
100%

Line / Area Chart

✓ Published0🌍 Public
CColinEberhardt
Last edited May 15, 2019
Created on May 15, 2019

This example shows a Cartesian line and area chart plotting two trigonometric functions, sine and cosine, against a shared linear x-axis. A purple line represents sine, while a semi-transparent green area represents cosine, with gridlines spanning the plot area. The visualization uses d3fc’s `chartSvgCartesian` to build the chart, while `seriesSvgLine`, `seriesSvgArea`, and `annotationSvgGridline` are combined via `seriesSvgMulti` for rendering. Data is generated inline with `d3.range`, and the x- and y-domains are calculated using `fc.extentLinear` with padding applied to the y-scale.

AI-generated description

This example demonstrates how to render a simple Cartesian chart with a line and an area series. The chart is constructed from the following components:

  • A Cartesian chart, with linear scales for x and y, is used to render the plot area, axes and labels.
  • The data is rendered via a line series and an area series, these are combined into a single series using the multi series component.
  • A gridlines component is also added to the multi series.
  • The extent utility function is used to calculate the domain for the x and y scale, with padding applied to the y scale.

forked from <a href='http://bl.ocks.org/ColinEberhardt/'>ColinEberhardt</a>'s block: <a href='http://bl.ocks.org/ColinEberhardt/7396acc69f9a061fe58b562c6220a08c'>Line / Area Chart</a>

mit Licensed

Similar vizzes