Page 1 of 1

Excel Range as Datasource

Posted: Wed Nov 07, 2007 9:08 pm
by 15047194
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.

Posted: Fri Nov 09, 2007 12:03 pm
by Pep
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.

Posted: Fri Nov 09, 2007 3:51 pm
by 15047194
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.

Posted: Mon Nov 19, 2007 9:32 am
by Pep
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.

Posted: Mon Nov 19, 2007 6:06 pm
by 15047194
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.

Posted: Tue Nov 20, 2007 10:03 am
by narcis
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!