Hi,
Does pie chart provide ratio of a data item?
for example
[
{ sales1:"20", sales2:"100", month:"Jan", color: "#3498db" },
{ sales1:"30", sales2:"300", month:"Fen", color: "#eeea36" },
{ sales1:"40", sales2:"200", month:"Mar", color: "#625e93" }
];
so for
Jan sales1 ratio is 20/(20+30+40)
Fen sales1 ratio is 30/(20+30+40)
Mar sales1 ratio is 40/(20+30+40)
maksim
2
You can use onParse event of datastore to calculate the summ value and later use it in value or label templates
http://webix.com/snippet/a59b8986
How do I access this.$summ in tooltip?
this returns template function, what’s the proper way to acess $summ?
maksim
4
Yep, my original solution was not good for such scenario.
Please check the updated snippet
on:{
"data->onParse":function(driver, data){
var summ = 0;
for (var i=0; i<data.length; i++)
summ += data[i].sales1*1;
for (var i=0; i<data.length; i++)
data[i].$summ = summ;
}
},
It will assign summ to the data object, so it will be available in all handlers
http://webix.com/snippet/c81eb88f