|
Draw circles on polar charts |
Posted by David Littau on May-25-2012 02:20 |
|
I need to draw circles on a polar chart using various line colors and line types (e.g. solid, dashed, dot-dashed, etc). Is this possible?
The circles are needed to note boundaries for data. I know about making circular zones, but that is not what is desired.
thanks,
David |
Re: Draw circles on polar charts |
Posted by Peter Kwan on May-26-2012 00:30 |
|
Hi David,
Instead of using Axis.addZone to add zones, you can use Axis.addMark to add mark circles. For example:
//add a blue dashed mark circle at r = 28.
c.radialAxis().addMark(28, c.dashLineColor(0x0000ff, Chart.DashLine));
You may refer to the documentation on dashLineColor for other patterns you may use (dotted line, dash-dot, other custom patterns) for the line.
Hope this can help.
Regards
Peter Kwan |
Re: Draw circles on polar charts |
Posted by David Littau on May-27-2012 06:33 |
|
Thank you for the quick response. As usual, it was a big help. |
Re: Draw circles on polar charts |
Posted by David Littau on May-28-2012 11:00 |
|
Is there a way to force the mark circles to appear in the chart? I have a situation such that all of the data are below the lowest value for a threshold, so the mark circles do not appear on the chart at all.
The only solution I can think of right now is to always graph an invisible point at a radius greater than the radius of the largest mark circle.
Also, is there a way to change the placement of the legend for the mark circles? The legend appears right on the top of the circle, in the middle of the chart. I would prefer it were at the top, above the chart, with the other data legends.
thanks,
David |
Re: Draw circles on polar charts |
Posted by Peter Kwan on May-29-2012 05:26 |
|
Hi David,
To avoid the label on the top of the mark circle, please do not provide a label when you call addMark (do not provide the third parameter).
To ensure the mark is within the chart, the method we usually suggest is exactly the method you are already using, which is to add an invisible layer with a data point at the mark value. This method can also be used to add a legend entry for the mark in the legend box. It is like:
c.addLineLayer(new double[] { myMarkValue }, c.dashLineColor(0x0000ff, Chart.DashLine)), "My Mark Name");
In the above, a line layer is added, so there will be a legend entry for the line layer. The line layer contains 1 data point, which is the mark value, so ChartDirector will auto-scale the axis to include the mark value. The line layer is invisible, because it needs at least two points to draw a line.
Hope this can help.
Regards
Peter Kwan |
Re: Draw circles on polar charts |
Posted by David Littau on May-29-2012 09:09 |
|
Again, you have solved my problem for me.
Thanks. |
|