ajustar el estilo de fuente y tamaño de ejes en la tabla asp.net?
-
30-09-2019 - |
Pregunta
¿Alguien sabe las propiedades que tengo que cambiar para disminuir el tamaño de fuente de los números de ejes y cambiar el estilo de fuente? También es necesario saber cómo añadir etiquetas xy 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>
Solución
Tome un vistazo a la href="http://msdn.microsoft.com/en-us/library/system.windows.forms.datavisualization.charting.labelstyle.aspx"> LabelStyle clase
Por ejemplo, para añadir un eje X con este LabelStyle que puede hacer: Y la creación de estilo de auto ajuste etiqueta para evitar que se escale la etiqueta pueden ser útiles también: Axis.LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) }
Chart.ChartAreas["MyChart"].AxisX = new Axis { LabelStyle = new LabelStyle() { Font = new Font("Verdana", 7.5f) } }
Chart.ChartAreas.["MyChart"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None;