清除然后重新添加系列会导致程序崩溃

清除然后重新添加系列会导致程序崩溃

本文介绍了图表-清除然后重新添加系列会导致程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我是图表的新手,并且是第一次尝试.

我正在尝试在同一张图表中实施多个系列.我有两个列表框,它们跟踪顺序以及显示的顺序(显示的列表框和隐藏的列表框).我将系列列表作为会话变量存储为List< series>.在为图表绘制图表时,我会在列表框中循环浏览,找到显示的列表框中的系列名称,然后将它们添加到图表中.

这一切都很好.我什至可以删除一个系列(也可以通过将其移动到隐藏"列表框来隐藏它).我已经尝试了chart.Series.Clear()//通过调试显示清除了图表系列,以及遍历所有图表系列和series.remove(chart.Series.FindByName(item.Value)),可以找到序列并将其删除.

但是,当我尝试重新添加之前已经存在的系列时,它崩溃了.还有什么我要清除的吗?我唯一能添加之前添加的内容的时间是当我清除包含所有系列的会话列表时.

我猜想这与系列名称相同有关,但是我觉得这没关系,因为我清除了图表系列.另一个问题可能是我将系列存储为sessionstateVar.它可以正常工作,但我认为由于某些原因,这可能是我无法将一系列重新添加到相同名称的原因.
任何帮助都是非常需要和赞赏的.

这是崩溃

Hey, I''m kind of new to charts and am trying this for the first time.

I am trying to implement multiple series within the same chart. I have two listboxes that keeps track of the order as well as which ones are shown (a shown listbox and a hidden listbox). I am storing the list of series as a session variable as List<series>. When I graph the chart I cycle through the listbox and find the name of the series that are in the shown listbox, then add them to the chart.

This all works fine. I can even remove a series (aka hide it by moving it to the hide listbox). I have tried both chart.Series.Clear() //which through debugging shows the charts series being cleared, as well as foreaching through all the charts series and series.remove(chart.Series.FindByName(item.Value)) which also works in finding the series and removing it.

BUT when I try to re-add a series that already existed before, it crashes. Is there something else I have to clear? The only time I am able to add something I added before is when I clear the session list that has all the series.

I''m guessing it has something to do with the name of the series being the same, but I feel like that shouldn''t matter since I clear the charts series. The other problem might have to be with me storing the series as a sessionstateVar. It works fine but I think for some reason it may be the reason why I can''t re-add a series to the same name.

Any help would be greatly needed and appreciated.

Here is the crash

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   System.Web.UI.DataVisualization.Charting.Series.ResetAutoValues(Boolean reset) +446
   System.Web.UI.DataVisualization.Charting.Series.ResetAutoValues() +34
   System.Web.UI.DataVisualization.Charting.Chart.ResetAutoValues() +128
   System.Web.UI.DataVisualization.Charting.ChartSerializer.Save(TextWriter writer) +162
   System.Web.UI.DataVisualization.Charting.Chart.SaveViewState() +345
   System.Web.UI.Control.SaveViewStateRecursive() +187
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Control.SaveViewStateRecursive() +106
   System.Web.UI.Page.SaveAllState() +168
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099

推荐答案


public void SelectIncomeVSExpense(DataTable dtGetInfo)
    {
        divErrIncomevsExpense.Visible = false;
        divErrIncomevsExpense.InnerHtml = "";
        divIncomeVsExpense.Visible = true;
        //Used For the Legend (Start here)
        chartIncomeVsExpense.Legends["Default"].Docking = Docking.Bottom;
        chartIncomeVsExpense.Legends["Default"].Alignment = System.Drawing.StringAlignment.Center;
        chartIncomeVsExpense.Legends["Default"].LegendStyle = LegendStyle.Table;
        chartIncomeVsExpense.Legends["Default"].TableStyle = LegendTableStyle.Wide;
        chartIncomeVsExpense.Legends["Default"].Font = new Font("Verdana", 8, FontStyle.Regular);
        chartIncomeVsExpense.Legends["Default"].ForeColor = Color.Black;
        //Used For the Legend (End here)
        string seriesname = string.Empty;
        string SERIESEXPENSE = string.Empty;
        string SeriesRefund = string.Empty;

        seriesname = "Income";
        SERIESEXPENSE = "Expenses";
        SeriesRefund = "Refund";

        string strCurrencyType = dtGetInfo.Rows[0]["Currency"].ToString();
        //if there are more than one lgends like in BP we have to create two Series
        // Series is the collection of data that we have to show on chart
        chartIncomeVsExpense.Series.Add(seriesname);
        chartIncomeVsExpense.Series[seriesname].ChartType = SeriesChartType.Column;//(SeriesChartType)Enum.Parse(typeof(SeriesChartType), ddlChartType.SelectedItem.Text, true);
        chartIncomeVsExpense.Series[seriesname]["PointWidth"] = "0.4";
        chartIncomeVsExpense.Series[seriesname].Name = seriesname;
        chartIncomeVsExpense.Series[seriesname].IsValueShownAsLabel = true;
        chartIncomeVsExpense.Series[seriesname].Label = "" + strCurrencyType + "#VAL ";

        chartIncomeVsExpense.Series.Add(SERIESEXPENSE);
        chartIncomeVsExpense.Series[SERIESEXPENSE].ChartType = SeriesChartType.Column;//(SeriesChartType)Enum.Parse(typeof(SeriesChartType), ddlChartType.SelectedItem.Text, true);
        chartIncomeVsExpense.Series[SERIESEXPENSE]["PointWidth"] = "0.4";
        chartIncomeVsExpense.Series[SERIESEXPENSE].Name = SERIESEXPENSE;
        chartIncomeVsExpense.Series[SERIESEXPENSE].IsValueShownAsLabel = true;
        chartIncomeVsExpense.Series[SERIESEXPENSE].Label = "" + strCurrencyType + "#VAL ";

        chartIncomeVsExpense.Series.Add(SeriesRefund);
        chartIncomeVsExpense.Series[SeriesRefund].ChartType = SeriesChartType.Column;//(SeriesChartType)Enum.Parse(typeof(SeriesChartType), ddlChartType.SelectedItem.Text, true);
        chartIncomeVsExpense.Series[SeriesRefund]["PointWidth"] = "0.4";
        chartIncomeVsExpense.Series[SeriesRefund].Name = SeriesRefund;
        chartIncomeVsExpense.Series[SeriesRefund].IsValueShownAsLabel = true;
        chartIncomeVsExpense.Series[SeriesRefund].Label = "" + strCurrencyType + "#VAL ";


        chartIncomeVsExpense.ChartAreas["ChartArea1"].Position.Auto = false;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].Position.X = 5;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].Position.Y = 15;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].Position.Width = 90;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].Position.Height = 60;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].AxisX.LabelStyle.IsStaggered = false;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = true;
        chartIncomeVsExpense.ChartAreas["ChartArea1"].AxisX.LabelStyle.Angle = 0;




        Title t = new Title("Income vs Expenses", Docking.Top, new System.Drawing.Font("Verdana", 14, System.Drawing.FontStyle.Regular), Color.FromArgb(28, 29, 29));
        chartIncomeVsExpense.Titles.Add(t);
        string strQuery = String.Empty;
        strQuery = "IsAllowedViewEarning=1 ";
        DataView dv5 = new DataView(dtGetInfo);
        dv5.RowFilter = strQuery;
        DataView dv6 = new DataView(dtGetInfo);
        chartIncomeVsExpense.Series[seriesname].Points.DataBindXY(dv5, "FullName", dv5, "TotalEarning");
        chartIncomeVsExpense.Series[SERIESEXPENSE].Points.DataBindXY(dv6, "FullName", dv6, "TotalExpenses");
        chartIncomeVsExpense.Series[SeriesRefund].Points.DataBindXY(dv6, "FullName", dv6, "Refund");

        chartIncomeVsExpense.Series[SERIESEXPENSE].Legend.Remove(0, chartIncomeVsExpense.Series[SERIESEXPENSE].Legend.Length - 1);
    }


/// <summary>
    /// Public ctrl graph class
    /// </summary>
    public partial class CtrlBarGraph : System.Web.UI.UserControl
    {
        private SessionStateVar<BusAdvertisingCollection> m_AdvertisingCollection;
        private SessionStateVar<BusRegionCollection> m_RegionCollection;
        private SessionStateVar<List<Series>> m_seriesCollection;
        /// <summary>
        /// CtrlBarGraph shows any type of bar graph
        /// </summary>
        public CtrlBarGraph()
        {
            m_AdvertisingCollection = new SessionStateVar<BusAdvertisingCollection>("advertisingCollection");
            m_RegionCollection = new SessionStateVar<BusRegionCollection>("regionCollection");
            m_seriesCollection = new SessionStateVar<List<Series>>("seriesCollection", new List<Series>());

        }
        protected void Page_Init(object sender, EventArgs e)
        {
            chrAdvertising.EnableViewState = true;
        }
        /// <summary>
        /// Page load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (chrAdvertising.Series.Count == 0)
            //    chrAdvertising.Visible = false;
            chrAdvertising.ViewStateContent = SerializationContents.Default;
            lblError.Visible = false;
            int i = 0;
            while (i < ddlColorPicker.Items.Count)

            {

                ddlColorPicker.Items[i].Attributes.Add("style", "background-color:" + ddlColorPicker.Items[i].Value);

                i++;

            }

        }        /// <summary>
        /// ibClicked happens when any image button is clicked.
        /// Moves the listitems in the list box either up or down,
        /// or moves them between shown and hidden
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ibClicked(object sender, EventArgs e)
        {
            ImageButton ibClicked = sender as ImageButton;
            string command = ibClicked.CommandArgument;
            if (command == "up")
                lbSeriesCurrent.Items.ShiftSelectedUp();
            else if (command == "down")
                lbSeriesCurrent.Items.ShiftSelectedDown();
            else if (command == "hide")
            {
                foreach (ListItem item in lbSeriesCurrent.Items.GetAllSelected())
                {
                    chrAdvertising.Series.Remove(chrAdvertising.Series.FindByName(item.Value));
                }
                lbSeriesCurrent.Items.MoveSelectedTo(lbSeriesNotShown.Items, true);
            }
            else if (command == "show")
                lbSeriesNotShown.Items.MoveSelectedTo(lbSeriesCurrent.Items, true);
            showGraph();
        }
        /// <summary>
        /// populates the advertising collection off the session variable
        /// </summary>
        protected void populate()
        {
            if (!m_AdvertisingCollection.IsSet())
            {
                m_AdvertisingCollection.Value = BusAdvertisingManager.GetALL("DateCreated");
            }
        }
        /// <summary>
        /// Populates the regions from the session variable
        /// </summary>
        protected void populateRegions()
        {
            if (!m_RegionCollection.IsSet())
            {
                m_RegionCollection.Value = BusRegionManager.GetRegionAll();
            }
        }
        /// <summary>
        /// Appends the current search to the list box
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAppend_Click(object sender, EventArgs e)
        {

            string legend = getLegendName();
            ListItem liAdded = new ListItem();
            liAdded.Text = legend;
            liAdded.Value = legend;
            foreach (ListItem item in lbSeriesCurrent.Items)
            {
                if (item.Text == liAdded.Text)
                {
                    lblError.Visible = true;
                    return;
                }
            }
            foreach (ListItem item in lbSeriesNotShown.Items)
            {
                if (item.Text == liAdded.Text)
                {
                    lblError.Visible = true;
                    return;
                }
            }

            populate();
            Series addSeries = new Series(legend);
            addSeries.ChartType = GetChartType();
            addSeries.BorderWidth = 3;
            addSeries.ShadowOffset = 2;

            DateTime startDtm = tbDateBegin.Text.ToDateTime(m_AdvertisingCollection.Value[0].DateCreated);
            DateTime EndDtm = tbDateEnd.Text.ToDateTime(m_AdvertisingCollection.Value.Last().DateCreated);
            List<DateTime> Periods = new List<DateTime>();
            List<List<double>> ListCollection = GetDateRange(startDtm, EndDtm, Periods);
            List<double> Pages = new List<double>();
            int count = 0;
            BusAdvertisingCollection AdCollection = m_AdvertisingCollection.Value;

            foreach (BusAdvertising item in AdCollection)
            {
                count = 0;
                double itemGraphed = 0;
                if (ddlSearchBy.SelectedItem.Value == "NumOfPieces")
                    itemGraphed = 1;
                else if (ddlSearchBy.SelectedItem.Value == "NumOfPages")
                    itemGraphed = item.NumberOfPages;
                else if (ddlSearchBy.SelectedItem.Value == "ComplexityScore")
                    itemGraphed = item.PageScoreID;
                else if (ddlSearchBy.SelectedItem.Value == "TurnaroundTime")
                    itemGraphed = 1;////////TEMP, not working yet////////////////////////<----------FIX

                if (!belongs(item, startDtm, EndDtm))

                    continue;

                if (count + 1 > Periods.Count())
                {
                    //count of 0, no items added within range
                }
                else if (count + 1 == Periods.Count())
                {
                    //All datapoints fall within one time period
                    ListCollection[count].Add(itemGraphed);
                }
                else
                {
                    //Item falls between two ranges of periods
                    while (count < Periods.Count && item.DateCreated >= Periods[count])
                    {
                        count++;
                    }
                    ListCollection[count - 1].Add(itemGraphed);
                }
            }
            count = 0;
            foreach (List<double> value in ListCollection)
            {
                string dateAxis = string.Empty;
                if (Periods.Count == 1)
                    dateAxis = startDtm.ToShortDateString() + " - " + EndDtm.AddDays(-1).ToShortDateString();
                else if ((count + 1 < Periods.Count))

                    dateAxis = Periods[count].ToShortDateString() + " - " + Periods[count + 1].AddDays(-1).ToShortDateString();

                else

                    dateAxis = Periods[count].ToShortDateString() + " - " + EndDtm.ToShortDateString();

                if (value.Count == 0)

                    addSeries.Points.AddXY(dateAxis, 0);

                else if (cbAvg.Checked)

                    addSeries.Points.AddXY(dateAxis, value.Average());

                else

                    addSeries.Points.AddXY(dateAxis, value.Sum());

                count++;

            }

            addSeries.Color = System.Drawing.Color.FromName(ddlColorPicker.SelectedValue);

            addSeries.LegendText = legend;

            addSeries.ToolTip = legend;

            lbSeriesCurrent.Items.Add(liAdded);



            if (!m_seriesCollection.IsSet())

                m_seriesCollection.Value = new List<Series>();

            m_seriesCollection.Value.Add(addSeries);
            showGraph();

        }
        /// <summary>
        /// belongs checks to see if the collection matches the dropdownlist selected,
        /// then checks to see if the date range is within the time frame.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="startDTM"></param>
        /// <param name="endDTM"></param>
        /// <returns></returns>
        private bool belongs(BusAdvertising item, DateTime startDTM, DateTime endDTM)
        {
            if (checkRB(item))
                if (checkTimeFrame(item, startDTM, endDTM))
                    return true;
            return false;
        }
        private bool checkRB(BusAdvertising item)
        {
            if (rbBranch.Checked)
            {
                if (item.Branch == ddlSearchText.SelectedItem.Value)
                    return true;
                return false;
            }
            else if (rbFANumber.Checked)
            {
                if (item.FANumber == ddlSearchText.SelectedItem.Value)
                    return true;
                return false;
            }
            else if (rbRegion.Checked)
            {
                if (item.RegionId.ToString() == ddlSearchText.SelectedItem.Value)
                    return true;
                return false;
            }
            return true;
        }
        private bool checkTimeFrame(BusAdvertising item, DateTime startDTM, DateTime endDTM)
        {
            if ((startDTM.AddDays(-1) < item.DateCreated)

                && (endDTM.AddDays(1) >= item.DateCreated))
                return true;
            return false;
        }
        private List<List<double>> GetDateRange(DateTime startDtm, DateTime EndDtm, List<DateTime> periods)
        {
            List<List<double>> range = new List<List<double>>();
            switch (ddlBreakdown.SelectedValue.ToInt(0))
            {
                case 0:////////////All//////////////////
                    periods.Add(startDtm);
                    range.Add(new List<double>());
                    break;
                case 1://////////Monthly////////////////
                    periods.Add(startDtm);
                    range.Add(new List<double>());
                    //Go to end of month
                    if (startDtm.Day == 1)
                        startDtm = startDtm.AddMonths(1);
                    while (startDtm.Day != 1)
                        startDtm = startDtm.AddDays(1);
                    while (startDtm < EndDtm)

                    {

                        periods.Add(startDtm);

                        range.Add(new List<double>());
                        startDtm = startDtm.AddMonths(1);
                    }
                    break;
                case 3://////////Quarterly//////////////
                    periods.Add(startDtm);
                    range.Add(new List<double>());
                    //Go to end of Quarter
                    if (startDtm.Day == 1 && ((startDtm.Month == 10) || (startDtm.Month == 1) || (startDtm.Month == 4) || (startDtm.Month == 7)))
                        startDtm = startDtm.AddMonths(3);
                    while (startDtm.Day != 1)
                        startDtm = startDtm.AddDays(1);
                    while (!((startDtm.Month == 10) || (startDtm.Month == 1) || (startDtm.Month == 4) || (startDtm.Month == 7)))
                        startDtm = startDtm.AddMonths(1);
                    while (startDtm < EndDtm)

                    {

                        periods.Add(startDtm);

                        range.Add(new List<double>());
                        startDtm = startDtm.AddMonths(3);
                    }
                    break;
                case 12://///Yearly (fiscal)////////////
                    periods.Add(startDtm);
                    range.Add(new List<double>());
                    if (startDtm.Day == 1 && startDtm.Month == 10)
                        startDtm = startDtm.AddYears(1);
                    while (startDtm.Day != 1)
                        startDtm = startDtm.AddDays(1);
                    while (!(startDtm.Month == 10))
                        startDtm = startDtm.AddMonths(1);
                    while (startDtm < EndDtm)

                    {

                        periods.Add(startDtm);

                        range.Add(new List<double>());
                        startDtm = startDtm.AddYears(1);
                    }
                    break;
                case 36:////Tri-Yearly (3 fiscal years)//
                    periods.Add(startDtm);
                    range.Add(new List<double>());
                    if (startDtm.Day == 1 && startDtm.Month == 10)
                        startDtm = startDtm.AddYears(3);
                    while (startDtm.Day != 1)
                        startDtm = startDtm.AddDays(1);
                    while (!(startDtm.Month == 10))
                        startDtm = startDtm.AddMonths(1);
                    while (startDtm < EndDtm)

                    {

                        periods.Add(startDtm);

                        range.Add(new List<double>());
                        startDtm = startDtm.AddYears(3);
                    }
                    break;

                default:
                    break;
            }
            return range;
        }
        private SeriesChartType GetChartType()
        {
            if (ddlChartType.SelectedValue == "Column")
                return SeriesChartType.Column;
            if (ddlChartType.SelectedValue == "Line")
                return SeriesChartType.Line;
            if (ddlChartType.SelectedValue == "Spline")
                return SeriesChartType.Spline;
            if (ddlChartType.SelectedValue == "StepLine")
                return SeriesChartType.StepLine;
            if (ddlChartType.SelectedValue == "Area")
                return SeriesChartType.Area;
            if (ddlChartType.SelectedValue == "SplineArea")
                return SeriesChartType.SplineArea;
            if (ddlChartType.SelectedValue == "Point")
                return SeriesChartType.Point;
            return SeriesChartType.Column;
        }
        private string getLegendName()
        {
            string legendName = string.Empty;
            if (cbAvg.Checked)
                legendName += "(Avg)";
            legendName += ddlSearchBy.SelectedItem.Text;
            if (rbBranch.Checked)
                legendName += "-Branch-" + ddlSearchText.SelectedItem.Text;
            else if (rbFANumber.Checked)
                legendName += "-FA-" + ddlSearchText.SelectedItem.Text;
            else if (rbRegion.Checked)
                legendName += "-Region-" + ddlSearchText.SelectedItem.Text;
            legendName += "~" + ddlChartType.SelectedItem.Text;
            return legendName;
        }
        private void clearChartSeries(List<Series> seriesCollection)
        {
            foreach (Series series in seriesCollection)
                if (chrAdvertising.Series.FindByName(series.Name) != null)
                    chrAdvertising.Series.Remove(chrAdvertising.Series.FindByName(series.Name));

        }
        /// <summary>
        /// Occurs any time a radio button changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void rbCheckChanged(object sender, EventArgs e)
        {
            ddlSearchText.Items.Clear();
            if (!rbAll.Checked)
            {
                ddlSearchText.Visible = true;
                populate();
                List<string> possibilities = new List<string>();
                BusAdvertisingCollection ddlCollection = m_AdvertisingCollection.Value;
                foreach (BusAdvertising item in ddlCollection)
                {
                    if (rbBranch.Checked)
                    {
                        if (!possibilities.Contains(item.Branch))
                            possibilities.Add(item.Branch);
                    }
                    else if (rbFANumber.Checked)
                    {
                        if (!possibilities.Contains(item.FANumber))
                            possibilities.Add(item.FANumber);
                    }
                    else if (rbRegion.Checked)
                    {
                        if (!possibilities.Contains(item.RegionId.ToString()))
                            possibilities.Add(item.RegionId.ToString());
                    }
                }
                populateRegions();
                possibilities.Sort();
                foreach (string item in possibilities)
                {
                    ListItem newItem = new ListItem();
                    newItem.Value = item;

                    if (rbRegion.Checked)
                    {
                        foreach (BusRegion region in m_RegionCollection.Value)
                        {
                            if (region.RjRegionId.ToString() == item)
                            {
                                newItem.Text = region.DescText;
                                break;
                            }
                        }
                        if (newItem.Text == "")
                            newItem.Text = item;
                    }
                    else
                        newItem.Text = item;
                    ddlSearchText.Items.Add(newItem);
                }
            }
            else
                ddlSearchText.Visible = false;

        }
        /// <summary>
        /// showGraph happens when the user wants to display the items
        /// in the listbox onto the chart.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void showGraph()
        {
            foreach (ListItem item in lbSeriesCurrent.Items)
                foreach (Series SeriesItem in m_seriesCollection.Value)
                    if ((SeriesItem.Name == item.Text) && (chrAdvertising.Series.FindByName(SeriesItem.Name) == null))
                    {
                        //SeriesItem.Name = //----------------I tried to add by different name each time.
                        chrAdvertising.Series.Add(SeriesItem);
                    }
        }        /// <summary>
        /// Removes all the graph information currently being pulled
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRemoveAll_Click(object sender, EventArgs e)
        {
            chrAdvertising.Series.Clear();
            m_seriesCollection.Clear();
            m_RegionCollection.Clear();
            m_AdvertisingCollection.Clear();
            lbSeriesCurrent.Items.Clear();
            lbSeriesNotShown.Items.Clear();
        }

        protected void btnSaveImage_Click(object sender, EventArgs e)
        {
            //chrAdvertising.SaveImage();
        }

    }


Here is the code that didnt past correctly to your reply


Here is the code that didnt past correctly to your reply


这篇关于图表-清除然后重新添加系列会导致程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:24