How delete all the charts in the FpSheet?

Posted by: robertobonilla2007 on 8 September 2017, 2:41 pm EST

  • Posted 8 September 2017, 2:41 pm EST

    I need delete all the Charts in the FpSheet how can i do it?

     Thanks in Advance

    RB

  • Replied 8 September 2017, 2:41 pm EST

    Hello,

    Here is the code for removing all the SpreadCharts from the ActiveSheet.

    <blockquote>

            FarPoint.Win.Spread.Chart.SpreadChart chart;
            FarPoint.Win.Spread.Chart.SpreadChart chart1;
            FarPoint.Win.Spread.Chart.SpreadChart chart2;
            int ChartCount;
            private void btnAddChart_Click(object sender, EventArgs e)
            {
                FarPoint.Win.Chart.BarSeries series = new FarPoint.Win.Chart.BarSeries();
                series.Values.Add(2.0);
                series.Values.Add(4.0);
                series.Values.Add(3.0);
                series.Values.Add(5.0);

                FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
                plotArea.Location = new PointF(0.2f, 0.2f);
                plotArea.Size = new SizeF(0.6f, 0.6f);
                plotArea.Series.Add(series);

                FarPoint.Win.Chart.LabelArea label = new FarPoint.Win.Chart.LabelArea();
                label.Text = "Bar Chart";
                label.Location = new PointF(0.5f, 0.02f);
                label.AlignmentX = 0.5f;
                label.AlignmentY = 0.0f;

                FarPoint.Win.Chart.LegendArea legend = new FarPoint.Win.Chart.LegendArea();
                legend.Location = new PointF(0.98f, 0.5f);
                legend.AlignmentX = 1.0f;
                legend.AlignmentY = 0.5f;

                FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
                model.LabelAreas.Add(label);
                model.LegendAreas.Add(legend);
                model.PlotAreas.Add(plotArea);

                chart = new FarPoint.Win.Spread.Chart.SpreadChart();
                chart.Size = new Size(100, 100);
                chart.Location = new Point(100, 100);
                chart.Model = model;
                fpSpread1.Sheets[0].Charts.Add(chart);

                chart1 = new FarPoint.Win.Spread.Chart.SpreadChart();
                chart1.Size = new Size(100, 100);
                chart1.Location = new Point(200, 100);
                chart1.Model = model;
                fpSpread1.Sheets[0].Charts.Add(chart1);

                chart2 = new FarPoint.Win.Spread.Chart.SpreadChart();
                chart2.Size = new Size(100, 100);
                chart2.Location = new Point(300, 100);
                chart2.Model = model;
                fpSpread1.Sheets[0].Charts.Add(chart2);
                ChartCount = fpSpread1.ActiveSheet.Charts.Count;
            }
            private void btnRemoveAllSpreadCharts_Click(object sender, EventArgs e)
            {
                for (int i = 0; i < ChartCount; i++)
                    fpSpread1.Sheets[0].Charts.RemoveAt(0);
            }

    </blockquote>

    Hope this will help you. Thanks.

  • Replied 8 September 2017, 2:41 pm EST

    <font size="4"><b><span id="result_box" class="short_text"><span class="hps">thanks for your</span> <span class="hps">quick response</span><span class="">, it works fine</span><span class="">! <img src="/emoticons/emotion-2.gif" alt="Big Smile" /></span></span></b></font>

    RB

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels