Chart.js: randomScalingfactor not defined

Created on 1 Aug 2017  路  1Comment  路  Source: chartjs/Chart.js

Hello community :)

I already 2 charts on my page and now i'm trying to put this one : http://www.chartjs.org/samples/latest/advanced/progress-bar.html

But i got an issue with this message : randomScalingfactor is not defined just after "var config={"
However, i declared all the files :

script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.js'></script> <script src='utils.js'></script>

`var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var progress = document.getElementById("myChart3");
var config = {
type: 'line',
data: {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "PPB ",
fill: false,
borderColor: "#4bc0c0",
backgroundColor: "#4bc0c0",
data: [
randomScalingFactor(12),
randomScalingFactor(12),
randomScalingFactor(14),
randomScalingFactor(5),
randomScalingFactor(7),
randomScalingFactor(9),
randomScalingFactor(3)
]
}, {
label: "PPS ",
fill: false,
borderColor: "#ff6384",
backgroundColor: "#ff6384",
data: [
randomScalingFactor(4),
randomScalingFactor(5),
randomScalingFactor(9),
randomScalingFactor(12),
randomScalingFactor(9),
randomScalingFactor(7),
randomScalingFactor(9)
]
},]
},

    options: {
        title:{
            display:true,
            text: ""
        }
    }
};
window.onload = function() {
    var ctx = document.getElementById("canvas").getContext("2d");
    window.myLine = new Chart(ctx, config);
};`

I need your help ! :)
Alexandre

support

Most helpful comment

@Doyoucom that function is defined in https://github.com/chartjs/Chart.js/blob/master/samples/utils.js which is included in a number of our sample files to generate data

>All comments

@Doyoucom that function is defined in https://github.com/chartjs/Chart.js/blob/master/samples/utils.js which is included in a number of our sample files to generate data

Was this page helpful?
0 / 5 - 0 ratings