We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

how do I get polar chart to be in degrees instead of radians?

Thread ID:

Created:

Updated:

Platform:

Replies:

76405 Sep 4,2008 06:23 PM Sep 16,2008 07:07 AM Windows Forms 6
loading
Tags: Chart
Byron Tate
Asked On September 4, 2008 06:23 PM

I can't find any options on the PrimaryXAxis that will allow degrees instead of radians for the min max range, and for values added to the series.


Byron Tate
Replied On September 4, 2008 08:56 PM


>I can't find any options on the PrimaryXAxis that will allow degrees instead of radians for the min max range, and for values added to the series.


Also, a series point at 0 degrees shows up at the top axis, but the right axis is labeled zero, the top axis is labeled 1.57 (90 degrees). So the axis labels seem to be 90 degrees off.


Manohari [Syncfusion]
Replied On September 8, 2008 01:55 AM

Hi Byron,

We regret for the delayed response. Please find our responses to your queries below.

1) It is posssible to display the Labels in degree by handling the ChartAxis.FormatLabel event. Please refer to the following sample code.

Sample Code:

void PrimaryXAxis_FormatLabel(object sender, ChartFormatAxisLabelEventArgs e)
{
double rad = e.Value;
double deg = rad * 360 / (2 * Math.PI);
if (deg != 360)
{

e.Label = deg.ToString();
}
else
{
e.Label = "";
}
e.Handled = true;
}


I have attached a sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F76405/Sample1.htm

2) We regret to inform you that currently we do not have support to reverse the ChartAxis labels in Polar ChartType ( to display axis values in Clock Wise ). However we have created a feature request in this regard and have forwarded it to our Development team. I will get back to you regarding the time line for implementing this feature on or before September 12th 2008.

Kindly let us know if you have any queries. Thanks for your patience.

Regards,
Manohari.R


Byron Tate
Replied On September 8, 2008 07:05 PM

Thanks for the info re: printing degrees as labels in the polar plot.

As for the other problem, I don't want to reverse the ChartAxis labels in Polar ChartType. What I see is that when I specify 0 radians for the x value, the y point is positioned along the vertical axis, not the horizontal axis. The horizontal axis is labeled 0. This looks like a bug.


>Hi Byron,

We regret for the delayed response. Please find our responses to your queries below.

1) It is posssible to display the Labels in degree by handling the ChartAxis.FormatLabel event. Please refer to the following sample code.

Sample Code:

void PrimaryXAxis_FormatLabel(object sender, ChartFormatAxisLabelEventArgs e)
{
double rad = e.Value;
double deg = rad * 360 / (2 * Math.PI);
if (deg != 360)
{

e.Label = deg.ToString();
}
else
{
e.Label = "";
}
e.Handled = true;
}


I have attached a sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F76405/Sample1.htm

2) We regret to inform you that currently we do not have support to reverse the ChartAxis labels in Polar ChartType ( to display axis values in Clock Wise ). However we have created a feature request in this regard and have forwarded it to our Development team. I will get back to you regarding the time line for implementing this feature on or before September 12th 2008.

Kindly let us know if you have any queries. Thanks for your patience.

Regards,
Manohari.R




Byron Tate
Replied On September 9, 2008 07:06 PM

I have version 6.1.0.34. I notice your sample was built using 6.3.0.30.

I downloaded the source project from the link on the example page. When I run it, I get strange radian values in the PrimaryXAxis_FormatLabel method, and the X axis labels are drawn the same as with PrimaryXAxis_FormatLabel removed as the event handler. axis labels are 0, 1.57, 3.14, 4.71, 6.28


Manohari [Syncfusion]
Replied On September 16, 2008 06:01 AM

Hi Byron,

We regret very much for the inconvinience caused. I have modified the sample to run in version 6.1.0.34.It is possible to format the Labels to display in degrees in version 6.1.0.34 using the ChartFormatAxisLabel event as given below.

Sample code:

void chartControl1_ChartFormatAxisLabel(object sender, ChartFormatAxisLabelEventArgs e)
{
if (e.AxisOrientation == ChartOrientation.Horizontal)
{
double rad = e.Value;
double deg = rad * 360 / (2 * Math.PI);
if (deg != 360)
{

e.Label = deg.ToString();
}
else
{
e.Label = "";
}

}
e.Handled = true;
}

I have attached the modified sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F76405/Sample2.htm

Kindly let us know if this meets your requirement. Thanks for your patience.

Regards,
Manohari.R


Manohari [Syncfusion]
Replied On September 16, 2008 07:07 AM

Hi Byron,

Please find Our response to your Query regarding YAxis Labels along the the horizontal axis.

It is possible to place the YAxis Labels along the the horizontal axis by drawing Custom Axis labels along the Horizontal Axis And hiding the existing Y Axis labels. Please refer to the sample code below.

Sample Code:

this.chartControl1.PrimaryYAxis.ForeColor = Color.Transparent; // To hide actual Y Axis Labels
this.chartControl1.ChartAreaPaint += new PaintEventHandler(chartControl1_ChartAreaPaint);
}

void chartControl1_ChartAreaPaint(object sender, PaintEventArgs e)
{
double min = this.chartControl1.PrimaryYAxis.Range.Min;
double Interval = this.chartControl1.PrimaryYAxis.Range.Interval;
double nInterval = this.chartControl1.PrimaryYAxis.Range.NumberOfIntervals;
float pntX = this.chartControl1.PrimaryYAxis.Rect.Right;
float pntX1 = this.chartControl1.PrimaryYAxis.GetCoordinateFromValue(min + Interval);
float pntY = this.chartControl1.PrimaryYAxis.Rect.Bottom;
float PntXDelta = pntX1 - pntY;
for (int i = 0; i <= nInterval; i++)
{
string str = (min + i * Interval).ToString();
SizeF sz = e.Graphics.MeasureString(str, this.Font);
e.Graphics.DrawString(str, this.Font, new SolidBrush(Color.Black), new PointF(pntX - (PntXDelta * i), pntY)); // Draws custom labels


I have attached a sample sample that illustrates the same in this link below.

http://websamples.syncfusion.com/samples/Chart.Windows/F76405/Sample3.htm

Please let us know if this meets your requirements. Thanks for your patience.

Regards,
Manohari.R



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;