chartjs-plugin-downsample icon indicating copy to clipboard operation
chartjs-plugin-downsample copied to clipboard

meteor installation

Open micha1983 opened this issue 8 years ago • 5 comments

Hi,

i want to implement the plugin in a meteor project where chartjs is used. do somebody know where i should copy the plugin files that every is working fine?

with npm i. the plugin will be installed on server side.

micha1983 avatar Feb 25 '17 20:02 micha1983

I have a similar request, but I'll phrase it slightly differently: would it be possible to get a version of this plugin that does not use NPM?

I'm using chartjs in a Rails app and would like to just throw a javascript file into my asset folder and use it, without the setup or config overhead of npm.

wrydere avatar Oct 12 '17 22:10 wrydere

Hey @wrydere ,

Built versions of the plugin are available on the releases page - these are the same as the ones used in the samples, and should be compatible with regular js.

Usage would be something similar to: (requires the Chart.js bundle as well)

<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.bundle.min.js"></script>
<script src="./chartjs-plugin-downsample.js"></script>

(there's nothing in the readme about this - woops!)

As of this comment the latest release is 5 commits old, but those 5 commits are just doc/package changes. Let me know if there's any issues.


As for @micha1983 , sorry, I've never used meteor - I've got no clue. Possibly similar to the above (plain js files)?

AlbinoDrought avatar Oct 12 '17 22:10 AlbinoDrought

@AlbinoDrought thank you much!

I've got it installed - but when I run .downsample() on an instance of a Chart, I get

Uncaught TypeError: Cannot read property 'x' of undefined

Specifically seems to be line 77 of the plugin, it always throws an error when trying to process

var pointAX = data[a].x * 1, // enforce Number (value may be Date)

Any tips? Thanks again.

Edit: I should mention I'm trying to use this with Chart.js 2.7.0, is there a recommended version that downsampling is compatible with?

wrydere avatar Oct 12 '17 23:10 wrydere

Hey @wrydere ,

Not sure what's going on there, any chance you can make a fiddle?

Here's one using Chart.js 2.7.0, the downsample plugin from the releases page, and .downsample on the chart instance: https://jsfiddle.net/yu56fnnv/1/

AlbinoDrought avatar Oct 13 '17 16:10 AlbinoDrought

@AlbinoDrought - thanks, the fiddle helped. I'm passing my data as a simple array of integers, rather than the Point based structure – I think switching to using Points rather than Number should fix it.

wrydere avatar Oct 13 '17 17:10 wrydere