question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Heatmap visualmap filtering not working - CoordSys is undefined

See original GitHub issue

Version

5.3.1

Link to Minimal Reproduction

No response

Steps to Reproduce

I’m following the Cartesian Heatmap chart example (https://echarts.apache.org/examples/en/editor.html?c=heatmap-cartesian). But the filtering with the visualMap doesn’t work properly. Once I move the cursors to select the desired range, it throws this error.

Uncaught TypeError: Cannot read properties of undefined (reading 'type')
    at HeatmapView.render (HeatmapView.js?d7f5:137)
    at Task.progress (Chart.js?fc49:233)
    at Task._doProgress (task.js?d463:187)
    at Task.perform (task.js?d463:153)
    at eval (echarts.js?f2a6:1821)
    at GlobalModel.eval (Global.js?05a0:654)
    at Array.forEach (<anonymous>)
    at each (util.js?d5c9:205)
    at GlobalModel.eachSeries (Global.js?05a0:651)
    at renderSeries (echarts.js?f2a6:1809)

The source code line that breaks is the 137 in HeatmapVIew.js file.

    this._progressiveEls = null;
    this.group.removeAll();
    var coordSys = seriesModel.coordinateSystem;

   // The following check breaks because coordSys is undefined
    if (coordSys.type === 'cartesian2d' || coordSys.type === 'calendar') {
      this._renderOnCartesianAndCalendar(seriesModel, api, 0, seriesModel.getData().count());
    } else if (isGeoCoordSys(coordSys)) {
      this._renderOnGeo(coordSys, seriesModel, visualMapOfThisSeries, api);
    }

I’ve debugged the code, and when the component renders(I’m using Vue@3) on mounted, coordSys.type is cartesian2d. But once I move the visualmap cursor, that variable becomes undefined.

image image

Current Behavior

Everything works as expected, until I use the visualmap to filter values. The chart breaks and doesn’t display values anymore.

Expected Behavior

It should apply a filter and display the values that falls within the selected range from the visualmap to the heatmap chart.

Environment

- OS: Linux
- Framework: Vue@3

Any additional comments?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
plainheartcommented, Mar 10, 2022

Don’t worry. You may still use this.heatmap_chart = echarts.init() to mount the echarts instance on this. Just please don’t put it in data block to avoid making echarts instance reactive.

data() {
    return {
        // DON'T declare here!
        // heatmap_chart: null
    }
},
mounted() {
    // Mount this echarts instance on current vue instance using `this`.
    // It's a common variable and won't make the echarts instance reactive.
    this.heatmap_chart = echarts.init();
},
beforeUnmount() {
    // destroy echarts instance
    this.heatmap_chart && this.heatmap_chart.dispose();
    this.heatmap_chart = null;
}
1reaction
plainheartcommented, Mar 10, 2022

In vue data() I have a heatmap_chart variable initialized to null,

@JiahuiChen99 This is not expected. Just remove the heatmap_chart variable from vue data block.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] Heatmap visualmap filtering not working - CoordSys is ...
But the filtering with the visualMap doesn't work properly. Once I move the cursors to select the desired range, it throws this error....
Read more >
Heatmap calendar visualMap.categories not work #12281
It is a visualMap defect. Currently visualMap only support "category" on axis, where the category data will be mapped to ordinal index (0,...
Read more >
Heat Map not filtering based on category selector
In my dashboard category selectors are not working for a heat map. These filters work on the heat map in Dashboards Classic as...
Read more >
Changelog - Apache ECharts
[Fix] Fix text truncate bug in treemap when using SVG renderer. [Fix] Fix label.rotate does not work in graph. Fix #9182, contributed by...
Read more >
echarts - UNPKG
1422, declare function filter<T, Context>(arr: readonly T[], cb: (this: Context, ... So the echarts inner featrues should not fetch shapes from here.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found