Posted 10 July 2019, 6:41 pm EST
I want to edit the tooltip for my pie charts in my MVC Core 2.2 app. Here is my code that defines the chart.
updateAgingChart = function (aging, agingChart) {
var labels = [“Current”, “1 to 30”, “31 to 60”, “61 to 90”, “91 to 120”, “Over 120”];
var eventsData = new wijmo.collections.ObservableArray();
agingChart.beginUpdate();
agingChart.isAnimated = false,
agingChart.selectionMode = wijmo.chart.SelectionMode.Point,
agingChart.selectedItemPosition = wijmo.chart.Position.Auto,
agingChart.innerRadius = 0.6,
agingChart.palette = wijmo.chart.Palettes[‘cocoa’],
agingChart.header = “Accounts Receivable Aging”
agingChart.binding = ‘value’;
agingChart.bindingName = ‘key’;
agingChart.itemsSource = processData();
agingChart.selectedIndex = null;
agingChart.hostElement.addEventListener(‘mouseover’, (e) => {
var htInfo = agingChart.hitTest(e);
alert(htInfo.value)
})
agingChart.endUpdate();
function processData() { eventsData.clear(); for (var i = 0; i < aging.length; i++) { eventsData.push({ key: labels[i], value: aging[i] }); } return (eventsData); };
}
My EventListener works and I can get the htInfo.value but I can’t figure out how to get the label name and modify the tooltip. Also, would like to add a value for the percent the value is of the total.
Can you give me an example of how to do it?
Thanks, Ed