Recent

Author Topic: [SOLVED] Zoom and pan a pie  (Read 5120 times)

guest58172

  • Guest
[SOLVED] Zoom and pan a pie
« on: March 06, 2017, 12:37:18 pm »
Zooming and panning a Pie doesn't work for me.

1. I have to show the axis, otherwise no effect
2. zooming and panning seems to be clipped, ie i can't manage to have a circle bigger then the component itself.

What's he proper way to do this ?

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Zoom and pan a pie
« Reply #1 on: March 06, 2017, 01:36:21 pm »
The impression that I get from the source code (it was not written by me) is that the pie series is not designed for zooming and panning because it always centers itself within the available axis range.

Did you look at the property "FixedRadius" of the series? It can be used to override the automatic size calculation of the circle.

guest58172

  • Guest
Re: Zoom and pan a pie
« Reply #2 on: March 06, 2017, 01:50:28 pm »
That's a problem for me. Actually now i've tried to plot a IRL thing and the problem is even worst. Clipping happens because of labels.

The consequence is hilarious, like shown by the screen capture:

guest58172

  • Guest
Re: Zoom and pan a pie
« Reply #3 on: March 06, 2017, 01:57:16 pm »
I missed a part of the answer. Yes with FixedRadius set to 100 it's a bit better.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Zoom and pan a pie
« Reply #4 on: March 06, 2017, 03:07:04 pm »
Don't display such huge labels. The pie series tries to squeeze everything, series plus labels, into the space available. If you freeze the size of the pie circle then, of course, the labels will be truncated because they don't fit into the available space any more.

Zooming will definitely will not help you.

Try to shorten the labels, maybe use numbers or abbreviations which you explain in the legend or outside the chart. Or you can also use linebreaks (embed LineEndings in the label text) --  but I don't think that this will be sufficient.
« Last Edit: March 06, 2017, 03:23:22 pm by wp »

guest58172

  • Guest
Re: Zoom and pan a pie
« Reply #5 on: March 06, 2017, 03:23:02 pm »
I have to display them. I use the pie to display profiling. So each part matches to a symbol in an executable. By the way that's a known problem in D. Since templates are much used, and in chain, this tends to create HUUUUGE symbols.

However in my case I also have them in a list:

http://bbasile.github.io/Coedit/widgets_profile_viewer

so I don't really care...It 's still better than a txt file.
If someone has a better idea and some time, PR are welcome !

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: [SOLVED] Zoom and pan a pie
« Reply #6 on: March 06, 2017, 03:30:38 pm »
A chart in which the information provided is hidden due to overlapping labels is useless.

Like in your link, add a grid or a listview to the form and display the series colors in the first column. There's even a TChartImageList to get the series icons in a convenient way.

Upload your raw data and I can write a little demo to show what I mean.

guest58172

  • Guest
Re: [SOLVED] Zoom and pan a pie
« Reply #7 on: March 06, 2017, 04:06:32 pm »
The parts for which the labels are overlapped are themselves very thin (labels are overlapped but their part in the pie is already indistinguishable), which means that what they represent is not what's you're after when measuring execution of each function.

Problem solved, even if I admit that's a bit "shitty".

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: [SOLVED] Zoom and pan a pie
« Reply #8 on: March 06, 2017, 08:03:17 pm »
In the attachment you can find a little project with a better user interface. Like your link, it contains a listview below the chart, it serves as a "super legend" and displays all items associated with a data point. And it shows a little icon in the color of the slice to emphasize to which data point in the series it belongs.

In addition you have the following possibilities:
  • Checkbox "Show series labels" displays the series labels like in your example, but they are truncated to a maximum length of 10 characters.
  • Checkbox "Show popup hints" activates a DatapointHintTool which shows a popup window with all relevant information whenever the mouse hovers above a slice in the pie chart. Note that this requires the new features of the current trunk version of TAChart.
  • Checkbox "Click on slice to move it out" enabled the feature that a click on a slice moves it a bit away from the center and highlights the corresponding line in the listview. Again, this requires TAChart from Lazarus trunk (but it can be modified to run also with older versions - see the radialdemo project in the demo folder).
  • Checkbox "Click in list to move slice out" goes the other way: if you click on a line in the listview the corresponding slice of the pie chart moves away from the center.
« Last Edit: March 07, 2017, 12:23:14 am by wp »

guest58172

  • Guest
Re: [SOLVED] Zoom and pan a pie
« Reply #9 on: March 07, 2017, 06:18:02 am »
Nice work. If you have a GitHub account you might be interested into submitting some changes directly in the project, source for the profile viewer is here:

https://github.com/BBasile/Coedit/blob/master/src/ce_profileviewer.pas

The software also works on Windows and there's very few requirements:
- sys: install this https://dlang.org/download.html#dmd
- laz: install https://github.com/BBasile/Coedit/blob/master/lazproj/cedsgncontrols.lpk

I attach a sample trace.log

 

TinyPortal © 2005-2018