[英]Remove tooltip hover effect on 'axis' trigger
我有一個堆疊的 EChart 圖,其中亮區 colors 和一個工具提示觸發器設置為“軸”:
var myChart = echarts.init(document.getElementById('chart')); option = { tooltip: { trigger: 'axis', }, legend: { data: ['A', 'B', 'C'] }, xAxis: { type: 'category', data: [0, 1, 2, 3, 4, 5, 6, 7, 8] }, yAxis: { type: 'value' }, series: [ { name: 'C', type: 'line', areaStyle: { color: '#fdd', }, stack: 'C', data: [ 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 0.7, 0.8, 0.8 ] }, { name: 'A', type: 'line', areaStyle: { color: '#ffd' }, stack: 'C', data: [ 2, 1.6, 1.6, 1.6, 1.6, 1.6, 2.4, 2.4, 2.4 ] }, { name: 'B', type: 'line', areaStyle: { color: '#dfd' }, stack: 'C', data: [ 2, 1.9, 2.1, 2.3, 2.3, 2.5, 2.1, 2.1, 2.1 ] } ], color: [ '#d34', '#fc1', '#3a4' ], grid: { left: 20, bottom: 20, right: 10, top: 40}, }; myChart.setOption(option);
<script src="https://cdn.jsdelivr.net/npm/echarts@5.0.0/dist/echarts.min.js"></script> <div id="chart" style="width: 100%;height:180px;"></div>
將 ECharts 版本更新到當前版本后,將鼠標懸停在軸上現在會淡化 colors 區域,因此它們幾乎不再可見。
我已經嘗試了不同的silence: true
和emphasis
設置並搜索了在線文檔,但我無法更改工具提示 hover 效果。
如何禁用工具提示 hover 效果,使線和區域 colors 不改變?
使用 強調覆蓋圖形的突出顯示樣式。 參見itemStyle
、 lineStyle
和areaStyle
series: [ {
name: 'C',
type: 'line',
areaStyle: { color: '#fdd', opacity: 1},
stack: 'C',
data: [ 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 0.7, 0.8, 0.8 ],
emphasis : {
areaStyle: { //--> to avoid the fade effect, set the same color
color: '#fdd'
}
}
}
]
其他選項是更改silent : true 以禁用觸發和響應鼠標事件:
series: [{
name: 'C',
type: 'line',
areaStyle: { color: '#fdd', opacity: 1},
stack: 'C',
data: [ 1.6, 1.6, 1.6, 1.6, 1.6, 1.6, 0.7, 0.8, 0.8 ],
silent: true //--> here
}
...
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.