How to use MS Office Chart

PaulZ

Active member
Joined
Apr 8, 2004
Messages
26
Location
Dordrecht, the Netherlands
How to requery a MS Office Chart

I have put a Com-component Microsoft Office Chart 10.0 on my VB.Net form. It gets its data from a Datamember (a query in an Access Database).
How do I perform a requery in .Net-coding for this Chart (there is a right-click on the chart that does the renewal of the data, but I dont want to use that for my users). I dont find any helpful information on MS of the helpfiles.
There is a Chart1.refresh option, but that does nothing.

Anyone more information?

Thanks,
Paul
 
Last edited by a moderator:
What code are you using to import the data in the first place? I would think that you could just repeat that procedure, no?
 
I would try to make use of the help files on it. I have not gone through it a lot, but I did dig up the following example:
Code:
Set c = ChartSpace1.Constants
Set ChartSpace1.DataSource = Spreadsheet1.Object
ChartSpace1.Charts.Add
ChartSpace1.Charts(0).Type = c.chChartTypeLineMarkers
ChartSpace1.Charts(0).SetData c.chDimCategories, 0, "a2:a28"
ChartSpace1.Charts(0).SetData c.chDimSeriesNames, 0, "b1"
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimValues, 0, "b2:b28"
The code is VB6/VBA code, but its the same idea. In that above example, it seems that the data is "bound" to an Excel spreadsheet. (The "b2:28" stuff.) I would think that there would be other ways to get data in there, but worst case this suggests that you could use Excel as the data source. However, if Excel is not already open, then I guess this would be quite a bit of extra overhead for just a Chart...

Ok, the help file for DataSource states: "Returns or sets the ADO DataSource object that represents the data source for the specified control." So the above example is just for when an Excel Worksheet is the ADO data source. You should be able to change/refresh your ADO settings by updating these values I would think.
 
Last edited by a moderator:
Ok, glad you found it! :)

But apparently this is a Read/Write String? Can you explain what you pass in? A new SQL String, I guess?
 
Back
Top