How do you adjust the formatting of the asp.net point chart? I'd like to dynamically set maximum and minimums based on data in a List<>. I'd also like to figure out the properties that allows me to tweak the intervals within each of the axes and also formatting the labels so that I can change decimals to percentages.
A:
I think I found the answer to the setting maximum and minimum on the axes. See below:
<asp:Chart runat="server" ID="Chart1" Width="500px" Height="500px">
<Series>
<asp:Series Name="Series1" MarkerSize="10" ChartType="Point">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="Gainsboro" 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, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
//define chart UI double minimum = -0.08; double maximum = 0.08; double interval = maximum/2;
Chart1.ChartAreas["ChartArea1"].AxisY.Minimum = minimum;
Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = minimum;
Chart1.ChartAreas["ChartArea1"].AxisY.Maximum = maximum;
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = maximum;
Chart1.ChartAreas["ChartArea1"].AxisX.Interval = interval;
Chart1.ChartAreas["ChartArea1"].AxisY.Interval = interval;
However, is there a way to change the label formatting to percentages instead of decimals?
cfarm54
2010-08-23 06:10:29