jiawulin001 commented on issue #16911: URL: https://github.com/apache/echarts/issues/16911#issuecomment-1105063686
So the problem is like this: |Tooltip when mouse on markline|Tooltip when mouse on markline's label (11.14)| |---|---| ||| <details> <summary>Code to reproduce</summary> ``` option = { title: { text: 'Temperature Change in the Coming Week' }, tooltip: { trigger: 'item' }, legend: {}, toolbox: { show: true, feature: { dataZoom: { yAxisIndex: 'none' }, dataView: { readOnly: false }, magicType: { type: ['line', 'bar'] }, restore: {}, saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value', axisLabel: { formatter: '{value} °C' } }, series: [ { name: 'Highest', type: 'line', data: [10, 11, 13, 11, 12, 12, 9], markPoint: { data: [ { type: 'max', name: 'Max' }, { type: 'min', name: 'Min' } ] }, markLine: { data: [{ type: 'average', name: 'Avg' }] } }, { name: 'Lowest', type: 'line', data: [1, -2, 2, 5, 3, 2, 0], markPoint: { data: [{ name: '周最低', value: -2, xAxis: 1, yAxis: -1.5 }] }, markLine: { data: [ { type: 'average', name: 'Avg' }, [ { symbol: 'none', x: '90%', yAxis: 'max' }, { symbol: 'circle', label: { position: 'start', formatter: 'Max' }, type: 'max', name: '最高点' } ] ] } } ] }; ``` </details> This is because the dispatcher of markLine and markLine's label is different, so the `dataModel` extracted is different. At this line: https://github.com/apache/echarts/blob/4a52199842039d7fa6019ee8584d1a395fbc771a/src/component/tooltip/TooltipView.ts#L656 markLine's dataModel is literally `markline`, but markline's label has no dataModel so it's given a seriesModel, which result in its tooltip displaying the first point of the series. I think a good way to solve this is to tell the model-getter to inheritate a model from component's parent. But I am not sure whether this issue is worth solving. What do you guys think? @Ovilia @pissang -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
