Hi Leslie,
Here's a VB.NET example that illustrates how you can bind an OWC Chart to
an XML Data Source and build an XY Scatter chart:
AxChartSpace1.ConnectionString = "provider=mspersist"
AxChartSpace1.CommandText = "c:\proddata.xml"
AxChartSpace1.HasPlotDetails = True
AxChartSpace1.Charts(0).Type =
OWC10.ChartChartTypeEnum.chChartTypeScatterMarkers
AxChartSpace1.SetData(OWC10.ChartDimensionsEnum.chDimXValues, 0,
"ProductID")
AxChartSpace1.SetData(OWC10.ChartDimensionsEnum.chDimYValues, 0,
"UnitPrice")
The XML used in this sample is based off of the Products table in the
Northwind sample database:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:CommandTimeout='30'>
<s:AttributeType name='ProductID' rs:number='1'>
<s:datatype dt:type='int' dt:maxLength='4' rs
recision='10'
rs:fixedlength='true' rs:maybenull='false'/>
</s:AttributeType>
<s:AttributeType name='UnitPrice' rs:number='2' rs:nullable='true'
rs:writeunknown='true'>
<s:datatype dt:type='number' rs:dbtype='currency' dt:maxLength='8'
rs
recision='19' rs:fixedlength='true'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row ProductID='1' UnitPrice='18'/>
<z:row ProductID='2' UnitPrice='19'/>
<z:row ProductID='24' UnitPrice='4.5'/>
<z:row ProductID='34' UnitPrice='14'/>
<z:row ProductID='35' UnitPrice='18'/>
<z:row ProductID='38' UnitPrice='263.5'/>
<z:row ProductID='39' UnitPrice='18'/>
<z:row ProductID='43' UnitPrice='46'/>
<z:row ProductID='67' UnitPrice='14'/>
<z:row ProductID='70' UnitPrice='15'/>
<z:row ProductID='75' UnitPrice='7.75'/>
<z:row ProductID='76' UnitPrice='18'/>
</rs:data>
</xml>
It's important to note that when you use the MSPersist provider to bind an
OWC chart to an XML data source that the XML data source use the Recordset
Persistance shema -- if the XML does not follow this schema, the provider
will be unable to interpret the data as a recordset.
Additional Resources:
HOW TO: Find Office Web Components (OWC) Programming Documentation and
Samples
http://support.microsoft.com/default.aspx?scid=kb;en-us;319793
Use An XML Data Source with the Office XP Chart Component (Q286212)
http://support.microsoft.com/?id=286212
Saving ADO Recordsets in XML Format
http://msdn.microsoft.com/library/psdk/dasdk/xmli546n.htm
Hope this helps you!
Lori Turner
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------