I am using canvas barchart to display number of votes. The problem that I am facing is that the tooltip only appears on mousehover. Is there a way to display the tooltip always, I mean that it does not disappear ever. Thanks.
Below is my current options array.
public chartOptions: any = {
tooltips: {enabled: true},
// hover: {mode: null},
responsive: true,
scales: {
yAxes: [{
display: true,
ticks: {
beginAtZero: true,
}
}]
},
animation: {
duration: 0,
onComplete: function () {
const chartInstance = this.chart,
ctx = chartInstance.ctx;
const fontSize = 20;
const fontStyle = '600';
const fontFamily = 'Open Sans';
// ctx.font = Chart.helpers.fontString(fontSize, fontStyle, fontFamily);
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
ctx.fillStyle = '#676A6C';
this.data.datasets.forEach(function (dataset, i) {
const meta = chartInstance.controller.getDatasetMeta(i);
meta.data.forEach(function (bar, index) {
if (dataset.data[index] !== 0) {
const data = dataset.data[index];
ctx.fillText(data, bar._model.x, bar._model.y);
}
});
});
}
}
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…