我想在图表中添加箭头,我想我是否可以找到最高标记的位置,可以使用它添加一些html以获得一些自定义工具提示或标记。 我尝试在标记中寻找format 函数,但在轴上,我不确定在这里寻找什么。 任何帮助深表感谢。我没办法把头缠住。
答案 0 :(得分:0)
此功能是一个WIP,我正在创建示例来说明该功能。
该功能的建议API如下所示
var options = {
chart: {
height: 350,
type: "area",
events: {
mounted: function(ctx, config) {
const lowest = ctx.getLowestValueInSeries(0)
const highest = ctx.getHighestValueInSeries(0)
ctx.addPointAnnotation({
x: new Date(ctx.w.globals.seriesX[0][ctx.w.globals.series[0].indexOf(lowest)]).getTime(),
y: lowest,
label: {
text: 'Lowest: ' + lowest,
offsetY: 2
},
customSVG: {
SVG: `<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>`,
cssClass: undefined,
offsetX: -10,
offsetY: -30
}
})
ctx.addPointAnnotation({
x: new Date(ctx.w.globals.seriesX[0][ctx.w.globals.series[0].indexOf(highest)]).getTime(),
y: highest,
label: {
text: 'Highest: ' + highest,
offsetY: 2
},
})
}
}
},
dataLabels: {
enabled: false
}
}
该功能在当前版本(3.5.1)的ApexCharts中不可用,但很快将在本周末(2019年3月10日)发布的3.6.0中添加。
免责声明:我是ApexCharts的创建者