in frontend/app/components/memory_viewer/max_heap_chart/max_heap_chart.ts [41:93]
drawChart() {
if (!this.chart || !this.maxHeap) {
return;
}
const data = [0].concat(this.maxHeap.map(heapObject => {
return heapObject ? heapObject.sizeMiB || 0 : 0;
}));
const chartItemColors = this.maxHeap.map(
heapObject => utils.getChartItemColorByIndex(heapObject.color || 0));
const dataTable = google.visualization.arrayToDataTable([
Array.from<string>({length: data.length}).fill(''),
data,
]);
const options = {
bar: {groupWidth: '100%'},
colors: chartItemColors,
chartArea: {
left: 0,
right: 0,
width: '100%',
height: '100%',
},
isStacked: 'percent',
legend: {position: 'none'},
orientation: 'vertical',
tooltip: {trigger: 'none'},
hAxis: {baselineColor: 'transparent'},
vAxis: {baselineColor: 'transparent'},
};
this.chart.draw(
dataTable, options as google.visualization.ColumnChartOptions);
google.visualization.events.addListener(this.chart, 'click', () => {
if (this.chart) {
this.chart.setSelection([]);
}
});
google.visualization.events.addListener(
this.chart, 'onmouseover',
(event: google.visualization.ChartSelection) => {
event = event || {};
const arr = [];
arr.push(event);
if (this.chart) {
this.chart.setSelection(arr);
}
this.selected.emit((event.column || 0) - 1);
});
}