在 ASP.NET 中创建 XY 散点图
我有两个数据数组,想以 XY 散点图显示。我已经下载了 ASP.NET 库,并且想知道如何显示数据。这是我在前端得到的信息,想知道是否有人对下一步的建议有什么建议(即如何将数组数据绑定到 x 和 y 轴?)
谢谢
<asp:Chart runat="server" ID="scatter" Width="500px" Height="500px">
<Series>
<asp:Series Name="Series1" MarkerSize="10" ChartType="Point">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom">
<Area3DStyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False"
WallWidth="0" IsClustered="False" />
<AxisY LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
你也知道如何当用户将鼠标悬停在数据点上时允许数据点显示其值?
I have two arrays of data that I would like to display in an XY scatter. I've downloaded the ASP.NET libraries and am wondering how to display the data. This is as far as I've gotten on the front end and was wondering if anyone has suggestions on what the next steps would be (i.e. how do I bind the array data to the x and y axes?)
thanks
<asp:Chart runat="server" ID="scatter" Width="500px" Height="500px">
<Series>
<asp:Series Name="Series1" MarkerSize="10" ChartType="Point">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
BackSecondaryColor="White" BackColor="Gainsboro" ShadowColor="Transparent" BackGradientStyle="TopBottom">
<Area3DStyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False"
WallWidth="0" IsClustered="False" />
<AxisY LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisY>
<AxisX LineColor="64, 64, 64, 64">
<LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</AxisX>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>
Also do you know how to allow the datapoints to show their values when the user hovers over them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个数组包含 X 值,另一个数组包含 Y 值,还是两者都包含 Y 值?
如果是前者,您可以使用 DataBindXY 方法。
如果是后者,您可以创建第二个系列(只需复制标记为 Series1 的部分并将其命名为 Series2),然后在每个系列上使用 DataBindY。
这是一个很好的资源,通过示例解释了许多不同的数据绑定方法:http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
Does one array contain X values and the other Y, or do both contain Y values?
If the former, you could use the DataBindXY method.
If the latter, you could create a second series (just duplicate the part you have labeled as Series1 and call it Series2) and then use the DataBindY on each.
This is a great resource explaining many different ways to databind all with examples: http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx
我在使用 MS Chart 绘制图表方面从未取得过太大成功。非常适合图表!对于图表来说不太好。
您可以考虑查看 ZedGraph:
http://zedgraph.sourceforge.net/linesamples.html
I never had much success using MS Chart for graphs. Great for charts! Less great for graphs.
You might consider looking at ZedGraph:
http://zedgraph.sourceforge.net/linesamples.html