Preact component for Chartist.js
npm install preact-chartistpreact-chartist
===============
Preact component for Chartist.js
```
$ npm install preact-chartist --save
Chartist is a peer dependency to preact chartist. You need to install it if you do not have it installed already.
``
$ npm install chartist --save
`js
import { ChartistBarChart } from 'preact-chartist';
const data = {
labels: ['W1', 'W2', 'W3', 'W4', 'W5', 'W6', 'W7', 'W8', 'W9', 'W10'],
series: [
[1, 2, 4, 8, 6, -2, -1, -4, -6, -2]
]
};
const options = {
high: 10,
low: -10,
axisX: {
labelInterpolationFnc: function(value, index) {
return index % 2 === 0 ? value : null;
}
}
};
function Bar() {
return (
ReactDOM.render(
`
js
import {
ChartistBarChart,
ChartistLineChart,
ChartistPieChart,
} from 'preact-chartist'
`Tree shaking is possible by modern bundlers for classes not imported.
$3
Please check out Chartist.js API documentation for more details of the options.
* data - chart data (required)
* style - inline css styles (optional)
* options - chart options (optional)
* responsive-options - chart responsive options (optional)
To add support for aspect ratio
`jsx
`$3
This module does not include the css files for Chartist. If you want to add it, include their CDN in your html file
`HTML
`Or
npm to install Chartist and include it in your build process.`
$ npm install chartist
`$3
`
$ npm ci
``MIT
Thanks to the original react-chartist project and it's contributors; from which this project was forked.