mschart series count error


Jan 20, 2005
Programming Experience
I am very new to using MSCharts and have to finish the work in 2 days!!

hence help required...

I am using a Mschart to create a bar graph report.

Well i have different types of report that requires ,different no of columns(series) and rows.

Every time i call for a different type of report i bind the data thro a multidimentional array.

this is what i am doing

Dim Array(RowCount, Colcount) As Integer

Dim arrCol As Integer

arrCol = 0

For lpAvg = 0 To dt.Rows.Count - 1

wtRating(0, arrCol) = dt.Rows(lpAvg).Item(5)

arrCol = arrCol + 1


MSCSSIntensity.ChartData = wtRating

later whhen i want to set the series colors and pattern I get an error saying

"Object Reference not set to an instance of the Object"

this is where i get the error

For i = 1 To MSCSSIntensity.Plot.SeriesCollection.Count

With MSCSSIntensity.Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel

.LocationType = VtChLabelLocationType.VtChLabelLocationTypeInside

.VtFont.Size = 8

End With

MSCSSIntensity.Plot.SeriesCollection(i).ShowLine = True

MSCSSIntensity.Plot.SeriesCollection(i).DataPoints(-1).Brush.Style = VtBrushStyle.VtBrushStylePattern

MSCSSIntensity.Plot.SeriesCollection(i).DataPoints(-1).Brush.PatternColor.Set(238, 221, 130)

MSCSSIntensity.Plot.SeriesCollection(i).DataPoints(-1).Brush.Index = setPattern(i) [where setpatten is a function that returns patterns]

MSCSSIntensity.Plot.SeriesCollection(i).DataPoints(-1).Brush.FillColor.Set(184, 134, 11)

Next i

The Error occurs on the following sequesnce

1) i have a graph whose array is Arr(1,7) which I bind to the Chart

2) Now i have Arr(6,3) which I bind to the Chart

3) now again when i want to view the graph for the 1st array (Arr(1,7)

and when i try to assign different pattern to the series i get an error when i try to assign the patten the the th series

it has the 2nd arrays value still embedded

Pls help
I understand that this is the error with respect to setting the no of series each time. so that the previous count is overridden .

but i don't know how to do it.

kindly help
Top Bottom