2012. 4. 25. 13:34ㆍNOTE/IT
ChartFX 문법 모음
Chart.OpenDataEx COD_VALUES,1,4
Chart.ValueEx(0,0) = 30.45
Chart.ValueEx(0,1) = 45.18
Chart.ValueEx(0,2) = 69.5
Chart.ValueEx(0,3) = 24.9
Chart.CloseData COD_VALUES
'이예제는 Data를 hardcoding 으로 입력 받은 예제이다
'그러나 db에서 받아오는 것도 마찬가지이다
' Chart.OpenDataEx COD_VALUES,1,4 1은 한 항목에 보여줄갯수,4는 총 항목수이다.
chart.Axis(AXIS_Y).Format = "#,##0.#"
'이렇게 Y축 포멧을 변경할수있다.
Chart.Legend(0) = "January"
Chart.Legend(1) = "February"
Chart.Legend(2) = "March"
Chart.Legend(3) = "April"
Chart.Legend(4) = "May"
Chart.Legend(5) = "June"
Chart.Legend(6) = "July"
Chart.Legend(7) = "August"
Chart.Legend(8) = "September"
Chart.Legend(9) = "October"
Chart.Legend(10) = "November"
Chart.Legend(11) = "December"
'이렇게 X축 Label를 변경시킬수 있다.
'보조축 그리는 방법
Set AxisY = Chart.Axis(AXIS_Y)
AxisY.Step = 20
AxisY.MinorStep = 5
AxisY.Max = 100
AxisY.Min = 0
AxisY.MinorTickMark = TS_CROSS
AxisY.Grid = True
'아래코드로 보조축범위를 색으로 표현 할 수 있다.
AxisY.Style = AxisY.Style Or AS_INTERLACED
AxisY.Grid = True
AxisY.GridColor = RGB(192,192,192)
'gallery 기타 종류
Chart.Gallery = PIE
Chart.Gallery = AREA
Chart.Gallery = SPLINE
Chart.Gallery = CURVEAREA
Chart.Gallery = PYRAMID
Chart.Gallery = BUBBLE
'차트위에 링크 아이콘생성방법 예제
Set chart = Server.CreateObject("ChartFX.WebServer")
chart.Chart3D = False
chart.BorderStyle = 0
chart.AxesStyle = CAS_FLATFRAME
chart.RGBBk = RGB(255,255,255)
chart.SerLeg(0) = "Sales"
chart.SerLeg(1) = "Projected"
' Attached Annotation objects need to have the data first
Chart.OpenDataEx COD_VALUES,1,4
Chart.ValueEx(0,0) = 14
Chart.ValueEx(0,1) = 17
Chart.ValueEx(0,2) = 12
Chart.ValueEx(0,3) = 18
Chart.CloseData COD_VALUES
' This chart will JUMP to the same URL passing parameters depending on where you click
chart.URL(0) = "DrillParam.asp"
chart.URLOptions = CHART_URL_JUMP Or CHART_URL_GLOBAL Or CHART_URL_PARAM
chart.URLParamMask = "Series=%s&Value=%v"
chart.ImgTags = "BORDER=0"
' Create Annotation Objects
Set AnnotX = Server.CreateObject("AnnotationX.AnnList")
' Add Annotation List to ChartFX
chart.AddExtension AnnotX
' Create a Rectangle
Set Obj = AnnotX.Add(1)
' Attach its center to X=1,Y=15
Obj.Attach 1,"1,15"
Obj.Width = 20
Obj.Height = 20
Obj.BkColor = RGB(255,0,0)
Obj.AllowMove = False
Obj.URL = "http://www.softwarefx.com"
Obj.URLTarget = "_new"
' Create a Text object
Set ObjText = AnnotX.Add(6)
' Attach its center to X=3,Y=13
ObjText.Attach 1,"3,13"
ObjText.Text = "Click here"
ObjText.Width = 60
ObjText.Height = 18
ObjText.BkColor = CHART_TRANSPARENT
ObjText.Color = RGB(0,0,0)
ObjText.AllowMove = False
ObjText.URL = "http://support.softwarefx.com"
%>
'ADO 사용,Y1,Y2 사용하기 예제
Source code that generates this chart:
<!-- Include this file so we can use all the ChartFX constants -->
<!-- #include virtual="/Include/CfxIE.inc" -->
<%
Set chart = Server.CreateObject("ChartFX.WebServer")
' The samples look better in white
chart.RgbBk = RGB(255,255,255)
chart.Rgb2DBk = RGB(255,255,255)
chart.AxesStyle = CAS_FLATFRAME
chart.Chart3D = False
' Create the database connection object
Set Conn = Server.CreateObject("ADODB.Connection")
' Open the ODBC data source
Conn.Open Application("CfxIEConn")
' Execute the SQL statement that will return the data
Set RS = Conn.Execute("SELECT Month,Sales,Projected From CIEDemoSales")
' Let ChartFX know how many series are you charting
' this is necessary so that you can use any of the Multi* properties
Chart.OpenDataEx COD_VALUES,2,1
Chart.CloseData COD_VALUES
' Assign Multiple YAxis before the data is retrieved so that ChartFX can
' automatically scale the secondary Y axis
Chart.Series(0).YAxis = AXIS_Y
Chart.Series(1).YAxis = AXIS_Y2
' Assign the contents of the ResultSet to the Chart
chart.AdoResultset RS
' Close the connection
Conn.Close
%>
<%= chart.GetHtmlTag("500","350") %>
http://support.softwarefx.com/CfxIE/
'NOTE > IT' 카테고리의 다른 글
[ASP]파일 다루기 (0) | 2012.04.25 |
---|---|
[VB] .INI 사용 (0) | 2012.04.25 |
[ASP] 간략 팁 모음 (0) | 2012.04.25 |
[SQL]CURSOR 사용 (0) | 2012.04.25 |
[SQL]TRUNCATE TABLE을 사용한 테이블의 모든 행 삭제 (0) | 2012.04.25 |