Click here to Skip to main content
13,144,265 members (31,667 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
How to clear values in MSchart when click button
con.Open()
        '********************************************************************
        Dim startDate As DateTime = DirectCast(dtpStart.Value, DateTime)
        Dim endDate As DateTime = DirectCast(dtpEnd.Value, DateTime)
        Dim ts As TimeSpan = endDate.Subtract(startDate)
 
        Dim days As Integer = ts.Days
 
        Try
 

            Dim str As String = "select distinct empfullname from employee where department='Transcription' and designation='" + cmbDesig.Text + "' order by designation, empfullname "
            Dim ds As DataSet
 
            ds = cnn.ExecuteDataset(str)
 

            Dim ds2 As New DataSet
            For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
 
                Dim cn As Integer = 0
                cmd.CommandText = "select sum(actuallinecount), designation from linecountdetails where (dateoflinecount between '" + Format(Convert.ToDateTime(dtpStart.Value), "yyyy-MM-dd") + "' and '" + Format(Convert.ToDateTime(dtpEnd.Value), "yyyy-MM-dd") + "') and empfullname='" + ds.Tables(0).Rows(i).ItemArray(0).ToString() + "' "
                cmd.Connection = con
                dr = cmd.ExecuteReader()
                While dr.Read()
                    If dr(0) Is DBNull.Value Then
                        cn = 0
                    Else
                        cn = dr(0)
                    End If
 
                End While
                dr.Close()
 
                Dim lc As Double = cn
                Chart1.Series("Series1").Points.Add(lc).AxisLabel = ds.Tables(0).Rows(i).ItemArray(0).ToString()
 
                Chart1.ChartAreas("ChartArea1").AxisY.Title = "Line Count"
                Chart1.ChartAreas("ChartArea1").AxisX.Title = "Employee"
 
                Chart1.ChartAreas("ChartArea1").AxisX.Interval = 1
                Chart1.ChartAreas("ChartArea1").AxisX.IntervalOffset = 1
 
                Chart1.Series("Series1").Points(i).ToolTip() = lc
            Next
            'End If
 
            Chart1.DataSource = ds.Tables("linecountdetails")
            Chart1.DataBind()
 
            con.Close()
 
        Catch ex As Exception
 
        End Try
Posted 29-Nov-11 0:51am
anjali21.3K
Updated 9-Mar-16 7:38am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You'll need to clear the values from each of your Series.
chart.Series["Series1"].Points.Clear();

I hope it will help you. :)
  Permalink  
Comments
anjutlya 29-Nov-11 7:18am
   
Thanks
RaisKazi 29-Nov-11 7:24am
   
My 5.
Manoj K Bhoir 29-Nov-11 7:25am
   
Thanks RaisKazi!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

.Clear() method will clear all points of given series.
chart.Series[0].Points.Clear();
  Permalink  
Comments
RaisKazi 29-Nov-11 7:24am
   
My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 29 Mar 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100