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.

Replies
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.3K
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)
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.3K
Hi Timothy,

Thank you for sending the code. The problem is that the code relies on custom decorations that are added to the scale initially, but not after you alter the scale (which will rebuild the scale decorations). To solve the problem you need to add custom decorations each time you modify the scale - for example:

  private void OnChartControlDoubleClick(object sender, EventArgs e)
   {
    var chart = nChartControl1.Charts[0];
    var axis = chart.Axis(StandardAxis.PrimaryY);
    var majorGridStyle = axis.ScaleConfigurator.MajorGridStyle;

    // toggle major grid line visibility
    majorGridStyle.SetShowAtWall(ChartWallType.Back, !majorGridStyle.GetShowAtWall(ChartWallType.Back));

    CreateVerticalAxisLabel(axis, "Title 1");

    nChartControl1.Refresh();
   }

Will fix the problem. You can also check out the following topic:
https://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_ProgrammingTheScale_Getting_Started.html

which talks about how to add custom-scale decorations.

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


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
Recreating the label with decorations solves the problem. Thank you!

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