By Ashis Mohapatra - 4 Years Ago
|
Hi Everyone,
I have been using Nevron Polar Charts to plot data points at positive and negative swing angles. 1. The angles of the chart start from 0-360
2. Is there any way I can have the first and fourth quadrant as positive angles(0 - 180) and second and third quadrant with negative angles(-1 till -180)
3. In short I want to mirror it from the centre ie. 0 deg
|
By Nevron Support - 4 Years Ago
|
Hi Ashis,
The only way to achieve this number is by using custom code - we could not find a way to achieve it with the standard .net format strings. The following code (which you need to paste in the code tab of the control) shows how to install a custom value formatter that formats all values after 180 degrees with their negative equivalent:
using System; using System.Drawing; using Nevron.Dom; using Nevron.GraphicsCore; using Nevron.Chart; using Nevron.ReportingServices;
namespace MyNamespace { class NCustomValueFormatter : NNumericValueFormatter { public override string FormatValue(double value) { if (value > 180) { value = -(360 - value); }
return value.ToString(); }
public override string FormatValue(object obj) { return FormatValue((double)obj); } } /// <summary> /// Sample class /// </summary> public class MyClass { /// <summary> /// Main entry point /// </summary> /// <param name="context"></param> public static void RSMain(NRSChartCodeContext context) { NPolarChart polarChart = (NPolarChart)context.document.Charts[0];
NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)polarChart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.LabelValueFormatter = new NCustomValueFormatter(); } } }
We hope this helps - let us know if you meet any problems or have any questions.
|
By Ashis Mohapatra - 4 Years Ago
|
Thank you so much, it works perfectly.
|