I have an array with contents and values of which I do not know how many records it will contain on forehand. One day 10 and other day 6 or even 20 or more.
I want to create a bar chart of one bar per product and how many there were sold. The example for desktopchart defines per bar a data set. I want to have this in an array, because otherwise I am repeating each line:
Var DS1 As New ChartLinearDataset(cell(2)+":"+cell(3), color.AccentThemColor, True, firstSetOfData)
DS1.ChartType = ChartLinearDataset.ChartTypes.bar
periodChart.AddLabel cell(2)
and I want just as much bars as I need. I tried several things, but all result in errors. I tried things like:
dim ds() as new ChartLinearDataset(content as String, color.AccentThemeColor, True, setofdata() as double)
but that result in a syntax error.
I do not want to write out every content of the chart in separate lines with a select…end select or if…end if statement. The code will be huge and I think there must be a way to solve this.
I tried:
if daySelectBx.SelectedRowText = cell(1) then
select case i //(where i is the record number in the array containing 1 product) case 0 FirstSetOfData.Add <amount like 3> Var DS1 As New ChartLinearDataset("", color.Blue, True, firstSetOfData) DS1.ChartType = ChartLinearDataset.ChartTypes.bar periodChart.AddLabel <variable content like "Fish & chips") case 1 SecondSetOfData.Add <amount like 1> Var DS2 As New ChartLinearDataset("", color.AccentThemeColor, True, SecondSetOfData) DS2.ChartType = ChartLinearDataset.ChartTypes.bar periodChart.AddLabel "Steak Hollandia" . . . end select
but after case 2, (DS2) it did forget the existence of DS1
Any idea how to solve this, I am out of ideas

