p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning VB 6 (http://p2p.wrox.com/forumdisplay.php?f=75)
-   -   MSChart - Populating Data (http://p2p.wrox.com/showthread.php?t=364)

kasie June 10th, 2003 03:38 AM

MSChart - Populating Data
 
:([:X][:p] Help me please..
Any one knows the best way of populating the data into the MSChart in the VB6. I use many way but can not find effective way, prob don't know how to use it correctly.

1. By .Datasource: I use recordset but the database design to fit the MSChart. I got this from google.
field 0 is row name, and field1 - field3 - col1 to col3 data, ie
rowname|col1|col2|Col3....
Jan | 10 | 20 | 40
Tue | 0 | 10 | 50
if you only want to display 1 col instead of 3 then just use col1
This method is best displays for me but I have to clear the table and put in the data first.. hence slow performance of the program.

2. By .ChartData: this area works faster, where you create an array object ie arrData. The array is 2 dimensional ie arrData(1 to 3,1 to 3), or arrData(1 to 3,1), where the first one is using 3 cols and the second one using 1.
This is good but, I unable to declare array size dynamically, and fixed size have to be declare, not good if your row data is too big for the array. Also if you declare ample size, ie 20, but if you have only for example 5 rows of data, you would not be able to see anything on the chart, hence array must be declare around the correct size with 1 or 2 over max.

Can any one help me .. thanks in advance.
Cheers
Kasie

psychadelic June 11th, 2003 06:00 AM

Hello

you can use dynamic arrays instead. Try this as an example:

Code:

   
Private Sub Command1_Click()

    Dim iCol As Integer
    Dim iRow As Integer

    iCol = 3    'or anything you want
    iRow = 3    'or anything you want
    ReDim arrData(1 To iCol, 1 To iRow)
'  instead of Dim arrData(1 to 3, 1 to 3)

'  set your array and put your code here
    MSChart1.ChartData = arrData
    DoEvents
    MsgBox "Voila..."

End Sub

regards,

psychadelic


All times are GMT -4. The time now is 01:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.