ecomfe / echarts-gl

Extension pack for Apache ECharts, providing globe visualization and 3D plots.
BSD 3-Clause "New" or "Revised" License
2.59k stars 844 forks source link

[BUG] visualMap not applying correctly for scatterGL with progressive Rendering #524

Open MatthiasMert opened 5 months ago

MatthiasMert commented 5 months ago

Just wanted to document the very strange behaviour of scatterGL + visualMap + progressive rendering

Example:

import * as echarts from 'echarts';
import 'echarts-gl';

var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;

const data = Array.from(Array(5000), (x, i) => [i, Math.random() * 100]);

option = {
  xAxis: {},
  yAxis: {},
  visualMap: {
    min: 0,
    max: 100,
    dimension: 1,
    text: ['HIGH', 'LOW'],
    calculable: true,
    inRange: {
      color: ['blue', 'green', 'yellow', 'red']
    }
  },
  series: [
    {
      type: 'scatterGL',
      data: data,
      symbolSize: 5,
      progressiveThreshold: 100,
      progressive: 1000
    }
  ]
};

option && myChart.setOption(option);

VisualMap is only applying correctly for the first progressivly rendered block (until datapoint 1000). Afterwards visualMap seems to be apllied randomly. Issue becomes more clear when moving the handle on the visualMap component to filter data. (also shows up on the internal progressiveThreshold of 100000 if not set)

helgasoft commented 4 months ago

Default progressive value is 100000. Workaround is to not change it, or to make it bigger than data size.

Revision

Yes, there is a bug with visualMap. When both progressiveThreshold and progressive values are larger than data size (5000), then visualMap works fine. When both progressiveThreshold and progressive values are smaller than data size (5000), then visualMap works correctly for the first progressive number of points (1000), the other points are randomly colored.