带有指针的电子图表工具提示

问题描述 投票:0回答:2

我需要使用指针获取 eCharts 工具提示,如下所示: 图1

但到目前为止,我的工具提示在图表中“浮动”,没有指针: 图2

这是我在 PHP 页面中的配置:

'tooltip' => [
    'trigger' => 'axis',
    'axisPointer' => [ 'type' => 'cross' ],
    'axis' => 'x',
    'backgroundColor' => 'rgba(250,250,250,1)',
    'borderColor' => '#5d00f3',
    'confine' => TRUE,
     
    'textStyle' => [
        'fontWeight' => 'bold',
        'fontSize'=> '17',
        'color' => '#000', 
    ],
],

我如何创建一个指针来跟随线,该文档对我来说不是很清楚: https://echarts.apache.org/en/option.html#grid.tooltip.position

javascript php charts echarts
2个回答
0
投票

axisPointer 中有一个设置应该可以工作(捕捉):

'tooltip' => [
'trigger' => 'axis',
'axisPointer' => [ 'type' => 'cross', 'snap' => TRUE ],
'axis' => 'x',
'backgroundColor' => 'rgba(250,250,250,1)',
'borderColor' => '#5d00f3',
'confine' => TRUE,
 
'textStyle' => [
    'fontWeight' => 'bold',
    'fontSize'=> '17',
    'color' => '#000', 
],

],


0
投票

我如何创建一个指针来跟随线

tooltip.position回调函数确实没有很好的文档记录,但可以使用,example

© www.soinside.com 2019 - 2024. All rights reserved.