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

Improve Pie- and Doughnut Chart Labels and Layout #286

Open
eselmeister opened this issue Mar 11, 2022 · 16 comments
Open

Improve Pie- and Doughnut Chart Labels and Layout #286

eselmeister opened this issue Mar 11, 2022 · 16 comments

Comments

@eselmeister
Copy link
Contributor

Have a look at the examples:

portfolio-performance/portfolio#2597
https://gist.github.com/digedag/a708844ba36927aa9f74e831b78a6f4c

@himanshu-balasamanta
Copy link
Contributor

  • centering the chart
  • aligning and shorten the labels
  • enable an export option to *.csv like in bar-, line- and scatter plots
    Anything else?

@eselmeister
Copy link
Contributor Author

The ComplexPieChartExample is a good test case to improve the above mentioned issues.

Screenshot from 2022-03-15 07-46-18

Let's discuss and coordinate the activities. Please let me know if you need help.

@himanshu-balasamanta
Copy link
Contributor

himanshu-balasamanta commented Apr 29, 2022

Hi. Here by centring the chart, you mean something like this?
As in no legend but only data is displayed on hover?
image

@himanshu-balasamanta
Copy link
Contributor

And as about displaying data on pie slices, what if we run into the problem faced below?
image

@himanshu-balasamanta
Copy link
Contributor

himanshu-balasamanta commented Apr 29, 2022

And as about displaying data on pie slices, what if we run into the problem faced below?

I mean, even if I do orient the text to be in accordance with pie slice, it can still become cluttered right?

@himanshu-balasamanta
Copy link
Contributor

Does Something like this seem a good solution to centring the chart? ie. only show values on hover.
image

@himanshu-balasamanta
Copy link
Contributor

As about orienting the data aligned with pie slices, not a problem, can be done like this

@eselmeister
Copy link
Contributor Author

The following example looks good:

portfolio-performance/portfolio#2597
https://user-images.githubusercontent.com/1877409/152893547-a2b5900c-ddc5-42e3-a207-4ebe44e95ea2.png

@himanshu-balasamanta Do you think, it's possible to get something similar as above?

@himanshu-balasamanta
Copy link
Contributor

It most certainly is. I will get on to working on it.

@eselmeister
Copy link
Contributor Author

Great! Let me know if you need any assistance.

@buchen
Copy link
Contributor

buchen commented Dec 4, 2022

BTW, I have experimented with the labels - see the screenshot below

Bildschirm­foto 2022-12-04 um 06 59 46

@eselmeister
Copy link
Contributor Author

eselmeister commented Dec 4, 2022 via email

@csprunk
Copy link

csprunk commented Dec 5, 2022

Thanks a lot for improving these!

  • centering the chart
  • aligning and shorten the labels
  • enable an export option to *.csv like in bar-, line- and scatter plots
    Anything else?

Not sure if it fits this issue or if it is even working as intended, but I noticed that the SWT charts enforce a minimum covered angle of 1 degree per item. If the plot contains too many items that should take less than 1 degree the results can look wrong, drawn angles for parent are off.

Context: org.eclipse.swtchart/src/org/eclipse/swtchart/model/Node.java, updateAngularBounds(), angleCovered and required.

I think a fix would either require to forego the 1 degree limit and/or to drop slices that are too small.

@buchen
Copy link
Contributor

buchen commented Dec 10, 2022

@csprunk writes:

Not sure if it fits this issue or if it is even working as intended, but I noticed that the SWT charts enforce a minimum covered angle of 1 degree per item.

It is a problem also for me. See here.

This is my understanding: the underlaying GraphicsContext SWT GC#fillArc only supports integers for startAngle and arcAngle. The current code applies an heuristic which then fails for many small slices.

@buchen
Copy link
Contributor

buchen commented Dec 10, 2022

@csprunk @eselmeister

the SWT charts enforce a minimum covered angle of 1 degree per item

For my project, I have done an alternative implementation. Instead of forcing the slices to be at least 1 degree, I am first assigning "free degrees" to the slices with 0 arc length (for example if rounding error lead to less than 360 degrees) and then I am inserting gaps to at least indicate that there is at least one slice not drawn. Because my data is typically sorted by size, there is one gap at the end.

Not sure if that works as general behavior. So far I am quite happy with the resulting charts. If you are interested, I could try to make a contribution (the existing algorithm in Node runs after each update - thus has to handle incomplete charts as well)

@eselmeister
Copy link
Contributor Author

@buchen That sounds reasonable. I would be happy if you would like to contribute your alternative implementation. We could add an option to the chart settings, whether to use the current or your implementation. Let me know if you need assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants