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

endAngle support for pie chart #4326

Closed
jarben opened this issue Oct 25, 2016 · 3 comments
Closed

endAngle support for pie chart #4326

jarben opened this issue Oct 25, 2016 · 3 comments
Labels
enhancement stale Inactive for a long time. Will be closed in 7 days.

Comments

@jarben
Copy link
Contributor

jarben commented Oct 25, 2016

Version: 3.2.3

Would be great if pie chart has endAngle proproty, similar to the gauge chart. I'm trying to achieve this:

image

Where what I seem to be able to achieve with pie chart is:
image

Also, I wonder whether this could be actually rendered as a bar chart with "polar" coordinate system. I haven't seen this type supported in the doc so haven't tried. This would potentially allow to render things like this one?

image

@jonavila
Copy link
Contributor

@jarben Just recently, I was looking for a similar option. I wanted to use the endAngle on a polar bar chart to achieve the exact same look. I solved it in a hacky sort of way, by leveraging echarts.registerProcessor and re-setting the axis extent. I'm not really sure that it is officially supported, so I'll let @pissang and @Ovilia and @100pah chip in.

echarts.registerProcessor(ecModel => {
  if (ecModel.getComponent('polar')) {
    ecModel
      .getComponent('polar')
      .coordinateSystem.getAxis('angle')
      .setExtent(90, -180);
  }
});

Here's a working example.
https://codepen.io/psumstr/pen/VQdNXy?editors=1010

I've used registerProcessor in the past to get some things like bandWidth of heat map to dynamically show or hide labels.

@jarben
Copy link
Contributor Author

jarben commented Feb 23, 2018

Awesome, thanks so much for the example @jonavila ! Didn't know about registerProcessor - I'm sure I'll find a lot use of that! Again - thanks for your solution & example..

@Ovilia Ovilia added the stale Inactive for a long time. Will be closed in 7 days. label Jul 17, 2019
@stale stale bot closed this as completed Jul 24, 2019
@javidoweb
Copy link

@jarben Just recently, I was looking for a similar option. I wanted to use the endAngle on a polar bar chart to achieve the exact same look. I solved it in a hacky sort of way, by leveraging echarts.registerProcessor and re-setting the axis extent. I'm not really sure that it is officially supported, so I'll let @pissang and @Ovilia and @100pah chip in.

echarts.registerProcessor(ecModel => {
  if (ecModel.getComponent('polar')) {
    ecModel
      .getComponent('polar')
      .coordinateSystem.getAxis('angle')
      .setExtent(90, -180);
  }
});

Here's a working example.
https://codepen.io/psumstr/pen/VQdNXy?editors=1010

I've used registerProcessor in the past to get some things like bandWidth of heat map to dynamically show or hide labels.

This solution dont work in Echarts version 4.0.2+ :|
I dont know WHY? How we can do it in Version 4.6.0 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stale Inactive for a long time. Will be closed in 7 days.
Projects
None yet
Development

No branches or pull requests

5 participants