TeeChart components of the application in ASP
TeeChart components of the application in ASP
The TeeChart VCL version widely used in a variety of development environments and are well recognized, Spain Steema Software SL company in October 1997 and developed the TeeChart Pro ActiveX. The B / S pattern of development is good news, since it only installed on the server, client without installing other software, as long as the use of a common browser to display statistical graphics, it is once again a city greatly welcome.
Below we explain with ASP technology TeeChart Pro V5 ActiveX components common attributes and applications.
Let us first look at a TeeChart components to display the "quarter sales" of the two-dimensional histogram examples:
<HTML> <BODY>
<%'———– TeeChartEg.asp————————
Set TChart1 = CreateObject ( "TeeChart.TChart")
TChart1.Header.Text (0) = "quarter sales statistics"
TChart1.AddSeries (1)
TChart1.Aspect.View3D = 0
TChart1.Series (0). Clear
TChart1.Series (0). Add 180, "a quarter", RGB (35,70128)
TChart1.Series (0). Add 240, "Q2", RGB (255,80128)
TChart1.Series (0). Add 210, "the third quarter", & HFACE87
TChart1.Series (0). Add 280, the "fourth quarter", 16777215
TChart1.Export.SaveToJPEGFile server.mappath ( "MyChart.jpg"), False, JPEGBestQuality, 100, TChart1.Width, TChart1.Height
Set TChart1 = nothing
%>
<img Src="MyChart.jpg">
</ BODY> </ HTML>
1) ASP other components with the use of the same, first of all, to create objects.
Set TChart1 = CreateObject ( "TeeChart.TChart")
2) use of its property that a static statistical graphics.
TChart1.Header.Text (0) = "quarter sales statistics"
……
TChart1.Series (0). Add 210, "the third quarter", & HFACE87
TChart1.Series (0). Add 280, the "fourth quarter", 16777215
3) generate statistical graphics files
TChart1.Export.SaveToJPEGFile server.mappath ( "MyChart.jpg"), False, JPEGBestQuality, 100, TChart1.Width, TChart1.Height
4) The release of Object
Set TChart1 = nothing
In the case of the object class attributes are a lot of default values, we can add settings for specific situations. Below TeeChart explain in detail the other components commonly used attributes (using procedures set out in the form of the Notes)
<HTML> <HEAD> <TITLE> TeeChart object's properties to introduce </ TITLE> </ HEAD>
<BODY>
<%
Set TChart1 = CreateObject ( "TeeChart.TChart")
TChart1.Height = 440 'high degree of the whole chart
TChart1.Width = 500 'width of the entire chart
'TChart1.Header.Text.Clear
'TChart1.Header.Text.Add "quarter sales statistics"' chart title, can be applied in ways TChart1.Header.Text (0) = "headline" form
TChart1.Header.Font.Size = 22 'Title font size
TChart1.Header.Font.Bold = True 'Title whether bold font
TChart1.Header.Font.Italic = True 'Title whether italics fonts
TChart1.Panel.MarginLeft = 3 'charts from the left
TChart1.Panel.Gradient.Visible = True 'whether there is a background color
TChart1.Panel.Gradient.StartColor = & HB3DEF 'chart background colors begin
TChart1.Panel.Gradient.EndColor = & HFACE87 'end chart background color
TChart1.Panel.BevelWidth = 0 'canvas inside indentation rate
TChart1.AddSeries (0) 'show graphics, range is from 1 to 39
TChart1.Aspect.View3D = False 'False said that 2-D graphics, 3-D graphics that True
TChart1.Aspect.Chart3DPercent = 10 'If 3-D graphics, that his inclination
TChart1.Aspect.Zoom = 100 'graphics ratio
TChart1.Aspect.Orthogonal = TRUE '3D graphics whether Cezhuai
TChart1.Aspect.Rotation = -20 'If the chart is Cezhuai, horizontal angle of -360 to 360 Cezhuai
TChart1.Aspect.Elevation = 0 'If the chart is Cezhuai, before and after the point of -360 to 360 Cezhuai
TChart1.Aspect.Perspective = 0 '3D graphics to the degree of aggregation heart
TChart1.Aspect.Chart3DPercent = 20 '3D graphics thickness of 1 to 100
TChart1.Walls.Bottom.Size = 5 'If it is 3-D graphics, that the thickness of the abscissa
TChart1.Walls.Bottom.Color = RGB (35,70128) 'base color
TChart1.Walls.Bottom.Transparent = True 'If 3-D graphics, whether transparent base TChart1.Walls.Back.Pen.Visible = True' is a reflection of the Senate coordinate frame
TChart1.Walls.Left.Size = 5 'If it is 3-D graphics, that the thickness of its Ordinate
TChart1.Walls.Left.Color = 8454143 'Ordinate color
TChart1.Walls.Left.Transparent = True 'If 3-D graphics, Ordinate is transparent wall
TChart1.Legend.Visible = True 'is a reflection of Legend
TChart1.Legend.VertSpacing = 9 'Legend framework of a high degree of
TChart1.Legend.DividingLines.Visible = False 'Legend of whether there is a line spacing
'TChart1.Series (0). Clear
'TChart1.Series (0). ColorEachPoint = True
'TChart1.Series (0). Add 180, "a quarter", RGB (35,70128)' static add to the display data in charts, followed by numerical parameters size, name, colors
'TChart1.Series (0). Add 240, "Q2", 255
'TChart1.Series (0). Add 210, "the third quarter", & HFACE87
TChart1.Series (0). Add 280, the "fourth quarter", 16777215
TChart1.Axis.Depth.Visibl e = False '3-D coordinate axis is transparent, which would show that the wall
TChart1.Axis.DrawAxesBeforeSeries = False 'grid is displayed on the map before
TChart1.Axis.Left.Title.Caption = "value (unit: million)," 'ordinate axis title
TChart1.Axis.Left.Title.Font.Bold = True 'ordinate axis title is bold
TChart1.Axis.Left.Title.Font.Size = 9 'size ordinate axis title
TChart1.Axis.Left.Title.Visible = True 'is a reflection of Ordinate name
TChart1.Axis.Left.Labels.Angle = 90 'Ordinate font tilt angle
TChart1.Axis.Left.GridPen.Visible = True 'abscissa axis would show that the parameters
TChart1.Axis.Bottom.Title.Caption = "Timeline" 'abscissa axis title
TChart1.Axis.Bottom.Title.Font.Bold = True 'abscissa axis title is bold
TChart1.Axis.Bottom.Title.Font.Size = 9 'size abscissa axis title
TChart1.Axis.Bottom.Labels.Angle = 0 'angle abscissa font 0 ~ 360
TChart1.Axis.Bottom.GridPen.Visible = True 'Senate would show that the longitudinal axis coordinates
TChart1.Footer.Text.Add "chart under the heading" 'under the title of the chart
TChart1.Footer.Font.Size = 11 'under the heading font size
TChart1.Footer.Font.Bold = True 'is the title for bold font
TChart1.Footer.Font.Italic = False 'under the heading fonts in italics
TChart1.Export.SaveToJPEGFile server.mappath ( "MyChart.jpg"), False, JPEGBestQuality, 100, TChart1.Width, TChart1.Height 'export documents stored as MyChart.jpg
Set TChart1 = nothing
%> <img Src="MyChart.jpg">
</ BODY> </ HTML>
Notes: 1. TChart1.AddSeries (0) graphics display attributes worthy of study, interested readers can be from 0 to 39 to test, find their ideal display.
2. Used for the color, use RGB said three methods, such as: RGB (255255255) = & HFFFFFF = 16777215. Specific conversion method is not that.
3. Attribute to the True and False can be said that alternative 1 and 0.
Adding to the AP, a list below shows that the two sets of data examples.
<% Set TChart1 = CreateObject ( "TeeChart.TChart")
TChart1.Header.Text (0) = "quarter sales" 'Title
TChart1.AddSeries (1)
TChart1.AddSeries (1)
TChart1.Series (0). Add 180, "a quarter", RGB (255255255)
TChart1.Series (1) Add 240, "a quarter", 255
TChart1.Series (0). Add 280, "Q2", RGB (255255255)
TChart1.Series (1) Add 200, "Q2", 255
TChart1.Series (0). Add 150, "the third quarter", RGB (255255255)
TChart1.Series (1) Add 320, "the third quarter", 255
TChart1.Series (0). Add 360, the "fourth quarter", RGB (255255255)
TChart1.Series (1) Add 200, the "fourth quarter", 255
TChart1.Series (0). Marks.Visible = True 'data indicate that the title
TChart1.Series (0). Marks.Style = 0 '0-style data for numerical 9,0, as a percentage of……
TChart1.Series (1). Marks.Style = 0
TChart1.Export.SaveToJPEGFile server.mappath ( "MyChart.jpg"), False, JPEGBestQuality, 100, TChart1.Width, TChart1.Height
Set TChart1 = nothing
%>
The above two examples are static produce results, then display. However, in practical work, and more from the existing database read dynamic statistics showed. Below we give a direct link to use ADO Access database, dynamic display of the results of examples. Database (test.mdb), table as the two colname, colvalue. Were in name and the corresponding statistical data colname (January, February,……), colvalue (103,210,……):
<% Dim OutputStream
Set TChart1 = CreateObject ( "TeeChart.TChart")
TChart1.Header.Text (0) = "quarter sales" 'Title
TChart1.AddSeries (0) 'numerical display graphics style for a ~ 39 below
Set Rst = Server.CreateObject ( "ADODB.Recordset")
Conn.Open "driver = (microsoft access driver (*. mdb)); dbq =" & server.mappath ( "zcw.mdb")
Strsql = "select * from test"
Rst.Open strsql, conn, 1,1
IF rst.RecordCount> 0 THEN
TChart1.Series (0). Datasource = rst
TChart1.Series (0). LabelsSource = "colname"
TChart1.Series (0). YValues.ValueSource = "colvalue"
ELSE
TChart1.Series (0). Fillsamplevalues (12)
TChart1.Header.Text (0) = "No results show that random data"
END IF
TChart1.Series (0). Marks.Visible = True
TChart1.Series (0). Marks.Style = 4
TChart1.Export.SaveToJPEGFile server.mappath ( "MyChart.jpg"), False, JPEGBestQuality, 100, TChart1.Width, TChart1.Height
Set TChart1 = nothing
Rst.Close
%> <img Src="MyChart.jpg">
The above three examples are generated static JPG picture files revealed that, if the results did not keep the value here, we can use the PNG (Portable Network Graphics) format.
<% Dim ChartType, OutputStream, ViewType
Set Chart1 = CreateObject ( "TeeChart.TChart")
Chart1.AddSeries (0)
Chart1.Series (0). FillSampleValues 20 'randomly generated data
OutputStream = Chart1.Export.asPNG.SaveToStream
Set Chart1 = Nothing
Response.Binarywrite OutputStream
%>
TeeChart components of the above attributes and ASP technology with a simple, we want to help. Teechart Pro ActiveX free trial version can be downloaded from http://www.steema.com/download/Downloadindex.htm. TeeChart and Asp on the combination of code examples can be found http://www.steema.com/products/teechart/asp/ASPHome.htm. If you have any views on this or views, please contact the author zcwmxn@sina.com.cn.
Tags: ASP, components








0 Comments to “TeeChart components of the application in ASP”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.