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

Doesn't work with Number datasets

Open AlbinoDrought opened this issue 8 years ago • 2 comments

In Chart.js, there are two types of data:

  • Point[], which works
  • Number[], which doesn't work

Support should be added for the Number type, and it shouldn't be too hard.


Here's a fiddle demonstrating this issue: https://jsfiddle.net/tx2qnd45/

Reference https://github.com/AlbinoDrought/chartjs-plugin-downsample/issues/1#issuecomment-336525071 https://github.com/AlbinoDrought/chartjs-plugin-downsample/issues/1#issuecomment-336310346

Dataset generation example:

    var scalingFactor = function(value) {
        return (value * 0.9) + (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 10);
    };
    
    var generateData = function (count) {
        var data = [];

        var y = 0;
        for (var i = 0; i < count; i++) {
            y = scalingFactor(y);
            data.push(y);
        }

        return data;
    };

Dataset example:

[
    4,
    -4.4,
    -11.96,
    -20.764000000000003,
    -10.687600000000003,
    -18.618840000000006,
    -22.756956000000006,
    -16.481260400000007,
    -4.833134360000006,
    -12.349820924000007,
    -4.1148388316000055,
    -10.703354948440005
]

AlbinoDrought avatar Oct 13 '17 18:10 AlbinoDrought

@AlbinoDrought Hi, do you plan to fix this issue soon?

iskrzycki avatar May 24 '18 16:05 iskrzycki

I cant use this module, too. I only have single numbers, not points.

MickL avatar Apr 11 '20 18:04 MickL