because you said that you were using the code I used, and I was redim-ing every time. This my code changed to redim only once. I add a chart and I left all defaults, plus a timer setting the interval to 1000msec.
The lines you see in the chart at design mode are just there to show how the chart looks as properties are changed.
The Scale property changes ScaleLeft, ScaleTop, ScaleWidth and ScaleHeight in just one call.
Dim myarray(109) As Double
Dim lastEntry As Long
Private Sub Timer1_Timer()
Timer1.Enabled = False
Dim k As Long
For k = 0 To 9
myarray(lastEntry + k) = Rnd * 50
chart.chartData = myarray
lastEntry = lastEntry + 10
Timer1.Enabled = (lastEntry < 110)
"There are two ways to write error-free programs. Only the third one works."
Thanks again for Your reply Marco. I came to a conclusion that MSChart is not the way to go about what I want to achive and your earlier suggestions about scaling were also very helpful. I am sure that MSChart will flicker every time I refresh it (btw the line "chart.Refresh" is not needed in the last bit of code you posted, "chart.chartData = myarray" does it. I tried it with the "chart.Refresh" line commented out). It is designed to load all the data into datagrid and then refresh screen (flicker) adjusting scales beforehand. But it will try to decide if scale adjustments needs to be made every time before ploting the data.
Please correct me if I am wrong.
Another interesting point I do not understand regarding You code is why it does not work for any other chartType but 2dBar? At least I did not have much succes changing chartType property and running it.
Thanks again. I feel I will have my first VB program done by monday. But it is a part of slightly larger project so coding does not stop there.
MsChart update and documentation
You can download the updated MsChart 6.0.1 control with documentation from here.
Major bug Fixes:
- datapoint(-1) error, can now do datapoint(n)
- rendering time
- array copy offset fix
No source code changes required [simply replace mschart with updated component and give same name] and IT COMES WITH DOCUMENTATION !!
Found it when I had problems with charting, see: support.microsoft.com
Microsoft kb 178545:
The Microsoft Chart control is based on First Impressions by Visual Components....First Impressions is manufactured by Visual Components, a vendor independent of Microsoft
Use VTChart1.DrawMode = VtChDrawModeBlit
VtChDrawModeBlit 1 The chart is redrawn off screen and displayed after the redraw is complete.
VtChDrawModeDraw 0 The chart is redrawn on the screen every time you change a setting.
Blit mode stores a bitmap copy of the chart in memory when the chart is laid out. Repainting the chart uses the bitmap and draws very quickly. It requires more memory than Draw mode, but can save time waiting for the chart to redraw on screen. Blit mode is particularly useful when working with charts that contain many elements.
Hi, This post is very informative, however I would like some specific information. If someone can help me then please send me a private message. Best Regards,
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center