Skip to content

Doesn't work with Number datasets #3

@AlbinoDrought

Description

@AlbinoDrought

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 #1 (comment) #1 (comment)

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
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions