# Column
Column charts display raw data as vertical columns.
# Usage
To visualize your data with a column chart, the main .charts-css
class should be followed by the .column
class.
<table class="charts-css column">
...
</table>
2
3
# Wrapper
It's recommended to wrap the chart with a wrapper element. This element is used not only to hold the chart components, but also for scoping the styles.
<div id="my-chart">
<table class="charts-css column">
...
</table>
<ul class="charts-css legend">
...
</ul>
</div>
2
3
4
5
6
7
8
9
10
11
To set the chart dimensions, add some CSS:
#my-chart {
width: 100%;
max-width: 300px;
margin: 0 auto;
}
#my-chart .column {
...
}
#my-chart .legend {
...
}
2
3
4
5
6
7
8
9
10
11
# Heading
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.
<div id="my-chart">
<table class="charts-css column show-heading">
<caption> Descriptive Column Chart Heading </caption>
...
</table>
</div>
2
3
4
5
6
7
8
# Data
To transform HTML tables into charts, you need to provide data. The chart requires unitless numbers, between 0
to 1
.
<tr>
<td> $ 40K </td>
</tr>
2
3
Use the --size
variable to set the data.
<tr>
<td style="--size: 0.4"> $ 40K </td>
</tr>
2
3
To help the framework identify the text, wrap the content with a <span class="data">
tag.
<tr>
<td style="--size: 0.4"> <span class="data"> $ 40K </span> </td>
</tr>
2
3
# Multiple Datasets
Single dataset have one <td>
tag in each <tr>
.
<tr>
<td> Data </td>
</tr>
2
3
Multiple datasets have several <td>
tags in each <tr>
.
<tr>
<td> Data </td>
<td> Data </td>
<td> Data </td>
</tr>
2
3
4
5
As any other data item, they should have the relevant structure.
<tr>
<td style="--size: 0.2"> <span class="data"> Data </span> </td>
<td style="--size: 0.4"> <span class="data"> Data </span> </td>
<td style="--size: 0.6"> <span class="data"> Data </span> </td>
</tr>
2
3
4
5
When using multiple datasets you should add the .multiple
class to let the framework apply different styles.
<table class="charts-css column multiple">
...
</table>
2
3
# Labels
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>
2
3
4
5
6
By default, labels are hidden. To display labels use the .show-labels
class.
<table class="charts-css column show-labels">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Axes
Control the axes displayed on the chart.
# Primary Axis
To add a primary axis, separating the labels from the data, use the .show-primary-axis
class.
<table class="charts-css column show-primary-axis">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Secondary Axes
To add secondary axes, located behind the chart data, use the .show-*-secondary-axes
class. Use the .show-*-secondary-axes
class. Replace the *
in the class name, with any number 1
-10
. For example, to display four axes use the .show-4-secondary-axes
class.
<table class="charts-css column show-4-secondary-axes">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Data Axes
Data axes are auto-generated based on the amount of columns (<tr>
tags) in the chart. Add data axes using the .show-data-axes
class.
<table class="charts-css column show-data-axes">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Spacing
Control the space between the data items and the datasets.
# Data Spacing
To add space between data items use the .data-spacing-*
class.
<table class="charts-css column data-spacing-10">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Datasets Spacing
To add space between data items use the .datasets-spacing-*
class.
<table class="charts-css column multiple datasets-spacing-10">
...
</table>
2
3
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |
# Orientation
Control the chart orientation, or direction. The initial orientation is top-to-bottom (on LTR and RTL languages) and right-to-left (on TTM languages).
# Reverse
Use the .reverse
class to reverse the orientation.
<table class="charts-css column reverse">
...
</table>
2
3
2016 | |
---|---|
2017 | |
2018 | |
2019 | |
2020 |
2016 | |
---|---|
2017 | |
2018 | |
2019 | |
2020 |
# Reverse Labels
Use the .reverse-labels
class to reverse the labels position.
<table class="charts-css column reverse-labels">
...
</table>
2
3
2016 | |
---|---|
2017 | |
2018 | |
2019 | |
2020 |
2016 | |
---|---|
2017 | |
2018 | |
2019 | |
2020 |
# Reverse Data
To reverse the data order use the .reverse-data
class.
<table class="charts-css column reverse-data">
...
</table>
2
3
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
Year | Progress |
---|---|
2016 | |
2017 | |
2018 | |
2019 | |
2020 |
# Reverse Datasets
To reverse the datasets order use the .reverse-datasets
class.
<table class="charts-css column reverse-datasets">
...
</table>
2
3
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |
# Reverse Data & Datasets
Combine the two classes to reverse the data order and the datasets order.
<table class="charts-css column reverse-data reverse-datasets">
...
</table>
2
3
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |
Year | Progress 1 | Progress 2 | Progress 3 | Progress 4 | Progress 5 |
---|---|---|---|---|---|
2000 | |||||
2020 |