Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
changfeng1800 opened this issue Mar 25, 2022 · 5 comments
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature. waiting-for: community

Comments

@changfeng1800
Copy link

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.

@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Mar 25, 2022
@jiawulin001
Copy link
Member

jiawulin001 commented Mar 25, 2022

I can see you've submitted the same issue #16646 before.
This problem is caused by wrong stack dimension.
At:

if (mayStack && !dimensionInfo.isExtraCoord) {
// Find the first ordinal dimension as the stackedByDimInfo.
if (!byIndex && !stackedByDimInfo && dimensionInfo.ordinalMeta) {
stackedByDimInfo = dimensionInfo;
}
// Find the first stackable dimension as the stackedDimInfo.
if (!stackedDimInfo
&& dimensionInfo.type !== 'ordinal'
&& dimensionInfo.type !== 'time'
&& (!stackedCoordDimension || stackedCoordDimension === dimensionInfo.coordDim)
) {
stackedDimInfo = dimensionInfo;
}
}

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.

@dtk-jgenot
Copy link

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

@david-dogneton
Copy link

Any status? This topic is quite blocking for us too

@DanielBogenrieder
Copy link

Same for us, this would really help.

@mikeg-de
Copy link

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature. waiting-for: community
Projects
None yet
Development

No branches or pull requests

6 participants