调整asp.net图表坐标轴的字体样式和大小? [英] adjusting the font axes style and size in asp.net chart?
本文介绍了调整asp.net图表坐标轴的字体样式和大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道我需要改变,以减少轴数字的字体大小和更改字体样式的属性?还需要知道如何添加x和y的标签。
< ASP:表=服务器ID =Chart1WIDTH =340pxHEIGHT =265px>
<&系列GT;
< ASP:系列名称=分散MarkerSize =4图表类型=点颜色=绿色MarkerStyle =圆>
< / ASP:系列>
< /系列>
< ChartAreas>
< ASP:ChartArea NAME =ChartArea1BORDERCOLOR =64,64,64,64BorderDashStyle =实
BackSecondaryColor =白色背景色=浅绿则shadowColor =透明BackGradientStyle =TopBottom>
< Area3DStyle旋转=10透视=10倾角=15IsRightAngleAxes =FALSE
WallWidth =0IsClustered =假/>
< AxisY LineColor =64,64,64,64>
< LabelStyle字体=投石机MS,5pt/>
< MajorGrid LineColor =64,64,64,64/>
< / AxisY>
< AxisX LineColor =64,64,64,64>
< LabelStyle字体=宋体,3点/>
< MajorGrid LineColor =64,64,64,64/>
< / AxisX>
< / ASP:ChartArea>
< / ChartAreas>
<&系列GT;
< ASP:系列名称=行图表类型=线边框宽度=3
MarkerStyle =无边框颜色=180,26,59,105颜色=DarkBlue>
< / ASP:系列>
< /系列>
< / ASP:图表>
解决方案
看看的<一个href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.labelstyle.aspx\">LabelStyle类。
Axis.LabelStyle =新LabelStyle(){字体=新的字体(宋体,7.5f)}
例如与此LabelStyle加一个X轴,你可以做:
Chart.ChartAreas [MyChart。AxisX =新中轴线{LabelStyle =新LabelStyle(){字体=新的字体(宋体,7.5f)}}
和标签自动调整样式设置为prevent标签缩放可能是有用的太:
Chart.ChartAreas [MyChart] = AxisY.LabelAutoFitStyle LabelAutoFitStyles.None。;
Does anyone know the properties that I need to change to decrease the font size of the axes numbers and change the font style? Also need to know how to add x and y labels.
<asp:Chart runat="server" ID="Chart1" Width="340px" Height="265px">
<Series>
<asp:Series Name="scatter" MarkerSize="4" ChartType="Point" Color="Green" MarkerStyle="Circle">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="LightGreen" ShadowColor="Transparent" BackGradientStyle="TopBottom">
<Area3DStyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False"
WallWidth="0" IsClustered="False" />
<AxisY LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 5pt" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Arial, 3pt" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
<Series>
<asp:Series Name="Line" ChartType="Line" BorderWidth="3"
MarkerStyle="None" BorderColor="180, 26, 59, 105" Color="DarkBlue">
</asp:Series>
</Series>
</asp:Chart>
解决方案
Take a look at the LabelStyle class.
Axis.LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) }
For example to add an X axis with this LabelStyle you can do:
Chart.ChartAreas["MyChart"].AxisX = new Axis { LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) } }
And setting label auto fit style to prevent label scaling may be useful too:
Chart.ChartAreas.["MyChart"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;
这篇关于调整asp.net图表坐标轴的字体样式和大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文