Line Chart - Tuong-Nguyen/Angular-D3-Cometd GitHub Wiki
Introduction
A line chart showing the number of donut sold in a day.
This chart includes:
- 2 axis - x and y
- Data points
- A line which connects data points
- An area below the line.
Steps
Preparation
- Create the canvas/svg.
- Create scales for x, y axis.
- Create x and y axis functions
- define the line function for drawing a line:
d3.line()
- define the area function for drawing an area below the line:
d3.area()
Drawing
- Draw the axis
- Draw the line (line format (dash - color - thickness - ...) is configured using css).
- Draw data points
- Draw the area below the line
Code
https://github.com/Tuong-Nguyen/Angular-D3-Cometd/tree/master/Line%20Chart