简体   繁体   English

ASP.net图表控件

[英]ASP.net Charting control

I want to create a radar chart to display in my asp.net website. 我想创建一个雷达图以显示在我的asp.net网站上。 To do this I am user the ASP.net charting controls 4.0 : c# 为此,我使用的是ASP.net图表控件4.0c#

I can create radar chart with out issue however my problem occurs when I wish to make the X-Axis labels into a hyper link. 我可以毫无问题地创建雷达图,但是当我希望使X-Axis标签成为超链接时,就会出现我的问题。

To make it easier for myself I created a little test. 为了使自己更轻松,我创建了一个小测试。 Really simple data with a bar chart. 带有条形图的非常简单的数据。 I had to create a custom labels to the X-Axis clickable. 我必须为X-Axis可点击项创建自定义标签。 Worked just as I expected. 按照我的预期工作。 However when I change the chart type ChartType = SeriesChartType.Radar; 但是,当我更改图表类型时, ChartType = SeriesChartType.Radar; the X-Axis labels stop being links. X-Axis标签不再是链接。

Here is the simple test code I am using: 这是我正在使用的简单测试代码:

ChartArea ca = new ChartArea();

List<string> f = new List<string>();
f.Add("Label 1");
f.Add("Label 2");
f.Add("Label 3");
f.Add("Label 4");

Series s = new Series();
s.ChartType = SeriesChartType.Radar;
s.Points.Add(new DataPoint(1, 20));
s.Points.Add(new DataPoint(2, 30));
s.Points.Add(new DataPoint(3, 40));
s.Points.Add(new DataPoint(4, 50));
Chart2.Series.Add(s);

for (int i = 1; i < s.Points.Count; i++)
{
    CustomLabel cl = new CustomLabel();
    cl.FromPosition = i-0.5;
    cl.ToPosition = i + 0.5;
    cl.Text = f[i];
    cl.Url = "someRandompage.aspx";
    ca.AxisX.CustomLabels.Add(cl);
}
Chart2.ChartAreas.Add(ca);

Any ideas on how to get this going? 有关如何进行此操作的任何想法?

Many Thanks 非常感谢

You should be able to solve it by checking out RadarChart examples on following links. 您应该可以通过以下链接中的RadarChart示例解决问题。

Example found right here! 在这里找到示例!

Source code right here! 源代码就在这里!

在此处此处检查图表的MapAreAttribute。

In the end I decided not to use asp.net charts. 最后,我决定不使用asp.net图表。 They just are not that great. 他们只是不是那么伟大。 Ended up using highcharts. 最终使用highcharts。 They are a javascript charting tool that were able to do everything I wanted. 它们是一个javascript图表工具,能够完成我想要的一切。 They are supported across all the major browsers and they look nice. 所有主流浏览器均支持它们,而且外观也不错。 The asp.net charts control on the other hand are not very nice and slow to render. 另一方面,asp.net图表控件不是很好,渲染起来很慢。

There are a few other javascript charting tools available which seem nice. 还有其他一些看起来不错的javascript图表工具。 If at all possible I would recommend going with the javascript stuff. 如果可能的话,我建议您使用JavaScript。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM