Maybe a simple one, but I can't see it:
I have a form with on it a simple image control.
On that image control I draw lines with Graham's chart dll.
When I have seen the chart I close the form and I thought that that would
clear the image, but it doesn't, so when I make a new chart and load the form
again I see the old chart plus the new one.
This is the relevant code section:
LineChart.New1(imgChart.Width, imgChart.Height)
LineChart.Text = strTerm
LineChart.Color = Rgb(255,255,230)
LineChart.MaxScaleValue = dMaxValue
LineChart.MinScaleValue = dMinValue 'no effect with positive values
LineChart.ShowGrid = True
LineChart.AddXAxisText(1, 80, strMinDate)
LineChart.AddXAxisText(160, imgChart.Width - 1, strMaxDate)
LineChart.XAxisIntervalValue = 240 'to avoid any ticks on the X-axis
dXAxisFactor = (lMaxDate - lMinDate) / imgChart.Width
LineChart.NewLine(cRed)
For n = 0 To lRecords - 1
'the + 1 and - 1 x-axis adjustments are to prevent
'these values falling of the image on the device
'-------------------------------------------------
If n = 0 Then
LineChart.AddPoint(1, ArrayListValues1.Item(n))
Else
If n < lRecords - 1 Then
LineChart.AddPoint(Int((ArrayListDateTicks.Item(n) - lMinDate) / dXAxisFactor), _
ArrayListValues1.Item(n))
Else
LineChart.AddPoint(imgChart.Width - 1, ArrayListValues1.Item(n))
End If
End If
Next n
Linechart.LineWidth = 1
LineChart.AddLine
imgChart.Image = LineChart.Draw
frmChart.Show
The arraylists are cleared before adding new values (from a SQLite Reader) and they are not the problem.
Thanks again for any advice.
RBS
I have a form with on it a simple image control.
On that image control I draw lines with Graham's chart dll.
When I have seen the chart I close the form and I thought that that would
clear the image, but it doesn't, so when I make a new chart and load the form
again I see the old chart plus the new one.
This is the relevant code section:
LineChart.New1(imgChart.Width, imgChart.Height)
LineChart.Text = strTerm
LineChart.Color = Rgb(255,255,230)
LineChart.MaxScaleValue = dMaxValue
LineChart.MinScaleValue = dMinValue 'no effect with positive values
LineChart.ShowGrid = True
LineChart.AddXAxisText(1, 80, strMinDate)
LineChart.AddXAxisText(160, imgChart.Width - 1, strMaxDate)
LineChart.XAxisIntervalValue = 240 'to avoid any ticks on the X-axis
dXAxisFactor = (lMaxDate - lMinDate) / imgChart.Width
LineChart.NewLine(cRed)
For n = 0 To lRecords - 1
'the + 1 and - 1 x-axis adjustments are to prevent
'these values falling of the image on the device
'-------------------------------------------------
If n = 0 Then
LineChart.AddPoint(1, ArrayListValues1.Item(n))
Else
If n < lRecords - 1 Then
LineChart.AddPoint(Int((ArrayListDateTicks.Item(n) - lMinDate) / dXAxisFactor), _
ArrayListValues1.Item(n))
Else
LineChart.AddPoint(imgChart.Width - 1, ArrayListValues1.Item(n))
End If
End If
Next n
Linechart.LineWidth = 1
LineChart.AddLine
imgChart.Image = LineChart.Draw
frmChart.Show
The arraylists are cleared before adding new values (from a SQLite Reader) and they are not the problem.
Thanks again for any advice.
RBS