3dcl / chartjs-plugin-responsive-downsample Goto Github PK
View Code? Open in Web Editor NEWA chart.js plugin to dynamically downsample line chart data depending on the chart screen size
License: MIT License
A chart.js plugin to dynamically downsample line chart data depending on the chart screen size
License: MIT License
hi,
After 5 seconds, I add a new sample to the chart. Currently, the chart is refreshed only by zoom/pan the chart. Is there a command refreshing the algorithm?
I am very happy that you took care of the old chartjs-plugin-downsample
plugin.
A hint in the README that you added it to npm
would be nice, as the first hints on search engines (depending of the search term of course) point to github instead of npmjs.org
.
Suggestion for README.md
(in front of configuration
):
### Installation
```bash
$ npm install chartjs-plugin-responsive-downsample
```
Preview:
$ npm install chartjs-plugin-responsive-downsample
Can you create a *.min.js file to easy include the plugin without npm? Got a simple project for testing ChartJS and the Plugins for it. And don't know if using NPM is the right for the project.
Hope you understand my issue.
This plugin really looks awesome! Anyway, maybe I am stupid but I cant make it work with ng2-charts
:
import { ResponsiveDownsamplePlugin } from 'chartjs-plugin-responsive-downsample';
export class AppComponent {
// ...
chartPlugins = [ResponsiveDownsamplePlugin];
chartOptions: ChartOptions = {
aspectRatio: 3,
responsive: true,
legend: {display: false},
scales: {
xAxes: [
{
ticks: {
maxTicksLimit: 20
}
}
]
},
};
Template:
<canvas baseChart
[data]="chartData"
[options]="chartOptions"
[labels]="chartLabels"
[plugins]="chartPlugins"
chartType="line"
>
</canvas>
There is no error or something, i just doesnt downsample.
Ran into this issue with chartjs-plugin-downsample as well.
When using time series data, Chartjs allows to use 't' instead of 'x' for each data point, but an error is thrown when using this plugin with 't'.
Not a huge problem, just have to switch to 'x', but should be allowed as per the Chartjs docs:
https://www.chartjs.org/docs/latest/axes/cartesian/time.html
Great plugin, btw.
As it seems version 1.1.2 introcued a bug. It works not when I use data with t value, but not anymore with data with x value.
The problem seems to be the line
var i = t.x || t.t;
in the minified version.
t.x || t.t return undefined if t.t is undefined...
I am getting the following error:
chart.downsample.js:204 Uncaught TypeError: Cannot read property 'getTime' of undefined
Probably because I am using chart.min.js, however, I am including also moment.js before that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.