I have several echarts in an application I develop. I'm using V4 of echarts (can't upgrade just yet) and following the documentation for tooltip usage as found here: https://echarts.apache.org/v4/en/option.html#tooltip All but my latest one are showing the tooltip just fine. I cannot see any difference between my new one and my old ones.
I have explicitly imported the proper modules as outlined in the answer to this question: Apache ECharts with Vue does not show Tooltip just like I did for my old ones.
I use vue files with the template on top, script in the middle, and css at the bottom. The chart is defined in the template thus:
<echarts
id="alertPie"
:options="option"
class="alertChart"
autoresize
/>
In my scripts section, I have these imports:
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/title'
import 'echarts/lib/component/legend'
The "option" for the chart is a computed field defined thus:
computed: {
option () {
return {
backgroundColor: '#efefef',
textStyle: {
fontStyle: 'italic',
fontWeight: 'bold'
},
title: {
text: 'Alert Adoption',
subtext: 'Count by Alert',
left: 'center',
top: 10,
textStyle: {
color: '#ee0022',
textBorderColor: '#000000',
textBorderWidth: 2,
textShadowColor: 'rgba(0,0,0,0.5)',
textShadowBlur: 4,
fontWeight: 'bold',
textShadowOffsetX: 2,
textShadowOffsetY: 2,
fontSize: 28
},
subtextStyle: {
color: 'black'
}
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
// orient: 'vertical',
// top: 'middle',
bottom: 10,
left: 'center'
},
series: [
{
name: 'pie',
type: 'pie',
data: this.alertPieData,
radius: '40%',
center: ['50%', '40%'],
selectedMode: 'single',
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
],
animationDuration: 2000
}
}
}
The pie shows the data correctly. The title and legend both show correctly. Of the imported items, only the tooltip is not working.
Like I said, my other charts are built the same and tooltips work. What could I have missed? I've stared at this and compared to my working examples and don't see any differences (other than data sources and title/label changes).
Any ideas?
Data sample below:
[ { "name": "Acthar Gel Med Order Alert", "value": 10 },
{ "name": "Anticoagulation / Hemoglobin Alert", "value": 6 },
{ "name": "Anticoagulation or Dual Antiplatelet / Hemoglobin Alert", "value": 7 },
{ "name": "Berinert Alert", "value": 10 },
{ "name": "Blood Culture Identification Alert", "value": 13 },
{ "name": "Clostridium Difficile Alert", "value": 9 },
{ "name": "Clostridium Difficile Lab Order Alert", "value": 15 },
{ "name": "Controlled Substance - Pyxis Removal / Late Admin Alert", "value": 13 } ]