apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.2k stars 19.61k forks source link

[Bug] js exception with radar char, grid and tooltip #16776

Closed dirslashls closed 5 months ago

dirslashls commented 2 years ago

Version

5.3.1

Link to Minimal Reproduction

No response

Steps to Reproduce

  1. Go to https://echarts.apache.org/examples/en/editor.html?c=radar
  2. Add the following to the options
"tooltip": {
        "trigger": "item",
        "axisPointer": {
            "type": "line",
            "animation": false
        },
        "confine": false,
        "appendToBody": true,
        "extraCssText": "max-height: 400px; overflow-y: scroll;z-index:100"
    },
  xAxis: [{
    data: ['a','c']
  }],
  yAxis: [{
    data: ['b','d']
  }],
  grid: [{
      show: true,
      tooltip: {
        show: true,
        trigger: 'item',
        axisPointer: {
          type: 'cross'
        }
      },
    }
  ], 

The labels of the radar chart disappear and in the console there is the following error

modelHelper.js:323 Uncaught TypeError: Cannot read properties of undefined (reading 'type')
    at makeKey (modelHelper.js:323:16)
    at modelHelper.js:215:34
    at GlobalModel.<anonymous> (Global.js:654:10)
    at Array.forEach (<anonymous>)
    at each (util.js:205:13)
    at GlobalModel.eachSeries (Global.js:651:5)
    at collectSeriesInfo (modelHelper.js:205:11)
    at collect (modelHelper.js:75:28)
    at Object.overallReset (install.js:76:60)

Current Behavior

Exception is being thrown

Expected Behavior

Exception should not be thrown and the chart should render correctly

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

I have a chart with both radar and grid. I isolated the problem to the above config. There is infact a scatter series associated with the x and y axis and grid.

jiawulin001 commented 2 years ago

Hi, as tested, if you move grid.tooltip.axisPointer out of tooltip and put it at grid.axisPointer, no errors would occur. The reason why the error would occur needs further debug.

Code Sample ``` option = { title: { text: 'Basic Radar Chart' }, legend: { data: ['Allocated Budget', 'Actual Spending'] }, radar: { // shape: 'circle', indicator: [ { name: 'Sales', max: 6500 }, { name: 'Administration', max: 16000 }, { name: 'Information Technology', max: 30000 }, { name: 'Customer Support', max: 38000 }, { name: 'Development', max: 52000 }, { name: 'Marketing', max: 25000 } ] }, series: [ { name: 'Budget vs spending', type: 'radar', data: [ { value: [4200, 3000, 20000, 35000, 50000, 18000], name: 'Allocated Budget' }, { value: [5000, 14000, 28000, 26000, 42000, 21000], name: 'Actual Spending' } ] } ], tooltip: { show: true, trigger: "item", axisPointer: { "type": "line", "animation": false }, "confine": false, "appendToBody": true, "extraCssText": "max-height: 400px; overflow-y: scroll;z-index:100" }, xAxis: [{ data: ['a','c'] }], yAxis: [{ data: ['b','d'] }], grid: [{ show: true, axisPointer: { type: 'cross' }, tooltip: { show: true, trigger: 'item', }, } ], }; ```
dirslashls commented 2 years ago

Hi @jiawulin001 , grid.axisPointer is not a valid option as per the docs and I also don't see it having the desired effect.

jiawulin001 commented 2 years ago

@dirslashls I am very sorry I made a mistake. You are right, grid.axisPointer does not exist. The problem seems to be that radar chart does not accept 'cross' as the type of axisPointer. If you use other types of axisPointer, error would not occur. Also I am not sure what effect you are looking for, so if you can provide with some relavant images, I might be able to better help with you.

dirslashls commented 2 years ago

https://user-images.githubusercontent.com/2200491/161133370-680bc055-878b-4702-9c08-05cc6b451b76.mov

@jiawulin001 , see the attached video. I am trying to overlay a grid layout for various types of charts and when the user is on a specific chart within the grid, I want the cross axis pointer to show the x and y dimensions that chart is meant for.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] commented 5 months ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!