Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#asp.net图表控件,获取数据点的饼图切片颜色_C#_Asp.net_Asp.net Charts - Fatal编程技术网

C#asp.net图表控件,获取数据点的饼图切片颜色

C#asp.net图表控件,获取数据点的饼图切片颜色,c#,asp.net,asp.net-charts,C#,Asp.net,Asp.net Charts,我有一个控件,带有一个饼系列。是否有方法检索序列的数据绑定事件中每个数据点的饼图切片颜色?如有任何建议,我们将不胜感激 <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px" BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"

我有一个控件,带有一个饼系列。是否有方法检索序列的数据绑定事件中每个数据点的饼图切片颜色?如有任何建议,我们将不胜感激

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
我之所以需要它,是因为我需要为每个数据点显示大量其他数据。我不想把它放在图例中,因为它占用了太多的空间,将来可能会显示很多其他数据

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>

开发商
TR关闭了
%
%
总数:
代码隐藏文件是:

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
public partial class ER_RecentTRsClosedPieChart : System.Web.UI.Page
{
    public DataAccessLayer DAL;
    public DataSet srv_TRsClosedByDevDS;

    public string srv_sToday;
    public int srv_nNumDays = 0;
    public int srv_nTotalTRsClosed = 0;

    private int index = 0;

    protected void Page_Load(object sender, EventArgs e)
    {
        DAL = new DataAccessLayer();
        srv_TRsClosedByDevDS = new DataSet();

        srv_sToday = "09/14/2012";//DateTime.Now.ToString("MM/dd/yyyy");

        if (!int.TryParse(Request.QueryString["NumDays"], out srv_nNumDays))
            srv_nNumDays = 7;

        srv_TRsClosedByDevDS = DAL.CRM_RequestMQEx(srv_nNumDays, 0, 0, 0, 0, srv_sToday, "", "", "", "", 13);

        srv_nTotalTRsClosed = SumColumn(srv_TRsClosedByDevDS.Tables[0], "TRsClosed");

        TRsClosedByDevelopers.Titles[0].Text += srv_nNumDays.ToString() + " Days    (TOTAL: " + srv_nTotalTRsClosed.ToString() + ")";

        TRsClosedByDevelopers.Series["Testing1"].Points.DataBind(srv_TRsClosedByDevDS.Tables[0].AsEnumerable(), "Developer", "TRsClosed", string.Empty);

        srv_TRsClosedByDevDS.Tables[0].Columns.Add("PieColor");

        TRsClosedTbl.DataSource = srv_TRsClosedByDevDS.Tables[0];
        TRsClosedTbl.DataBind();
    }

    public int SumColumn(DataTable dt, string columnName)
    {
        return (from c in dt.AsEnumerable()
                where !c.IsNull(columnName)
                select c.Field<int>(columnName)
                ).Sum();
    }

    protected void TRsClosedTbl_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {

    }

    protected void TRsClosedByDevelopers_DataBound(object sender, EventArgs e)
    {
        string r;
        string g;
        string b;

        for (int i = 0; i < TRsClosedByDevelopers.Series["Testing1"].Points.Count; i++)
        {
            string dev = TRsClosedByDevelopers.Series["Testing1"].Points[i].Color.ToString();

            //Here, I Want to add the rendered Pie Slice color to the DataColumn "PieColor" of each row.

            //r = TRsClosedByDevelopers.Series["Testing1"].Points[i].MarkerColor.R.ToString();
            //g = TRsClosedByDevelopers.Series["Testing1"].Points[i].MarkerColor.G.ToString();
            //b = TRsClosedByDevelopers.Series["Testing1"].Points[i].MarkerColor.B.ToString();
        }
    }
}
public分部类ER\u recenttrsclosedpieckhart:System.Web.UI.Page
{
公共数据访问层;
公共数据集srv_TRsClosedByDevDS;
公共字符串srv_sToday;
公共整数srv_nNumDays=0;
公共int srv_nTotalTRsClosed=0;
私有整数指数=0;
受保护的无效页面加载(对象发送方、事件参数e)
{
DAL=新的DataAccessLayer();
srv_TRsClosedByDevDS=新数据集();
srv_sToday=“09/14/2012”//DateTime.Now.ToString(“MM/dd/yyyy”);
如果(!int.TryParse(Request.QueryString[“NumDays”],out srv\u nNumDays))
srv_nNumDays=7;
srv_TRsClosedByDevDS=DAL.CRM_RequestMQEx(srv_nNumDays,0,0,0,srv_sToday,,,,,,,,13);
srv_nTotalTRsClosed=SumColumn(srv_TRsClosedByDevDS.Tables[0],“TRsClosed”);
TRsClosedByDevelopers.Titles[0]。Text+=srv_nNumDays.ToString()+“天(总计:“+srv_nTotalTRsClosed.ToString()+”);
TRsClosedByDevelopers.Series[“Testing1”].Points.DataBind(srv_TRsClosedByDevDS.Tables[0].AsEnumerable(),“Developer”,“TRsClosed”,string.Empty);
srv_TRsClosedByDevDS.Tables[0]。Columns.Add(“PieColor”);
TRsClosedTbl.DataSource=srv_TRsClosedByDevDS.Tables[0];
TRsClosedTbl.DataBind();
}
public int SumColumn(DataTable dt,string columnName)
{
返回值(从dt.AsEnumerable()中的c)
其中!c.IsNull(columnName)
选择c.字段(columnName)
).Sum();
}
受保护的void TRsClosedTbl_ItemDataBound(对象发送方,RepeaterItemEventArgs e)
{
}
受保护的void TRsClosedByDevelopers_数据绑定(对象发送方,事件参数e)
{
字符串r;
字符串g;
b串;
对于(int i=0;i
您是否尝试为图表设置自定义调色板

                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
chart.Palette = ChartColorPalette.None;
Colors[] myColors = {Color.Red, Color.Green, Color.Blue, ...};
chart.PaletteCustomColors = myColors;

现在,您可以在将来的操作中使用颜色数组。第一张图片的颜色是myColors[0]等。

谢谢你的回复,刚刚编辑了这篇文章。我想知道,是否有可能访问饼片的渲染颜色..嗨,安迪,我想我没有明确说明我的要求。我需要在单独的表格视图中显示数据点,在图表之外(而不是图例)。获取每个数据点的颜色会有很大帮助。但是如果您设置自己的颜色并保存该数组,您就知道每个切片的颜色。编辑了我的答案。安迪,切片的数量是未知的。此外,我将低于Y值1%的切片归为“其他”。(请检查附件中的预览)刚刚添加了两张图片。对于图表,您可以使用粉彩调色板。该调色板的颜色(按正确顺序和对应顺序):87CEEB、32CD32、BA55D3、F080804682B4、9ACD3、40E0D0、FF69B4、F0E68C、D2B48C、8FBC8B、6495ED、DDA0DD、5F9EA0、FFDAB9、FFA07A
                <asp:Chart ID="TRsClosedByDevelopers" runat="server" Height="892px"
                    BorderlineDashStyle="Solid" BorderlineWidth="2" BorderSkin-SkinStyle="Emboss"
                    BorderlineColor="BlueViolet" Width="980px" Palette="Pastel"
                    style="margin-left:-8px; margin-top:-8px;" EnableViewState="True" 
                    SuppressExceptions="True" ondatabound="TRsClosedByDevelopers_DataBound">

                    <Titles>

                        <asp:Title BackColor="LightSteelBlue" BackGradientStyle="VerticalCenter" 
                            BorderColor="SteelBlue" BorderWidth="0" 
                            Font="Microsoft Sans Serif, 15.75pt, style=Bold" ForeColor="DarkSlateGray" 
                            IsDockedInsideChartArea="False" Name="PieChartTitle" 
                            Text="TR's Closed in the past ">
                        </asp:Title>

                    </Titles>

                    <Series>
                        <asp:Series Name="Testing1"
                            Font="Microsoft Sans Serif, 9.75pt, style=Bold" BorderColor="0, 0, 192" 
                            ChartType="Pie" LabelForeColor="DarkSlateGray" 
                            CustomProperties="MinimumRelativePieSize=50, CollectedSliceExploded=True, CollectedLegendText=OTHER, CollectedColor=ActiveBorder, CollectedLabel=OTHER   (#VALY)  (#PERCENT{P2}), PieLabelStyle=Outside, CollectedThreshold=1" 
                            YValueType="Int32" Label="#VALX"
                            XValueType="String">

                            <SmartLabelStyle CalloutLineAnchorCapStyle="Diamond" 
                                AllowOutsidePlotArea="Yes" />

                            <EmptyPointStyle IsValueShownAsLabel="false" IsVisibleInLegend="false" 
                                BorderWidth="0" CustomProperties="PieLabelStyle=Disabled" MarkerBorderWidth="0" 
                                MarkerSize="0" />

                        </asp:Series>
                    </Series>

                    <ChartAreas>
                        <asp:ChartArea Name="ChartArea2">
                            <Area3DStyle Enable3D="true" Inclination="0" />
                        </asp:ChartArea>
                    </ChartAreas>

                    <BorderSkin SkinStyle="Emboss" />

                </asp:Chart>
            </td>
            <td>
                <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;">
                    <tr style="background-color:#cccccc; font-size:large;">
                        <th style="width:30px;">
                            &nbsp;
                        </th>
                        <th align="left" style="width:260px;">
                            Developer
                        </th>
                        <th>
                            TR's Closed
                        </th>
                    </tr>
                </table>

                <asp:Repeater ID="TRsClosedTbl" runat="server" OnItemDataBound="TRsClosedTbl_ItemDataBound">                                                
                    <HeaderTemplate>
                        <table cellspacing="2" cellpadding="2" style="width:100%; margin-left:-2px;" id="SummaryTbl">
                    </HeaderTemplate>

                    <ItemTemplate>
                        <tr style="background-color:#eeeeee; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </ItemTemplate>

                    <AlternatingItemTemplate>
                        <tr style="background-color:#eeeeff; height:24px; font-size:large;" class="normalCell">
                            <td style="width:30px;" runat="server" id="ColorCell">&nbsp;</td>
                            <td style="width:260px;"><%#((DataRowView)Container.DataItem)["Developer"]%></td>
                            <td align="right" style="width:50px"><%#((DataRowView)Container.DataItem)["TRsClosed"]%></td>
                            <td align="right"><%#String.Format("{0:N2}", Math.Round(Convert.ToDouble(((DataRowView)Container.DataItem)["TRsClosed"])/Convert.ToDouble(srv_nTotalTRsClosed) * 100, 2))%> %</td>
                        </tr>
                    </AlternatingItemTemplate>

                    <FooterTemplate>                                                        
                            <tr style="background-color:#EEFFCC; height:24px; font-size:large;" class="normalCell">
                                <td align="right" colspan="2">TOTAL:</td>
                                <td align="right"><%=srv_nTotalTRsClosed%></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </FooterTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>