echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Realtime Label of Categary Axis

Open abitwhy opened this issue 3 years ago • 3 comments

What problem does this feature solve?

The category axis's label can be configured with real-time effect.

What does the proposed API look like?

const len = 10;
const randomValue = () => +(Math.random() * len + 5).toFixed(1);
const categories = Array(len)
  .fill(0)
  .map((e, i) => i);
const data = categories.map(() => randomValue());

option = {
  title: {
    text: 'Realtime Label of Categary Axis'
  },
  grid: { top: '15%' },
  xAxis: {
    /* Demand (not exist) */
    // label: {
    //   realtime: true
    // },
    type: 'category',
    data: categories
  },
  yAxis: {
    max: 18,
    min: 0
  },
  series: {
    /* Existing (real-time bound with sort) */
    // realtimeSort: true,
    type: 'bar',
    data
  }
};

let count = len + 1;
setInterval(function () {
  data.shift();
  data.push(randomValue());
  categories.shift();
  categories.push(count++);
  myChart.setOption({
    xAxis: {
      data: categories
    },
    series: {
      data
    }
  });
}, 2100);

abitwhy avatar May 06 '22 10:05 abitwhy

realtimeSort means to sort with the axis's value. Do you wish to sort category axis in dictionary order? Can you give an example about the user-case?

Ovilia avatar May 07 '22 06:05 Ovilia

Not about sorting at all. The use case is to turn pages smoothly to display data. ECharts already has the function of turning pages, and has the ability to display labels smoothly. So why not open this ability? By the way, the above code is a simplified example.

abitwhy avatar May 09 '22 08:05 abitwhy

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] avatar May 08 '24 21:05 github-actions[bot]

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!

github-actions[bot] avatar May 16 '24 21:05 github-actions[bot]