Objective Chart User’s Guide Stingray® Studio Version 11.2.0 OBJECTIVE CHART USER’S GUIDE THIS MANUAL © Copyright 1997-2014 Rogue Wave Software, Inc All Rights Reserved Rogue Wave and Stingray are registered trademarks of Rogue Wave Software, Inc in the United States and other countries All other trademarks are the property of their respective owners ACKNOWLEDGMENTS This documentation, and the information contained herein (the "Documentation"), contains proprietary information of Rogue Wave Software, Inc Any reproduction, disclosure, modification, creation of derivative works from, license, sale, or other transfer of the Documentation without the express written consent of Rogue Wave Software, Inc., is strictly prohibited The Documentation may contain technical inaccuracies or typographical errors Use of the Documentation and implementation of any of its processes or techniques are the sole responsibility of the client, and Rogue Wave Software, Inc., assumes no responsibility and will not be liable for any errors, omissions, damage, or loss that might result from any use or misuse of the Documentation ROGUE WAVE SOFTWARE, INC., MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THE DOCUMENTATION THE DOCUMENTATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND ROGUE WAVE SOFTWARE, INC., HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS WITH REGARD TO THE DOCUMENTATION, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NONINFRINGEMENT IN NO EVENT SHALL ROGUE WAVE SOFTWARE, INC., BE LIABLE, WHETHER IN CONTRACT, TORT, OR OTHERWISE, FOR ANY SPECIAL, CONSEQUENTIAL, INDIRECT, PUNITIVE, OR EXEMPLARY DAMAGES IN CONNECTION WITH THE USE OF THE DOCUMENTATION The Documentation is subject to change at any time without notice ROGUE WAVE SOFTWARE, INC Address: 5500 Flatiron Parkway, Boulder, CO 80301 USA Product Information: Fax: Web: (303) 473-9118 (800) 487-3217 (303) 473-9137 http://www.roguewave.com CONTENTS PART I User’s Guide 1Chapter Introduction to Objective Chart 1.1 Welcome to Objective Chart 1.2 Product Features 1.3 Location of Samples 1.4 Supported Platforms 1.5 Getting Help 1.5.1 Documentation 1.5.2 Knowledge Base 1.5.3 Professional Services 1.5.4 Technical Support 1.6 Licensing Restrictions 2Chapter Basic Concepts 2.1 What is an MFC Extension Library? 2.2 Notes on Objective Chart Installation 2.3 Objective Chart Libraries 2.3.1 Stingray Foundation Library 2.3.2 Standard Objective Chart Library 2.3.3 Objective Chart Utility Toolkit 2.4 Building Objective Chart 10 2.4.1 Using the Build Files 10 2.4.2 Using the Build Wizard 13 2.4.3 Miscellaneous Build Issues 14 Contents iii 2.5 Incorporating Objective Chart into Your Application 15 2.5.1 Linking to the Objective Chart Library as a DLL 15 2.5.2 Including Unicode Support 16 2.6 Examples of Basic Charts 17 2.7 Objective Chart Basics 19 2.8 Objective Chart Terminology 20 2.9 How a Chart is Constructed 21 2.9.1 Create an SRGraph Object 21 2.9.2 Create and Configure Components 21 2.9.3 Add Data Objects 21 2.9.4 Call DrawComponentList 22 3Chapter Design Overview of Objective Chart 3.1 Introduction 23 3.2 Graph Classes 24 3.2.1 SRGraph 24 3.2.2 SRDynamicGraph 25 3.2.3 Data Managers 26 3.3 Component Classes 27 3.3.1 SRGraphComponent 28 3.3.2 SRGraphBackground 29 3.3.3 SRGraphTitle and SRGraphTitleResizeable 29 3.3.4 SRGraphDisplay 29 3.3.5 SRGraphLegend 29 3.3.6 SRGTextPanel 29 3.4 Axis Drawing Classes 30 3.4.1 SRGraphLabel 30 3.4.2 SRGraphLabelBlock 30 3.4.3 SRGDecimalScale 30 3.4.4 SRGLogScale 31 3.4.5 SRGDateScale 31 3.4.6 SRGIndexScale 31 3.4.7 SRGGroupScale 31 3.4.8 Axis Scale Bar Classes 31 3.4.9 SRGCompoundDisplay 32 3.5 Data Scope 32 3.6 Data Storage Classes 33 3.6.1 SRGraphDataList 34 iv 3.6.2 SRGraphData 34 3.6.3 CScale 35 3.7 Style Class 36 3.8 Annotation Classes 37 3.8.1 SRGraphAnnotation 37 3.8.2 SRGraphAnnotationList 37 3.9 Utility Classes 39 3.9.1 SRGCompiledPolygon 39 3.9.2 SRGRect 39 3.9.3 SRGraphException 40 3.9.4 CObStack 40 3.10 Display Scheme 41 3.11 View Classes 42 3.11.1 SRGraphView and SRGScrollView 42 3.11.2 SREGraphView and SREScrollView 42 3.12 User Interaction and Feedback 43 3.12.1 Feedback Management 43 3.12.2 SRGraphFeedback 43 3.12.3 SRGraphPosition 44 3.13 Chart Persistence 46 3.13.1 Chart Template System 46 3.13.2 Serialization 47 3.14 MFC Integration 48 3.14.1 Document and View Integration 48 3.14.2 Documents 48 4Chapter Fast Start With Objective Chart 4.1 Introduction 49 4.2 Step 1: Creating a Basic Chart Application 50 4.2.1 Modifying the View Class 58 4.2.2 Modifying the CChartAppDoc Class 61 4.2.3 Modifying the ChartApp Resources 62 4.2.4 Reviewing the Steps to a Functional Graph 64 4.2.5 Assessing the ChartApp’s New Capabilities 65 4.3 Step 2: Adding the Ability to Read Tab-Delimited Data Files 66 4.3.1 Adding Text File Handling to the Document 67 4.3.2 Reading the Tab Delimited File 68 v 4.3.3 Reassessing the ChartApp’s Capabilities 69 4.4 Moving On 71 5Chapter Integration Tutorial 5.1 Introduction 73 5.2 Step One: Creating and Displaying the Statistics Chart 75 5.2.1 Introduction 75 5.2.2 Set Up the Resources 75 5.2.3 Create CStatic-based Control for Use in a Dialog Box 78 5.2.4 Construct a Dialog to Display the OC Control 83 5.2.5 Display the Dialog 88 5.3 Step Two: Plotting Scribble Data with an X-Y Scatter Chart 92 5.3.1 Introduction 92 5.3.2 Create the Chart View 92 5.3.3 Modify the CView's Base Class 93 5.3.4 Display the Graph in the View 94 5.3.5 Add the Chart View to the Splitter Pane 95 5.3.6 Add an SRGraph Object to the Document 95 5.3.7 Modify the Serialization Function 96 5.3.8 Initialize the Document 96 5.3.9 Add Fresh Data to the Chart 97 5.3.10 Modify the Button Handler 98 5.3.11 Gather the Mouse Movements 99 5.4 Step Three: ComDocs and Document Linking 101 5.4.1 Introduction 101 5.4.2 Create the Scroll View 101 5.4.3 Modify the Scroll View 102 5.4.4 Allow Linked Documents 102 5.4.5 Create a Linked Document 106 5.4.6 Update the Linked Documents 110 6Chapter Chart Types 6.1 Chart Types Overview 115 6.2 Graphs with Classic Axes 116 6.2.1 Line Graphs 117 6.2.2 Line Only Graphs 117 6.2.3 Step Graphs 117 6.2.4 Step Line Only Graphs 117 6.2.5 Area Graphs 118 6.2.6 Strata Graphs 118 6.2.7 Freestyle Graphs 119 vi 6.2.8 Stock Graphs 119 6.2.9 Area Stock Graphs 119 6.2.10 Candle Graphs 120 6.2.11 Shaded Candle Graph 120 6.2.12 Hi-Low-Open-Close Graphs 121 6.3 Vertical Bar Graphs 122 6.3.1 Vertical Bar Graphs 122 6.3.2 Extended Vertical Bar Graphs 123 6.3.3 Stacked Vertical Bar Graphs 123 6.3.4 Strata Vertical Bar Graphs 123 6.3.5 Strata Vertical Bar by Group Graphs 124 6.3.6 100% Strata Vertical Bar Graphs 124 6.3.7 100% Strata Vertical Bar by Group Graph 125 6.4 Horizontal Bar Graphs 126 6.4.1 Horizontal Bar Graphs 126 6.4.2 Extended Horizontal Bar Graphs 127 6.4.3 Stacked Horizontal Bar Graphs 127 6.4.4 Strata Horizontal Bar Graphs 127 6.4.5 Strata Horizontal Bar by Group Graph 128 6.4.6 100% Strata Horizontal Bar Graph 128 6.4.7 100% Strata Horizontal Bar by Group Graph 128 6.5 Graphs with Stage or Platform Axes 129 6.5.1 Manhattan Graph 129 6.5.2 RoofTop Graph 130 6.5.3 Ribbon Graph 130 6.6 Pie Graphs 131 6.6.1 Pie Graph 131 6.6.2 Isographic Pie Graph 131 6.7 Polar Graphs 132 6.7.1 Polar Graph 132 6.7.2 Area Polar Graph 132 6.8 Web Graphs 133 6.8.1 Web Graph 133 6.8.2 Area Web Graph 133 6.9 Scatter Graphs 135 6.9.1 XY Scatter-Alternating Graph 135 6.9.2 XY Scatter by Group Graph 135 6.9.3 XY Scatter by Index Graph 136 6.9.4 Extended XY Scatter Graphs 136 vii 6.10 Bubble Graphs 137 6.10.1 Bubble Radius Graph 137 6.10.2 Bubble Area Graph 138 6.11 Vector Graphs 139 6.11.1 Vector-Centered Graph 139 6.11.2 Vector-End Graph 140 6.11.3 Vector-Offset Graph 140 6.12 Gantt Graph 141 6.13 Defined but Unimplemented Axis and Graph Types 141 6.14 Custom Graph Types 141 7Chapter Customizing a Chart 7.1 Using Components 143 7.2 Component Placement 144 7.3 Component Panel Appearance 146 7.3.1 Component Border Styles 146 7.3.2 Component Shadow Styles 147 7.3.3 Component Fill Styles 147 7.4 Using SRGraphBackground 150 7.5 Using SRGraphTitle 151 7.5.1 Font selection 151 7.5.2 Font sizing 152 7.5.3 Font style 152 7.5.4 Using LOGFONT 153 7.5.5 Text Alignment 154 7.5.6 Word Wrap 154 7.6 Using SRGTextPanel 155 7.7 Using the Display Component 157 7.7.1 SRGDisplayBase 157 7.7.2 SRGraphDisplay 158 7.7.3 Graph-Type Specific Displays 158 7.7.4 Data Display Rectangle 159 7.7.5 Display Scope 159 7.7.6 Selecting a Graph Type 160 7.7.7 Selecting an Axis Type 162 7.7.8 Valid Graph and Axis Combinations 164 7.7.9 Changing Chart Types Dynamically 165 7.7.10 Defining the Chart Axes 166 viii 7.7.11 Logarithmic Axis Scaling 166 7.7.12 Autoscaling Axis Limits 166 7.7.13 Setting Fixed Axis Limits 167 7.7.14 Customizing Axis Labels 168 7.7.15 Avoiding Overlapped Labels 168 7.7.16 Controlling Tick Marks and Grid Lines 169 7.7.17 Displaying an Axis Title 170 7.7.18 Setting a Background Color for the Display Rectangle 171 7.8 Using SRGraphLegend 172 7.8.1 Legend Placement 172 7.8.2 Legend and Display Binding 172 7.8.3 Legend Scope 172 7.8.4 Legend Styles 173 7.8.5 Legend Key Style 174 7.8.6 Legend Spacing 175 7.9 Using Annotations 178 7.9.1 SRGraphAnnotationList 178 7.9.2 SRGraphAnnotation 178 7.9.3 Supporting Multiple Languages or Audiences 179 7.9.4 Where Annotation Lists Are Used 180 7.10 Using SRGraphLabel 181 7.10.1 Placement of Labels 181 7.10.2 Placement of Labels in a Label Block 182 7.10.3 Tick List Management 183 7.11 Data Object Appearance 184 7.11.1 Line or Frame Styles 184 7.11.2 Interior Fill Styles 186 7.11.3 Object Styles 187 7.11.4 Modifying Wigets 189 7.11.5 Modifying Line Ends 190 7.11.6 Modifying Bars 190 7.11.7 Labeling Wedges of a Pie Chart 192 7.11.8 Copying Styles 194 7.11.9 Using the Default Data Style 194 7.11.10 Choosing Automatic Colors, Fills, and Wigets 195 8Chapter Data Storage Models 8.1 Data Storage Classes 197 8.2 Standard Data Model 199 8.2.1 Standard Model Features 199 8.2.2 Using the Standard Model 200 ix 8.3 Dynamic Data Model 201 8.3.1 SRGraphDynamicData 201 8.3.2 Dynamic Model Features 202 8.3.3 Using the Dynamic Model 202 8.4 Structure Data Model 205 8.4.1 SRGStructureData 205 8.4.2 Data-type Specific Classes 206 8.4.3 Structure Model Features 207 8.4.4 Using the Structure Model 207 8.5 Choosing the Right Model 209 8.5.1 Earlier Versions of Objective Chart 209 8.6 Data Array Access 211 8.7 Null Data 214 8.8 Deleting Groups 215 9Chapter Objective Chart Dialogs 9.1 Introduction 217 9.2 Objective Chart Editor 218 9.3 Objective Chart Wizard 219 9.3.1 Chart Wizard Features 219 9.3.2 Using Chart Wizard 221 9.3.3 Chart Wizard Property Pages 222 9.3.4 Chart Wizard User Interactions 223 9.3.5 Customizing Chart Wizard 224 10Chapter 10 User Interaction 10.1 Introduction 225 10.2 Mouse Event Handlers 226 10.3 Feedback Management 227 10.4 Chart Tips 228 10.4.1 Using Chart Tips 228 10.4.2 Customizing Chart Tips 228 x