Home

Welcome to TeeChart Pro version 3 - Activex Control

image

Contents

1. Chart OnClick You may use the OnClick event of the Chart to get the same information Private Sub TCharti_OnClick Dim t As Integer For t 0 To TChartl SeriesCount 1 If TChart1 Series t GetMousePoint lt gt 1 Then MsgBox Clicked Series TChartl Series t Name at _ point StrS TChartl Series t GetMousePoint Bnd If Next t End Sub TeeChart Pro v3 Chart guide 64 Custom drawing on the chart If you require to add textboxes or other shapes relative to chart axis the Shape Series may be the best choice If the shape Series doesn t match your specific requirement you may draw your own lines and or shapes on the chart Calculating Co ordinates This chapter explains how to convert from Point co ordinates to pixels and vice versa Also how to determine the exact co ordinates for each graphics element in Chart components Point Values are expressed in user custom scales Chart Axis are responsible for converting point values into suitable X and Y screen pixel co ordinates for displaying them Both Axis and Series components have several functions to convert from screen co ordinates in pixels to Axis or points values in user defined units The difference between using Axis or Series conversion functions is that Axis will only interpret co ordinates for the topmost position in 3D mode while Series will adjust co ordinates to their Z order position Note Using conversion functions is only va
2. The Chart will repaint and the horizontal bottom axis will be scrolled to the left a quantity of 1000 in axis scales The CheckLimits boolean parameter instructs the axis to scroll ONLY if there are more Series points in the scrolling direction Scroll event The Chart OnScroll event is fired every time users scroll manually the Chart Private Sub TCharti_OnScroll Labell Caption This chart has serolled 1 end sub TeeChartO Pro v3 Chart guide 83 Real Time Charting and Speed Two big rules apply to speed performance in real time charting 1 Plot as few points as possible 2 Use the fastest possible hardware Together these two rules really make a big speed difference when drawing charts many times continuously Some other suggestions are Use 2D Three dimensional charts are slower to paint than 2D Make Charts small Bigger charts need more pixels to be filled Remove Chart Legend and Titles when possible Use default fonts and font sizes Use FastLineSeries for fastest way to plot many points Use solid pens and brushes styles Avoid using circular shapes or circular bar styles Don t use background bitmaps or gradient fill effects Set Chart Bevellnner and BevelOuter properties to bvNone When possible set Chart1 AxisVisible to False to remove axis Set your video mode resolution and colour depth to the optimum values according to your video card A combination of 800x600 x 256
3. The moving average function permits you to track the current average as your data charts You may define the period over which the moving average steps Fig 10 9 Moving average applied to track data in a candle Series 0 13 12 96 20 12 96 27 12 96 03 01 97 10 01 97 17 01 97 Exponential Average The exponential average is similar to a moving average It has a weight factor to add importance to more recent data The diagram shows an exponential average with weighting 0 2 TeeChart Pro v3 Chart guide 61 Fi g 10 2 Fredsco Web Page 2D 40 01 97 17197 240197 31901197 7102 97 14 02 97 Momentum A momentum Series is defined usng period The curve takes the last value of the period and subtracts the first value Fi g 10 3 Travel Sales 2D Momentum Series Period 10 15 01 97 1 02 97 15 02 97 1 03 97 15 03 97 Flights booked Momentum Fitted Curve The CurveFitting Function performs a polynomical gaussian calculation on the underlying Series data to draw a smooth curve over the original points Fig 10 5 l Lottery participation 2D Curve fit 15 01 97 a No of people Fitted curve R S I Relative Strength Index RSI is often used in financial applications TeeChart Pro v3 Chart guide 62 Fig 10 4 2D RSI curve calculating over the last 20 data points of a candle series Relative strength index 20 01 97 27 01 97 TeeChart Pro v3 Chart guide 10 0
4. We suggest that you to play with each different sample project and create new small projects to test TeeChart with your real data TeeChart Pro v3 Chart guide 29 Charting reference This section describes design considerations specific to each chart and Series type Rather than attempting to list all properties that are anyway better covered and more easily navigable via the online help file we would like to bring to your attention points of interest that may help in the design of your application To understand the design paradigm of TeeChart we need to separate conceptually the contents of the chart the data Series from the chart itself e g its axis format legend and titles We can define and work with Series across chart boundaries referencing Series components independently of the chart We may however copy and paste a chart and it will copy with all its defined contents axis legends and Series TeeChart Pro v3 Chart guide 30 The Chart components Chart component There is 1 chart component TChart Chart subcomponents The Chart component has subcomponents If for example you wish to access or modify the property of an axis of your chart you will be modifying the property of one of the following subcomponents AXIS TOP Axis Left Axis Bottom Axis Right See the online help to get a complete list of axis properties Legend is another example of of a TChart subcomponent The Chart as backdrop to y
5. view percentage 3D Fig 8 15 E Computers Income by Division O Telecoms DE AE A 3D o B Electronics 1 150 combining E Index P O gt 1 100 Series types Pec A 4 050 e 6 3D 3 S aJ 1 000 a A x 20 10 0 Apr May Jun Sales Month Or you could modify code so that at runtime the chart will put all Series in the same Z plane 3D charts have a property called Z Order see figure which controls the depth position of each Series It is possible to put all Series on the same plane although we advise caution as the effect may be confusing depending on which Series types you are combining The following line of code name of chart here TChart1 will put all Series in the same Z plane TChart1 Aspect ApplyZOrder False TeeChart Pro v3 Chart guide 48 9 Extended Series Fig 9 1 2D Candle There are 5 Extended Series Types included with TeeChart Pro Activex Control Candle 11 000 10 000 10 500 with moving 10 000 average and volume Fig 9 2 Candle zoomed The Candle Series properties include HighValues LowValues OpenValues and CloseValues and DateValues The candle is ideally suited to tracking financial market information Example If you look at the figure of the zoomed candle you can see how the financial information is tracked White bars reflect the market rising high end of the white bar being the day close The red bars identify a fall in the
6. 1 e 1997 mmm vbYellow TChart i Series 2 Adad Raad s0 Forman 1 ESE 1997 mmm vbGreen Next End Sub 11 We populated the data for 12 months but are showing only 5 months The Paging tab in the Chart page of the editor has the definition of points per page Set Points per page to 5 TeeChartO Pro v3 Chart guide 40 Bar Series disp lay The Multi Bar parameter set in the Format tab of the Series page for one of the bar Series sets the display alignment of the bars for each bar Series in the Chart It is not necessary to go to each bar Series to change the parameter The following figure shows different formats to display bar Series Each Chart has the same information only displayed in a different way The Stacked 100 Series display doesn t represent the actual values but rather the relative value of each element of the Series to a total of 100 May Fig 8 4 a A 3D Bar Series showing four methods to display the same Jan Feb Mar Apr May information Sales Month Fig 8 4 b Jan Feb Mar Apr Sales Month Fig 8 4 c Ss Jan Feb Mar Apr May Sales Month Fig 8 4 d 400 ES E 50 5 Jan Feb Mar Apr May Sales Month TeeChart Pro v3 Chart guide Stacked property None Side Stacked Stacked 100 41 Horizontal bar The horizontal bar Series shares the same properties as the bar Series Apart from any aesthetic requ
7. CalcxXPosValue 22 5 Top TChartl1 Series 0 CalcYPosValue 5000 Right TChartl1 Series 0 CalcxXPosValue 57 6 Bottom TChartl1 Series 0 CalcYPosValue 15000 TChart1 Zoom ZoomRect Left Top Right Bottom TeeChartO Pro v3 Chart guide 34 Backdrop You can add more information to your chart or simply enhance its appearance by adding a bitmap as a backdrop Fig 7 1 Bitmap asa chart backdrop You will find the parameters to define your Chart backdrop in the General tab of the chart page of the Chart editor TChart component The TChart component is the basic building block for all charts Select the TChart component from the toolbox and simply drag it onto your form to include a chart in your application Database connectivity The Datasource for the Series is defined by the Series definition not by the chart Thus multiple Series in a TChart could access different data sources Creating the Dataset TeeChart charts will connect with all ODBC version 3 compatible datasources The minimum that requires to be set in each case is 1 The name of the ODBC DSN 2 For the table the TableName of a table or in the case of the query a valid SQL string TeeChart Pro v3 Chart guide 35 Connecting your Series to a database Dataset In Getting Started you saw how to connect a data Series to a database dataset Let s recap here on the key components When you select your new Series in the Chart
8. 358858 rene Mn ne ee manne ne One nt eue 12 TeeChart Pro 3 Activex pack contents 12 TeeChart COMPONENES c 5 scerccdccceesesedousecea jeseesvedertetedesodvasedarte vedoeseridvvecdiricedeededebgetaoisedeseede sense 12 Tee Chart COMPONEHES cio 12 ISLAMALIONSL PDE EE ER a deta a cia 13 Visual Bas A leads iD 13 Visual BASIC DS AE AE A E ME ANT Ra 14 3 Using TeeChart on line help and tutorials ss 15 Using TeeChart on line help iii 15 Selecting the TeeChart component 15 Selecting a TeeChart property method or event ss 15 Help in the TeeChart Chart Editor 15 Acc ssing the Tutorials ii atada iaa 15 4 Editing Charts ii 16 Navigating the Charts Editors a mia ro mn ek et en A edad 16 Pages of the Chart Editor sisi 16 Page tab sections of the Chart Editor cooonooncooconnncnnnnonnonnononocnononnnnononnnnnonononnononononnononnnanononoss 16 Calling the Chart Editor at runtime us 16 5 A TeeChart quick Start guide ss inennenennnnnnenenennnnenennennees 17 Th T Charts Control iii das 17 Creating a new chart with TChart component 0 cccceesssssececececeesensecececececeensnssseeeeeeseeensntssaeess 17 Creada New A aii 17 Edit then w Carbo A ment A acid 17 The Chart editora hd seh Si tetes te 18 Add AAA Deres pac e enter net nds t ee s dr tienne tonte eco de san a 19 Edit th Series A na te A titre ne 20 Programmatically adding data to a Series 20 TeeChart Pro v3 Chart guid
9. Create a new Form Create a new form and place a TChart component on it Select it on the toolbar and drag it to size on the new form Drag the corners of the new TChart component out to a size that helps you visualise the contents of the new chart as you define it Later you can adjust the size of the chart to suit your needs Edit the new chart Position the mousepointer over the new chart and press the right mousebutton A menu appears that includes the Edit option This menu may vary slightly depending on the programming environment in which you are working TeeChart Pro v3 Chart guide 18 Fig 5 1 Using the right mouse button on the chart will call the Chart Bring Ta Rront options menu Select the Edit option to edit the chart and define and populate its data Series The Chart editor Fig 5 2 The Chart Editor screen GE range The Chart page 15 page of the Chart editor contains definition information for the chart There are various sections to define general and other more specific chart parameters Some parameters won t apply until you have some data Series defined in the chart Try modifying a parameter the Title for example and you will see it update in real time on the chart Let s chart some data To do that we need to create a data Series TeeChart Pro v3 Chart guide 19 Add a data Series Press the Add button in the Series tab section o
10. Editor Series page you will see the tab option for Data Source If you want your data Series to be connected to a new dataset then you should select ODBC Datasource from the drop down combo listbox A new option tab will appear with the options for definition of the new datasource The exact contents of the page will change depending on the Series type you have chosen The parameters you set here modify the properties in the Series definition which vary between Series type The following table shows the possible options for normal Series types function Series are different their datasources are other Series please refer to the Functions section of this document SERIES TYPE DATASOURCE PROPERTIES fe ee SO ES CR E XValues YValues XLabel XValues YValues XLabel XValues YValues called Bar XLabel StartXValues StartYValues XLabel EndXValues EndYValues Bubble Xvalues YValues XLabel RadiusValues Gantt StartValues EndValues AY Y axis level AXLabel Label optionally shown on Y axis or as mark Shape XO Top YO Bottom X1 Left Y1 Right TeeChart Pro v3 Chart guide 36 Extended Candle OpenValues CloseValues HighValues LowValues DateValues ErrorValues XValues YValues 3D Surface XValues YValues ZValues Volume XValues YValues VolumeValues XLabel Coding your datasource You may populate your Chart at runtime by coding which Series to add to the chart and defining the f
11. LineSeries with some random data Clear lt this removes all points from Seriesl let s add 60 minutes from 12 00 to 12 59 For 0 To 59 AddXY TimeValue 12 amp t 00 Rnd 100 vbRed Next t let s add 60 more minutes from 13 00 to 13 59 For t 0 To 59 AddxXY TimeValue 13 t amp 00 Rnd i00 vbRed Next t End With End Sub This code will Clear Series 0 and plot two hours of random values from 0 to 100 Because it is placed on the Form Load event each time the form is shown this code is executed Double click the Command1 component to see its associated Click code TeeChart Pro v3 Chart guide 27 Private Sub Command1_Click Dim h m s As Integer m Minute TChart1l Series 0 XValues Last h Hour TChart1l Series 0 XValues Last add a new random point to the Series one more minute s 0 m m 1 If m 60 Then m 0 h hAh l End IF TChartl Series 0 AddXY TimeValue h m s Rnd 100 vbGreen The next source code is the demo purpose How to scroll the Horizontal Axis as new Points are added to the end The easy way is to type the following code at the continuation in the Command1 Click event This is called each time a new point is added to the Series Now scroll the axis to show the last hour of data SerolilHorizAxis End Sub In this example we scale the bottom horizontal chart axis to show 55 minutes prior to the last point and 5 min
12. TChartl Series 0 YValues MyHalfwayPoint CInt Maximum Minimum 0 5 Minimum then calculate the Screen Pixel co ordinate of the above valu YPosition TChartl Axis Left CalcYPosValue MyHalfwayPoint With TChartl Canvas change pen and draw the line avoiding the 3D areas and axis of the chart Height3D Width3D Pen Width 3 Pen Style psSolid Pen Color vbBlack With TChartl Canvas MoveTo Axis Bottom CalcXPosValue 0 YPosition Canvas LineTo Axis Bottom CalcXPosValue 0 Aspect Width3D YPosition Aspect Height3D Canvas LineTo Axis Bottom CalcXPosValue Axis Bottom Maximum _ Aspect Width3D YPosition Aspect Height3D End With End With End With End Sub Series Methods Series have similar methods for converting co ordinates to point values and vice versa The main difference is that by using the Series method you don t need to know the exact Axis component for calculations This is a big advantage when having Series associated to Right or Top Axis or multiple Series associated to each Axis This code calculates where in the screen the Series 0 point with value 1000 is located Dim MyPos as Integer MyPos TChartl Series 0 CalcXPosValue 1000 or MyXPos TChartl1 Series 0 CalcXPosValue TChartl Series 0 XValues Value 0 t es First point J Chart Canvas TeeChart Pro v3 Chart guide 66 Chart Canvas is derived from a standard Delphi Canvas You may contr
13. Use the Gantt chart as a planner or to track progress of a project or Series of activities The Gantt Series draws bars that have start and end values which may be of datetime format You may define a Y axis value for the vertical position of the bar and you may define next bar to draw connection lines between the bars Fig 8 10 Testing 2D Chart ce with a Gantt Launch Promotion ne Series Doc Publishing ER it SSS ds Lo ial Design m me me Al 6 6 amp 8 5 LE f How to add Gantt bars manually Use the AddGantt or AddGanttColor methods Example With TChartl Series 0 asGantt AddGantt DateValue 1 1 1997 DateValue 31 1 1997 2 _ Hello AddGantt DateValue 1997 1 15 DateValue 1997 2 15 1 _ Nice AddGantt DateValuef 1997 2 1 DateValue 1997 2 28 0 World AddGantt DateVaiue l997 3 i DateValuef 1997 3 31 2 TV AddGantt DateValue 1997 4 1 DateValue 1997 4 30 0 AddGantt DateValue 1997 3 15 DateValue 1997 4 15 1 change connecting lines ConnectingPen Width 3 ConnectingPen Color vbBlue increase bar heights Pointer VerticalSize 16 End With Or With TChartl Series 0 asGantt AddGantt DateValue 1 1 1997 DateValue 31 1 1997 2 _ Hello vbGreen End with Where 2 is the desired vertical position for this bar TeeChart Pro v3 Chart guide 45 Choose the vertical position you prefer To co
14. colours can be faster than 1024x768 x 32k colours on average video cards Use Windows 95 or Windows NT with accelerated drivers for your video card TeeChart Pro v3 Chart guide 84 Index Separation See Separation Active 70 Add 55 Adding See series AddOHLC 47 AddSeries 70 AddXY 73 AllowZoom 31 Area 40 Area series 40 Arrow 42 asArea 77 asArrow 77 asBar 77 asBubble 77 Automatic axis scaling 26 Average 52 59 axis 29 30 63 66 69 Bottom 81 Bottom 66 labels 30 Left 66 Top 66 Bar 37 barstyle 37 BMP 31 Bottom Axis 26 Bubble 42 CalcPosPoint 63 CalcXPos 64 CalcXPosValue 32 64 CalcYPos 64 CalcYPosValue 32 candle 47 candle series 47 Canvas 29 65 CheckLimits 81 ClassInheritance 76 Clipping 79 CloseValues 47 colour 75 CurveFitting 60 CustomDraw 69 Data Source See Datasource Database See Datasource Dataset 33 See datasource DataSource 21 33 53 DateTime 67 TeeChart Pro v3 Chart guide DateValues 47 Delete 73 Desired increment 30 Divide 57 draw 63 EMF See metafile Error Series 48 events 62 ExchangeSeries 38 Exponential average 59 Export 31 Extended series 47 Candle 47 Error bar 48 Polar 50 Surface 49 Volume 48 fast 82 Fast line 36 fonts 79 function 22 51 Changing 53 Deleting 53 Functions 51 Add 55 Average 59 CurveFitting 60 Divide 57 Exponential average 59 High 58 Low 58 Momentum 60 Moving average 5
15. market The thinner lines show the day s high and lows The following code shows use of the AddOHLC method This code fills the Series evenly divided across the screen with random data You could substitute the random clauses with sources of you own data or connect your CandleSeries directly to a dataset via the Chart editor Dim tmpopen tmp As Integer With TChart1 Series 0 Clear tmpopen 1000 Rnd 100 For 1 Ze 8 tmp Int 100 Rnd 50 asCandle AddCandle Date t tmpopen tmpopen 20 tmpopen 20 tmpopen tmp TeeChartO Pro v3 Chart guide 49 tmpopen tmpopen tmp Next t End With Volume The volume Series is another Series with origins in financial markets It behaves very much like a bar Series except that each bar is represented as a thin line and the bars cannot be stacked Volume series with moving average Fig 9 3 Volume Series with moving average 1 01 97 801 97 15 01 97 22 01 97 Errorbar The height of the T on top of the bars of the Error Series show the size of the error Error bar Series may be applied to any data that has a real and estimated value a success and failure level etc Fig 9 4 3D Error bar Surface Surface Series use co ordinates in 3 planes TeeChart surface Series support null values as none data points which appear as holes in the surface TeeChart Pro v3 Chart guide 50 Fig 9 5 3D Surface chart TeeChart Pro
16. tab From the listbox select your data source type There are 4 types of data source available The DataSource style is a component property that may be one of the following TeeChart Pro v3 Chart guide 23 1 No data if points are being added programmatically at source code Or 2 Random values draw your chart Series with random values Or 3 A function which may be One or more other Series like LineSeries1 BarSeries2 etc which could come from this chart or from another chart in your project A function may work with a combination of one or more other Series and an algorithmic function min max average etc or 4 An ODBC Database which may be Any valid ODBC v3 Datasource Adding a dataset For our example let s choose the 4t option from the previous section ODBC Database style In our TChart we ll include data from the example MS Access mdb database included as a demo with TeeChart You need to select the listbox option an ODBC database to map this Series to a table in the teedemo mdb database As you make the selection you will notice new page options appear to define the dataset for the pie Series Your editor should look like Fig 5 7 l Fig 5 7 Chat Series The Chart Seriest Y Fie Seriest Editor screen Fomat General Marks Data Source showing the Data sour ata source Dataset ve e tab for our pie Series Labels
17. the Series tab allows you to edit your Series The next step is to add data to the Series The steps necessary to include the data for the Series vary slightly depending on whether you are going to program your data input or if you wish to access an ODBC datasource directly See the following 2 sections Programmatically adding data to a Series for a description on how to programmatically add data to a TChart Series Configuring an ODBC datasource for a Series describes the actions necessary to add an ODBC datasource to a TChart Series Programmatically adding data to a Series We have a TChart on the form and have added a Series to it We are ready to populate the Series Let s type some code to add points values programmatically We ll see later how to create a database aware Chart with automatic record retrieval Example Pie Series Suppose the Series we added were a Pie Series We could populate the Series in the following way For the following code to work we should leave the Series name as its default of Series 1 Visual Basic Place a CommandButton on your Form and go to the OnClick event Copy the following code at the Command1 Click event Private Sub Commandi_Click With TChart1 Series 0 Add 40 Pencil vbRed Add 60 Paper vbBlue Add 30 Ribbon vbGreen End With End Sub A description of the Add method and other available methods and properties is available at design time via the context sensitive he
18. v3 Chart guide 51 Polar The polar Series plots XValues as angular rotation from 0 The second variable YValues are plotted as distance from the origin Fig 9 6 2D Polar Series TeeChart Pro v3 Chart guide 52 O Functions Functions are independent components that use Series When you add a new function really what you are doing is adding a new Series as any other then applying a function definition Normally that function works upon one or more other Series to give a dynamic result For example if you define a line Series A which has various values across one year and then you define a Series B which contains the function Max A then you will be using Series A as the input for the new Series The Max A function datasource of Series B will scan the data from Series A to find the maximum value then plot its own data as that value The Series type of the function is configurable you may use any Series type to represent your function data provided that the Series type mix on the chart complies with the general rules for combining Series types You may define a Function to use input Series from another chart as its Datasource Note When you add a function from the gallery of the Chart Editor by default you will adda LineSeries You may change the type of Series afterwards to any other available Series type using the Change button In general all functions work to the same basic rules
19. 0 Shape 44 Surface 49 Volume 48 Series class 36 Shape 44 shapes 63 Speed 82 SQL See Query Stacked 39 stairs 36 subcomponent 31 subcomponents 29 Subtract 52 56 TChart 16 33 ticks 37 Titles 37 Top Axis 26 valueindex See OnClickSeries volume series 48 WMF See metafile wysiwyg See printing X Values 23 Y value 23 Z order 63 71 zoom 31 79 Enable 79 OnZoom 80 Undo 80 ZoomRect 80 TeeChart Pro v3 Chart guide 86 Zoom AnimatedSteps 80 ZoomRect 32 tee ChartPro Thank You and Good TeeCharting teeMach SL P O Box 22262 08080 Barcelona Tel 34 7 259 71 61 Fax 34 3 423 59 82 email info teemach com www www teemach com TeeChart Pro v3 Chart guide
20. 1 Axis Left SetMinMax 0 10000 J TeeChart Pro v3 Chart guide 68 DateTime Axis Note An Axis contains DateTime scales when the associated Series components have XValues DateTime or YValues DateTime properties True There is no DateTime property for Axis Changing scales in DateTime Axis is the same as for non datetime values With TChartl1 LeftAxis begin Automatic False Minimum DateValue 1 2 1998 Maximum DateValue 28 2 1998 End with Logarithmic Axis An Axis can be to Logarithmic only if Axis Minimum and Maximum are greater than or equal to zero This is the only difference between setting linear and logarithmic scales Note Axis Labels are not displayed in logarithmic increments You can generate custom Axis Labels see chapter below Inverted Axis An Axis can be Inverted so Axis Minimum and Maximum are swapped We suggest you use Inverted True as little as possible as it can give misleading results due to its normally rarity of use Axis Styles amp Increment Axis can be displayed in several ways with tick lines or without with grids or without with Labels or without and you can customise all formatting properties such as colours fonts and pen styles The Axis Increment property controls the number of grid lines and labels and the distance between them By default it s zero meaning Axis will automatically calculate the Labels increment Setting the Axis Increment property is independent
21. 2 97 17 02 97 63 1 1 z Working with charts and series You have seen how to create a chart add Series and populate them Now we ll take an introductory look at how to access the chart data at runtime This chapter highlights some of the more common ways to program access to chart data You will find more detailed information and example code on these and other advanced subjects in the TeeChart tutorials Click events Chart OnClickSeries The TChart event OnClickSeries permits access to any active Series in your chart Put the following code into your project To access the event and add the procedure definition to your project in Visual Basic double click on your chart The Left Object Combobox will show the name of the TChart and the right will list the event procedures associated with the Chart Select the event OnClickSeries Private Sub TCharti1_OnClickSeries ByVal Series As TeeChart ISeries ByVal ValueIndex As Long ByVal Button As TeeChart EMouseButton ByVal Shift As TeeChart EShiftState ByVal X As Long ByVal Y As Long MsgBox Clicked Series Series Name at point Strs ValueIndex End Sub The valueindex refers to the index of the Series data point point bar etc within the chart You may use it to access the X and Y value For example MsgBox Clicked Series Series Name at point _ Str Series XValues Value Valuelndex _ Str Series YValues Value ValueIndex
22. 2 input Series the default period for the divide function is 1 The 2nd Series in the list is the denominator If you add more than 2 Series then the 1 will be divided by the 24 then that is divided by the third etc Fig 10 5 Divide function month month2 month3 month4 months month6 O Series3 E Series1 E Function Divide TeeChartO Pro v3 Chart guide 59 High High accepts multiple input Series and will always display the highest point between those Series at each period point 1 Series default period 0 2 or more Series default period 1 Fig 10 6 High function month month2 months month4 months month6 O Series3 E Series1 E Function High Low Low accepts multiple input Series It will always display the lowest point between those Series at each period point 1 Series default period 0 2 or more Series default period 1 Fig 10 7 Low function month month2 month3 month4 months month6 O Series3 E Series1 MA Function Low TeeChartO Pro v3 Chart guide 60 Average Fig 10 8 Average function month month2 months month4 months month6 E Series GB Function average The default period for average with one Series is O all which will give you the average for that Series across the whole chart If you have more than one Series the period will be 1 axis point You may change the period to alter the frequency of the average curve Extended Functions Moving average
23. 9 Multiply 57 period 55 Relative Strength Index RSI 60 Subtract 56 Gantt 43 Grid lines 68 GridVisible See CustomDraw High 58 HighValues 47 horizontal bar 40 HorizontalBar 40 increment 30 Inverted 67 JPEG 31 Labels 23 See axis LabelsSeparation 67 LabelStyle 68 Left Axis 26 Legend 29 Line 36 loAscending 72 loDescending 72 Logarithmic 67 loNone 72 Low 58 LowValues 47 margins See printing MaxValue 75 Metafile 31 78 Metafiles 79 minor 37 MinValue 75 Momentum 60 Moving average 59 Multi Bar 39 Multiply 57 null 71 Null Values 71 ODBC 33 OnAfterDraw 66 OnBeforeDrawseries 66 OnClick 62 OnClickSeries 62 OpenValues 47 Paging 38 ParentChart 38 pen 79 performance 82 Period 51 54 55 Pie 21 23 41 Pie series 41 pixels 63 Point 41 63 Point series 41 PointColor 75 PointLabel 76 polar series 50 PosAxis See CustomDraw PosLabels See CustomDraw PosTitle See CustomDraw printer See printing printing 77 properties 36 QuickReports 31 RadiusValues 74 random 38 RecalcMinMax 75 Relative Strength Index 60 Repaint 65 85 Right Axis 26 royalties 7 RSI See Functions Scroll 79 Enable 81 ScrollForm 25 Scrolling 81 separation 31 Series 36 Active 70 Adding 69 Area 40 Arrow 42 Bar 37 Bubble 42 Candle 47 Delete 73 Error bar 48 Fast Line 36 Gantt 43 Horizontal bar 40 Line 36 Pie 41 Point 41 Polar 5
24. Axis LabelStyle property control axis labelling modes TChart1 Axis Bottom Labels Style talValue Possible values are Labels display Axis scales Labels display Series Point Marks Labels display Series XLabels No labels displayed Style is automatically calculated When LabelStyle is talText TeeChart will set it automatically to talValue if Series have no XLabels For talMark and talText styles axis labels are displayed exactly at Series point positions thus not using the axis Increment property For advanced techniques for working with Axis labels see the TeeChart Pro tutorials TeeChart Pro v3 Chart guide 70 CustomDraw Axis CustomDraw adds more axis to your chart As many as you wish CustomDraw adds an axis as a copy of an existing axis at a new location The following example populates a line Series with random data And creates 2 additional axis There are 3 configurable locations PosLabels PosTitle and PosAxis to place respectively the labels title and the axis The last parameter GridVisible which is boolean defines whether to extend the axis grid to the new axis Private Sub Commandi_Click Dim t As Integer For t 0 To 20 TChart Series 0 AddxyY ts 100 Rad 1 Bnd 70 i vbRed Next End Sub Private Sub TChart1 OnBeforeDrawSeries Dim posaxis As Integer With TChart1 When scrolling or on zoom always keep the gridlines enclosed in the Chart r
25. Chart Editor Series page showing editor tab for our Pie Series Chart Series Eos Pie Series Format General Marks Data Source I Circled Pie F 3D Color T 3D Shadow IV 3 Dimensions F Dark 3D Pie Pie Border Shadow ealan Rotation fo Custom Pie Radius Radius fo Y Auto J Pattems YRadius 0 FN Auto acte Color Many things can be done visually in the editor or try modifying some parameters in Object Inspector or modifying a property with your own code For more advanced projects you ll most likely find yourself typing some code Now we ll take a closer look at how to add data using an ODBC datasource Configuring an ODBC datasource for a Series Prior to using any database facilities you should have correctly installed ODBC version 3 in your Windows environment TeeChart s ODBC demo database We have included demo database tables in DBF format as an example ODBC datasource The ODBC DSN called TeeChart Sample Data is automatically added to your system when TeeChart is installed A Step by step guide to creating a database aware chart Select and install a Pie Series as described in section Edit the new chart Go to the Series page of the Chart editor by either double clicking on the Series name highlighting the Series and selecting Edit or by selecting the Series tab Select your Series from the Series listbox and go to the datasource
26. Series in the Series list You can use SeriesCount to traverse all Chart Series for t 0 to TChartl SeriesCount 1 With TChartl Series t do Color vbBlue End with Next t Deleting Series Series can be hidden in 2 ways A Setting the Series Active property TChartl1 Series 0 Active False B Destroying the Series completely TChart1 RemoveSeries 0 TeeChart Pro v3 Chart guide 72 Changing the Series Z order at runtime In 3D mode when Chart1 View3D is True all Series are assigned a Z order position That is the order where Series will be drawn starting with the far most Series on the Chart 3D space You can control the order Series will be drawn using this method TChartl ExchangeSeries 0 1 Adding Points Every Series type has at least 2 values for each point These values are designed as X and Y point co ordinates Note Values are defined as Double floating point variables Extended Series types have more than 2 values like BubbleSeries has X Y and Radius values for each point So each Series type has its appropriate method to add points although the most common Series types like Line Bar Point and Area share the generic AddY method to add points The following code empties a Pie Series and adds some sample values to it TChartl Series 0 Clear TChartl Series 0 Add 1234 USA vbBlue TChartl Series 0 Add 2001 Europe vbRed For extended Series types please re
27. The properties of the underlying Series type Line Bar etc apply to the function Series Thus a function added as a Bar Series will have standard bar properties such as barwidth There is one important property that distinguishes function Series from non function Series Period Period applies to repetition of the function For example I want the average of all points of Series will present one flat line across the chart which is the average I want the average of all points of Series1 by month will draw an average for each month and will display as 12 different values across a chart of 1 year Important Study the implications of period carefully before applying it to your chart Series When you have only 1 Series in your function the function will by default not apply period and you must add it manually by code if you require period breakdown of the Series data When you have more than 1 Series in your function the default applied is period 1 If you wish to obtain any other period for the function you must add it manually by code Period is based on number of points we don t recommend the implementation of functions composed of Series with distinct point frequencies Adding a Function with the Chart Editor Functions may be added using the Chart editor at design time Similarly to adding a Series you may use the TeeChart Gallery to choose the function In the Gallery all functions are initially displayed as LineSeries funct
28. Tutorials Tutorials are in HTML format and due to Activex content of some pages are best seen with an Activex enabled browser such as Internet Explorer TeeChart Pro v3 Chart guide 16 4 Editing charts Navigating the Chart Editor Pages of the Chart Editor How can we best navigate in the Chart Editor We hope you find the Chart Editor reasonably intuitive For all configuration relating to the chart and not specific to a particular Series got to the Chart page of the Chart Editor For any parameters that apply specifically to a Series go to the Series page where you may select the Series from a drop down combo box Selecting a Series activates the Series definition tab pages to the parameters of that Series Page tab sections of the Chart Editor Each Page of the Chart Editor has several tabs that contain the configuration parameters of the page Each tab groups like parameters for example parameters that apply to axis format are grouped together on the axis tab of the Chart page Calling the Chart Editor at runtime Use the Showeditor method eg TChart1 Showeditor TeeChart Pro v3 Chart guide 17 5 A TeeChart quick start guide The TChart Control There is one TeeChart icon in the component palette 2 TChart TChart is the basic building blocks of all TeeChart charts Creating a new chart with 7Chart component This section describes the common steps needed to start defining either your chart
29. Welcome to TeeChart Pro version 3 Activex Control tee hartPro teeMach TeeChart Copyrights O 1995 1997 David Berneda O 1997 teeMach SL All Rights Reserved This manual is Copyright 1997 of teeMach SL All rights reserved No part of this manual may be reproduced or distributed in any form or by any means or stored in a database or retrieval system without the prior written permission from teeMach SL with the exception that the program listings may be entered stored and executed in a computer system but they may not be reproduced for publication While every precaution has been taken in the preparation of this book teeMach SL assumes no responsibility for errors or omissions or for damages resulting from the use of the information contained herein C Builder and Delphi are trademarks of Borland International Inc Activex is trademark of Microsoft Corporation All other brand names and product names included in this book are trademarks registered trademarks or trade names of their respectives holders Contents BE OCU CUO Ih di a a et cu 7 1 Introduction iia di 8 LACA a EERE 8 About Techado daba 9 Tee Chart Versions nest e cous Belen Es Pa aar es gad estaba deuce eee gah eae dad sede renier eee 9 TeeChart version 3 VCL Version included with Delphi 3 9 Te Chart Prove VOIR en cis abe ae vee A AREA IES 9 TeeChart Pro Activex Control version 3 10 Ea A ct ete il 11 2 Installing TeeChart 55
30. alculating Co ordimates ccccccccsssssecssssssecsssnssecsesensecsessusecseseusecseseusecssesusecseeessecseseaaeceeeenees 64 Chart Canvas in hier miel nitrate osthasvaacadas a ENE a A E TSS 65 REPAIR A AA a eA ONE ee 66 When to draw ain A A e tein ai iin atte 66 Setting Axis scales nt in bado 67 CustomDraw AXIS cana ds ci 70 S ries MANIPULA td A A AA A AAA A sed ete 70 Adding Series At runtime ian eis an aE iii imite aie 70 SEFIES ACTA alas ate 71 Seres COUPLE cta lea oido 71 D l ting A NN 71 Changing the Series Z order at runtime us 72 Adding POMts ti tii 72 AOAN Aa E E EEE E E E O rio tilda 72 Controlling Points O Fd OT sisi 73 O POMO T nas 74 Pot MMS ib a Ie te er tu 74 D l ting Pots ind E SOE caste gat cod a tds tt 74 Retrieving and modifying Points us 75 TOC atin e Roms cli aid OR a A Ao Ed 75 Point Statistics aiii dba 76 O tale trad tas 76 Pont Colours n pureso A A Mellen wd eR ae ei AAA Ad dt 76 Point Labels A aa ee BA Alea a Ga Ai 77 Changing the Series type at runtime Advanced nooocooooccnccncnnnonononononononnnnnanononononnonnnnanonononoss 77 Series type specific properties and methods 77 Printing Chata A oe a diia 78 TeeChartO Pro v3 Chart guide MIA ao 78 Detalla nn ins M Men TR A liada 78 Print Rrinthandsca pe inicia 79 Windows and printers limitations 80 Chart Zoom and Scrolls ado 80 Li OU PEE AS aaa loa a aa Sees ca doh Ea Wha tas eee TR ae 80 Animated Zoom tt ii 81 LOOMING COLE A Na ds 81 U
31. ations Dim MyTotal as Double Dim t as Integer MyTotal 0 for t 0 to TChartl Series 0 Count 1 MyTotal MyTotal TChart1 Series 0 YValues Value t Next t Msgbox Str MyTotal Extended Series types have additional array properties such as BubbleSeries RadiusValues You can access these properties in the same way as with XValues or YValues arrays if TChartl Series 0 asBubble RadiusValues Value Index gt 100 then Modifying point values can be performed using the above properties TCharti Series 0 YValues Value 0 _ TChartl Series 0 YValues Value 0 1 TChart1 Series 0 RefreshSeries Locating Points The XValues and YValues Locate function searches a specific value in the List and if found returns the value Index starting from zero Dim MyIndex as Integer MyIndex TChart1 Series 0 YValues Locate 123 if MyIndex 1 then Msgbox 123 not found in Seriesl else Msgbox 123 is the Str MyIndex 1 th point in Seriesi End if TeeChartO Pro v3 Chart guide 76 Point Statistics XValues and YValues properties maintain the following statistical figures Total The sum of all values in the list TotalABS The sum of all values as absolute positive MaxValue The maximum value in the list MinValue The minimum value in the list You can call manually to RecalcMinMax method to recalculate MinValue and MaxValue Total and TotalABS are maintained automatically Th
32. dSeries Combol ListIndex Combo Lists assorted Series types Fill the new Series with random values Series 0 FillSampleValues 10 Series 0 Title Combol List Combol ListIndex Series End With Often used parameters All the parameters associated with charts are useful at the time you need them There are a few parameters however that are worth mentioning here in special context They are often used or serve to change the overall look performance or exportability of your chart For a more detailed study of these and many other configurable parameters please refer to section Chart reference Label increment separation and angle It may be difficult to fit all your axis labels onto the axis that displays onscreen ie this is often true of date labels which are long and can have a high incidence of change on the axis Label Increments TeeChart offers Label increment as a means to controlling the frequency of labelling on your Chart axis You can access the property via the Chart Editor under Axis select your axis Scales Desired increment The menu shows you a list of the standard options for time increments e g One second one minute one day etc Selecting one day will cut out repetitions of date on the axis showing the date label only once for the point range of that date Via code you may access the property as a property of the subcomponent for the relevant axis TeeChart Pro v3 Cha
33. ded Statistical functions Data aware Series Gallery 2D 3D Zoom scroll and real time Custom drawing Custom printing Extensive demo code Runtime Chart Editor and Gallery Online help amp HTML format tutorials Electronic reference manual Word format With TeeChart Pro ActiveX version you may build comprehensive Charting applications across a multitude of programming environments The extensive demos will show you how to build Charting applications to deploy on the Web or in internal Windows environments TeeChart Pro v3 Chart guide 11 Getting Started This section should bring you up to speed if you are trying out TeeChart Pro version 3 for the first time Building a chart from scratch is very quick with TeeChart so we recommend it worth your while to run through the examples in your own programming environment TeeChart Pro v3 Chart guide 12 2 Installing TeeChart TeeChart Pro 3 Activex pack contents The contents of TeeChart Pro Activex Control doesn t vary for the programming environmment in which you wish to install it The pack contains code examples and documentation for a variety of programming environments TeeChart Components TeeChart Pro contains components for all the supported operating environments The correct version specific components are selected at install time The following sections describe where TeeChart files are installed No registry entries are modified by the TeeChart installatio
34. e AS A a eG T SEITE GEER LEE 20 Editing the Seres E ta eels Bee conta Geek tasa ads 21 Configuring an ODBC datasource for a Series 22 6 Using the TeeChart emo iicrcicccicseds ii ii 26 Charting Re terenC C52 lan tal ds cl ee 29 7 The Chart components iiccicvoiiccciii ii ii li dl da ei 30 Charticomponent es selon ts RGR r id 30 Chart SubCOMpPOMents di dia nde 30 The Chart as backdrop to your Series occcccnnononononononnononnnnnanonononcononnnnononononnononnnnonononconocnannnnos 30 Associating a Series with a Chart su 30 Often used parameters iaa a da 31 TORA Component A A O a eta oo nonstate 34 Database connectivity aa 34 Creating th Dataset neccen usn nm onde da sed E tido 34 Connecting your Series to a database Dataset coccocoocoonncnnccnonnononanonononnonnananonononnononnananononoss 35 Coding your dat source Serea ene dates 36 SN O O ne el tes 37 DEPIES CLASS iii a lisa 37 Tane Seria rr da 37 MC A AAA AA AA AA E AA EA AAA PR ed 37 Hast Un a e anak aN aE a ins 37 NN 38 Example bar Series configuration 4 38 Bar Series display A een nn ta er ia de te 40 Horizontal ARE ER A TE ARS M NE Rte PE RE ES 41 ATOME E AEE A e M entr ie 41 PONS SE Re AR RS DA NN tte T eats 42 EAL AS SAS A Cee HR IE CESARE CET 42 ATT WA TS ANA OE RTS 43 Bubble naa a deban eos suesiees 43 O avebe ess vnlldarteoenas 44 How to add Gantt bars manually cocnnnnnuoococcnnnnnnonnonanononncnononnon nono noncnnononnnnonononnonnnnnon
35. ectangle Canvas ClipRectangle Axis Left Position _ Axis Left CalcYPosValue Axis Left Maximum _ Axis Bottom CalcXPosValue Axis Bottom Maximum _ Axis Bottom Position Always draw the 2nd vertical Axis at the middle point of the Chart posaxis Axis Left Position _ Axis Bottom CalcXPosValue Axis Bottom Maximum _ Axis Left Position 0 5 Axis Lef CustomDraw posaxis 10 posaxis 20 pos xis True Draw the 2nd Horizontal axis at the level of 10 on the vertical asis posaxis Axis Left CalcYPosValue 10 Axis Bottom CustomDraw posaxis 10 Dosaxis 40 posaxis True Canvas UnClipRectangle Do not carry over cliprectangle End With End sub Series manipulation This chapter documents how to manipulate Series and how to manipulate Series points and other Series internal data Adding Series at runtime You may add a new Series to a Chart using the following code TChart1 AddSeries scLine TeeChart Pro v3 Chart guide 71 ESeriesClass scLine will add a LineSeries Alternatively add a BarSeries scBar AreaSeries scArea etc See the online help for the full options of ESeriesClass Class references Series array Chart components store all Series in a Series list You have read only access to this list by using the Series array property TChartl Series 0 is the first Series in the Chart SeriesCount property The TChart1 SeriesCount property returns the number of
36. ectangle tmpLeft tmpRight Next t End With Repainting You should call Chart1 Repaint or Series1 Repaint to force a Chart component to draw again When to draw Best place to custom draw over a Chart component is at TeeChartO Pro v3 Chart guide 67 TChart1 OnAfterDraw event which is fired each time the Chart component is redrawn just before copying the internal bitmap to screen The equivalent of drawing before the Chart is drawn is to use the OnBeforeDrawSeries event after Chart walls and background have been painted Setting Axis scales Chart components have four axes Left Right Top and Bottom Axes are responsible for calculating pixel co ordinates for Series points and to allow any valid range so scroll and zoom can be always performed As new Series are inserted or new points are added to the Series Axis recalculate by default their Minimum and Maximum values You can turn off automatic recalculation of Axis scales by setting the Automatic property to false TChart1 Axis Left Automatic False Also both the Axis Minimum and Axis Maximum values can optionally be automatic or not independently of each other False True TChart1 Axis Left AutomaticMaximum TChart1 Axis Left AutomaticMinimum You can change Axis scales using the Minimum and Maximum properties With TChartl Axis Left Automatic False Minimum 0 Maximum 10000 End with or using the Axis SetMinMax method TChart
37. efault 15 printing margins The TChart ChartPrintRect TRect function returns after applying the printing margins the space where the Chart component will be drawn expressed as logical canvas units pixels or dots With PrintMargins you can define any area of any size inside the page Note When changing paper orientation margins are recalculated Detail Charts are printed in metafile WMF in 16bit EMF in 32bit format TeeChart Pro v3 Chart guide 79 Metafiles are scaleable vector formats so a wysiwyg effect can be achieved if sending to the printer how a Chart looks on screen However you might want to exploit the printer s bigger detail capabilities versus screen displays The TChart Printer Detail integer property controls how a chart is scaled when sending it to the printer By default Detail is zero Setting it to a negative value in the percentage range from zero to 100 makes the Chart proportionally bigger so there s more space for Axis Labels Smaller fonts are used as they will be clearer on paper than on screen Setting it to a positive value makes font sizes bigger Print PrintLandscape Several methods exist to print a Chart component TChart Printer Print TChart Printer PrintPortrait TChart Printer PrintLandscape The above methods will do the same print a Chart ona new page and eject form feed the page TChart Printer Orientation AOrientation TPrinterOrientation Will Change t
38. ese values are used to speed up several Axis scaling calculations and are used as helpers for percent calculations The ValueList Class has several other methods and properties to manipulate point values Please refer to online help documentation Notifications Whenever points are added deleted or modified the Series generates internal notification events These events are used to recalculate Series that depend on other Series points TChartl1 Series 0 RefreshSeries Will manually force dependant Series to recalculate their points Point Colours All Series maintain an internal List of colours One for each point in the Series You can access this list with PointColor array property to retrieve or change point colours Var Mylolor TColor MyColor TChartl Series 0 PointColor 0 TChart1 Series 0 PointColor 1 vbBlue TeeChart defines a generic colour constant named clTeeColor Points with clTeeColor colour will be drawn using the SeriesColor colour Visual Basic predefines constants for basic colours vbBlue vbRed etc Colours can also be expressed in RGB format Using a video colour depth of 16k colours or more results in better colour matching TeeChart Pro v3 Chart guide 77 Point Labels Each point has an associated text called PointLabel and declared as a string Point Labels are used in Axis Labels Chart Legend and Point Marks Labels are stored at Series PointLabel array property Vou ca
39. f the Chart page TeeChart will show you a gallery of Series types Select one to add to your chart you can change its type later if you decide that you would prefer to visualise your data in a different way A a TeeChart Gallery A ES Fig 5 3 Standard Functions Extended The Chart Bar Horiz Bar Area sis mi ds Point Pie Fast Line Arrow Bubble Gantt Shape E Le o Select a Series type by mouse or with arrow keys and press OK Double clicking on the Series type will achieve the same result The Extended Series page is only available in the Gallery with TeeChart Pro The Series type is automatically added to your chart In the Chart Editor you will see a new configuration tab added for the new Series Suppose we had selected a line Series The editor will appear as follows Editing DBChart1 E Fig 5 4 Chart Series New Series Series General Axis Titles Legend Panel Paging Walls added to chart TeeChart has added the Series to the chart It has also added some random values so that you can visualise in the chart the Series appearance at design time to easily follow any changes you are making TeeChart Pro v3 Chart guide 20 Compile your project The project should compile to show you an empty chart The random values don t work at runtime so the next step is to go back to the chart editor and add a data source or write your own code to add data values Edit the Series Selecting
40. fer to each specific Series reference to know which method should be used to add points Null Values In some circumstances you might have no values for specific points You should then add these points as zero or add them as null values Null values will not be displayed while zero values will be displayed as usual The following code adds several points and a null point With TChartl Series 0 Clear Add 10 John vbGreen Add 20 Anne vbYellow Add 15 Thomas vbRed AddNull Peter Add 25 Tony vbBlue Add 20 Mike vbCyan End with TeeChartO Pro v3 Chart guide 73 Each Series type will handle null values in different ways Bar HorizBar Line Area and Point do not display null points PieSeries use null values as zero Controlling Points Order Points can be optionally sorted either by their X values or Y values The Series XValues and Series YValues Order property controls the points Order TChart1 Series 0 XValues Order loAscending Possible values are loNone loAscending or loDescending By default XValues Order is set to loAscending and YValues Order to loNone which means new added points are ordered by their X co ordinate For non XY charts the X co ordinate is always the point position starting from zero The point Order is used by Series components to draw their points Note Order must be set before points are added to the Series You can change the Order
41. g any previous zoom in or zoom out operation either by code or using the mouse Note If you want axis scales to be at specific values after undoing zoom you can use the TChart OnUndoZoom event documented below Zoom Events The OnZoom event is triggered whenever zoom is applied to a TChart either manually or programmatically Private Sub TChartl1_OnZoom Buttonl Visible True make visible the no zoom button end sub TeeChart Pro v3 Chart guide 82 The OnUndoZoom event is called when undoing zoom by code or by mouse Scrolling Scrolling is very similar to zoom Axis scales are incremented or decremented and the whole chart component is repainted to show Series points at their new positions The Chart Scroll Enable property controls if users can scroll Chart contents by dragging the mouse Its possible values are pmNone No scroll is allowed pmHorizontal pmVertical Allow scroll only on these directions pmBoth Allow complete scroll over all directions Example TChart1 Scroll Enable pmNone no scroll is allowed You can programmatically scroll a chart using the Axis Scroll method Procedure Scroll Offset Double CheckLimits Boolean Example TChartl Axis Bottom Scroll 1000 True The above code increments Bottom Axis scales by 1000 This is the same as doing With TChart1 Axis Bottom SetMinMax Minimum 1000 Maximum 1000 End with and setting AxisBottom Automatic property to False
42. hart export Custom Chart Builder available with the native Delphi version of TeeChart Pro is not included in this release of the ActiveX version All the underlying native Delphi component architecture has been maintained Still inherent is the flexibility to mix and match different Series across different charts New Function definitions can be applied to any group of your data Series across charts The Chart Editor still offers Series cloning type change and chart copy that permits all chart and Series parameters to be copied as one to a new chart thus permiting Copy amp Paste inside your programming environment Series may be connected to ODBC v3 Tables or SQL Queries You may use TeeChart Pro ActiveX in Microsoft s Internet Explorer components and deploy them on the WWW Licensing issues Royalty free If you wish to distribute your programs compiled with TeeChart components you are free to do so with no royalties If you wish to distribute your programs with the possibility that users may access to re code with TeeChart components therein or use TeeChart components to re compile their code you should purchase TeeChart for those users Disclaimer TeeMach SL disclaim all warranties either express or implied including but not limited to implied warranties of merchantability and fitness for a particular purpose with respect to the instructions contained in this manual In no event shall TeeMach SL be liable for any damages
43. he DataSource tab of the Series page Changing a FunctionType with the Chart editor The option to change the FunctionType is in the DataSource tab of the Series page for the function Series The drop down combobox contains a list of all function types You may choose any from the list Copy will directly copy the input Series duplicating the Series Adding a Function by Code 1 Add a data Series to your Chart and populate it with data You could achieve that by using the Chart Editor at design time or by putting code behind a Command button eg With TChart1 AddSeries scBar Series 0 FillSamplevalues 20 End with 2 Add another Command button to the project and add the following code With TChartl TeeChart Pro v3 Chart guide 55 AddSeries scLine new Series to form basis for the function Series 1 SetFunction tfAverage apply the function to the Series Series 1 Datasource Series0O add the first Series as Datasource End with 3 Run the project and click the button to add the first Series then the 2n4 button to add the Function you will see an average of the Bar Series display on the Chart 4 You may change the average period by code eg TChart1 Series 1 FunctionType Period 2 That will alter the Average function to show the average for every 2 points of Series1 See the section entitled Period for more information about this property Deleting a function by code To delete a Functi
44. he Printed page orientation TChart Printer Print Will print a TChart in the current printer s paper orientation TeeChart Pro v3 Chart guide 80 Windows and printers limitations Metafiles are very good as they are small and fast and scaleable Some limitations occur when using metafiles as described in Microsoft Knowledge Base www mskb com TeeChart inherits those limitations Clipping Clipping is stored in physical co ordinates in metafiles This means moving or scaling a clipped metafile will not scale or move the clipping region giving undesirable results TeeChart does not draw partial points so no clipping Drawing on zoomed charts will probably show partial points outside the Chart axis Rounding circles As metafiles can be scaled circles will be converted to ellipses when scaling Rotating fonts Rotated fonts can not be exactly aligned on non proportionally scaled metafiles Dotted Pen styles and Pen Width Non solid pens dots dashes can be drawn as solid with scaled metafiles Chart Zoom and Scroll Scrolling and Zooming a Chart is simply setting its Axis scales to the desired values After zooming or scrolling a Chart all Series will repaint their points in their new positions Note Pie Series can t be scrolled or zoomed You can control Pie dimensions using Chart margins or Pie custom radius properties Zoom Charts can be zoomed programmatically or by user interaction with mouse draggi
45. hod Drop a TChart on a Form add a Point Series With TChart1 Series 0 Clear Addaxy 10 10 Barcelona clBlue AddxXY i 10 San Francisco ciRed End with Note If you use a Bubble Series use the BubbleSeries AddBubble method Remember to set XValues Order to loNone if don t want points to be sorted on their X co ordinate Point Limits Maximum 134217727 points per Series and same number of Series per Chart Deleting Points Simply call the Series Delete method passing the point index as the argument Point index starts at zero TChartl Series 0 Delete 0 removes the first point in TChartl Series 0 TChartl1 Series 0 Delete TChartl Series 0 Count 1 removes the last point in TChartl Series 0 An exception List out of bounds will be raised when attempting to Delete a non existing point so always check there are enough points in the Series prior to delete them if TChartl Series 0 Count gt MyIndex then TChart1 Series 0 Delete MyIndex End if TeeChart Pro v3 Chart guide 75 Calling Delete forces re calculation of Functions and repainting of the Chart Retrieving and modifying Points Once points have been added you can retrieve their co ordinates or change them The XValues and YValues array properties can be used Dim MyValue as Double MyValue TChartl1 Series 0 YValues 0 Value retrieves the first Y value You can traverse these arrays to perform calcul
46. ields of those Series It assumes you have access to an ODBC table Table1 with fields Name and Amount TChart1 AddSeries scLine With TChart1 Series 0 DataSource DSN SQLSource TABLE Tablel LabelsSource Name YValues ValueSource Amount CheckDatasource Refreshes data End with TeeChart Pro v3 Chart guide 37 Series types Adding values accessing values Series class The Series class is the ancestor of all Series types When referencing the properties of the Series type with which you are working check in addition to the properties listed with that Series the properties of Series in the online help to get a full list of inherited properties common to all Series Line Series There are 2 line Series types available Line and Fast Line Which one should be used Fast line is just what its name describes it is fast It is distinct from Line because to achieve speed speed to add new points to the Series the price paid is that it foregoes some properties that the Line Series has See the section on Fast Line for a description of those differences Line Fig 8 1 A 3D TChart with 2 Line Series B Series1 A 3D Line 800 CAS amen ES Series 700 F a tes showing one a AA o f aa Series with Fco Mons Eu e us the stairs 2 400 Gr aa A oro property set 300 6 ro to true The 200 stairs can be 100 inverted QA A 30 Nov 96 07 Dec 96 14 Dec 96 21 Dec 96 Fast line This line Series draws only a
47. installation directory is TeeChart Pro Activex Control below your default program installation directory The TeeChart installation will automatically register the TeeChart ocx file Next you will then need to install the components in your programming environment You should follow the version specific steps outlined below Visual Basic 4 To install TeeChart Pro ActiveX v3 in Visual Basic 4 open the Tools menu and select Custom Controls a Custom Controls x Fig 2 1 Available Controls DK The Custom El Microsoft Common Dialog Control a Cancel gt E Microsoft Data Bound List Controls Controls O Microsoft Excel 8 0 Object Library screen in O Microsoft Forms 2 0 Object Library Browse Vi l Basi O Microsoft Grid Control 1sua asic O Microsoft Internet Controls 4 O Microsoft MAPI Controls O Microsoft Masked Edit Control O Microsoft Multimedia Control O Microsoft Outline Control O Microsoft PictureClip Control El Microsoft Rich Textbox Control E Microsoft Windows Common Controls 5 0 O Microsoft Word 8 0 Object Library OMS Organization Chart 2 0 y m TeeChart Library a Help Show IV Insertable Objects Y Controls I Selected Items Only Location C TeeAx TEECHART OCX TeeChart Pro v3 Chart guide 14 Select TeeChart ocx from the list of available controls the OK TeeChart is now installed on your toolbar Visual Basic 5 To install TeeChart Pro ActiveX v3 in V
48. ions you may change Series type after initially adding the function TeeChart Pro v3 Chart guide Fig 10 1 Subtract function defined in the Chart editor 53 When you have added the function go to the DataSource tab of the Series page Here you may choose which input Series or Series to add to the function The first Series in the selected listbox reading from top to bottom is the Series on which the operation is performed in the case of function which doesn t treat each member of the list homogeneously Eg Subtract Editing DBChart1 ix Chart 1 Series3 lx Line Format General Marks Data Source Function Function Subtract Rd Source Series Available Selected In the Chart editor screen you see Series3 being defined with inputs Series1 and Series2 The Series order in the list defines which Series is doing the subtraction Here Series3 Series1 Series2 Step by step guide To add a new Function with the Chart Editor follow these steps We will add the function Average to show the average value of an input Series 1 Place a Chart on a form and add a new Series The Section in this document A TeeChart Quickstart Guide will help you through the steps of adding a Series 2 When you have a Series in your Chart return to the Chart Editor and select the Add button on the first Chart page The TeeChart Gallery will open Select the Functions page 3 Double c
49. irement one occurrence of the need to use a horizontal bar Series may be to adequately display long axis labels which are best read horizontally Fig 8 1 2D Horizontal bar Area An Area Series has similar characteristics to a line Series filled Fig 8 5 3D Area Series 2 500 3 000 2 000 1 500 1 000 612 96 13121986 204296 TeeChartO Pro v3 Chart guide 42 Point A Point Series is similar in definition to a Line Series without the line Fig 8 6 2D Horizontal bar 184 2 96 25 1 2 96 1 01 97 Date Pie A Pie Series is unique in not needing any axis It is possible to mix a Pie Series in a Chart with another Series that requires an axis Fig 8 7 3D Pie TeeChart Pro v3 Chart guide 43 Arrow Fig 8 8 3D Arrow Series The arrow Series is useful for displaying start and end points of many individual events Bubble The Bubble Series has 3 configurable parameters that define the value of the data in your Series Xvalues YValues RadiusValues The bubble Series is useful for showing importance weighting For example comparing high volume selling product that by income doesn t bring in a revenue of the scale of another low volume seller We can see at a glance literally that big bubbles are important Fig 8 9 2D Bubble Chart Shapes Bubble Series can be configured in variable shapes triangles etc TeeChart Pro v3 Chart guide 44 Gantt
50. isual Basic 5 open the Project menu and select Components When you have selected TeeChart in your components window select OK and the TeeChart icon al will appear on the VB toolbar TeeChartO Pro v3 Chart guide 15 Using TeeChart on line help and tutorials Using TeeChart on line help Selecting the TeeChart component Whilst designing your project using the TeeChart component you may select the component from the component palette or on the form where you have placed it and key F1 Context sensitive help relating to that component will appear Selecting a TeeChart property method or event Highlight a property or event in Object Inspector and key F1 to obtain help for that item Alternatively write the word for which you would like some help in your code Select the word by placing and clicking the cursor on that word and key F1 TeeChart s context sensitive help will take you directly to the description relating to that functionality Help in the TeeChart Chart Editor At the top righthand side of the Chart Editor box you will see a button with the symbol Drag that onto any item in the Editor for which you wish to receive help and TeeChart s online help will show you the equivalent runtime functionality of that item Accessing the Tutorials The contents page of the Online helpfile accessible via the TeeChart Pro v3 Activex Control s icon group of Windows 95 or NT programs menu contains a link to the first page of the
51. languages eg Visual Basic don t support Class inheritance thus TeeChart provides homogeneity by grouping all common Series properties and methods in the Series class and all Series type specific properties and methods in Series type interfaces accessible as Series properties TeeChart Pro v3 Chart guide 78 Example Common Series properties are accessible via the Series class TChartl Series 0 Color vbBlue Series specific properties are available via the Series type s interface The Candle Series is accessible via the TChart Series Index as are all other Series in the Chart TChart1 Series 0 asCandle AddCandle DateValue 2 12 97 _ 110 102 119 114 You may combine these With TChartl1l Series 0 Clear Title My Candle Series asCandle UpCloseColor vbGreen asCandle DownCloseColor vbYellow asCandle AddCandle DateValue 2 12 97 110 102 119 114 end With Series specific properties methods are accessible via the Series properties asArea asArrow asBar asBubble etc See the TeeChart online help for a full listing Printing Charts This chapter explains how Charts are printed and which properties and methods are used to control the printing process Margins When printing you can specify which margins on the paper page should be left blank The public PrintMargins property stores the desired paper margins expressed as percents of total page dimensions PrintMargins Rect 15 15 15 15 d
52. lick on the Function entitled Average This will add the Average function to your Chart and close the Gallery 4 The Chart Editor will take you directly to the Datasource page for the new function If you move elsewhere return to the Series tab of the Chart Editor and select Series2 the Function Series from the dropdown combobox Select the Datasource page for the Series TeeChart Pro v3 Chart guide 54 5 The Function combobox will tell which FunctionType you have selected this case Average The Source Series framed area will show the first Series of your Chart in the left window You may move it to the right window using the arrowbox thus converting it to Datasource for the Function Series 6 Close the Editor and put some code on your form to populate the first Series with data Simplest would be eg TChart1 Series 0 FillSamplevalues 20 Run the Project 7 You will see the Average function drwaing a line across your Chart to display the average value of Series1 8 You could add a button or scrollbar that modifies the period for the Function Eg TChart1 Series 1 FunctionType Period 2 That will alter the Average function to show the average for every 2 points of Series1 Deleting a function with the Chart editor You may delete the Series you have added as carrier for the function delete Series from the first page of the Chart editor or you may redefine the Series as having a different datasource in t
53. lid after a Chart component has been drawn either to screen or to a private hidden Canvas Axis Methods You can calculate the screen position for a given value using any Axis Dim MyPos As Integer MyPos TChart1 Axis Left CalcYPosValue 100 MsgBox MyPos MyPos holds now the pixel co ordinate for 100 0 on TChart1 Left Axis Vertical being 100 0 a floating value in Axis scales You can use this co ordinate to custom draw or to calculate mouse clicks See the Tutorial Custom Drawing If you want to convert from pixel co ordinates to Axis values you can use the opposite function Dim MyPos As Integer MyPos TChartl Axis Left CalcPosPoint 100 MsgBox MyPos TeeChart Pro v3 Chart guide 65 MyValue holds now the Axis value co ordinate for 100 on Chart1 Left Axis Vertical being 100 a screen pixel co ordinate Note Pixel co ordinates start from 0 being 0 0 the Chart origin point This is valid for screen but when drawing to metafiles drawing to custom canvases or printing Chart origin point can optionally be different to 0 0 You could use CalcYPos and CalcXPos When drawing using the XPos and YPos co ordinates remember that the co ordinate 0 0 is Top Left of the Chart rectangle The following example draws a line from an arbitary point from the Y axis across the chart Note the use of canvas properties Private Sub Command3_Click Dim MyHalfwayPoint YPosition As Integer With
54. lp included with TeeChart Place TeeChart Pro v3 Chart guide Fig 5 5 The Chart Editor screen showing the new Pie Series 21 the cursor on the word Add in your code and press F1 for a full description of the method Return to your code and run the project Press Command 1 to see the Pie chart appear the code works Editing the Series Close the program to go back to design mode In design mode all Chart and Series properties are accessible by right clicking the Chart and selecting the Edit option Here we ll use the Chart editor to edit our new chart and Series Fig 5 Shows the first editor screen To edit features of the Series we can double click on the Series in the list or highlight the Series and select Edit or directly select the tab for the Series each technique will take us to the editor for the Series Chart Series Series General Axis Titles Legend Panel Paging Walls Delete Title Clone Change Try changing some properties of the Pie Series you will see the results update automatically on the chart There is no cancel to undo changes but most parameters are easily toggled Remember in design time the TChart component hasn t yet run your code so it shows the randomly generated set of data You will need to start your project to see how the new parameters show up with your own data TeeChart Pro v3 Chart guide 22 Fig 5 6 The
55. n Delphi will modify registries at install time but will clean up should you de install TeeChart from Delphi TeeChart components TeeChart Pro Activex Control contains components for all the supported operating environments The following sections describe where TeeChart files are installed No registry entries other than registration of the OCX component are modified by the TeeChart installation Contents OCX and DLL installable files TeeChart ocx Online help TeeChartx hlp TeeChartx cnt Tutorials HTML Format TeeChart Tutorials with HTML help reference Manual MS Word format TeeChartx doc TeeChart Pro v3 Chart guide 13 A printable starter guide and Quick reference to the TeeChart Pro Activex Control Formatted as Word 95 document Example code There are extensive coded examples included with TeeChart Pro You will find them in the directory tree below your TeeChart installation directory Other files Please refer to the welcome txt file in the directory where you installed TeeChart for an overview of the files included with this release of TeeChart Installation steps All TeeChart installation files are included in one executable file TeeChartx exe Running the file will lead you through the installation steps At the end of the install the welcome txt file will display to tell you of any important release information The files are decompressed and installed in the directory of your choice Default
56. n access and modify PointLabel point texts TChartl Series 0 PointLabel 0 Sales Changing the Series type at runtime Advanced Every chart type corresponds to a different Component Class Changing a Series type involves changing the Series Component Class That means a new Series of the new class must be created old Series properties should be assigned to the new instance and finally the old Series must be destroyed All this happens automatically when you manually change a Series type at design time using the Chart Editor Dialog and the Gallery You can change a Series type at run time calling eg TChart1 ChangeSeriesType 0 scBar Changes the existing 1 Series to a Bar Series Warning If the new Series type does not share the same number of variables ie a Bar Series has X and Y 2 variables a CandleSeries has High Open Low Close 4 variables then the new Series type will not successfully paint Series type specific properties and methods TeeChart Pro Activex Control uses class inheritance internally to provide a homogeneous environment for working with differing Series Types This is a powerful feature of TeeChart that offers you the flexibility to mix many different types of Series in the same Chart and is the underlying reason why with TeeChart you first add the Chart then are able to add the various Series you require to the Chart instead of choosing from a limited list of Chart types Some programming
57. nations it is not practical as axis definition between Series may directly conflict For those cases the Series not available are greyed out in the Series gallery so that you cannot mistakenly select them See the section on functions for more about combining Series types Functions work with other Series to create and display algorithmic relationships Example Series combination Combining Seriestypes in one chart can add a great deal of information value The following example shows the incomes by Division and puts the index in the same chart to measure the effect of that external influence on incomes perhaps no influence at all in this example Fig 8 13 E Computers Income by Division E Telecoms 1 200 2D Bl Electronics 0 gt 1 150 Combining Index 50 Series types S 40 30 A 20 10 0 Jan Feb Mar Sales Month You may combine Series in 3D Charts The previous example is represented in 3D below The chart looks attractive although a high degree of 3D perspective makes it more difficult to visualise the monthly index with Division incomes TeeChart Pro v3 Chart guide 47 Fig 8 14 E Computers Income by Division Oi Telecoms MoN a ee 1 200 sD B Electronics i 1 150 combining Msindex s0 4 _ 25 dl 1 100 Y Series types 1 050 E 60 3D i an A lt 900 850 800 Jan Feb Mar Sales Month You could minimise the effect by reducing the extent of side
58. ndoing Zoomin nn M Mn nn ais 81 LOOM Events is Me nn M E a ete dr Ted ere esters el ete re esters i eae 81 Scroll io 82 Scrol EVENT axes tddi de sde medio 82 Real Time Charting and Speed ccccsssessscscececssssssnsccecececssesnseaueescesecsessnseaeescececeesssaaaaaeeeseceees 83 DINO ccc occa ce tac tis neck cates see ee nn tan nn ne nn shied vee ere de tee nine teen 84 TeeChart Pro v3 Chart guide Introduction Thank You for using TeeChart Pro ActiveX version 3 we hope you enjoy working with it This manual is aimed at helping those with or without experience of development with TeeChart There s a Quick Start section to get you up to speed on the fundamentals of TeeChart Pro version 3 a chart type overview and a comprehensive Charting reference section We ve packed in many hints and tips basing the contents on our experience of types of questions received from TeeChart customers The manual is protected by copyright Please don t distribute the whole manual Feel free however to copy for personal use only any specific parts of this manual you find useful TeeChart Pro v3 Chart guide 1 Introduction TeeChart Pro ActiveX derives from the 100 Native Delphi product TeeChart Pro version 3 shipped with Borland s Delphi version 3 TeeChart Pro ActiveX version 3 contains many exciting new features New for the ActiveX version are direct linking to ODBC version 3 datasources via the Chart Editor and JPEG C
59. ng The Chart Zoom Enable property controls if users can apply zoom TChart1 Zoom Enable True Users can zoom drawing a rectangle around the Chart area they want to see in detail Note Dragging should be done from top left to bottom down default Left mouse button Dragging in the opposite direction resets axis scales no zoom As soon as users release the mouse button TeeChart repaints to show the zoomed area TeeChart Pro v3 Chart guide 81 Animated Zoom You can control if TeeChart will calculate zoom positions immediately or it will be calculating zoom in short steps until reaching the desired zoom window This makes an animated zoom effect which helps to identify better the zoomed area This code activates animated zoom TChart1 Zoom Animated True Set the Zoom AnimatedSteps property to the desired number of intermediate zooms TChart1 Zoom AnimatedSteps 5 Zooming by code You can zoom in or zoom out a Chart using any of these methods Zoom ZoomRect adjusts axis scales to show the rectangular parameter area The rectangle is expressed in screen pixel co ordinates Rectangle areas inside TChart1 rectangle area bounded by axes will zoom in while area outside rectangle will zoom out TChartl1 Zoom ZoomRect 100 100 200 200 Undoing Zoom The Zoom Undo method resets axis scales to their automatic Minimum and Maximum values TChart1 Zoom Undo This will display all Series points undoin
60. ng better onscreen Zoom TeeChart offers as default zoom on all charts To obtain zoom at runtime hold the left mouse button and drag mouse toward down right You ll see a rectangle around the selected area Release the left mouse button to Zoom You can continue zooming again and again To RESTORE or UNDO the zoom drag a rectangle in the opposite direction up left Note You may use mouseclicks to activate code associated with points in data Series That OnClick behaviour will override zoom behaviour You can set toggle between OnClick events and zoom with the CancelMouse property You may enable or disable zoom functionality in the Chart Editor Chart page General tab The option AllowZoom accesses the chart property also changeable by code TChart1 Zoom Enable False TeeChartO Pro v3 Chart guide 33 False deactivates zoom Zoom can also be obtained via coding It is necessary to obtain the screen pixel co ordinates for the area in which you wish to do the zoom Example 1 Zoom an area with pixel co ordinates Dim Left Top Right Bottom as integer Left 123 Top 67 Right 175 Bottom 100 TChart1 Zoom ZoomRect Left Top Right Bottom Example 2 Zoom an area with point value co ordinates You need first to translate from value to pixel co ordinates To do so you can use the Axis or Series components which both share conversion from index value to pixel methods Left TChartl1 Series 0
61. nn nono 44 S aY OO Do DT Sa ete 45 Combining S ries ci iaa edita 46 Example Series combination 46 9 Extended Seres cuco 48 Cali nd E N E AE beck Haseena o beck oat aed edad E aa 48 NOU a Ra iaa 49 NS OF h AIREA RR TIO 49 O RR E O O NN NT 49 BOBA IA A A A ES A Rire AT at dios 51 10 FUNCTIONS ii A a cutee a 52 Adding a Function with the Chart Editor oooooooccccnnccnnnnnnonanonononnononnonononcononnnnnnnonononnnnononnananononnnnos 52 TeeChartO Pro v3 Chart guide Step by Step guide ne ne a 53 Deleting a function with the Chart editor 54 Changing a FunctionType with the Chart editor 54 Adding a Function by Code csccsccsccccssssesnesnssscescessesssecsscccessssseneassescesssessessaaseescosvessenneccece 54 Deleting a function py Code it aia 55 P rOd RT 55 Srandard fUnctonS aid lo ii 56 A A AAA A aha Aves E RA A tn AN dt id 56 UA asa 57 Multiply IES Se IST TO id tentes dia 58 Divide ie o Io nasheed enn eh 58 A AT 59 A RO RN ON 59 NV OR AOC nn MR DE ae RS Ls eT Se LO LU citerne EAs ROLES Bs Bie 60 Extended Function nil ini a 60 Mi A aa 60 Exponential Average a tas 60 Moment sels elated do tete A ET teste R SISTER 61 Pitted Curve iia ie iso ious send Lashed DA 61 Fe ste A NR 61 11 Working with Charts and series nes 63 CICK OVENS tt nn ER RM Rain MS se berne tt 63 Chart On Click Series italiano aloe 63 Chart Om Cle ke swish ccc Fcc A as Pre eee Sa eh Lee E 63 Custom drawing on the chart essieu 64 C
62. nnect gantt bars 1 Store the AddGantt or AddGanttColor function return longint Dim tmpl tmp2 as Integer With TChartl Series 0 asGantt tpl AddGantt DateValue 1 1 1997 DateValue 31 1 1997 27a Development Emp2 AddGantt DateValue 1997 1 15 DateValue 1997 2 15 Tp Testing End with 2 Then use the NextTask property TChartl Series 0 asGantt NextTask tmpl tmp2 This will draw a line from Development gantt bar to Testing bar The ConnectingLinePen property is the pen used to draw lines Shape Shape Series are useful for defining or adding any additional information to your chart perhaps in runtime as a result of receipt of exceptional data You may add text to any shape you add to your chart and relate the shape to another Series Fig 8 11 Shape Series 100 f Mytext message AAN 0 0 50 100 Each shape has two co ordinates associated with it top left and bottom right of the invisible rectangle that encloses the shape You may add text to the box These co ordinates and messages could be updated at runtime by your code to dynamically put the shapes anywhere on your chart TeeChartO Pro v3 Chart guide 46 Fig 8 12 Combining Series Combining Series There is no practical limit to the number of Series that you can add concurrently to your chart You may mix different Series types almost any Series type with any other Series type For certain combi
63. of setting Axis scales You can have automatic Axis Maximum and Minimum and a fixed Increment The Increment property grows automatically until all Axis Labels can be displayed If you don t want this automatic feature set the Axis LabelsSeparation to zero TChartl Axis Left LabelsSeparation 0 Warning When LabelsSeparation is zero no checking is performed against labels size so you must take care labels will not overlap each other The following code sets the vertical Axis Increment to 30 TeeChart Pro v3 Chart guide 69 TChart1 Axis Left Increment 30 By default the first Axis label starts at nearest Increment Setting RoundFirstLabel to False makes labels to start at Axis Maximum TChart1 Axis Left RoundFirstLabel False DateTime Increment Use the predefined DateTimeStep array of constants to determine the Axis Increment on DateTime axis TChart1 Axis Bottom Increment TChartl GetDateTimeStep dtOneMonth And set the ExactDateTime property to True if you want Axis Labels to be at exact datetime boundaries for example at 1st day of month TChart1 Axis Bottom ExactDateTime True Note Logarithmic axis use the Increment property as linear Grid lines Axis Grid lines are displayed at each Increment position or at each Axis Label position The Axis TickOnLabelsOnly property controls this feature TChart1 Axis Bottom TickOnLabelsOnly False Axis Labels There are several Axis labelling styles The
64. ol the appearance of your chart using Canvas properties The following example divides the area of the backdrop of the Chart rectangle into 5 equal segments and colours them according to the colour array Put the code in the TChart OnBeforeDrawSeries event to see the result Dim MyColors 5 As ColorConstants Dim t partial tmpLeft tmpTop tmpRight tmpBottom As Integer MyColors 0 RGB 215 0 0 MyColors i RGB 255 128 0 MyColors 2 RGB 128 128 255 MyColors 3 RGB 0 0 153 MyColors 4 RGB 215 0 0 With TChartl1 setup the draw area tmpTop TChart1 Axis Left CalcYPosValue TChart1 Axis Left Maximum tmpBottom TChartl Axis Left CalcYPosValue _ TChart1 Axis Left Minimum tmpLeft TChartl Axis Bottom CalcXPosValue _ TChartl Axis Bottom Minimum tmpRight tmpLeft we will divide the total chart width by 5 partial TChartl Axis Bottom CalcXPosValue _ TChart1 Axis Bottom Maximum tmpLeft 5 change the brush style Canvas Brush Style bsSolid Canvas Pen Style psSolid t for each section fill with a specific color For t 0 To 4 adjust the rectangle dimension tmpRight tmpRight partial set the brush color Canvas Brush Color MyColors t Canvas Pen Color MyColors t paint 117 Canvas Rectangl tmpLeft TChartl Aspect Width3D _ tmpfop TChart Aspect Height3D tmpRight TChartl Aspect Width3D tmpBottom TChartl Aspect Height3D adjust r
65. on Series delete the Series TChart1 RemoveSeries 1 Period You may find the Period property extremely useful when working with functions It is used to define the frequency for which the function re calculates Example We have 6 data points eg bars of a Bar Series with values 3 8 6 2 9and 12 We define a function Series with Period 0 default when only one Series is input to the Function the average drawn is 6 667 With Period set to 2 we get 3 values of average as output from the function 5 5 4and 10 5 These values will plot centrally in their period range ie The 1st value between bars 1 and 2 of the input Series 21d value between bars 3 and 4 etc You may define Period by selecting the function in the Chart Editor or you may modify Period at runtime using FunctionType Eg Where Series 1 is the function Series TChart1 Series 1 FunctionType Period 2 TeeChart Pro v3 Chart guide 56 Fig 10 1 2D Add function with 1 Series input Standard functions Add The Add function adds data from one or more Series If we create a line Series Series1 create a line Series Function Add and define Series Function Add as Add of Series1 and do nothing more we will obtain a chart with Series1 displayed and Function Add as one flat line which is the sum of all values of Series1 In the figure the total of 1 2 38 4 5 6 21 Series Function Add 0 month1 month2 mon
66. ontal position for each Y value Later try deleting the pie Series and adding a Series of a different type ie LineSeries you will see the option to apply X and Y values appear We don t have X Values in a Pie Series TeeChart Pro v3 Chart guide 25 Now click the OK button The TDBChart component will show a Pie Chart and a Legend You are seeing exactly the same chart you saw when you pressed F9 to run the project TeeChart Pro v3 Chart guide 26 6 Using the TeeChart demos You have seen the most basic TeeChart procedures The next step is to look at some examples in the demo files First Thing To Do Open the Examples folder below your TeeChart installation Folder There are many subfolders containing TeeChart example code for a variety of operating environments Each example shows a specific TeeChart feature Many Forms contain Source code to show event handling or interactive charting In the Visual Basic 4 and 5 folders you will find a folder entitled Scrolling Let s see the ScrollForm1 Frm demo form You may open this with notepad or in Visual Basic by openaing the vbp project file ScrollForm1 shows a basic TChart component with one Line Series component Click on Form Load you will see that it calls Fill DemoPoints Switch to source code to see the following Private Sub Form_Load FillDemoPoints End Sub Private Sub FillDemoPoints Dim t As Integer With TChart1 Series 0 fill the
67. opers wishing to program with or make use of extended TeeChart functionality TeeChart Pro includes 100 source code Extended features of TeeChart Pro 100 Source code 16 bit version for Delphi 1 32 bit version for Delphi 2 and 3 and C Builder Extended Series types TeeChart Pro v3 Chart guide 10 Custom Chart and Series creation Developer Custom Series TeeLoper guide Extended Statistical functions Extensive demo code Runtime Chart Editor and Gallery Extended Online help Printed reference manual with developer guide With TeeChart Pro you define the limits Use the developer guide to help you create hot spots for drilldown on your charts or customise the TeeChart code to create your own Series types and functions and permanently add them to the TeeChart Gallery With 100 source code you can choose which functionality to deliver TeeChart Pro Activex Control version 3 TeeChart Pro ActiveX version is a comprehensive charting tool for developers across programming language boundaries It includes extended TeeChart functionality and additional features TeeChart Pro ActiveX version does not include source code Features of TeeChart Pro Activex version e 32 bit Activex version for Visual Basic Visual C Delphi C Builder MS Access Internet Explorer Visual Foxpro Crystal Reports ODBC version 3 table and SQL query data access 11 Standard Series types 5 Extended Series types Standard and Exten
68. our Series The Chart components provide the backdrop for your data Series The overall look of your chart is controlled by the chart properties accessible via the Chart Editor or by coding see the online help for a complete list As a backdrop you have available to you Canvas property and methods to calculate screen co ordinates from values and vice versa Associating a Series with a Chart You may add a Series to a TChart with the Chart Editor or by code Via the Chart editor After a Chart has been placed on a form a right button click gives access to the Chart Editor via the Edit menu option some programming environments support double click on the Chart The first screen of the Edit chart menu offers a list of button options to add delete clone change type or title of a Series Adding a data Series via this menu automatically associates the new data Series with the chart TeeChart Pro v3 Chart guide 31 Via code Use the TChart AddSeries property to add a Series to a chart Example In this example we ll create and populate a new Series Clearing out any Series that already exist in the Chart You can find this code in the demo Add Series SeriesProject vbp With TCharti Look to s if there s already a Series in the Chart If SeriesCount gt 0 Then Remove the existing Series RemoveAllSeries End IF Add and randomly populate the new Series leg AddSeries scHorizBar is the same as AddSeries 2 Ad
69. property at run time followed by a call to Sort method Example Drop a TChart onto a Form add a Line Series Drop a TButton and assign this code to Button1Click With TChart1 Series 0 Add 5 clTeeColor Ada 2 M elTeeColor Bda 3 elTeeColor Add 9 clTeeColor End with Now drop another TButton and add this code to Button2Click With TChartl Series 0 YValues Order loAscending YValues Sort End with TChartl Repaint Now execute and press Button1 to fill Series1 and press Button to see Series1 points drawn on Series YValues Ascending order but having the original X co ordinates Note If you aren t using X co ordinates one more line of code is required Note 11 y q Drop a new TButton Button3 and add this code to Button3Click TChart1 Series 0 XValues FillSequence TChartl Repaint TeeChart Pro v3 Chart guide 74 Now points will be re numbered starting from zero among Series1 XValues axis This will re order points so now they will be drawn as if they were originally added to the Series in their new order This two step point sorting allows Line Series to draw with vertical orientation XY Points Adding X co ordinates to points makes Series components calculate user specific horizontal point positions Note Bar charts can be difficult to interpret with X co ordinates Pie Series do not allow X co ordinates To add X co ordinates simply use the AddXY met
70. r ticks off on the bottom axis 7 Each Series has a different shape defined for its bars We define the shape individually in the configuration page of each barSeries The first tab Format has the option for Style N TeeChart Pro v3 Chart guide 39 You could code the style with With TChartl Series 0 asBar BarStyle bsPyramid East Series 1 asBar BarStyle bsInvPyramid West Series 2 asBar BarStyle bsRectangl Other End With Lookup BarStyle in the TeeChart online help to get the full list of options 8 For this chart it would be necessary to control the Series order to achieve the correct effect This can be done in the Chart Editor at design time by selecting the Series in the Series list of the Chart page and using the arrows to change the order At runtime we can achieve the same with the following code 9 Drawing order is always based on the order for which the Series are assigned to ParenTChart The order can be altered at run time via the ExchangeSeries property TChartl ExchangeSeries 0 1 Reverses the Z Order between Series 0 and Series 1 1 becomes 0 and 0 becomes 1 10 We added some random values to populate this demo We could launch the code at form creation or put a button on the form to run the code Private Sub Commandi Click Dim t As Integer For t 1 To 12 TCharti Series 0 Add Rnd 70 Format 1 1997 mmm vbRed TChartl Series 1 Add Rnd 70 Format
71. rt guide 32 Example TChart1 Axis Bottom Increment TChart1 Axis Right Increment TChart1 GetDateTimeStep dtOneHour 1000 Separation If the labels on the axis have a look of rolling into one another you can increase the separation which will forcibly increase the gap between them In some cases this may as a result hide some labels It will very much depend on your labels and whether your chart users will have the option to resize their chart The option is available in the Chart Editor under Axis select your axis Labels Separation Setting Labels Separation to 0 means no overlapping checking will be performed thus all axis labels will be displayed Angle If it is neither practical or possible to place the axis labels side to side along the axis another option is change the angle of the labels to 90 to the axis This option is available in the Chart Editor under Axis select your axis Labels Angle Export File formats J PEG BMP or Metafiles TeeChart Pro Activex Control offers JPEG bitmap BMP and Metafile format to save charts Two type of metafile formats are supported WMF Windows Metafile Format and EMF Extended Metafile Format Bitmap format is used internally by TeeChart It is quicker to draw onscreen than a Metafile When requiring a Chart to be exported to another application or to be embedded in a container application such as MSWord a Metafile format handles resizi
72. t 2 Dimensions but draws very quickly performance will depend on your hardware The Series type was originally conceived to tackle high volume requirements of technical and financial applications but serves well for any dataset of very high point volumes TeeChartO Pro v3 Chart guide 38 Bar The bar Series in 2 or 3 dimensions doesn t have to be represented by a rectangular bar Fig 8 2 Choose a barstyle for your Chart Series or mix and match to suit your needs Example bar Series configuration Mixing bar Series styles may be useful for some applications Below is an example stacked bar chart Fig 8 3 Region Sales Mixed 100 bartypes 2 S 50 o 0 at dm Pl i Jan Feb Mar Apr May Sales Month Steps taken to build this demo chart and populate it with data are as follows 1 Drag a Chart component onto your form and drag it out to the size you want Click the right mouse button over the chart and select editor from the menu 3 Add 3 Bar Series and give them individual titles using Title on the first editor screen titles in our example East West and Other 4 Select Multi Bar and set as stacked in the Format page of any one of the 3 Series The change will apply to all 3 Series 5 Add a title using the entry tab for Titles in the Chart page of the editor 6 Go to the axis tab Select Left axis and add the title We allowed the axis to automatically size itself but took mino
73. ths month4 monthS month6 We can modify the Series Function Add to represent Add of Series1 by 2 point groupings 1 2 8 4 5 6 We use the period property Chart Editor in the Data source page Coded it looks like this TChart1 Series 2 FunctionType Period 2 where Series 2 is the functionSeries Defining the period as 2 sets the Add function to add every 2 points The period property adds enormous value to function Series TeeChart Pro v3 Chart guide 57 Fig 10 2 Add function with period 2 month month2 month3 month4 months month6 Subtract Subtract requires 2 input Series With more than one Series in the function the default period sets to 1 axis point the 24 Series will be subtracted from the 1 t Series in the list The following chart is defined with ApplyZOrder False which forces all Series to draw in the same 3 Dimensional plane The resulting Series overlay a sort of optical illusion in the chart depends on the Series paint order Fig 10 3 Subtract function month month2 month3 month4 months month6 E Series O Series3 E Function Subtract TeeChartO Pro v3 Chart guide 58 Multiply The default period for the function multiply is 1 You may add as many Series as you wish to the multiply function Fig 10 4 Multiply function month1 month2 month3 month4 monthS month6 O Series3 Ml Series1 BB Function muttiply Divide As divide requires at least
74. utes after the last point Private Sub ScrollHorizAxis With TChartl Axis Bottom lt with the Horizontal Axis Automatic False lt we dont want automatic scaling In this example we will set the Axis Minimum and Maximum values to show One Hour of data ending at last point Time plus 5 minutes Maximum TChartl Series 0 XValues Maximum _ TimeValue 0 5 0 Minimum Maximum TimeValue 1 0 0 End With End Sub This code increments the last added point Time by one more minute The incremented Time value is added to the Series thus giving a new point Many possibilities can be achieved by manually setting the Axis properties Each Chart component has four axis accessible via the TChart Axis property Left Top Right and Bottom Each Axis has a boolean Automatic property that defaults to True meaning TeeChart will always calculate the Minimum and Maximum values for each Axis The Minimum and Maximum properties are of type double allowing float numbers or DateTime representations like Date Time Now or any other valid datetime value TeeChart Pro v3 Chart guide 28 We have seen a specific TeeChart feature in detail Now compile and execute this project and look at each sample form They should give you ideas that you can apply to your projects while you learn about TeeChart features The TEECHARTX HLP file describes each component property in detail with some source code examples
75. whatsoever including without limitation damages for loss of business profits business interruption loss of business information or other pecuniary loss even if TeeMach SL have been advised of the possibility of such damages TeeChartO Pro v3 Chart guide About TeeChart TeeChart charting components are written in Delphi by David Berneda They are available as a 100 Delphi Native Visual Component Library TeeChart Pro has been interfaced to an ActiveX component by teeMach SL TeeChart products are distributed and supported by teeMach SL of Barcelona Catalonia Spain TeeChart versions TeeChart version 3 VCL Version included with Delphi 3 Runtime TeeChart libraries are included as part of Borland s Delphi version 3 They include many compiled units of the Chart components and all compiled standard Series types TeeChart v3 has a design time Chart Editor extensive coded examples and demos full online help and electronically saved MS Word format user manual Features of TeeChart 3 runtime version 32 bit version for Delphi 3 standard Series types Statistical functions Data aware Series Gallery 2D 3D QuickReport Integration Zoom scroll and real time Royalty free Custom drawing Custom printing Extensive demos Design time integrated Chart and Series editor Online help Electronic reference manual Word format TeeChart Pro v3 VCL TeeChart Pro is a comprehensive charting tool aimed at those Delphi devel
76. z Pie F DateTime Close TeeChartO Pro v3 Chart guide 24 You will need to select the New button which will open the TeeChart ODBC Connection Window Fig 5 8 The TeeChart ODBC Connection Window Select DataSet x lation i ODBC gt Select Dataset Table F System Tables Sole ja S DDEC Manager 1 Click on the down arrow in the Datasource combobox This will show a list of all predefined ODBC DSNs 2 Select your DSN 3 Highlight the radio button Table 4 Select the table As we have defined a Pie Series we are presented with pie specific configuration options Each Series has parameters that vary but only slightly in definition from the example below The Pie field is mandatory and must contain a valid numeric field or a string field with values that can be converted to numbers In our example choose the Weight field The ANIMALS table is a collection of animal names with weight and size information You can optionally select an Labels field to draw the corresponding string for each point on the pie In our example choose the Name field This label will be used to draw the Pie Legend Note Some chart Series types have more than one figure to represent a point Values that are plotted by date or time are an example of X Values Series Not all date time values should be equally spaced The X Value is the specific horiz

Download Pdf Manuals

image

Related Search

Related Contents

inventix CRM Benutzerhandbuch  DeLOCK USB2.0 WLAN mini Stick    User Manual  Service Manual  sinus n modbus rtu en  XC236xA - Digi-Key  In-roof system Kappa Installation manual  MANUAL DE CODIFICAÇÃO 13  Black & Decker 386230 Instruction Manual  

Copyright © All rights reserved.
Failed to retrieve file