如何通过单击工具提示访问顶点图表的数据值?
我不想要索引。我需要值(value)。我如何访问该值?
<script>
var options = {
chart: {
type: 'line',
events: {
dataPointSelection: function (event, chartContext, config) {
console.log(config);
var ix = config.dataPointIndex;
alert(ix);
}
}
},
series: [{
name: 'TEST',
data: [[1324508400000, 34], [1324594800000, 54], [1325604800000, 39] , [1326236400000, 43]]
}],
xaxis: {
},
tooltip: {
intersect: true,
shared: false
},
markers: {
size: 6,
}
}
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
</script>
最佳答案
这对我有用:
dataPointSelection: (event, chartContext, config) => {
console.log(config.w.config.series[config.dataPointIndex])
console.log(config.w.config.labels[config.dataPointIndex])
}
关于apexcharts - 如何访问 Apexchart 的 dataPointSelection 函数的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57486591/