当我想用系列绑定动态数据时,出现错误,你不能用系列绑定数据....我怎么做???
`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>
答案 0 :(得分: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>