How to change Y axis Label font size?

Moonil Kim picture Moonil Kim · Jul 4, 2012 · Viewed 34.9k times · Source

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...!! :)

Answer

Oleg picture Oleg · Jul 24, 2012

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);