How to change Y axis Label font size?
36,418
Solution 1
You seem to have forgotten to change auto fit style for this axis. It default setting replaces your font size
Chart1.ChartAreas.["ChartArea1"].AxisY.LabelAutoFitStyle
= LabelAutoFitStyles.None;
Chart1.ChartAreas.["ChartArea1"].AxisX.LabelStyle.Font
= new System.Drawing.Font("Trebuchet MS", 2.25F, System.Drawing.FontStyle.Bold);
Solution 2
You try this may be its working
Chart1.ChartAreas["ChartArea1"].AxisX.TitleFont = new Font("your required font",uyour required size, FontStyle.your required style);
Set Title Color
Chart1.ChartAreas["ChartArea1"].AxisX.ForeColor = Color.Red;
Solution 3
Instead of trying to alter the font size directly, assign the font with the style you require. Eg:
Chart1.ChartAreas.["ChartArea1"].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 2.25F, System.Drawing.FontStyle.Bold);
Depending on what you're doing you may also want to set IsLabelAutoFit to false as well.
Solution 4
The secret is not in chartArea, but in Series:
Chart1.Series["SerieName"].Font = new Font("Arial", 7, FontStyle.Bold);
Author by
Admin
Updated on July 28, 2022Comments
-
Admin almost 2 years
I want to change the Y-axis label font size.
I tried...
AxisY LineColor="64, 64, 64, 64" LabelAutoFitMinFontSize="5" LabelStyle Font="NanumGothic, 5pt"
and
Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font.Size = 5;
but it doesn't work. Its size cannot be modified even though I extend or minify it.
Please help me...!! :)