4

更改 asp 图表图例标签宽度

象素

<asp:Chart ID="Chart1" runat="server" Width="600px">
    <Series>
        <asp:Series Name="Series1" ChartType="Pie" IsValueShownAsLabel="True" Legend="Legend1">
        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1" AlignmentOrientation="All">
            <AxisX TitleAlignment="Near">
            </AxisX>
        </asp:ChartArea>
    </ChartAreas>
    <Legends>
        <asp:Legend  Name="Legend1" >
        </asp:Legend>
    </Legends>
</asp:Chart>

背后的代码

Chart1.Titles.Add(new Title("Completed/Pending Count Anaysis",Docking.Top,new Font("Verdana", 12f, FontStyle.Bold),Color.Black));
Chart1.Series[0].XValueMember = "COLUMN_NAME";
Chart1.Series[0].YValueMembers = "H_COUNT";
Chart1.Series[0].ChartType = SeriesChartType.Pie;
Chart1.Series[0].IsValueShownAsLabel = false;

Chart1.Series[0].Label = "#PERCENT";
Chart1.Series[0].LabelFormat = "{0:0%}";
Chart1.Series[0].LegendText = "#VALX #PERCENT{P2}";

Chart1.Series["Series1"]["PieLabelStyle"] = "outside";
Chart1.Series[0]["PieStartAngle"] = "45";
Chart1.Series[0].LabelForeColor = Color.Black;

Chart1.Legends["Legend1"].Docking = Docking.Bottom;
Chart1.Legends["Legend1"].IsDockedInsideChartArea = false;

Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
Chart1.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 30;
Chart1.DataSource = ds;

有人知道如何解决这个问题吗?

4

0 回答 0