You must be logged in to post your query.
Home › Forums › Chart Support › Chart is rendering but y axis is not proper
Tagged: Canvas js
Hi
I am creating the chart it is rendering but the y axis is not accourding to the values
Below is the code and js fiddle link
KIndly help me in this
window.onload = function () {
function ParseDatapoints(data)
{
var dataPoints = [];
$.each(data, function (key, value) {
if( value[0] != null)
{
dataPoints.push({ x: value[0], y: value[1]});
}
});
// dataPoints.pop();
console.log(dataPoints);
return dataPoints ;
}
var weightForAgeJsonData = ‘[[[0,2.4],[1,3.2],[2,4],[3,4.6],[4,5.1],[5,5.5],[6,5.8],[7,6.1],[8,6.3],[9,6.6],[10,6.8],[11,7],[12,7.1],[13,7.3],[14,7.5],[15,7.7],[16,7.8],[17,8],[18,8.2],[19,8.3],[20,8.5],[21,8.7],[22,8.8],[23,9],[24,9.2],[25,9.3],[26,9.5],[27,9.6],[28,9.8],[29,10],[30,10.1],[31,10.3],[32,10.4],[33,10.5],[34,10.7],[35,10.8],[36,11],[null,null]],[[0,2.9],[1,3.8],[2,4.7],[3,5.4],[4,5.9],[5,6.4],[6,6.7],[7,7],[8,7.3],[9,7.6],[10,7.8],[11,8],[12,8.2],[13,8.4],[14,8.6],[15,8.8],[16,9],[17,9.2],[18,9.4],[19,9.6],[20,9.8],[21,10],[22,10.2],[23,10.4],[24,10.6],[25,10.8],[26,10.9],[27,11.1],[28,11.3],[29,11.5],[30,11.7],[31,11.9],[32,12],[33,12.2],[34,12.4],[35,12.5],[36,12.7],[null,null]],[[0,3.2],[1,4.2],[2,5.1],[3,5.8],[4,6.4],[5,6.9],[6,7.3],[7,7.6],[8,7.9],[9,8.2],[10,8.5],[11,8.7],[12,8.9],[13,9.2],[14,9.4],[15,9.6],[16,9.8],[17,10],[18,10.2],[19,10.4],[20,10.6],[21,10.9],[22,11.1],[23,11.3],[24,11.5],[25,11.7],[26,11.9],[27,12.1],[28,12.3],[29,12.5],[30,12.7],[31,12.9],[32,13.1],[33,13.3],[34,13.5],[35,13.7],[36,13.9],[null,null]],[[0,3.6],[1,4.6],[2,5.6],[3,6.4],[4,7],[5,7.5],[6,7.9],[7,8.3],[8,8.6],[9,8.9],[10,9.2],[11,9.5],[12,9.7],[13,10],[14,10.2],[15,10.4],[16,10.7],[17,10.9],[18,11.1],[19,11.4],[20,11.6],[21,11.8],[22,12],[23,12.3],[24,12.5],[25,12.7],[26,12.9],[27,13.2],[28,13.4],[29,13.6],[30,13.8],[31,14.1],[32,14.3],[33,14.5],[34,14.7],[35,14.9],[36,15.1],[null,null]],[[0,4.2],[1,5.4],[2,6.5],[3,7.4],[4,8.1],[5,8.7],[6,9.2],[7,9.6],[8,10],[9,10.4],[10,10.7],[11,11],[12,11.3],[13,11.6],[14,11.9],[15,12.2],[16,12.5],[17,12.7],[18,13],[19,13.3],[20,13.5],[21,13.8],[22,14.1],[23,14.3],[24,14.6],[25,14.9],[26,15.2],[27,15.4],[28,15.7],[29,16],[30,16.2],[31,16.5],[32,16.8],[33,17],[34,17.3],[35,17.6],[36,17.8],[null,null]],[[3.63333333333333,5]]]’;
var weightData = JSON.parse(weightForAgeJsonData);
console.log(weightData);
var chart = new CanvasJS.Chart(“chartContainer”, {
animationEnabled: true,
title:{
text: “Cumulative App Downloads on iTunes and Play Store”
},
axisY :{
yValueFormatString:”0.0″,
includezero:false
},
axisX: {
valueFormatString: “0”,
title: “Months After Launch”,
interval:5,
includezero:false
},
toolTip: {
shared: true
},
data: [
{
includezero:false,
type: “stackedArea”,
name: “Android”,
markerType: “none”,
showInLegend: true,
dataPoints: ParseDatapoints(weightData[0])
},
{
includezero:false,
type: “stackedArea”,
name: “Android”,
markerType: “none”,
showInLegend: true,
dataPoints: ParseDatapoints(weightData[1])
}
]
});
chart.render();
}
According to the values if we see using tooltip in fiddle y axis labels are not proper
Kindly help me in this Its a POC so that later i can buy licence version of it
below is my js fiddle
https://jsfiddle.net/ahmed123456789/mn8xq6pg/106/
Stacked Area Charts are Area Charts plotted together with aligned x values, such that at any point it shows a cumulative total of that point for all series. Because of this reason, the dataSeries will be shown at the value which is the sum of all its previous dataSeries.
—-
Manoj Mohan
Team CanvasJS
Tagged: Canvas js
You must be logged in to reply to this topic.