0

你如何调整asp.net点图的格式?我想根据 List<> 中的数据动态设置最大值和最小值。我还想弄清楚允许我调整每个轴内的间隔并格式化标签的属性,以便我可以将小数更改为百分比。

4

1 回答 1

0

我想我找到了在轴上设置最大值和最小值的答案。见下文:

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

//定义图表 UI 双最小值 = -0.08; 双倍最大值 = 0.08;双间隔 = 最大值/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;

但是,有没有办法将标签格式更改为百分比而不是小数?

于 2010-08-23T06:10:29.690 回答