CHART
Refer : Chart Tutorial
Description:
This tag is used to create Charts.
TheTag:
|
|
Special Attributes.
| AttrName | Description | GBasic Property | GBasic Sample |
This can be overridden by specifying ChartType property for each data series. BAR_CHART - 1 LINE_CHART - 2 POINT_CHART - 4 PIE_CHART - 8 These Values can be added to get Multiple charts. Ex: (2+4)=6 will give a Line chart with Points. NOTE: For Pie Charts the Point Values should be above 1. |
ChartTypeAll | #Chart1.ChartTypeAll= 1 |
|
| XDivs | #Chart1.XDivs = 5 |
||
| YDivs | Number of Legend Divisions in Y Axis |
YDivs | |
When XHasValues=1 is specified then the X Axis Max Min is calculated , normalized and Plotted as values. WhenXHasValues=0 the X Axis is assumed to be time series where each point is plotted equidistant. |
|||
| When Plotting Barcharts, This attribute
determines Bar Chart Gap. When Poltting Point, This attribute determines Point Width. When Plotting Pie Charts This Attribute Determines the Gap Between the Pie Segments. |
#Chart1.Gap=8 |
||
| StartGap |
When StartGap=0 the Charts First Point is on Leftmost X Axis and
The Last point is on the Rightmost Point in the Chart. |
StartGap | #chart1.StartGap= 1 |
| Thickness |
|
Thickness | print #Chart1.Thickness #Chart1.Thickness= 2 |
| ShowXLeg | Determins if X Legend is Displayed (0/1/2) 0 - XLegend is Hidden 1 - XLegend is Displayed using Horizontal Text. 2 - XLegend is Displayed using Vertical Text. |
ShowXLeg | #Chart1.ShowXLeg=1 |
| ShowYLeg | Determins if Y Legend is Displayed 0 - No Legend is Displayed. 1 - Y Legend is Displayed. 2 - Data Values for Points is displayed. 3 - Y Legend and Data Values for Points is displayed. |
ShowYLeg | #Chart1.ShowYLeg=1 |
|
WrapLeg
|
(0/1)Determins if Text in Legends are wrapped. | WrapLeg | #Chart1.WrapLeg=1 |
| XLegFont YLegFont |
X,Y Legend Text Fonts | XLegFont YLegFont | #Chart1.XLegFont=5 #Chart1.YLegFont=5 |
| XLegStyle YLegStyle |
X,Y Legend Text Styles (Bold/Underline etc) | XLegStyle YLegStyle | #Chart1.XLegStyle=1 #Chart1.YLegStyle=1 |
| YLegFormat XLegFormat |
X,Y Legend Value Formats EX 10.2 | YLegFormat$ XLegFormat$ | #Chart1.YLegFormat$="10.2" #Chart1.XLegFormat$="10.2" |
| XLegCol YLegCol |
X,Y Legend Text Colors | XLegCol YLegCol | #Chart1.XLegCol=16 #Chart1.YLegCol=16 |
| ChartBg ChartGrad,ChartGradDir |
Background Color of the Chart Chart Gradient Color and Direction Chart BG Rounded Rect Radius |
ChartBg ChartGrad,ChartGradDir | |
| ChartBrdr | Border Color of the chart | ChartBrdr | |
| XGridCol YGridCol |
Color of the X and Y Grid Lines in the Chart. | XGridCol YGridCol | |
| XLegLabel | Label for the X Legend Displayed below the X Legend. | XLegLabel$ | #Chart1.XLegLabel$="Year" |
| YLegLabel | Label for the Y Legend Displayed Vertically Next to the Y Legend. | YLegLabel$ | #Chart1.YLegLabel$="Price" |
| XLegLabStyle YLegLabStyle |
Style of the X and Y Legend Labels. | XLegLabStyle YLegLabStyle | |
| FlipXY |
Flips the X and Y axis of a chart. This can be used for Horizontal Bar
Charts. |
FlipXY | #Chart1.FlipXY=1 |
| BaseY |
Base Bar Chart
(Chart Type - 17).
|
BaseY | #Chart1.ChartTypeAll=17 #Chart1.BaseY=1000 |
| Chart Legend Properties |
Chart Legend is a small windows that displays the
Chart Legend Texts when multi series charts are displayed. When Displaying Pie charts this window displays the X Legend Texts for the various Pies. |
||
| ShowChartLeg | This Attribute determines if the Chart Legend Shows
up. For Pie Charts. ShowChartLeg =1 then Only the X legend Text for points is displayed. ShowChartLeg =2 then Xleged Text and Y Value is displayed ShowChartLeg =3 then Xleged Text and Y Percentage Value is displayed ShowChartLeg =4 then Xleged Text and YValue and Y Percentage Value is displayed For Bar/Line/Point Charts ShowChartLeg =1 then the Chart Legend With Chart Labels is displayed. For other values the Chart X Point Legend text is used. ShowChartLeg =8+1 then Only the X legend Text for points is displayed. ShowChartLeg =8+2 then Xleged Text and Y Value is displayed ShowChartLeg =8+3 then Xleged Text and Y Percentage Value is displayed ShowChartLeg =8+4 then Xleged Text and YValue and Y Percentage Value is displayed Note: When Using Bar/line/point Charts that display X Legend Text, the Color array should be setup for the Legend Button Colors to match with Chart point Colors. |
ShowChartLeg | #chart1.ShowChartLeg=1 |
| ChartLegPos |
This Attribute determines if the location of the Chart
Legend. |
ChartLegPos | #chart1.ChartLegPos=1 |
| ClickedX |
This Attribute Returns the X value of the Chart That corresponds to
a |
ClickedX | print #chart1.ClickedX |
| ClickedY |
This Attribute Returns the Y value of the Chart That corresponds
to a |
ClickedY | print #chart1.ClickedY |
| ClickedSeries |
This Attribute Returns the Chart Series
Mouse Click Location. |
ClickedSeries | print #chart1.ClickedSeries |
| ChartLegBG ChartLegGrad, ChartLegGradDir |
Background Color of the Chart Legend Rect.
Chart Gradient Color and Direction Chart BG Rounded Rect Radius |
ChartLegBG ChartLegGrad, ChartLegGradDir | |
| ChartLegFG | Text Color of the Chart Legend Text. | ChartLegFG | |
| ChartLegBtnW | Width of the Chart Legend Buttons . | ChartLegBtnW | |
| ChartGapScale | This Attribute is used to scale the gaps etc on the chart. | ChartGapScale | |
| HideGrid | This Attribute determines if the Grid should be
hidden. 1 - Hides the Y (Horz) Grid Lines 2 - Hides the X (Vert) Grid Lines 3 - Hides the All Grid Lines |
HideGrid | #HideGrid=2 ' Hide Vert Grid |
| Chart Componet Positions Margins LeftMargin BottomMargin TopMargin RightMargin Legend Window ChartLegX ChartLegY ChartLegW ChartLegH Chart Window ChartW ChartH |
These Attributes are readonly and are calculated
automatically by the Chart Control. |
LeftMargin BottomMargin TopMargin RightMargin ChartLegX ChartLegY ChartLegW ChartLegH ChartW ChartH | print #chart1.LeftMargin print #chart1.BottomMargin print #chart1.TopMargin print #chart1.RightMargin print #chart1.ChartLegX print #chart1.ChartLegY print #chart1.ChartLegW print #chart1.ChartLegH print #chart1.ChartW print #chart1.ChartH |
| Chart Max Min
Values YMin YMax XMin XMax |
These Attributes are readonly and are calculated
automatically by the Chart Control. Min and Max are calculated from the data and normalized based on the XDIVS/YDIVS parameters. |
YMin | print #chart1.YMin print #chart1.YMax print #chart1.XMin print #chart1.XMax |
| User MaxMin
Values UserYMax UserYMin UserXMax UserXMin NormMaxMin |
In Some cases it Might be necessary for
the Max and Min Values to be Set from GBasic. For example if there
is a wide variance in the data or there are very few points. NormMaxMin property can be set to 1 to normalize the User Max Min Values. Note: UserYMax UserYMin Values Should not be equal. If they are set to The same value then they are ignored. Same Applies to UserXMax UserXMin. |
UserYMax UserYMin UserXMax UserXMin NormMaxMin | #chart1.UserYMin=50 #chart1.UserYMax=100 print #chart1.UserYMin print #chart1.UserYMax |
| Chart Data
Transformation TfmX(X) TfmY(Y) Reverse RTfmX(X) RTfmY(Y) |
These properties let you
transform an arbitrary point into chart Location. This can be usefull for overlaying Lines, Rectangles and text onto an existing chart. Note: This property works only after the chart is painted after a SetData Method. So incase you need these values before the chart has a chance to paint then you need to call #chart1.Paint(0) method. |
TfmX TfmY RTfmX RTfmY |
print #chart1.TfmX(2) print #chart1.TfmY(342) End sub form_paint TfmX=#Chart1.TfmX(2)+#chart1.x TfmY=#Chart1.TfmY(3600)+#chart1.y fillrect(TfmX,TfmY,10,10,100) end sub Example of Base Line: TfmY=#Chart1.TfmY(3600) x1=#chart1.x+#chart1.LeftMargin x2=#chart1.x+#chart1.LeftMargin+#chart1.ChartW y=#chart1.y+TfmY drawline(x1,y,x2,y,2,1020) |
| DispData |
These property gets/sets the number of
points being displayed. (Set Initially using SetData Method). SetData overwrites this property. |
DispData | print
#chart1.DispData |
| ScrollStart |
This Property Can be be used to Set the Scroll Start for Data Points. | ScrollStart | #Chart1.SetData(a,,,0,100,10) #Chart1.ScrollStart=50 |
| CurDispSel |
This Property Can be be used to Set the Current Display Point. | CurDispSel | print #Chart1.CurDispSel+#Chart1.ScrollStart |
| ShowCursor (Default 1.) |
(0/1)This Property determines if the Chart Cursor is Displayed or not. | ShowCursor | #Chart1.ShowCursor=0 |
| PtBrdrCol | Border Color of points. For Bar and Point charts if PtBrdrCol=0 then the Border Color is set to the Point's color. For Pie charts this is the factor by which the Pie Color is reduced to create the shadow Color. |
PtBrdrCol |
'Blue
Border |
| UseKM | Determines if the GoDB Converts Legend values
greater than 10,000 to K and values greater than 10,000,000 to M.
Default is 1. |
UseKM |
#chart1.UseKM=0 ' Do not transform Legend Numbers to K andM |
Object Methods
| MethodName | Description | GBasic Sample |
| SetData(FloatArray[XlegendArray,ColorArray, Start,Count, DisplayCount]) |
Note: The Size of the String array should match the items
in the data points array. |
dimf a(10) for i=0 to 9 a(i)=(i+100)*4 next dims leg$(12) leg$(0)="Jan" leg$(1)="Feb" .... leg$(11)="Dec" dimi col(10) col(0)=5000 col(1)=10000 .... col(9)=1000 #Chart1.SetData(a,leg$,col) 'Specifying Color col(9)=PointCol |
| ChartType(ChartIDX,ChartType) | BAR_CHART - 1 LINE_CHART - 2 POINT_CHART - 4 PIE_CHART - 8 These Values can be added to get Multiple charts. Ex: (2+4)=6 will give a Line chart with Points. To Generate a Horizontal Bar Chart, FlipXY attribute can be used. |
|
|
This Method sets color
for all the points charts in a Chart Series. This can be overridden by the color specified for each point using SetColor Method. |
#Chart1.ChartColor(0,63488) #Chart1.ChartColor(1,63488) Chart1.ChartColor(0,BGCol) #Chart1.ChartColor(0,2016) #Chart1.ChartColor(1,33823) #Chart1.ChartColor(2,64512) | |
| ChartLabel(ChartIDX,String) | #Chart1.ChartLabel(0,"Company1") #Chart1.ChartLabel(1,"Company2") |
EventHandling: -
Events Supported - CLICK ,
RCLICK
sub Chart1_click
print "Chart1_click"
print
"ClickedX";#chart1.ClickedX
print "ClickedY";#chart1.ClickedY
print
"ClickedSeries";#chart1.ClickedSeries
endsub
Samples:
dimf a(10) for i=0 to 9 a(i)=(i+100)*4 next #Chart1.SetData(a) '***************************** ' Example with Start and Count '***************************** dimf a(100) for i=0 to 10 a(i)=(i+100)*4 next #Chart1.SetData(a,,,0,10) '***************************** ' Example with two Streams '***************************** dimf a(2,10) for i=0 to 9 a(0,i)=(i+100)*4 a(1,i)=(i+20)*12.56 next #Chart1.SetData(a) '***************************** 'XY Chart '***************************** dimf a(2,10) for i=0 to 9 a(0,i)=(i+100)*4 ' X Data a(1,i)=(i+20)*12.56 ' YData next #Chart1.XHasValues=1 #Chart1.SetData(a) '***************************** 'Two XY Charts '***************************** dimf a(4,10) dims leg$(100) for i=0 to 9 a(0,i)=(i+100)*4 a(1,i)=(i+20)*12.56 a(2,i)=(i+100)*5 a(3,i)=(i+20)*16.56 next #Chart1.XHasValues=1 #Chart1.SetData(a) '***************************** 'Charts with Legend and Color '***************************** dimf a(1,10) dims leg$(100) dimi col(100) tot=0 for i=0 to 9 a(0,i)=(i+10)*400 col(i)=(i+1)*1000 leg$(i)="Data"+(i) next #Chart1.SetData(a,leg$,col) |
Notes:
Special Chars:
Special chars in attributes (say value) should be escaped with a %.
For Example,
% should be %25
> should be
%3E
| should be %7C