canvasjs

Loop in order to generate data points in Javascript

隐身守侯 提交于 2019-12-01 13:14:59
I am trying to generate an area graph for two (or more) products i.e. Mosquito Repellents and Liquid Soap. I am using the JavaScript library CanvasJS to do that. The problem is that I need approximately 2000 data points instead of 4 hardcoded here and the problem is that I am unable to generate a for loop for two (or more) products that will do this for me. Can anyone help me on how to create this loop? var chart = new CanvasJS.Chart("chartContainer", { data: [{ type: "area", name: "Mosquito Repellents", showInLegend: "true", dataPoints: [{ y: 83450, label: "spring" }, { y: 51240, label: