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.

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,

The title cannot be wrapped automatically, but it is possible to add new lines in the title string - they will be regarded. If you use XML formatted text, you can insert a <br /> tag to split the line.

Best Regards,
Nevron Support Team


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
Thank you for your answer. I'll try to use XML formatted text.
However, automatic axis title wrapping when resizing a chart is a nice to have feature.
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
1. How can I measure the width of XML-formatted string and the height of Y-Axis?
2. I want to wrap the title each time when new series is added or the chart is resized. Is there any event that fires after such actions have occurred?

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


Ivan Gorenko
Ivan Gorenko
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: 1, Visits: 6
Hi!

Your sample working perfect, thanks. But is it possible to do same for vertical axis? I mean label is displaying horizontally. So, is there a way to change this label orientation from horizontal to vertical?

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,
Yes you can use the same code to apply an axis label to the vertical axis. If you want to change the orientation you can use the label style angle:

label.Style.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);

For more information you can take a look at the following topic:
http://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_Scale_Labels.html

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




Best Regards,
Nevron Support Team


Timothy Wong
Timothy Wong
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: 5, Visits: 49
Hello,

We have been using the suggested approach for years, but recently we needed to implement a new feature of toggling visibility of grid lines. We tried calling SetShowGridLines() on axis' scale configurator but noticed that when we hide grid lines, axis labels also get hidden. 

Is there another way to show/hide grid lines without affecting visibility of axis labels?

Thank you!


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 Timothy,

Can you please send the code you're testing with for review? - We just tested with:

   NChart chart = nChartControl1.Charts[0];

    NBarSeries bar = new NBarSeries();
    bar.Values.Add(10);
    bar.Values.Add(20);
    bar.Values.Add(30);

    chart.Series.Add(bar);

    chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator.MajorGridStyle.SetShowAtWall(ChartWallType.Back, false);

And this did not affect the visibility of the Y axis labels, so it must be some other setting that's affecting this....

Best Regards,
Nevron Support Team


Timothy Wong
Timothy Wong
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: 5, Visits: 49
Please find an example attached
Attachments
Test.zip (270 views, 2.00 KB)
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