I want to save image from chart graphic. I'm using following line.
chart.SaveImage("D:\\mypic.png", System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
but I have a problem:
Here is my code.
protected void btnBar_Click(object sender, EventArgs e)
{
string degerler = txtDeger.Text;
ArrayList array = new ArrayList();
if (Convert.ToInt32(TextBox2.Text) > Convert.ToInt32(TextBox1.Text))
{
Label3.Text = "TopNCount sayısı büyük olamaz...";
}
else
{
Label3.Text = "";
for (int i = 1; i < Convert.ToInt32(TextBox1.Text) + 1; i++)
{
array.Add(Convert.ToInt32(degerler.Split(',')[i - 1]));
}
chart.ChartType = myChart.ChartTypes.Bar;
chart.TopNCount = Convert.ToInt32(TextBox2.Text);
chart.DataSource = array;
chart.DataBind();
chart.SaveImage("D:\\mypic.png", System.Web.UI.DataVisualization.Charting.ChartImageFormat.Png);
this.Controls.Add(chart);
}
}