0

当我想将动态数据与系列绑定时,发生错误,您无法将数据与系列绑定......我怎么做???

`enter code here`
 <asp:Chart ID="Chart4" runat="server">
    <Series>
        <asp:Series Name="Series1" Label='<%# Eval("coulmname") %>'>
        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1">
        </asp:ChartArea>
    </ChartAreas>
</asp:Chart>
4

1 回答 1

0

您可以将图表绑定到 DataTable:

chart1.DataSource = dataTable1;
chart1.DataBind();

然后在您的标记中使用 YValueMembers 和 XValueMember 属性指定您的数据成员:

<asp:Chart ID="chart1" runat="server">
  <Series>
    <asp:Series Name="series1" YValueMembers="coulmname1" XValueMember="coulmname2" IsValueShownAsLabel="true" ></asp:Series>
  </Series>
  <ChartAreas>
    <asp:ChartArea Name="ChartArea1"></asp:ChartArea>
  </ChartAreas>
</asp:Chart>
于 2012-10-02T15:09:48.320 回答