ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Zoom on polar chart
Posted by Miguel on Nov-05-2020 18:56
Hi!

I'm trying to do something similar to this: https://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=polar&thread=1581935682 but on a windrose chart.

I added
c.radialAxis().setLinearScale(-(max/10), max, max/5);
but I want to start the labelling on 0, or even better at the first mark.

I also tried to change the background color of the axis mark labels but I coudn't. Any help on this too? (I'm quite new to c# and starting to try the chartdirector's library).

And last but not least, is it possible to add zooming and panning to a polarchart? It would be helpful as some zones on the windrose are small and usually on the center part, making it difficult to determine its size.

Thank you Peter!

  Re: Zoom on polar chart
Posted by Peter Kwan on Nov-05-2020 23:57
Hi Miguel,

Although I am not sure the exact chart you want, I am quite sure ChartDirector can achieve what you need because ChartDirector has very flexible labelling support.

If your intention is to put the r = 0 away from the center for layout reasons, you can use Axis.setMargin to a margin in pixel units. For example:

c.radialAxis().setMargin(0, 20);

The above means the lower limit of the axis scale is 20 pixels away from the center. If the lower limit is 0, then it means r = 0 is a circle 20 pixels away from the center. You can let ChartDirector auto-scale the axis, or configure the axis scale yourself using setLinearScale. ChartDirector has APIs to allow you to set constraints on how the axis is auto-scaled. There are also APIs to add axis labels at any location of your choice. If you have these requirements, please let me know.

To set the background color of the radial axis labels, you can use:

ChartDirector.TextBox t = c.radialAxis().setLabelStyle("Arial", 8, 0x000000);
t.setBackground(0xffff00, Chart.Transparent);  //yellow background, transparent border

Unluckily, there is no built-in "zooming and panning" for the polar chart. In ChartDirector, zooming and panning does not increase the size of anything. They just changes the axis range. For example, in an XYChart, instead of display one year of data, it can "zoom in" to display one month of data. The chart size, label font size, etc., all remain the same.

For a polar chart, it does not seem we change the axis range. For "zooming and panning" for a polar chart, are you thinking about a "graphical zoom" like zooming in a photograph?

Regards
Peter Kwan

  Re: Zoom on polar chart
Posted by Miguel on Nov-06-2020 18:16
Attachments:
Hi Peter,

c.radialAxil().setMargin(0,20); worked as intended, as you can see on the pictures there is a difference on readability on the center zone.

Also tried the TextBox properties, I'll try different color combinations.

On "zooming and panning" as you said I was thinking on a picture like zoom style.
I'm not sure if it can be done by redrawing the chart with a new radius as (r) you scroll/move a bar for the zoom, and moving with some mouse event changing the (x) and (y) in function setPlotArea(x,y,r,c).
Can something like that be done? With a "reset zoom" button to recenter and zoom back to 100% the chart.

I'm still learning c# and my program for sure is not written in a proper and logical way, but it shows what I want at the moment. If you say it is possible to emulate a zoom this way, I'll try :)

Thank you Peter
Windrose 20Margin.JPG
Windrose noMargin.JPG