chart控件 饼图 在点击某一块的时候它会分离出来 离开的时候又会收回去
------解决方案--------------------------------------------------------
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 = "#INDEX";
}
}
2.在Chart1_Click事件中获得点击的索引值:
protected void Chart1_Click(object sender, ImageMapEventArgs e)
{
ViewState["no"] = e.PostBackValue.ToString();
}
3.在Chart1_PreRender事件中设置分离
protected void Chart1_PreRender(object sender, EventArgs e)
{
Chart1.Series["Series1"].Points[Convert.ToInt16(ViewState["no"])].CustomProperties += "Exploded=true";
}