asp: placeholder> form> body> html> Owc.aspx .vb:
Imports System Imports OWC IMPORTS System.Web.ui
Public class owc inherits system.web.ui.page protected withevents chartholder as system.Web.ui.WebControls.PlaceHolder
#Region "The code" of the web form designer "
'This call is required for the web form designer. private subinitializecomponent ()
End Sub
Private Sub Page_init (Byval E AS System.EventArgs) Handles mybase.init 'Codegen: This method call is required by the Web Form Designer' Do not modify it using the code editor. InitializationComponent () End Sub
#End region
Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'where user code page placement initialization' to place the object graph created ChartSpace Dim objCSpace As ChartSpace = New ChartSpaceClass () 'in Add a chart in the ChartSpace object, the add method returns the CHART object DIM ObjChart AS WCCHART = Objcspace.Charts.Add (0) 'Specifies the type of the chart. Type by Owc.ChartchartTypeenum enumeration value worth ObjChart.Type = chartcharttypeenum.chcharttypeColumnClustered 'Specify whether the chart needs the legend objChart.haslegegend = True
'Given Title ObjChart.hastitle = true objChart.title.caption = "1-6 Say Data Distribution Map"
'Given the X, Y axis ObjChart.axes (0) .hastitle = true objchart.axes (0) .title.caption = "Y axis: Quantity" ObjChart.axes (1) .haastitle = true objchart. Axes (1) .title.caption = "x axes: month"
'Calculation Data' * Categories and VALUES You can use Tab to represent * DIM strsName as string = "Figure 1" DIM STRCATEGORY AS STRING = "1" ControlChars.tab "2" controlchars.tab _ " 3 " ControlChars.tab " 4 " ControlChars.tab " 5 " ControlChars.tab _ " 6 " ControlChars.tab Dim Strvalue as string =" 9 " ControlChars.tab " 8 " ControlChars. Tab _ "4" ControlChars.Tab "10" ControlChars.Tab "12" ControlChars.Tab _ "6" ControlChars.tab
'Add a series objchart.seriescollection.add (0)
'Given the name Objchart.seriesCollection (0) .SetData (ChartdimensionSenum.chdimseriesNames, _ ChartspecialDataSourcesenum.chDataLiteral, strsriesname)
'Given classification objChart.SeriesCollection (0) .SetData (ChartDimensionsEnum.chDimCategories, _ ChartSpecialDataSourcesEnum.chDataLiteral, strCategory)' given value objChart.SeriesCollection (0) .SetData (ChartDimensionsEnum.chDimValues, _ ChartSpecialDataSourcesEnum.chDataLiteral, strValue) 'output GIF file. DIM StrabsolutePath As string = (Server.mAppath ("))) " /Images/test.gif "Objcspace.exportPicture (StrabsolutePath," GIF ", 600, 350)
'Creating a relative path for GIF files. Dim strreLativePath As String = "images / test.gif"' Add image to PlaceHolder. DIM STRIMAGETAG AS STRING = "
"
ChartHolder.controls.add (New LiteralControl (StrimageTag)) End Sub
END CLASS
Here is the C # version of OWC.ASP.CS
Ublic Class OWC: System.Web.ui.page {protected system.Web.ui.webcontrols.PlaceHolder ChartHolder;
Private Void Page_Load (Object Sender, System.EventArgs E) {// Place the user code here to initialize the page // to create a ChartSpace object to place the chart OWC.CHARTSPACECSPACE = New Owc.chartSpaceClass ();
// Add a chart in a ChartSpace object, add method to Chart object owc.wcchart objChart = objcspace.charts.add (0);
/ / Specify the type of the chart. Type by Owc.ChartchartTyPeenum enumeration value worth ObjChart.Type = Owc.Chartcharttypeenum.chcharttypeColumnClustered;
/ / Specify whether the chart needs the legend objChart.haslegend = true;
// Given the title objChart.hastitle = true; objChart.title.caption = "The first half of the year map";
/ / A given X, Y axis illustration ObjChart.axes [0] .hastitle = true; objChart.axes [0] .title.caption = "Y: Number"; ObjChart.axes [1] .haastitle = True Objchart.axes [1] .title.caption = "x: Month";
// Calculation Data / * Categories and VALUES can be represented by Tab to represent * / string strsName = "Figure 1"; String strcategory = "1" '/ t' "2" '/ t' " 3 " '/ t' " 4 " '/ t' " 5 " '/ t' " 6 " '/ t'; string strign =" 9 " '/ t' " 8 " '/ t' "4" '/ t' "10" '/ t' "12" '/ t' "6" '/ t'; // Add a Series ObjChart.seriesCollection .Add (0);
// Given the name ObjChart.seriescollection [0] .SetData (Owc.ChartdimensionSenum.chdimseriesNames, (int) OWC.CHARTSPECIALDATASNUM.CHDATALIAL, STRSERIESNAME);
// Givecation ObjChart.seriesCollection [0] .SetData (Owc.ChartdimensionSenum.chdimcategories, (int) owc.chartspecialDataSourcesenum.chdataral, strcategory;
// setpoint objChart.SeriesCollection [0] .SetData (OWC.ChartDimensionsEnum.chDimValues, (int) OWC.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);. // output into GIF files string strAbsolutePath = (Server.MapPath ( "." )) "//i//test.gif"; Objcspace.exportPicture (StrapSolutePath, "GIF", 600, 350);
// Create a relative path to the GIF file. String strreLativePath = "./i/test.gif";
// Add the picture to the PlaceHolder. String strimagetag = "
"; chartholder.controls.add (new literalcontrol (strimagetag));}
#Region Web Form Designer Generated Code Override Protected Void OnNit (Eventargs E) {// // Codegen: This call is necessary for the ASP.NET Web Form Designer. // InitializeComponent (); base.oninit (e);
/// /// Designer supports the required method - do not use the code editor to modify the // / this method. /// summary> private () {this.load = new system.eventhandler (this.page_load);} #ENDREGON}
If you use the ADO.NET DataSet object, you can generate a string split by tab:
Strvalue = (nodes.Item (j) .ChildNodes.Item (0) .innerText '/ t'); strcategory = (nodes.Item (j) .innertext '/ t' );