[JS]
$("#container").ejChart(
{
//...
load:"chartLoad",
});
function chartLoad(sender) {
for (var i = 1; i < sender.model.series.length; i++) {
for (var j = 0; j < sender.model.series[i].points.length; j++) {
var currentPoint = sender.model.series[i].points[j].y;
previousPoint = sender.model.series[i - 1].points[j].y;
sender.model.series[i].points[j].y = currentPoint + previousPoint;
}
}
sender.model.series.reverse();
}
|
[JS]
$("#container").ejChart(
{
//...
load:"chartLoad",
});
function chartLoad(sender) {
var series = sender.model.series;
var maxPoints = 0;
// find the maximum points count
for (var i = 0; i < series.length; i++) {
maxPoints = (series[i].points.length > maxPoints) ? series[i].points.length : maxPoints;
}
for (var j = 0; j < maxPoints; j++) {
currentPointIndex = j;
// total of all points
var maxValue = 0;
for (var l = 0; l < series.length; l++) {
maxValue += series[l].points[currentPointIndex].y;
}
// getting percentage value
var value = 0;
for (var m = 0; m < series.length; m++) {
if (!ej.util.isNullOrUndefined(series[m].points[currentPointIndex]))
value += (series[m].points[currentPointIndex].y / maxValue) * 100;
series[m].points[currentPointIndex].y = value;
}
}
sender.model.series.reverse();
} |