none
关于在微软图表控件上标示数据的问题 RRS feed

  • 问题

  • 我用以下代码可以标识,但是如果改变图表的类型或者启用3D模式时,就不能显示标识的数据了;chart的数据源采用sql datasource;请问是怎么回事  

     protected void Chart1_PostPaint(object sender, ChartPaintEventArgs e)
            {
                //标识数据           
                if (this.CheckBox2.Checked)
                {
                    this.Chart1.Series["IpCount"].MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.None;
                    int Interval = int.Parse(this.DropDownList1.SelectedValue);
                    //Response.Write(this.Chart1.Series["IpCount"].Points.Count.ToString());
                    for (int i = 0; i < this.Chart1.Series["IpCount"].Points.Count; i++)
                    {
                        if (i % Interval == 0)
                        {
                            this.Chart1.Series["IpCount"].Points[i].IsValueShownAsLabel = true;
                            this.Chart1.Series["IpCount"].Points[i].MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.Circle;

                        }
                    }

                }
            }

    2011年4月4日 9:35

答案