Threshold
API v0.xGlobal: reads the global Chartist, for backwards compatibilityNo SSRchartist-plugin-threshold@0.0.2Splits lines and bars at a value and gives the parts above and below their own classes to style.
- Author
- Gion Kunz
- License
- WTFPL
- Downloads
- 1,441 a month (October 14, 2026)
- Last release
- 2015
- Charts
- Line, Bar
See it run
src/main.ts
import 'chartist/styles.css';
import './style.css';
import { lineChart } from 'chartist';
import { fromLegacyPlugin } from 'chartist/compat';
// Plugin scripts register on the global `Chartist`.
const { plugins } = Chartist;
lineChart(
'#chart',
{
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
series: [[2, 5, 3, 7, 4, 8, 6]]
},
{
showArea: true,
plugins: [fromLegacyPlugin(plugins.ctThreshold({ threshold: 4 }))]
}
); Live
Use it on your site
Runs on v2 with chartist/compat. A script: load it after importing chartist/compat, which sets up the global it reads. With the UMD build or a bundler
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/index.min.css">
<script type="module">
import 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/compat.min.js';
</script>
<script defer src="https://cdn.jsdelivr.net/npm/chartist-plugin-threshold@0.0.2/dist/chartist-plugin-threshold.js"></script>
<script type="module">
import { lineChart } from 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/index.min.js';
import { fromLegacyPlugin } from 'https://cdn.jsdelivr.net/npm/chartist@2.0.0-rc.2/dist/compat.min.js';
lineChart('#chart', data, {
plugins: [fromLegacyPlugin(Chartist.plugins.ctThreshold())]
});
</script>