Profile Picture

Y-Axis (And X-Axis) Label size in Float Bar

Posted By Vahid Mesri 6 Years Ago
Author
Message
Vahid Mesri
Problem Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 67
Hi,
I've created the attached float bar chart. 

https://www.nevron.com/forum/uploads/images/b41bde85-8b8e-42bf-8eab-8287.png
Y-Axis font size:
The y-axis labels are quite lengthy and I wanted to increase y-axis font, however, I haven't been able to do so.
Moreover I tried to break labels into separate lines but again unfortunately I couldn't find any way to break the lines.
X-Axis font size:
I cannot change the font size for the x-axis even though I have changed all relevant settings Axis -> Scale -> Label Text Style. I would like to keep the size of the chart area as it is but resize the font of the axis. 

It seems that the font sizes are handled automatically for both the y-axis and x-axis hence my settings are overwritten. Can you kindly let me know how I can change the font sizes?

Best Regards,
Vahid



Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,000
Hi Vahid,

The following code shows how to limit the width of the axis labels as well as how to modify the font size of both the X and Y axis labels:

// configure the chart
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.Axis(StandardAxis.Depth).Visible = false;
chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);

// setup X axis
NOrdinalScaleConfigurator scaleX = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
scaleX.AutoLabels = false;
scaleX.MajorTickMode = MajorTickMode.AutoMaxCount;
scaleX.DisplayDataPointsBetweenTicks = false;

// set range labels with wrapping
NRangeScaleLabelStyle labelStyle = new NRangeScaleLabelStyle();
labelStyle.TickMode = RangeLabelTickMode.None;
labelStyle.MaxWidth = new NLength(100);
labelStyle.WrapText = true;
labelStyle.TextStyle.FontStyle.EmSize = new NLength(12);
scaleX.LabelStyle = labelStyle;

scaleX.Labels.Add("Some Long Label Some Long Label 1");
scaleX.Labels.Add("Some Long Label Some Long Label 2");

// add interlaced stripe to the Y axis
NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
linearScale.LabelStyle.TextStyle.FontStyle.EmSize = new NLength(12);

// create the float bar series
NFloatBarSeries floatBar = (NFloatBarSeries)chart.Series.Add(SeriesType.FloatBar);
floatBar.DataLabelStyle.Visible = false;

// add bars
floatBar.AddDataPoint(new NFloatBarDataPoint(2, 10));
floatBar.AddDataPoint(new NFloatBarDataPoint(5, 16));

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

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic