Excel Range as Datasource

TeeChart for ActiveX, COM and ASP
Post Reply
dastrw
Newbie
Newbie
Posts: 16
Joined: Wed Oct 31, 2007 12:00 am

Excel Range as Datasource

Post by dastrw » Wed Nov 07, 2007 9:08 pm

Is there a way to tell a chart to get its series data from a range in the current Excel workbook?

I can choose Excel from the list of DataSources, but then it wants to open that workbook and it won't let me choose the current workbook.

The examples require using Macros to populate the series point-by-point. I was hoping to just reference a range and have all of those data points added to the chart in the same way that Excel does.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Nov 09, 2007 12:03 pm

Hi,

I'm sorry, I don't understand what's the problem. Giving a range of the X and YValues, Sheet and Excel file to the DataSource should be enough.
Would you be so kind to send us a simple excel file where we can see the data you're trying to load so we can tell you the better way or reproduce the problem here ?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

dastrw
Newbie
Newbie
Posts: 16
Joined: Wed Oct 31, 2007 12:00 am

Post by dastrw » Fri Nov 09, 2007 3:51 pm

Sorry, but the last time I subscribed to that newsgroup my computer got screwed up and I had to re-image it.

Here is the code from your own example 'TeeChart Pro Inserted into Excel.xls':

For t = 2 To 6
TChart1.Series(0).Add SampleData.Item(t, 2), SampleData.Item(t, 1), clTeeColor
Next

Notice how you populate the series point-by-point.

Can you provide me with a code snippet where you populate the chart all at once by specifying a range for all the data, or a range for X values, a range for Y values, and a range for colors?

Can you tell me what I would need to do through the Tee Editor interface to specify a range in the current workbook in which I am working? The interface only seems to allow me to import data from another workbook, not the current one.

I couldn't find any examples in the tutorials.

Thanks.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 19, 2007 9:32 am

Hi,

I'm afraid the teeChart Pro Activex does not have an inbuilt facility to directly import data from Excel worksheets. However, you should, with relative ease, be able to acheive what you need by connecting TeeChart and Excel together via ADO. For details of how to use ADO with Excel please see:
http://support.microsoft.com/default.as ... US;q257819
For details of how to use TeeChart with ADO please see:
C:\Program Files\TeeChart Pro v6 ActiveX Control\Examples\Visual Basic\Visual Basic 5 & 6\ADO Databases

However, you should be able to move around cells on the other sheets by using similar code to the following article :
http://support.microsoft.com/kb/147650
And then use the same code as in the example to add to populate the data into the Chart.

dastrw
Newbie
Newbie
Posts: 16
Joined: Wed Oct 31, 2007 12:00 am

Post by dastrw » Mon Nov 19, 2007 6:06 pm

The reason we purchased TeeChart was that we were expecting that in all ways it would be superior to Excel charting.

In Excel you can associate a range of cells with a chart. Then if a person changes the data in those cells, the corresponding points change instantly in the chart.

I was hoping that TeeChart could do this.

Now, if I use ADO, which I have reverted to by the way, any time any point is changed, I have to have the user push a button to update the chart. No big problem, but there are lots of users who are used to plots changing as soon as the data is changed in the cell. So they may change the data, and then forget to re-plot.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 20, 2007 10:03 am

Hi dastrw,

In that case, what you request is possible using ChartGrid as you can see in the example at All Features\Welcome!\Components\Chart Grid in the features demo, available at TeeChart's program group.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply