我在ASP.NET C#中有一个数据绑定图表 . 其中一个数据绑定字段是文本,另一个是值 . 我希望图例显示饼图的文本,我希望该值确定图表的形成方式,并在饼图的每一部分上显示为标签 .
这是我到目前为止的代码:
<asp:Chart ID="consignedChart" runat="server" DataSourceID="SqlDataSource4"
BackColor="LightSlateGray" Palette="None"
PaletteCustomColors="LightSeaGreen; SteelBlue" Width="400px" >
<Series>
<asp:Series Name="Series1" ChartType="Pie" XValueMember="Owner"
YValueMembers="TotalValue" Legend="Legend1" >
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true" BackColor="LightSlateGray">
<Area3DStyle Enable3D="True" LightStyle="Realistic"/>
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="Legend1">
</asp:Legend>
</Legends>
</asp:Chart>
EDIT
这是一个图像,它可能使它更容易理解 . 红色框中的标签是我想要更改以显示值编号的标签 .
1 回答
我知道这个答案可能有点太晚了,请不要炒我:)
我不确定你如何绑定你的数据,但我下载并安装了Microsoft Forms for Windows Forms Samples Environment,我可以从中学到很多东西 .
这是一个链接,您可以从MSDN archives获取asp.net样本 .
我也在使用ILSpy来查看System.Windows.Forms.DataVisualization.Charting命名空间中的代码 . 通过这种方式,您可以找到大量未记录的内容 .
最后,这里有一些winform代码示例,您可以从中为您的问题得出一些想法,然后将其写入asp.net标记:
希望有所帮助 .