15

Having a chart displayed with a System.Windows.Forms.DataVisualization.Charting.Chart control in a .Net 4.0 WinForms application, can I save its render into a picture file?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
Ivan
  • 63,011
  • 101
  • 250
  • 382

2 Answers2

26

How about the Chart.SaveImage() method?

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • 1
    Thanks. I haven't ever been using the Chart control before and have somehow missed the method while searching. – Ivan Jun 02 '12 at 18:56
25

You can use the code below by passing proper ChartImageFormat.*:

this.chart1.SaveImage("C:\\mycode\\mychart.png", ChartImageFormat.Png);

Also look this SO if you met any problem: Save Image Using .net Chart and Saving higher resolution charts without messing up the appearance

Community
  • 1
  • 1
AvkashChauhan
  • 20,495
  • 3
  • 34
  • 65