Skip to main content
100%

Line / Area Chart

✓ Published0🌍 Public
CColinEberhardt
Last edited May 28, 2019
Created on Mar 26, 2017

This example shows a Cartesian chart with a sine wave rendered as a purple line and a cosine wave as a semi-transparent light green area, sharing a common x-axis over 50 data points. It uses d3 and d3fc, combining a d3fc line series, area series, and gridlines into a single multi-series component within a d3fc Cartesian chart. Linear scales define both axes, with the y-domain padded using d3fc’s extent utility. The data is generated inline with d3.range and Math functions.

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.
mit Licensed

Similar vizzes