Please take a look at this jsfiddle.
I suggest you to refer MDN Documentation for more info on JavaScript related queries / tutorials.
—
Vishwas R
Team CanvasJS
Please take a look at this jsfiddle.
I suggest you to refer MDN Documentation for more info on JavaScript related queries / tutorials.
—
Vishwas R
Team CanvasJS
In the jsfiddle that you have shared y-values passed to the dataPoints are string. Y-values in dataPoints can accept numeric values only. Changing it to numeric should work fine in your case. Please take a look at this updated jsfiddle.
—
Vishwas R
Team CanvasJS
You can render chart inside a table row/cell. Please take a look at this jsfiddle.
—
Vishwas R
Team CanvasJS
Shift is a JavaScript array method that removes the first item of an array. Please refer this link for more info on the same. Please refer our documentation for complete step-by-step tutorial on creating dynamic charts.
—
Vishwas R
Team CanvasJS
Legends will be shown for every dataSeries. You can enable legend by setting showInLegend property in dataSeries level to true. Text shown in legend can be set with the help of name or legendText.
—
Vishwas R
Team CanvasJS
You seemed to be using chart within getData method but which is undefined as its not passed when the function is called. Passing chart as parameter to getData method should work fine in your case getData(chart);
.
It would be helpful for us to understand your scenario better when we look at your code working live in jsfiddle. So I kindly request you to create jsfiddle and share it with us if you find any issue working in CanvasJS in future.
—
Vishwas R
Team CanvasJS
valueFormatString is used to format numbers and date time values (x-values) that appears on axisX but not for labels. Passing x-value to dataPoints should work fine in your case dps.push({"x":new Date(result[i].time), "y":result[i].humidity});
.
To format labels, you can use labelFormatter.
—
Vishwas R
Team CanvasJS
Please take a look at an gallery example on Chart Data from Database for rendering chart in PHP with data from mysql database. You can also download PHP Samples from our download page for more working examples in PHP.
—
Vishwas R
Team CanvasJS