This is a migrated thread and some comments may be shown as answers.

How to ChartView.ExportToImage from List<ChartView>

2 Answers 101 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
kieran
Top achievements
Rank 2
kieran asked on 15 Dec 2020, 12:44 AM

Hi,

    I have 3 ChartViews on a form, I wish to export each to a separate Image.

I would like my routine to be generic so I can reuse it for many Chart sets.

I am trying the following.

foreach (ChartView x in PnlCharts.Controls.OfType<ChartView>())
            {
                x.ExportToImage();
            }

However the ExportToImage Method is not available.  It only seems to be available if I directly reference the instance inserted into the form.

eg ChartView1.ExportToImage();

Am I missing something here?

Why can I export from the instance, but not from the same instance when it is contained within a list?

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Dec 2020, 08:17 AM
Hello, Kieran,   

The ExportToImage method is available for controls of type RadChartView. However, in your sample code snippet, I can see that you are extracting the controls of type ChartView, not RadChartView.  
            foreach (RadChartView x in this.Controls.OfType<RadChartView>())
            {
                string filePath = @"..\..\..\exprtedChart" + x.Name + ".png";
                x.ExportToImage(filePath, this.radChartView1.Size, System.Drawing.Imaging.ImageFormat.Png);
            }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
kieran
Top achievements
Rank 2
answered on 19 Dec 2020, 11:30 PM

Thankyou, I am a dumba_ _.  Sorry for the silly request.

 

Tags
ChartView
Asked by
kieran
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
kieran
Top achievements
Rank 2
Share this question
or