Morning Everyone,
I am making a custom control that only has a chart on it right now. It has 1 sub for initialization. I have added this control to a form and passed information to the control on form load. No matter what I do, I can see the initial chart on the custom control in display mode however when added to the form, I can never get the chart to show up. I have even taken code straight from the net that was labeled as an answer that didn't work. So...
Here is the code on my custom control that only has a chart control:
And here is the code on my form that only has the dashpart on it that I can't get to display anything:
Thanks for any help you can give!!
I am making a custom control that only has a chart on it right now. It has 1 sub for initialization. I have added this control to a form and passed information to the control on form load. No matter what I do, I can see the initial chart on the custom control in display mode however when added to the form, I can never get the chart to show up. I have even taken code straight from the net that was labeled as an answer that didn't work. So...
Here is the code on my custom control that only has a chart control:
VB.NET:
Public Class dashpart
Public Sub init(ByVal pLables As Hashtable, ByVal pCharttype As SeriesChartType, ByVal pSeriesData() As DataTable)
'hash: title,xlable,ylable,series1, series2,,,
Chart1.Series.Clear()
For Each seriesdt As DataTable In pSeriesData
Dim series As New Series
series.Name = pLables("series1")
series.ChartType = pCharttype
series.Points.DataBind(seriesdt, "Value", "Date", "")
Chart1.Series.Add(series)
Next
With Chart1.ChartAreas(0)
.AxisX.Interval = 10
.AxisX.Title = "Value"
.AxisY.Title = "Dates"
End With
End Sub
End Class
And here is the code on my form that only has the dashpart on it that I can't get to display anything:
VB.NET:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim temphash As Hashtable = Nothing
temphash.Add("title", "tester")
temphash.Add("series1", "Innards")
Dim dt() As DataTable = Nothing
dt(0).Columns.Add("Date")
dt(0).Columns.Add("Value")
Dim dr1 As DataRow = dt(0).NewRow
Dim dr2 As DataRow = dt(0).NewRow
Dim dr3 As DataRow = dt(0).NewRow
dr1.Item("Date") = DateAdd(DateInterval.Month, -5, Now)
dr1.Item("Value") = 100
dr2.Item("Date") = DateAdd(DateInterval.Month, -8, Now)
dr2.Item("Value") = 500
dr3.Item("Date") = DateAdd(DateInterval.Year, -1, Now)
dr3.Item("Value") = 300
dt(0).Rows.Add(dr1) : dt(0).Rows.Add(dr2) : dt(0).Rows.Add(dr3)
Dashpart1.init(temphash, DataVisualization.Charting.SeriesChartType.Bar, dt)
End Sub
End Class
Thanks for any help you can give!!