ASP.net C# ,用VS2010自带chart控件pie型,已根据数据库形成饼图。
现在想实现的是,点击饼图中某个扇形(或对应的标签),可以根据此扇形的x值形成QueryString并打开一个新窗口。这个能否实现?谢谢~
------解决方案--------------------------------------------------------
se_series.Points.Add(new DataPoint(0, (double)x.Value) { Label = x.Value.ToString(), LegendText = se[x.Key - 1].ChinaName, ToolTip = se[x.Key - 1].ChinaName, Url=se[x.Key - 1].FullUrl });
------解决方案--------------------------------------------------------
- C# code
//1.在Page_Load中添加Chart1的Click事件,索引每个点: protected void Page_Load(object sender, EventArgs e) { this.Chart1.Click += new ImageMapEventHandler(Chart1_Click); foreach (Series series in this.Chart1.Series) { series.PostBackValue = series.Name + ",#INDEX"; } }//2.在Chart1的Click事件下获得点击了第几个点!(加一个Label来显示演示) protected void Chart1_Click(object sender, ImageMapEventArgs e) { string[] input = e.PostBackValue.Split(','); Label1.Text = "你选中了" + input[0] + "的第 " + (Convert.ToInt16(input[1]) + 1).ToString() + " 点"; }