Area charts are a type of line chart where the area between the line and the x-axis is filled in with color. This creates a visual representation of the cumulative value over time.
Typical use cases for area charts include visualizing trends in data such as website traffic, sales figures, and economic indicators. They are particularly effective for showing how a quantity accumulates or decreases over time.
In this tutorial we will plot the daily value of the S&P 500 stock market index from the year 2000 till 2020. Every workday for twenty years equals more than 5000 values, no problem for DataPicta. To get started can download this dataset, just click this link:
Upload the data
- Goto www.datapicta.com
- Click the Upload data icon
- Click the Upload button
- Select the S&P500.csv file you just downloaded
- Enter a name for the dataset, for example S&P 500
- Click Parse
After parsing, you should see your data in a table.
Add the area Mark
To create an Area chart you will need the Area Mark.
- Click the Add a Mark icon
- Click Area
Area charts usually have the timeline on the horizontal axis and their values on the vertical axis. Lets do that too.
- For X axis choose Date
- For Y axis choose Adj Close
Change the color
To make the chart a little more appealing we could make the fill color a lighter color and add a line on the top. Let's first change the color.
- Click the Style tab
- For Fill color pick any light color
Add a line on top
To add a line on top of the area we will add the line mark
- Click the Add a Mark icon
- Click Line
- For X axis choose Date
- For Y axis choose Adj Close
Please note that the steps you made for the Line mark were exactly the same as for the Area mark. As a final step we will change the color of the line.
- Click the Style tab
- For Stroke color pick the same color, but a little darker
- For Stroke width type 1
For some interactivity we will add a tooltip to the line mark.
- Click the Tooltip checkbox