I have made a method including the code of pie chart and call that method everywhere i need to refresh the chart, but whenever i click on those buttons where i have called the method then the pie chart duplicates the value automatically. And also i have tried Refresh() and Update option too but it doesn't work.
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        chart();
    }
    private void chart()
    {
        chart1.Series["new"].Points.AddXY("Peter", "1000");
        chart1.Series["new"].Points.AddXY("Julia", "1000");
    }
    private void button1_Click(object sender, EventArgs e)
    {
        chart();
    }
}
                If I've understood the problem correctly, I think you simply need to clear down the Series' Points collection.
For example:
        private void chart()
    {
        chart1.Series["new"].Points.Clear();
        chart1.Series["new"].Points.AddXY("Peter", "1000");
        chart1.Series["new"].Points.AddXY("Julia", "1000");
    }
Is this what you were looking to do?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With