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

[Bug] When polar coordinates are negative, it still renders the bar from 0. #16840

Closed
BillYu811 opened this issue Apr 6, 2022 · 9 comments · Fixed by #17078
Closed

[Bug] When polar coordinates are negative, it still renders the bar from 0. #16840

BillYu811 opened this issue Apr 6, 2022 · 9 comments · Fixed by #17078
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature. stale Inactive for a long time. Will be closed in 7 days. waiting-for: community

Comments

@BillYu811
Copy link

BillYu811 commented Apr 6, 2022

Version

5.3.0

Link to Minimal Reproduction

https://codepen.io/billyu811/pen/QWaQZvg

Steps to Reproduce

1.I want to create a polar chart as usual, but it has negative values ​​on the radius axis.
2.I got data from BE use axios.
3.I didn't get the effect I wanted,I want it to fill the bar towards positive numbers starting from a minimum value.
But it turned out to be this:
https://codepen.io/billyu811/pen/QWaQZvg
4.then I tried to change the min, max, scale, axisLine.onZero of the radius axis, they are not work.
I can't find a solution in the doc.
Until I saw a PR that seemed to fixed the same problem.But I don't know why it reappeared.
#12418

Current Behavior

I want to create a polar chart, but I got the opposite bar.

Expected Behavior

I want fill the bar towards positive numbers starting from a minimum value.

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

Please let me know if I'm using a wrong option, or something is wrong with my code, or if it's just a bug.

@BillYu811 BillYu811 added the bug label Apr 6, 2022
@echarts-bot echarts-bot bot added the missing-title This issue is missing a descriptive title. label Apr 6, 2022
@echarts-bot
Copy link

echarts-bot bot commented Apr 6, 2022

I'm sorry to close this issue for it lacks the necessary title. Please provide a descriptive and as concise as possible title to describe your problems or requests and then the maintainers or I will reopen this issue.

Every good bug report or feature request starts with a title. Your issue title is a critical element as it's the first thing maintainers see.

A good issue title makes it easier for maintainers to understand what the issue is, easily locate it, and know what steps they'll need to take to fix it.

Moreover, it's better to include keywords, as this makes it easier to find the issue self and similar issues in searches.

@echarts-bot echarts-bot bot closed this as completed Apr 6, 2022
@BillYu811 BillYu811 changed the title [Bug] [Bug] When polar coordinates are negative, it still renders the bar from 0. Apr 6, 2022
@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 Apr 6, 2022
@echarts-bot echarts-bot bot reopened this Apr 6, 2022
@echarts-bot echarts-bot bot removed the missing-title This issue is missing a descriptive title. label Apr 6, 2022
@jiawulin001
Copy link
Member

jiawulin001 commented Apr 9, 2022

Interestingly enough, I find all bar charts start at 0. And since radius axis bar charts are based on original charts, they must also start at 0. @pissang Does Echarts need a new feature to accept a number instead of 0 as the starting value of the bar chart?
However, there are still alternatives for @BillYu811 to achieve the effect you want. Here's an example but need a bit adjustment on data.

Code Sample
option = {
  title: [
    {
      text: 'Radial Polar Bar Label Position (middle)'
    }
  ],
  polar: {
    radius: [30, '80%']
  },
  radiusAxis: {
    min:0,
    max:30,
    axisLabel:{
      formatter: value=>value-120
    },
  },
  angleAxis: {
    type: 'category',
    data: ["  0-30", " 30-60", " 60-90", " 90-120", "120-150", "150-180", "180-210", "210-240", "240-270", "270-300", "300-330", "330-360"],
    startAngle: 75
  },
  tooltip: {
    formatter: (params)=> `${params.name}: ${(params.value-120)}`
  },
  series: {
    type: 'bar',
    color: "#F53700",
    data: [13, 13, 12, 11, 10, 10, 10, 11, 11, 13, 12, 13 ],
    //data: [-107,-107,-108,-109,-110,-110,-110,-109,-109,-107,-108,-107],
    coordinateSystem: 'polar',
    label: {
      show: true,
      formatter: (params)=> `${(params.value-120)}`
    }
  },
  backgroundColor: '#fff',
  animation: false
};

@BillYu811
Copy link
Author

First of all, thanks for your reply, have a happy weekend,

This sample seems to solve my problem to a certain extent, But I'm worried that when my data changes I also have to modify my FE code =>

  • First: I can't predict what kind of data will get from the BE.

  • Second: I would prefer to build a reusable component that will adapt to any situation. This is more in line with engineering thinking.

  • At the same time, this sample code doesn't seem very elegant.

All in all, I think maybe we need a new feat that accepts a value as a starting value?
@pissang @jiawulin001

Interestingly enough, I find all bar charts start at 0. And since radius axis bar charts are based on original charts, they must also start at 0. @pissang Does Echarts need a new feature to accept a number instead of 0 as the starting value of the bar chart? However, there are still alternatives for @BillYu811 to achieve the effect you want. Here's an example but need a bit adjustment on data.

Code Sample

@BillYu811
Copy link
Author

Also I found an interesting thing, when I used "pyechart" to render the result I wanted, it did what I expected. Like the example below:
https://codepen.io/billyu811/pen/VwyxNep
This also makes me very suspicious.
@jiawulin001 @pissang

Interestingly enough, I find all bar charts start at 0. And since radius axis bar charts are based on original charts, they must also start at 0. @pissang Does Echarts need a new feature to accept a number instead of 0 as the starting value of the bar chart? However, there are still alternatives for @BillYu811 to achieve the effect you want. Here's an example but need a bit adjustment on data.

Code Sample

@jiawulin001
Copy link
Member

I guess that's because the result you want is the problem that #12418 wants to solve. Anyway, glad that you find a way to solve it.

@BillYu811
Copy link
Author

BillYu811 commented Apr 12, 2022

I'm very sorry for my short description, it caused you to misunderstand what I meaning.Please allow me to express in more details:

  • I am trying to use echart-5.3.0 in VUE to achieve the following effects: https://codepen.io/billyu811/pen/QWaQZvg
  • This PR should have fixed the issue I raised, but it didn't, this bug reappeared in 5.3.0 or earlier. Fix 12109 #12418
  • I am confused that this bug is not present in the version of echart used by py-echart. Even though that echart version does what I want, I can't use it in npm.
  • I could use the alternative in the code sample above, but it's not elegant enough. It may prone to some unknown bugs. I described my worries above.
  • To sum up, I think a new official feature will be best.

please let me know your idea.
@jiawulin001

I guess that's because the result you want is the problem that #12418 wants to solve. Anyway, glad that you find a way to solve it.

@BillYu811
Copy link
Author

Any update? @jiawulin001 @pissang

Copy link
Contributor

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 github-actions bot added the stale Inactive for a long time. Will be closed in 7 days. label Apr 18, 2024
Copy link
Contributor

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 github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature. stale Inactive for a long time. Will be closed in 7 days. waiting-for: community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants