# Area

Area charts display raw data with colors between axis and line.

# Usage

To visualize your data with an area chart, the main .charts-css class should be followed by the .area class.

<table class="charts-css area">
  ...
</table>
1
2
3

# Data

When you add data, you need to supply not only the data --size variable but also the --start variable that indicates the starting point.

<table class="charts-css area" id="my-chart">

  <tbody>
    <tr>
      <td style="--start: 0.2; --size: 0.4"> <span class="data"> $ 40K </span> </td>
    </tr>
    <tr>
      <td style="--start: 0.4; --size: 0.8"> <span class="data"> $ 80K </span> </td>
    </tr>
    <tr>
      <td style="--start: 0.8; --size: 0.6"> <span class="data"> $ 60K </span> </td>
    </tr>
    <tr>
      <td style="--start: 0.6; --size: 1.0"> <span class="data"> $ 100K </span> </td>
    </tr>
    <tr>
      <td style="--start: 1.0; --size: 0.3"> <span class="data"> $ 30K </span> </td>
    </tr>
  </tbody>

</table>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Area Example #1
$ 40K
$ 80K
$ 60K
$ 100K
$ 30K
Open in:

# Dimensions

To control the chart dimensions you can use regular CSS. You can use media queries to set different dimensions for smaller devices.

#my-chart.area {
  height: 200px;
  max-width: 400px;
  margin: 0 auto;
}
1
2
3
4
5
<table class="charts-css area" id="my-chart">
  ...
</table>
1
2
3
Area Example #2
Open in:

# Orientation

You can control the chart orientation, or direction. The initial orientation is top-to-bottom (on LRT and RTL languages) and right-to-left (on TTM languages). Using the .reverse class you can reverse the orientation.

<table class="charts-css area reverse">
  ...
</table>
1
2
3
Area Example #3
Open in:

# Heading

You can add a heading to your chart using the <caption> tag. By default the heading is hidden. To display the heading use the .show-heading class.

<table class="charts-css area show-heading">
  <caption> Descriptive Chart Heading </caption>
  ...
</table>
1
2
3
4
Descriptive Chart Heading
Open in:

# Multiple Datasets

You can use a single dataset (one <td> tag in each <td>).


 


<tr>
  <td> Data </td>
</tr>
1
2
3

Or multiple datasets (many <td> tags in <td>).


 
 
 


<tr>
  <td> Data </td>
  <td> Data </td>
  <td> Data </td>
</tr>
1
2
3
4
5

But when using multiple datasets you should add the .multiple class.

<table class="charts-css area multiple">
  ...
</table>
1
2
3
Area Example #5
50 20 40
80 50 10
40 30 20
Open in:

# Labels

You can add labels to your data and control the labels positions and size. Labels added using <th> tag inside the <tr>


 





<tr>
  <th scope="row"> Label </th>
  <td> Data </td>
  <td> Data </td>
  <td> Data </td>
</tr>
1
2
3
4
5
6

By default the labels are hidden. To display the labels use the .show-labels class.

<table class="charts-css area show-labels">
  ...
</table>
1
2
3
Area Example #6
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #7
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:

Some charts use long labels others use short ones. To customize the label size use the --labels-size variable.

#my-chart.area {
  --labels-size: 3rem;
}
1
2
3
Area Example #8
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #9
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:

# Axes

You can control the axes that will be displayed on the chart.

# Primary Axis

To add a primary axis to separate the labels from the chart itself use the .show-primary-axis class.

<table class="charts-css area show-primary-axis">
  ...
</table>
1
2
3
Area Example #10
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #11
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:

# Secondary Axes

To add secondary axes, located inside the chart itself, use the .show-*-secondary-axes class.

<table class="charts-css area show-4-secondary-axes">
  ...
</table>
1
2
3
Area Example #12
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #13
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:

# Data Axes

To add data axes which are auto-generated based on the amount of rows (<tr> tags) you have. Use the .show-data-axes class to add them.

<table class="charts-css area show-data-axes">
  ...
</table>
1
2
3
Area Example #14
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #15
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:

# Reverse Order

You can reverse the order of the elements without changing the HTML markup.

# Reverse Data Order

To reverse thr data order use the .reverse-data class.

<table class="charts-css area reverse-data">
  ...
</table>
1
2
3
Area Example #16
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in:
Area Example #17
Year Progress 1 Progress 2 Progress 3
2000 50 20 40
2010 80 50 10
2020 40 30 20
Open in: