Wrapping axis title


Author
Message
Alex W
Alex W
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)
Group: Forum Members
Posts: 5, Visits: 1
Hi,

My Y-Axis title is quite long.
Is there any way to wrap axis title (make it multiline)?

Thanks.

Reply
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 Alex,

This can be achieved using custom range labels. The following code snippet shows how to create a custom range label that automatically wraps when then length of the text exceeds the length of the x axis:

         NChart chart = nChartControl1.Charts[0];

         NAxis axisX = chart.Axis(StandardAxis.PrimaryX);
         NStandardScaleConfigurator scaleX = (NStandardScaleConfigurator)axisX.ScaleConfigurator;

         // make modifications to the configurator here...

         axisX.UpdateScale();

         // create label
         NRangeScaleLabelStyle style = new NRangeScaleLabelStyle();
         style.WrapText = true;
         style.TextStyle.TextFormat = TextFormat.XML;
         style.TickMode = RangeLabelTickMode.None;

         NRulerRangeDecorationAnchor anchor = new NRulerRangeDecorationAnchor(Nevron.HorzAlign.Left, new NLength(0), Nevron.HorzAlign.Right, new NLength(0));
         NRangeScaleLabel label = new NRangeScaleLabel(anchor, "Some Title Text with <b>XML</b> formatting", style);

         // create decorator
         NCustomScaleDecorator decorator = new NCustomScaleDecorator();
         decorator.Decorations.Add(label);
         
         // create a new scale level
         NScaleLevel scaleLevel = new NScaleLevel();
         scaleLevel.Decorators.Add(decorator);
         axisX.Scale.Levels.Add(scaleLevel);

Hope this helps - 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