Javascript 向使用web UI数据可视化图表创建的饼图添加链接
我已经建立了一个pic图表,它的工作,现在我需要添加链接到饼图部分,我不能让它工作 在我看来,我有Javascript 向使用web UI数据可视化图表创建的饼图添加链接,javascript,c#,html,asp.net-mvc,Javascript,C#,Html,Asp.net Mvc,我已经建立了一个pic图表,它的工作,现在我需要添加链接到饼图部分,我不能让它工作 在我看来,我有 <div class="row"> @*<img src="@Url.Action("LastYear")" alt="LastYear" />*@ <img src="@Url.Action("CurrentYear")" alt="Cu
<div class="row">
@*<img src="@Url.Action("LastYear")" alt="LastYear" />*@
<img src="@Url.Action("CurrentYear")" alt="CurrentYear" />
我做错了什么?将显示饼图,但单击饼图的部分不会导致url被触发。我将第二个设置为google,只是想看看是否是我的控件,但它也没有发生任何变化
我是否错过了其他需要做的事情
谢谢您使用哪个工具/插件生成数据可视化?谷歌图表?
public ActionResult CurrentYear()
{
var hl = new HomeLogic();
decimal approved = hl.GetAppCount("A");
decimal rejected = hl.GetAppCount("R");
decimal ops = hl.GetAppCount("O");
decimal srd = hl.GetAppCount("S");
var xLbl = new string[] { "Approved", "Rejected", "Ops", "SRD" };
var yData = new decimal[] { approved, rejected, ops, srd };
var chart = new Chart();
chart.ChartAreas.Add(new ChartArea());
chart.BackColor = Color.Transparent;
chart.Width = Unit.Pixel(550);
chart.Height = Unit.Pixel(550);
// add a Series to the chart
chart.Series.Add(new Series("0"));
chart.Series["0"].ChartType = SeriesChartType.Pie;
// set pie lables to be outside of the pie chart
chart.Series[0]["PieLabelStyle"] = "Outside";
// set border width so that labels are shown on the outside
chart.Series[0].BorderWidth = 1;
chart.Series[0].BorderColor = Color.FromArgb(26, 59, 105);
// add a legend to the chart and dock it to the bottom-center
chart.Legends.Add("Legend1");
chart.Legends[0].Enabled = true;
chart.Legends[0].Docking = Docking.Bottom;
chart.Legends[0].Alignment = StringAlignment.Center;
// set the legend to display pic chart values as percentages
// again, the p2 inicates a precision of 2 decimals
chart.Series[0].LegendText = "#PERCENT{P2}";
// load data into the chart
chart.Series[0].Points.DataBindXY(xLbl, yData);
// set each pie sections color
chart.Series[0].Points[0].Color = Color.FromArgb(0, 255, 0);
chart.Series[0].Points[1].Color = Color.FromArgb(255, 0, 0);
chart.Series[0].Points[2].Color = Color.FromArgb(0, 0, 255);
chart.Series[0].Points[3].Color = Color.FromArgb(255, 165, 0);
// set each pie sections url
chart.Series[0].Points[0].Url = "/Home/CyrAppExcel";
chart.Series[0].Points[1].Url = "https://google.com";
chart.Series[0].Points[2].Url = "/Home/CyrOpsExcel";
chart.Series[0].Points[3].Url = "/Home/CyrSrdExcel";
MemoryStream ms = new MemoryStream();
chart.SaveImage(ms, ChartImageFormat.Png);
return File(ms.ToArray(), "image/png");
}