Nevron Forum

scale Ruler/label/title alignment of custom axis

https://www.nevron.com/Forum/Topic6102.aspx

By Jim Rowe - Tuesday, February 7, 2012

Hi, I've created a new custom axis like so:
NAxis customAxis = ((NCartesianAxisCollection)_chart.Axes).AddCustomAxis(AxisOrientation.Vertical, (AxisDockZone)(i % 2));
And would like to align the vertical scale to the left of the chart (default, correct?), the hash marks and their labels to the right of the ruler and the scale title to the top right of the scale, horizontally.

I've attached a png of how i would like it to look.

I've tried various combinations of the following:

customAxis.Anchor = new NDockAxisAnchor(AxisDockZone.FrontLeft, false, 0, 100);
customAxis.Anchor.RulerOrientation = RulerOrientation.Right;
(customAxis.Anchor as NDockAxisAnchor).SynchronizeRulerOrientation = true;
customAxis.ScaleConfigurator.Title.RulerAlignment = Nevron.HorzAlign.Right;
customAxis.ScaleConfigurator.Title.ContentAlignment = ContentAlignment.TopRight;
(customAxis.ScaleConfigurator as NLinearScaleConfigurator).DisplayFirstLabel = false;
(customAxis.ScaleConfigurator as NLinearScaleConfigurator).DisplayLastLabel = false;
(customAxis.ScaleConfigurator as NLinearScaleConfigurator).LabelStyle.ContentAlignment = ContentAlignment.MiddleRight;
(customAxis.ScaleConfigurator as NLinearScaleConfigurator).LabelStyle.KeepInsideRuler = true;

thanks!
By Nevron Support - Tuesday, February 7, 2012

Hi Jim,

We're unable to open the attachment - can you try to post it again or drop a short mail to support@nevron.com with it?
By Jim Rowe - Tuesday, February 7, 2012

Ok, I've edited the previous and reposted the image.
Thanks
By Nevron Support - Wednesday, February 8, 2012

Hi Jim,

You're very close - actually only the SynchronizeRulerOrientation property should be set to false in order to flip the labels on the right side. The following code displays a Y axis similar to the one in the attached chart:

   NChart chart = nChartControl1.Charts[0];
   NAxis axis = chart.Axis(StandardAxis.PrimaryY);

   // set an anchor to the axis that has right orientation
   NDockAxisAnchor anchor = new NDockAxisAnchor();
   anchor.SynchronizeRulerOrientation = false;
   anchor.RulerOrientation = RulerOrientation.Right;
   axis.Anchor = anchor;

   NStandardScaleConfigurator scale = axis.ScaleConfigurator as NStandardScaleConfigurator;

   // hide inner ticks
   scale.InnerMajorTickStyle.Length = new NLength(0);
   scale.InnerMinorTickStyle.Length = new NLength(0);

   scale.MinorTickCount = 1;

   // hide first / last labels
   scale.DisplayFirstLabel = false;
   scale.DisplayLastLabel = false;

   scale.Title.Text = "Inches";
   scale.Title.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.View, 0);
   scale.Title.RulerAlignment = HorzAlign.Right;
   scale.Title.ContentAlignment = ContentAlignment.TopRight;


Hope this helps -let us know if you meet any problems or have any questions.

 

By Jim Rowe - Thursday, February 9, 2012

that did it, thanks