Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The prompt of broken line icon is abnormal #16911

Closed
ZJNLJH opened this issue Apr 19, 2022 · 2 comments · Fixed by #16971
Closed

[Bug] The prompt of broken line icon is abnormal #16911

ZJNLJH opened this issue Apr 19, 2022 · 2 comments · Fixed by #16971
Labels
bug en This issue is in English topic: marker

Comments

@ZJNLJH
Copy link

ZJNLJH commented Apr 19, 2022

Version

5.3.2

Link to Minimal Reproduction

No response

Steps to Reproduce

  1. Open link(https://echarts.apache.org/examples/zh/editor.html?c=line-marker)
  2. Change the trigger under tooltip to item
  3. Move the mouse to 11.14
  4. It is found that the prompt is different from the prompt when the mouse moves on the marking line
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: '最高点'
            }
          ]
        ]
      }
    }
  ]
};

Current Behavior

Test Echarts

Expected Behavior

Test Echarts

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@ZJNLJH ZJNLJH added the bug label Apr 19, 2022
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Apr 19, 2022
@Ovilia
Copy link
Contributor

Ovilia commented Apr 20, 2022

Sorry, I cannot understand. Can you give an image to illustrate what's wrong?

@jiawulin001
Copy link
Member

So the problem is like this:

Tooltip when mouse on markline Tooltip when mouse on markline's label (11.14)
image image
Code to reproduce
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: '最高点'
            }
          ]
        ]
      }
    }
  ]
};

This is because the dispatcher of markLine and markLine's label is different, so the dataModel extracted is different. At this line:

const dataModel = ecData.dataModel || seriesModel;

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

@plainheart plainheart added topic: marker and removed pending We are not sure about whether this is a bug/new feature. labels May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English topic: marker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants