gpt4 book ai didi

c# - 在 asp.net 图表中调整字体轴样式和大小?

转载 作者:行者123 更新时间:2023-11-30 14:19:00 24 4
gpt4 key购买 nike

有谁知道我需要更改哪些属性来减小轴号的字体大小并更改字体样式?还需要知道如何添加 x 和 y 标签。

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

最佳答案

看看 LabelStyle类(class)。

Axis.LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) }

例如,要使用此 LabelStyle 添加 X 轴,您可以执行以下操作:

Chart.ChartAreas["MyChart"].AxisX = new Axis { LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) } }

设置标签自动调整样式以防止标签缩放也可能有用:

Chart.ChartAreas.["MyChart"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;

关于c# - 在 asp.net 图表中调整字体轴样式和大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3553139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com