简体   繁体   中英

ASP.net Charting control

I want to create a radar chart to display in my asp.net website. To do this I am user the ASP.net charting controls 4.0 : c#

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.

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. Worked just as I expected. However when I change the chart type ChartType = SeriesChartType.Radar; the X-Axis labels stop being links.

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.

Example found right here!

Source code right here!

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

In the end I decided not to use asp.net charts. They just are not that great. Ended up using highcharts. They are a javascript charting tool that were able to do everything I wanted. 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.

There are a few other javascript charting tools available which seem nice. If at all possible I would recommend going with the javascript stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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