PaulZ Posted November 25, 2004 Posted November 25, 2004 (edited) 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 don't want to use that for my users). I don't find any helpful information on MS of the helpfiles. There is a Chart1.refresh option, but that does nothing. Anyone more information? Thanks, Paul Edited November 25, 2004 by PaulZ Quote
Mike_R Posted November 29, 2004 Posted November 29, 2004 What code are you using to import the data in the first place? I would think that you could just repeat that procedure, no? Quote Posting Guidelines Avatar by Lebb
PaulZ Posted November 29, 2004 Author Posted November 29, 2004 I linked a MS-Access query during designtime. Repeating by reentering the query does not work either. Quote
Mike_R Posted November 29, 2004 Posted November 29, 2004 (edited) 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: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 it's 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. Edited November 29, 2004 by Mike_R Quote Posting Guidelines Avatar by Lebb
PaulZ Posted December 9, 2004 Author Posted December 9, 2004 Just found the correct answer: ChartSpace.XMLDATA = Chartspace.XMLDATA Simple as that! Quote
Mike_R Posted December 9, 2004 Posted December 9, 2004 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? Quote Posting Guidelines Avatar by Lebb
Recommended Posts