Hi,
We have to add Microsoft Chart Control 6.0 from com Components and Microsoft Activex Data Objects 2.0 Library from Add Reference->Com in our Toolbox
In Button_Click
AxMSChart1.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).ValueScale.Auto = False
AxMSChart1.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).ValueScale.Auto = False
AxMSChart1.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).ValueScale.Maximum = CDec(txt_maxvalue.Text)
AxMSChart1.Plot.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).ValueScale.Minimum = CDec(txt_minvalue.Text)
Dim db As New riskpro_net.dataaccess
Dim i As Integer
Dim ds As New DataSet
Dim fdate As String
Dim tdate As String
fdate = Format(CDate(dtp_from.Value), "yyyy-MM-dd")
tdate = Format(CDate(dtp_to.Value), "yyyy-MM-dd")
ds = db.retds("select * from tbl_chart where cdate between '" + fdate + "' and '" + tdate + "'", "tbl_chart")
gv.ColumnCount = ds.Tables(0).Rows.Count + 1
gv.RowCount = ds.Tables(0).Columns.Count + 1
Dim s As Integer
gv.Rows(0).Cells(0).Value = "Date"
gv.Rows(0).Cells(0).Style.ForeColor = Color.DarkBlue
gv.Rows(0).Cells(0).Style.Font = New Font(gv.Font, FontStyle.Bold)
gv.Columns(0).Width = 120
gv.Rows(1).Cells(0).Value = "Avg Realized Rate"
gv.Rows(1).Cells(0).Style.ForeColor = Color.DarkBlue
gv.Rows(1).Cells(0).Style.Font = New Font(gv.Font, FontStyle.Bold)
gv.Rows(2).Cells(0).Value = "Avg Invoiced Rate"
gv.Rows(2).Cells(0).Style.ForeColor = Color.DarkBlue
gv.Rows(2).Cells(0).Style.Font = New Font(gv.Font, FontStyle.Bold)
gv.Rows(3).Cells(0).Value = "Avg Spot Rate"
gv.Rows(3).Cells(0).Style.ForeColor = Color.DarkBlue
gv.Rows(3).Cells(0).Style.Font = New Font(gv.Font, FontStyle.Bold)
For s = 1 To gv.ColumnCount - 1
gv.Columns(s).Width = 68
Next
For s = 1 To ds.Tables(0).Rows.Count
gv.Rows(0).Cells(s).Value = CDate(ds.Tables(0).Rows(s - 1)("cdate")).ToString("dd-MMM-yy")
gv.Rows(0).Cells(s).Style.ForeColor = Color.DarkBlue
gv.Rows(0).Cells(s).Style.Font = New Font(gv.Font, FontStyle.Bold)
gv.Rows(1).Cells(s).Value = CDec(ds.Tables(0).Rows(s - 1)("AvgRealizedRate"))
gv.Rows(2).Cells(s).Value = CDec(ds.Tables(0).Rows(s - 1)("AvgInvoicedRate"))
gv.Rows(3).Cells(s).Value = CDec(ds.Tables(0).Rows(s - 1)("AvgSpotRate"))
Next
AxMSChart1.RowCount = ds.Tables(0).Rows.Count
AxMSChart1.ColumnCount = ds.Tables(0).Columns.Count - 1
For i = 1 To AxMSChart1.RowCount
AxMSChart1.Row = i
AxMSChart1.RowLabel = CDate(ds.Tables(0).Rows(i - 1)("cdate")).ToString("MMM-yy")
AxMSChart1.Column = 1
AxMSChart1.Data = ds.Tables(0).Rows(i - 1)("AvgRealizedRate")
AxMSChart1.ColumnLabel = "Avg Realized Rate"
AxMSChart1.Column = 2
AxMSChart1.Data = ds.Tables(0).Rows(i - 1)("AvgInvoicedRate")
AxMSChart1.ColumnLabel = "Avg Invoiced Rate"
AxMSChart1.Column = 3
AxMSChart1.Data = ds.Tables(0).Rows(i - 1)("AvgSpotRate")
AxMSChart1.ColumnLabel = "Avg Spot Rate"
Next
AxMSChart1.Visible = True