Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 10th, 2003, 03:38 AM
Authorized User
 
Join Date: Jun 2003
Location: Crowland, Lincs, United Kingdom.
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default MSChart - Populating Data

:( 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
  #2 (permalink)  
Old June 11th, 2003, 06:00 AM
Authorized User
 
Join Date: Jun 2003
Location: Goodlands, n/a, Mauritius.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to psychadelic
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating data in subforms michayos Infopath 0 May 25th, 2007 10:40 AM
WebShop: populating data from different db JoinTTT BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 April 7th, 2007 04:54 PM
populating cboBox with remote table data Loralee Access 8 October 31st, 2005 11:24 PM
MSChart : A chart that needs incomplete data point sanjib VB Components 0 February 22nd, 2005 03:33 AM
MSChart - Populating the chart kasie VB Components 0 June 10th, 2003 03:22 AM





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