I have a chart with two bars for each x-point.
I need to catch the click on the single bar and get the value for both x and y.
Do you have any tip?
Here there is my code:
webix.ui({
view: "chart",
type: "bar",
barWidth: 60,
radius: 2,
gradient: "rising",
xAxis:{
title: "Magnitudo",
template: function (obj) {
if (obj.id === -2) {
return "0";
} else {
return obj.id;
}
}
},
yAxis:{
title: "Rischi Aperti/Chiusi",
start: 0,
step: 5,
//end: 100
},
legend:{
values:[
{
text: "Aperti",
color: "#26609b",
},
{
text: "Chiusi",
color: "#b9723a",
}
],
valign: "middle",
align: "right",
width: 90,
layout: "y",
toggle: false
},
series: [
{
value: function (obj) {
return obj.Aperte;
},
color: function (obj) {
return "#26609b";
},
tooltip: function (obj) {
return obj.Aperte;
},
id: "rischiAperti",
},
{
value: function (obj) {
return obj.Chiuse;
},
color: function (obj) {
return "#b9723a";
},
tooltip: function (obj) {
return obj.Chiuse;
},
id: "rischiChiusi",
},
],
/*on: {
onItemClick: function (id) {
var item = dashboardAPI.rischiPerMagnitudo.getItem(id);
if (id === "-2") {
item.id = 0;
}
console.log(item);
}
},*/
data: arrayRischiAPI,
}, $$('lytChartRischiPerMagnitudo'));