Wrap X Axis labels in a horizontal chart


Author
Message
Bob Smith
Bob Smith
Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)Forum Guru (69 reputation)
Group: Forum Members
Posts: 69, Visits: 1

I have a horizontal bar chart and I would like to force the X Axis labels to wrap as they are quite long. I can't find a setting in the configuration for it but I am hoping that I might be able to use code injection to wrap the labels. It makes the chart quite wide and adds a lot of white space next to the chart.

I've attached a screenshot of my issue with important data blanked out.


Attachments
Chart_Example.gif (789 views, 21.00 KB)
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 Bob,

The following code snippet shows how to force X axis labels to wrap so that their width does not exceed 100 pixels:

NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

NRangeScaleLabelStyle labelStyle = new NRangeScaleLabelStyle();
labelStyle.TickMode = RangeLabelTickMode.None;
labelStyle.WrapText = true;
labelStyle.MaxWidth = new NLength(100, NGraphicsUnit.Pixel);
labelStyle.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Right;
scaleX.LabelStyle = labelStyle;

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