1👍
✅
Okay I think I’ve figured it out and it’s hilariously simple, I printed the object imported from chartjs-plugin-downsample
and it came out looking suspiciously like the thing you’re meant to pass to the plugin service.
So the way to do this is:
import { Chart } from 'react-chartjs-2';
import DownsamplePlugin from 'chartjs-plugin-downsample';
...(component declaration)...
componentWillMount() {
Chart.plugins.register(DownsamplePlugin);
}
...(rest of your component)...
and then just play around with the options. Make sure to set your min
and max
options, I’ve had it do weird things otherwise.
Source:stackexchange.com