Second, use the OWC control and HTML form to display XML data
2.1 Implementation of basic functions
Another HTML page is created here. In order to use the XML data just got, in the HTML page, XML data island is used:
TR>
TABLE>
In the init () function corresponding to the onReadyStateChange event just now, we implements the OWC chart by the following code:
ClassID = CLSID: 0002E556-0000-0000-C000-000000000046 Viewastext> Object> Sub init () IF (dbxml.readystate = "complete") THEN DIM STRXML SET STRXML = dbxml.xmldocument CreateChart Strxml, CS1 END IF End Sub Sub createchart (byref oxml, cspace) 'According to the incoming XML generation chart Dim xdoc, xroot, ccnt DIM NDX, CNODE, TXTDATA, TXTCAT, TXTDATA2 Set xdoc = dbxml.xmldocument Set xroot = xdoc.documentelement CCNT = XRoot.childNodes.Length TXTDATA = "": txtcat = "" 'Get the corresponding string from XML data For ndx = 0 to ccnt - 1 Set cnode = xroot.childNodes (NDX) TXTCAT = txtcat & cnode.childNodes (0) .Text TXTDATA = TXTDATA & CNODE.CHILDNODES (1) .text TXTDATA2 = TXTDATA2 & CNODE.CHILDNODES (2) .text IF NDX <> (CCNT -1) THEN TXTCAT = TXTCAT & " TXTDATA = TXTDATA & "," TXTDATA2 = TXTDATA2 & "," END IF NEXT '--- Next start drawing ---------- 'Add data sequence 1 Set ch = cspace.Charts.Add () Set s = ch.seriescollection.add () S.name = "Call costs (yuan)" S.caption = S.Name S.SetData C.chdimcategories, C.chdataliteral, TXTCAT S.SetData C.chdimvalues, C.chdataliteral, TXTDATA S.TYPE = 8 'graph 'Setting the time scale axis format SET AXCATEGORY = Cspace.Charts (0) .axes (c.chaxispositioncategory) With Axcategory .Ghaxittype = c.chaxisunitmonth 'Month .Ghouplacenit = 1 'unit .Numberformat = "short date" "short date End with 'Add Data Sequence 2 Set S2 = ch.seriescollection.add () S2.NAME = "Calls (times)" S2.caption = S2.NAME S2.SetData C.chdimvalues, C.chdataLitral, TXTDATA2 'title ch.hastitle = true ch.title.caption = "Call Situation Month" Ch.title.font.color = "black" ch.TILE.FONT.SIZE = 10 ch.title.font.bold = true 'ChartSpace properties Cspace.border = C.chlinedash CSPACE.hasselectionMarks = TRUE CSPACE.ALLOWFILTERING = true 'Allow commands and packets CSPACE.AllowPropertyToolbox = True 'Setting the legend and location ch.legend.position = C.chlegendPositionRight ch.haslegegend = false 'Divided into different groups, display double coordinate axis S2.ungroup True SET AXINCOMEAXIS = Ch.axes.add (S2.Scalings (c.chdimvalues)) AxIncomeaxis.position = C.ChaxisPositionRight Axincomeaxis.hasmajorgridlines = false S2.TYPE = 0 'cylindrical chart End Sub In this way, we get a data sheet and chart, and the ultimate results are as follows: Thus, with the use of XML technology and IE binding techniques, we realize the display of OWC's data in the database, and do not expose any data connection information in the client. 2.2 Other features OWC can be easily achieved to save the chart as a local image, which greatly facilitates the user. At the same time, OWC provides a variety of chart types, such as: pie chart, graph, column chart, etc., suitable for displaying data in different situations. If you use the COM component, and our flexible use of XSL, we can get better performance and stronger features. For example: Sort by the HTML table (see HTML source code in the attachment), data pagination, etc. In addition, we can also achieve universal data access, search function. Attachment: Reference documentation 1: The Microsoft MSDN online documentation provides a direct binding of XML data to implement charts, which requires simultaneous loading of the DataSourceControl control or Spreadsheet control. See: Http://msdn.microsoft.com/library/en-us/dnowcbk/html/odc_chap4owc.asp?frame=true#odc_chap4owc_xml 2: This document refers to the relevant content of the CHARTSPACE chart in the OWC Toolpack document. OWC Toolpack is the best reference document recommended by Microsoft. The download address is as follows: Http://www.microsoft.com/downloads/details.aspx?familyid=beb5d477-2100-4586-a13c-50e56f101720&displayLang=en
ClassID = CLSID: 0002E556-0000-0000-C000-000000000046 Viewastext>
Object>
Sub init ()
IF (dbxml.readystate = "complete") THEN
DIM STRXML
SET STRXML = dbxml.xmldocument
CreateChart Strxml, CS1
END IF
End Sub
Sub createchart (byref oxml, cspace) 'According to the incoming XML generation chart
Dim xdoc, xroot, ccnt
DIM NDX, CNODE, TXTDATA, TXTCAT, TXTDATA2
Set xdoc = dbxml.xmldocument
Set xroot = xdoc.documentelement
CCNT = XRoot.childNodes.Length
TXTDATA = "": txtcat = ""
'Get the corresponding string from XML data
For ndx = 0 to ccnt - 1
Set cnode = xroot.childNodes (NDX)
TXTCAT = txtcat & cnode.childNodes (0) .Text
TXTDATA = TXTDATA & CNODE.CHILDNODES (1) .text
TXTDATA2 = TXTDATA2 & CNODE.CHILDNODES (2) .text
IF NDX <> (CCNT -1) THEN
TXTCAT = TXTCAT & "
TXTDATA = TXTDATA & "," TXTDATA2 = TXTDATA2 & ","
NEXT
'--- Next start drawing ----------
'Add data sequence 1
Set ch = cspace.Charts.Add ()
Set s = ch.seriescollection.add ()
S.name = "Call costs (yuan)"
S.caption = S.Name
S.SetData C.chdimcategories, C.chdataliteral, TXTCAT
S.SetData C.chdimvalues, C.chdataliteral, TXTDATA
S.TYPE = 8 'graph
'Setting the time scale axis format
SET AXCATEGORY = Cspace.Charts (0) .axes (c.chaxispositioncategory)
With Axcategory
.Ghaxittype = c.chaxisunitmonth 'Month
.Ghouplacenit = 1 'unit
.Numberformat = "short date" "short date
End with
'Add Data Sequence 2
Set S2 = ch.seriescollection.add ()
S2.NAME = "Calls (times)"
S2.caption = S2.NAME
S2.SetData C.chdimvalues, C.chdataLitral, TXTDATA2
'title
ch.hastitle = true
ch.title.caption = "Call Situation Month"
Ch.title.font.color = "black"
ch.TILE.FONT.SIZE = 10
ch.title.font.bold = true
'ChartSpace properties
Cspace.border = C.chlinedash
CSPACE.hasselectionMarks = TRUE
CSPACE.ALLOWFILTERING = true 'Allow commands and packets
CSPACE.AllowPropertyToolbox = True
'Setting the legend and location
ch.legend.position = C.chlegendPositionRight
ch.haslegegend = false
'Divided into different groups, display double coordinate axis
S2.ungroup True
SET AXINCOMEAXIS = Ch.axes.add (S2.Scalings (c.chdimvalues))
AxIncomeaxis.position = C.ChaxisPositionRight
Axincomeaxis.hasmajorgridlines = false
S2.TYPE = 0 'cylindrical chart
In this way, we get a data sheet and chart, and the ultimate results are as follows:
Thus, with the use of XML technology and IE binding techniques, we realize the display of OWC's data in the database, and do not expose any data connection information in the client.
2.2 Other features
OWC can be easily achieved to save the chart as a local image, which greatly facilitates the user. At the same time, OWC provides a variety of chart types, such as: pie chart, graph, column chart, etc., suitable for displaying data in different situations.
If you use the COM component, and our flexible use of XSL, we can get better performance and stronger features. For example: Sort by the HTML table (see HTML source code in the attachment), data pagination, etc. In addition, we can also achieve universal data access, search function. Attachment: Reference documentation
1: The Microsoft MSDN online documentation provides a direct binding of XML data to implement charts, which requires simultaneous loading of the DataSourceControl control or Spreadsheet control. See:
Http://msdn.microsoft.com/library/en-us/dnowcbk/html/odc_chap4owc.asp?frame=true#odc_chap4owc_xml
2: This document refers to the relevant content of the CHARTSPACE chart in the OWC Toolpack document. OWC Toolpack is the best reference document recommended by Microsoft. The download address is as follows:
Http://www.microsoft.com/downloads/details.aspx?familyid=beb5d477-2100-4586-a13c-50e56f101720&displayLang=en