Nevron Forum

How to maintain label dimension constant

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

By Luca Azzoni - Thursday, November 14, 2013

Hi Nevron,

My chart is contained in a NContentPanel that has a fixed width and also it has a Y axis with its NLinearScaleConfigurator that sometimes is updated with LabelValueFormatter that adapts labels that sometimes are smaller and sometimes are bigger depends on decimal values.

The visual effect is not very good because the font size changes depending on the decimal values so the labels are difficult to read.

How could I maintain the font size constant maintaining also constant the width of NContentPanel ?
Thanks-
By Nevron Support - Thursday, November 14, 2013

Hi Luca,

The font size can change due to one of the following reasons:

1. The axis uses automatic auto scaling to resolve overlapping labels.

2. The axis zone bounds exceed the maximum specified zone bounds (by default 30 percent of the plot area).

Can you send us a screenshot of the chart you're having problems with for review?

By Luca Azzoni - Thursday, November 14, 2013

Hello,
Thanks for your reply. You can find in the attachment the image.

Perhaps another idea is to adapt the panel with: larger when label with increase and smallest when the label with decrease. But how can I found the label size?

I'am telling this because the size retrieved by myScaleconfigurator.LabelStyle.TextStyle.FontStyle.EmSize it is always the same it didn't change.
By Nevron Support - Friday, November 22, 2013

Hi Luca,

Please elaborate on the problem - as mentioned above the control can automatically scale the labels sizes if it encounters one of the above conditions - you can switch off both using:

NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.MaxDockZoneMargins =
new NMarginsL(10000);
((
NStandardScaleConfigurator)(chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator)).LabelFitModes = new LabelFitMode[0];
((
NStandardScaleConfigurator)(chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator)).LabelFitModes = new LabelFitMode[0];

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