How to force Y axis to invert (increase going down, not up)


Author
Message
Michael Rovak
Michael Rovak
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 2, Visits: 2
I am in process of evaluating this product for our use. I am using VS2015, C#, winforms.
I am finding it difficult to get the vertical axis to invert so that increasing values go down instead of up.

This code:
            nChartControl1.Visible = false;
            nChartControl1.Charts.Clear();
            nChartControl1.Legends.Clear();
            NCartesianChart chart = new NCartesianChart();
            nChartControl1.Charts.Add(chart);
            NChart m_Chart = nChartControl1.Charts[0];
            NLineSeries m_Line = (NLineSeries)m_Chart.Series.Add(SeriesType.Line);
            m_Line.DataLabelStyle.Visible = false;
            m_Line.MarkerStyle.Visible = false;
            m_Line.UseXValues = true;
            NAxis axis = chart.Axis(StandardAxis.PrimaryX);
            axis.View = new NRangeAxisView(new NRange1DD(0.2, 2000.0));
            NLogarithmicScaleConfigurator logarithmicScale = new NLogarithmicScaleConfigurator();
            logarithmicScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            logarithmicScale.MinorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            logarithmicScale.MinorGridStyle.SetShowAtWall(ChartWallType.Back, true);
            logarithmicScale.MinorTickCount = 8;
            logarithmicScale.MajorTickMode = MajorTickMode.CustomStep;
            logarithmicScale.CustomStep = 1;
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = logarithmicScale;
            m_Line.Values.AddRange(mapTheDoubles);
            m_Line.XValues.AddRange(secondCurve);
            NRange1DD nr = new NRange1DD(4950.0, 5000.0);
            //nr.Invert();
            chart.Axis(StandardAxis.PrimaryY).View = new NRangeAxisView(nr, true, true);
            nChartControl1.Refresh();
            nChartControl1.Visible = true;

..produces this result:

I want the vertical axis inverted to put 4950 at the top, and 5000 at the bottom, with the data following that orientation.
When I uncomment the nr.Invert() line and run it, this is the results:

Alternative results, by doing this some other way, fail to change the first image orientation.
What's the secret to getting this to work with an inverted Y axis?
Thanks.


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Michael,

You just need to set the Invert property of the scale configurator to true:

logarithmicScale.Invert = true;

Let us know if you meet any problems.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search