echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Confidence Band example with xAxis.type and yAxis.type equal "log"

Open changfeng1800 opened this issue 3 years ago • 5 comments

What problem does this feature solve?

I set xAxis.type from "category" to "log" in a Confidence Band example. The chart won't show right. You can run the attachment by browser.

image confidence-band-20220308.zip

What does the proposed API look like?

"xAxis.type" is also needed 'log' type.

changfeng1800 avatar Mar 25 '22 05:03 changfeng1800

I can see you've submitted the same issue https://github.com/apache/echarts/issues/16646 before. This problem is caused by wrong stack dimension. At:https://github.com/apache/echarts/blob/d3dbf1215a0ae0c5075efffb10b17fe4de37582c/src/data/helper/dataStackHelper.ts#L104-L117 Echarts is trying to set the stack dimension and its way is to find the FIRST dimension that can be stacked! This means when x axis type is 'category', 'time', or 'ordinary' echarts can correctly find y axis as stack axis. But when x axis is also "stackable", echarts will take x axis as default axis to stack the data. That results in wrong stack in both bar chart and line chart. Here's a wrong-stacked bar example:

option = {
  xAxis: {
    type: 'value',
    data: [1,2,3,4,5,6,7]
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
      stack: '1',
      showBackground: true,
      backgroundStyle: {
        color: 'rgba(180, 180, 180, 0.2)'
      }
    },
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
      stack: '1',
      showBackground: true,
      backgroundStyle: {
        color: 'rgba(180, 180, 180, 0.2)'
      }
    },
  ]
};

Changing x axis type into 'category' and things will look right.

When user use bar or line chart, they might want to stack data to x or y axis and a default stack axis is never enough. So I think the best way is to add a new option series.stackDim to allow user to specify the axis to stack. Submitting a PR to solve this.

jiawulin001 avatar Mar 25 '22 10:03 jiawulin001

Any news about this fix? This is something we need in our project too.

dtk-jgenot avatar Jun 01 '22 14:06 dtk-jgenot

Any status? This topic is quite blocking for us too

david-dogneton avatar Oct 11 '22 12:10 david-dogneton

Same for us, this would really help.

DanielBogenrieder avatar Mar 03 '23 07:03 DanielBogenrieder

Same here

mikeg-de avatar Apr 23 '24 17:04 mikeg-de