Use the OWC control to implement the details of the chart function in ASP

xiaoxiao2021-03-06  16

Easily implement various chart features, such as pie chart, cluster column, and fold line diagrams, etc. in ASP. In the following code, I give a detailed method of using the pie chart, a cluster column pattern, and a line diagram. More features of OWC, attributes can participate in the msowcvba.chm help file (find yourself below the Office 2000 folder).

Testowc.asp


SUB Window_onload () ------------------------------------- ------------------------------------------ 'For the data assignment categories = Split ("<% = mx1%>", ",") 'data item name array values ​​= split ("<% = mx2%>", ",")' data item value array set cht = chartspace1.Charts.add 'Add an icon object set c = chartspace1.constants' Returns an object, this object allows script users to use the named constant.

CHT.TYPE = C.chcharttypepie 'Sets chart types for pie chart' ------- Set chart title ------------------------- --------------- chartspace1.haschartspaceTitle = true 'specifies the chart workspace contains the title chartspace1.ChartSpaceTitle.caption = "Pie" Set Chart Workspace Title content' Set ChartSpace1.ChartSpaceTitle.Font.Bold = True 'Set the chart workspace title contents Bold Chartspace1.ChartSpaceTitle.Font.Color = "Blue" Set color chart.italic = false' settings for chart workspace titles Whether the chart workspace title is a slope ChartSpace1.ChartSpaceTitle.Font.name = "隶书" 'Setting the chart workspace title content fonts chart.size = 18' Set the size of the chart workspace title content (unit: lbs) Chartspace1.ChartSpaceTitle.Font.underline = C.OWCunderLinesTyLESINGLE 'Setting Underline Properties' ------- Set Less --------------------------- ------------------ CHT.HASLEGEND = true 'Specifies that the chart workspace contains legend cht.legend.font.size = 9' other related paragraph settings Chart title section cht.legend.position = c.chlegendPositionright 'Set the legend on which case cht.setdata c.chdimcategories, c.chdataliteral, categories cht.seriescollection (0) .SetData C.chdimValues, C .chDataLiteral, VALUES SET DL = cht.seriescollection (0) .Datalabelscollection.add 'Add Legend Data Tag DL.haasvalue = false dl.haspercentage = true dl.ste.size = 11' --------- --------- Pie chart (end) ------------------------------------ ------------ '------------------------------------- --------------------------- set cht = chartspace2.Charts.add 'Add an icon object set c = chartspace2.constants' Returns an object This object allows script users to use named constants.

CHT.TYPE = C.chchartTypeColumnClustered 'Sets the chart type to fold the line chart' ------- Set chart title ------------------------- --------------- chartspace2.haschartspaceTitle = true 'Specified Chart Workspace Contains Title Chartspace2.ChartSpaceTitle.caption = "Column" Set Chart Workspace Title content' For font settings Chartspace2.ChartSpaceTitle.Font.Bold = true 'Sets the chart workspace title contents Bold Chartspace2.ChartSpaceTitle.Font.Color = "Blue" Set Color Chartspace2.ChartSpaceTitle.Font.italic = FALSE' Settings chart Whether the workspace title is a slurry chartspace2.ChartSpaceTitle.Font.Name = "隶书" 'Setting the chart workspace title content fonts chart.size = 18' Set the size of the chart workspace title content (unit: pound) Chartspace2 .ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle 'provided underline attribute cht.SetData c.chDimCategories, c.chDataLiteral, categories' cross item (category axis) cht.SeriesCollection (0) .SetData c.chDimValues, c.chDataLiteral, values SET DL = cht.seriescollection (0) .Datalabelscollection.add 'Add legend data tag DL.haasvalue = true dl.haspercentage = false dl.color = "red" DL.Position = C .chlegendposi TionRight

'Set the vertical value attribute set categoryaxis = cht.axes (c.chaxispositionbottom) categoryaxis.font.size = 9' Setting classification group attribute set categoryaxis = cht.axes (c.chaxispositionLes) categoryaxis.font.size = 9 '--- ------------------------------------------- ----------- '------------------line chart------------------ ---------------------------------------- SPARR = Split ("<% = mx1% > ",", ") DATEARR = SPLIT (" <% = datestr%> ",") SET CHT = chartspace3.Charts.add 'Add an icon object set c = chartspace3.constants' Returns an object, this object Allow scripts users to use a named constant.

CHT.TYPE = C.chcharttypelinemarkers 'Settings the chart type is a folding chart' ------- Set chart title ------------------------- --------------- chartspace3.haschartspaceTitle = true 'Specified Chart Workspace Contains Title Chartspace3.ChartSpaceTitle.caption = "Available Pacing Map" Set Chart Workspace Title content' Set ChartSpace3.ChartSpaceTitle.Font.Bold = true 'Set the chart workspace title content Bold Chartspace3.ChartSpaceTitle.Font.Color = "Blue"' Settings the color of the chart workspace Title Color chartspace3.ChartSpaceTitle.Font.italic = FALSE ' Set whether the chart workspace title is a beef chartspace3.ChartSpaceTitle.Font.name = "Lishu" 'Setting the Chart Workspace Title content Fontspace3.ChartSpaceTitle.font.size = 18' Set the size of the chart workspace title content (unit: pound) ) Chartspace3.ChartSpaceTitle.Font.underline = C.OWCunderLineStingLeSingle 'Sets the underscore properties' ------- Set the legend ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------ CHT.HASLEGEND = True 'Specifies that the chart workspace contains legend cht.legend.font.size = 9' other related paragraph settings See Set the chart title section cht.Legend.Position = C.chlegendPositionBottom 'Set the legend on its way CHT.SetData C.chdimseriesNames, C.chdataral, Sparr' series Cht.SetData C.chdimcategories, C.chda Talitral, Datearr 'Hype Impansion (Classified axis)' Set Longitudinal Numerical Properties Set Categoryaxis = Cht.axes (C.ChaxisPositionBottom) Categoryaxis.Font.Size = 9 'Sets Category Group Properties Set Categoryaxis = Cht.axes (c.chaxispositionLesitionLes) CategoryAxis .Font.size = 9 values ​​= split ("<% = sqarxlstr%>", ",") for i = 0 to Ubound (sparr) valueTemp = "" for j = i * (ubound (datearr) 1) to (i 1) * (Ubound (Datearr) 1) -1 'Read Data VALUETEMP = ValyEtemp & "By Sky Machine (J) Next Valuearr = Split (MID (ValyTemp, 2),", "

转载请注明原文地址:https://www.9cbs.com/read-42197.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.029, SQL: 9