返回首页

如何清除在MSChart控件的值时,按一下​​按钮

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
:anjutlya

回答

评论会员:k 时间:2