Pre loader

Polar chart x-axis starting point and direction

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

2
1

I’m trying out polar chart for my specific needs. In my scenario x-axis needs to display 0-360 (angle) values starting from bottom and going counter-clockwise so that 0 is at the bottom, 90 is at right, 180 is at the top and so on. Looking at polar chart default x-axis display it starts from right and go clockwise. Is there any way to change this behavior?

  • You must to post comments
1
0

Hi there,

Unfortunately current implementation of polar chart does not allow to change starting point but for you could use next workaroud:

 <s:SciChartSurface>
        <s:SciChartSurface.LayoutTransform>
            <RotateTransform Angle="90" CenterX="0.5" CenterY="0.5"/>
        </s:SciChartSurface.LayoutTransform>

        <s:SciChartSurface.XAxis>
            <s:PolarXAxis FlipCoordinates="True"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxis>
            <s:PolarYAxis Angle="270"/>
        </s:SciChartSurface.YAxis>
 </s:SciChartSurface>

Here we’re doing next:

  1. Using RotateTransform to rotate whole chart on 90 degrees;
  2. Set FlipCoordinates = true to reverse xAxis coordinates;
  3. Set Angle=270 on yAxis to compensate rotation effect caused by RotateTransform.

Is this suitable for you? Hope it helps!

Images
  • Parashar Satpute
    I tried your solution, it works but not perfect. There are side effects that may need further workarounds. Some of the side efforts are as below: 1) Due to layout transformation entire chart is rotated 90 deg that rotates the assigned background for example. If the background has gradient brush then it’s visible. Minor fix but still an important consideration. 2) Annotations are affected as their orientation is changed too. It’s apparent on text annotations. I got few more issues on the polar chart that I would like to mention. I can attach the sample I am playing with to see these issues if I could without submitting an answer. 1) The rollover modifier does not render x-axis label consistently. In certain range(s) of x-values rollover modifier is unable display x-axis values. If the size of the chart is increased then it works. But for smaller size it shows this inconsistency. 2) x-axis label tick are not correctly aligned. Again the size of the chart matters.
  • You must to post comments
0
0

There are several operative issues.
1) There is a live resize the chart is displayed in 3 sizes ( Depending on the monitor Capture meduim, small, Big )
2) The scale Xaxis should have a padding or margin so it could stick near the chart
3) The Yaxis have too many decimal separators I the scale could be in 0.5 steps (Optimization)
4) Xaxis should need to be in a 90 degree step ( 0,90,180,270)
5) The XY Zoom in and out is funny too ( I tried all 3 Y, X, and XY and is unclear what is really zommed)

Your answer:

1)THere is no background gradient so it is no question in this case
2)Annotation can be replaced normal labels so it no issue
3)I’ve noticed this to the rollover modifier is unable to display x-axis values
4) x-axis label tick is not correctly aligned. Again the size of the chart matters this issues redirects to my question 1.

  • You must to post comments
0
0

To Move the starting Angle Set the Rotation Anagle

<!--  Declare Axes  -->
            <s:SciChartSurface.XAxis>
                <s:PolarXAxis
                    x:Name="xAxis"
                    FlipCoordinates="False"
                    RotationAngle="90"
                    TickProvider="{StaticResource 'CustomTickProvider '}" />
            </s:SciChartSurface.XAxis>

To create the desired tick interval like 0, 90, 180, 270 or 0, 45,90, 135 etc create a tick provider like below

 public class DoubleTickProvider : TickProvider<double>
    {
        public override IList<double> GetMinorTicks(IAxisParams axis)
        {
            return GenerateTicks((DoubleRange)axis.VisibleRange, (double)axis.MinorDelta);
        }

        private static double[] GenerateTicks(DoubleRange tickRange, double delta)
        {
            var ticks = Enumerable.Range(0, 360).Where(x => x % 45 == 0 || x == 360).Select(t => (double)t).ToList();
            return ticks.ToArray();
        }

        public override IList<double> GetMajorTicks(IAxisParams axis)
        {
            return GenerateTicks((DoubleRange)axis.VisibleRange, (double)axis.MajorDelta);
        }
    }
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies