Home

QCChart2D CF Charting Library for the .Net Compact Framework

image

Contents

1. C Font toolTipFont new Font Microsoft Sans Serif 10 FontStyle Regular DataToolTip datatooltip new DataToolTip chartVu TimeLabel xValueTemplate new TimeLabel ChartObj TIMEDATEFORMAT MDY NumericLabel yValueTemplate new NumericLabel ChartObj CURRENCYFORMAT 0 datatooltip GetToolTipSymbol SetColor Color Green datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA_TOOLTIP_XY_TWOLINE datatooltip SetEnable true chartVu SetCurrentMouseListener datatooltip Visual Basic Dim toolTipFont As New Font Microsoft Sans Serif 10 FontStyle Regular Dim datatooltip As New DataToolTip chartVu Dim xValueTemplate As New TimeLabel ChartObj TIMEDATEFORMAT MDY Dim yValueTemplate As New NumericLabel ChartObj CURRENCYFORMAT 0 datatooltip GetToolTipSymbol SetColor Color Green datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP XY TWOLINE Data ToolTips 339 datatooltip SetEnable True chartVu SetCurrentMouseListener datatooltip Complex data tooltip example Adapted from the OpeningScreen example In this example the tooltip will display the x value of the data point as a date and the y value as currency The x and y values are displayed on one line side by side C Font toolTipFont n
2. In degrees double radiusD ta 35 31 5 12 14 14 30 SimpleDataset dataset new SimpleDataset Control angleData radiusData AntennaCoordinates antennacoords new AntennaCoordinates antennacoords AutoScale dataset ChartObj AUTOAXES FAR Visual Basic Dim angleData As Double 0 30 60 90 120 150 180 In degrees Dim radxusData As Double 35 31 5 12 14 14 30 Dim dataset As SimpleDataset _ New SimpleDataset Control angleData radiusData Dim antennacoords As AntennaCoordinates New AntennaCoordinates antennacoords AutoScale dataset ChartObj AUTOAXES FAR Miscellaneous Coordinate System Topics Inverted Coordinate Systems Charts that use linear logarithmic and time coordinate systems usually follow the convention that values increase as you move from left to right and from bottom to top This is not always the case though Many standard charts that users want to reproduce on the computer have the x scale the y scale or both increase as you move from right to left and from top to bottom Invert the x and or y scales by swapping the scale starting and ending vaues in the call to the CartesianCoordinates or the TimeCoordinates constructor Example of inverted x scale using the CartesianCoordinates constructor C double xMin 5 double xMax 15 double yMin 0 double yMax 15 CartesianCoordinates simpleScale simpleScale new CartesianCo
3. Visual Basic Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData pTransforml New TimeCoordinates pTransforml SetWeekType weekmode pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR Define axes axes labels and grids Dim attribl As New ChartAttribute Color Red 1 DashStyle Solid Color Red attribl SetFillFlag True thePlotl New OHLCPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 75 attribl thePlotl SetFastClipMode ChartObj FASTCLIP X chartVu AddChartObject thePlotl Note how the ChartCalendar GetCalendarWidthValue method calculates the width of the bars as a function of time in this case a width of 0 75 days 284 Group Plot Objects Stacked Bar Plots Class StackedBarPlot GraphObj ChartPlot GroupPlot StackedBarPlot The StackedBarPlot class extends the GroupPlot class and displays data in stacked bar format In a stacked bar plot each group is stacked on top of one another each group bar a cumulative sum of the related group items before it StackedBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rbarwidth As Double _ ByVal rbarbase As Double _ ByVal attribs As ChartAttribute ByVal nbarjust As Integer _ C public StackedBarPlot PhysicalCoordinates transform Grou
4. essen 140 Placing Multiple Charts in a ChartView essen 141 Multiple Coordinate Systems in the Same Chartes eee eee 142 Chart View Object Resize Modes e eget ette Nate ta cate eere edere 143 Chart View View MOdes 1 2 eerte teet ete ee rese leet ee d eoa eo ee eode e eo ede aet eese leaena aua 144 Finding hart Objects cronaca doen niacin dede dete Bad ha dns AER 144 6 Background Colors and Gradients eene tete eden denen 147 yv PurPccI X 151 Chart A XO soc apice taa ose eti edu EID ect A etai RE en 152 LAM Ar AXES Stee dis 153 Logarithmic AXES oic soot ncs ncaa pom dua Ret emaciated Ret esa 159 Date MEAK S ao eite R eat iu cout cse eite ates cu Eu uii fere 165 Elapsed TIME eS hs decet no die ydus et S ese tee Cent art M eS 174 Polar AXES MU OM eas 178 ANNIA C HH 182 8 OUS WAG EG css caedote tutu det duse hare dieta idus totus du deed ds 189 AXIS Labels Tins tede ette ui a a a olan Sad aes uno pP ha tad d 189 Numeric Axis Labels eae eoo t ect dacs en ee dul rp ep b Ring 191 Time and Date Axis Labels concio lt ete tu td coat x vse eiua bU E RUNE 196 Blapsed Time Axis Labels aca uiecuse e Ee tle ai deci eet e E e Sd euet 202 Polar ARES Labe lsrin enn lotus a aA acte sai s due Meses 207 Antena Axes Labels au hse bu md nasal und Spese ltd tipsc ade tad 209 9 AXIS GdS et teh d c e en dr
5. Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates _ ByVal timespan As TimeSpan _ ByVal timeformat As Integer _ Visual Basic Declaration Public Sub New _ transform As PhysicalCoordinates _ tfont As Font _ timespan As TimeSpan _ x As Double _ y As Double _ npostype As Integer _ timeformat As Integer _ xjust As Integer _ yjust As Integer rotation As Double _ Cit public ElapsedTimeLabel PhysicalCoordinates transform ChartCalendar date int timeformat public ElapsedTimeLabel PhysicalCoordinates transform Font tfont TimeSpan timespan double x double y int npostype timespan timeformat int timeformat int xJ st int yjust double rotation Text Classes 391 The time span value used to initialize the label The format used to convert the time span value to a text stringUse one ofthe TIMEDATAFORMAT _ constants TIMEDATEFORMAT NONE TIMEDATEFORMAT 24HMS TIMEDATEFORMAT 24HM TIMEDATEFORMAT MS StringLabel constructors Visual Basic Overloads Public Sub New ByVal ByVal ByVal ByVal ByVal ByVal transform As PhysicalCoordinates tfont As Font _ tstring As String x As Double _ y As Double _ npostype As Integer _ Overloads Public Sub New ByVal Ct public StringLabel PhysicalCoordinates transform Font tfont string tstring double x double y int npostype ByVal
6. hePlotl PlotLabelTemplate DecimalPos 1 hePlotl ShowDatapointValue true label outliers hePlotl ScatterPlot ShowDatapointValue true ct CRO vCPO cU Ft oct oct o wt o ct xt ce ct hePlotl AutoBWChart chartVu AddChartObject thePlotl Visual Basic New York City Dim NYCity As Double 131 5 33 6 42 4 52 5 62 7 71 6 130 79 8 15 5 58 2 57 5 41 5 36 6 Group Plot Objects 251 Houston Dim Houston As Double 50 4 53 9 60 6 68 3 74 5 80 4 _ Sp 100 802 0 22 3 18 2 69 6 61 53 5 San Francisco Dim Sanfrancisco As Double 148 7 52 2 53 3 55 6 58 1 Tr HLS 2 7 3 7 D4 5 DI 54 9 49 4 Boston Dim Boston As Double 132 4 53 9 44 6 58 3 64 5 70 4 _ T3 90 72 6 1237 069 2 49 6 41 33 5 Pittsburgh Dim Pittsburgh As Double 141 4 54 24 6 38 3 44 5 61 4 _ 63 105 72 06 72 29 069 2 49 95 4l 33 5 Dim defaultattrib As New ChartAttribute Color Black 1 DashStyle Solid Color Red defaultattrib SetFillFlag True Dim fillattrib As New ChartAttribute Color Black 3 DashStyle Solid Color Red fillattrib SetFillFlag True hePlotl New BoxWhiskerPlot pTransforml 0 25 fillattrib hePlotl AddPopulation NYCity 1 hePlotl AddPopulation Houston 2 hePlotl AddPopulation Boston 4 t t t thePlotl AddPopulation SanFrancisco 3 t thePlotl AddPopulation Pittsburgh 5 thePlotl BWFormat
7. new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleX 0 10 pTransforml SetScaleY 0 10 plransforml SetGraphBorderDiagonal 0 15 15 90 0 75 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag true Arrow basearrow new Arrow ArrowPlot thePlotl new ArrowPlot pTransforml Datasetl basearrow attribl chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New GroupDataset First xl yl 246 Group Plot Objects Datasetl SetAutoScaleNumberGroups 1 Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE _ ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pIransforml SetScaleX 0 10 prTransforml SetScaleY 0 10 pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 75 Dim background As New Background pTransforml _ ChartObj PLOT BACKGROUND Color White chartVu AddChartObject background Define axes axes labels and grids Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag True Dim basearrow As New Arrow Dim thePlotl As New ArrowPlot pTransforml Datasetl basearrow attribl chartVu AddChartObject thePlot1
8. xAxis SetColor Color Red chartVu UpdateDraw Visual Basic Dim chartVu As ChartView ChartViewl Dim xAxis As LinearAxis New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis xAxis SetColor Color Red chartVu UpdateDraw The Chart View 141 You can change the values of a dataset or even change the complete dataset of a chart plot object Changing the values of the dataset will not show in the current graph until the ChartView repaints Call the ChartView UpdateDraw method to force a repaint See the example programs DynPieChart and ScrollingMixedPlot The auto scale methods are not automatically invoked if you change the values of dataset If you want the graph to rescale taking into account the new data values you must call the appropriate autoscale methods of the coordinate system and of the related axes objects The chart classes that are NOT subclasses of GraphObj do not have a physical representation in a graph so do not try to add them to the ChartView draw list This includes the coordinate conversion classes the dataset classes and all of the utility classes The GraphObj and ChartView classes use these utility classes for coordinate conversions data storage math calculations and I O Delete a specific chart object from the ChartView draw list using the ChartView DeleteChartObject method Clear the entire draw list using the ChartView ResetChartObjectList method You can leave an
9. C public SimpleBarPlot PhysicalCoordinates transform SimpleDataset dataset double barwidth double barbase ChartAttribute attrib int barjust transform The coordinate system for the new SimpleBarPlot object dataset The bar plot represents the values in this dataset barwidth The width of the bars in physical coordinates barbase The base value for bars in physical coordinates attrib Specifies the attributes line color and fill color of the bars barjust Specifies the justification with respect to the independent data value Use one of the justification constants JUSTIFY MIN JUSTIFY CENTER JUSTIFY MAX A ChartAttribute object sets the objects global line color fill color and fill mode Change the ChartAttribute object using the objects SetChartObjAttributes method The simple bar plot SetColor method can be used to change the bar color Simple Plot Objects 229 Individual bars in a simple bar plot object can have unique properties Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods Simple bar plot example extracted from the example program BigChartDemo class SimpleBarChart C TimeSimpleDataset Datasetl new TimeSimpleDataset Actual Sales x1 y1 TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prIransforml SetScaleStartY 0 pTransforml SetTimeScaleStart new ChartCalendar 1997
10. Dim dataset As SimpleDataset New SimpleDataset Sales xData yData Dim simpleScale As CartesianCoordinates New CartesianCoordinates simpleScale AutoScale dataset You can control the tightness of the auto scale values about the dataset values using other versions of the CartesianCoordinates AutoScale method that take rounding mode parameters Example of auto scaling a CartesianCoordinates object using a single dataset and explicit rounding mode parameters simpleScale AutoScale dataset ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR You can auto scale the bounds of the coordinate system using a dataset and then explicitly modify the range the auto scale selected There are methods that set the minimum and maximum values of the x and y scales This way you can use the auto scale methods for the values of one scale the y scale in the example below but explicitly set the values for the other scale the x scale in the example below Example of modifying the minimum and maximum values selected by an auto scale method C double xData 2 3 4 5 6 7 8 9 double yData 22 33 44 55 46 33 25 14 SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates 104 Scaling and Coordinate Systems simpleScale AutoScale dataset simpleScale SetScaleStopX 10 simpleScale SetScaleStartX 1 0 Visual Basic Dim xData A
11. GroupPlot CandlestickPlot The CandlestickPlot class is a concrete implementation of the GroupPlot class It extends the GroupPlot class and displays stock market data in an open high low close format common in financial technical analysis Every item of the plot is a group of two horizontal lines representing High and Low values which are connected with a vertical line and a box representing the Open and Close values If the Open value is greater than the Close value for a particular candlestick the box is filled otherwise it is unfilled The number of groups must be four The data in the dataset is organized in the following manner The Y 0 values of the group dataset represent the values for Open the Y 1 values for High the Y 2 values for Low and the Y 3 values for Close Group Plot Objects 255 CandlestickPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rwidth As Double _ ByVal defaultattrib As ChartAttribute ByVal fillattrib As ChartAttribute C public CandlestickPlot PhysicalCoordinates transform GroupDataset dataset double rwidth ChartAttribute defaultattrib ChartAttribute fillattrib transform dataset rwidth defaultattrib fillattrib The coordinate system for the new CandlestickPlot object The CandlestickPlot plot represents the group open high low close values i
12. Note the use of the GroupDataset method SetAutoScaleNumberGroups This forces the auto scale routine to look at only the first group of y values since those are the only y values that specify the absolute position of the arrows The other groups of y values specify size and rotation information and should not be considered in the auto scale calculation Box and Whisker Plots Class BoxWhiskerPlot GraphObj ChartPlot GroupPlot BoxWhiskerPlot Group Plot Objects 247 The BoxWhiskerPlot class extends the GroupPlot class and displays statistical data in a box and whisker format The BoxWhiskerPlot class graphically represents groups of numerical data through their five number summaries the smallest observation lower quartile Q1 median Q2 upper quartile Q3 and largest observation A BoxWhiskerPlot is unique among our chart types because the data is not represented by a 1D or 2D matrix Instead it consists of multiple populations where each population can have a different number of data points Each population is summarized by 5 statistics the smallest observation lower quartile Q1 median Q2 upper quartile Q3 and largest observation display graphically in a chart Read the Wikipedia entry for more information concerning box and whisker plots http en wikipedia org wiki Box plot BoxWhiskerPlot constructor Visual Basic Declaration Public Sub New _ transform As PhysicalCoordinates
13. simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed TimeAxis xAxis new TimeAxis simpleTimeScale Create the linear y axis LinearAxis yAxis new LinearAxis simpleTimeScale ChartObj Y AXIS TimeAxisLabels xAxisLabels new TimeAxisLabels xAxis NumericAxisLabels yAxisLabels new NumericAxisLabels yAxis Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject xAxisLabels chartVu AddChartObject yAxisLabels Visual Basic Define a Time coordinate system Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed Dim xAxis As TimeAxis New TimeAxis simpleTimeScale Create the linear y axis Dim yAxis As LinearAxis _ New LinearAxis simpleTimeScale ChartObj Y AXIS Dim xAxisLabels As TimeAxisLabels New TimeAxisLabels xAxis Dim yAxisLabels As NumericAxisLabels New NumericAxisLabels yAxis Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add th
14. 0 Dim yMax As Double 105 Dim simpleScale As ElapsedTimeCoordinates simpleScale New ElapsedTimeCoordinates xMin yMin xMax yMax or scale using TimeSpan values Dim xTSMin As TimeSpan TimeSpan FromSeconds 0 starting time is 0 Dim xTSMax As TimeSpan TimeSpan FromSeconds 30 ending time is 30 seconds simpleScale new ElapsedTimeCoordinates xTSMin yMin xTSMax yMax Another technique uses the default constructor and scales the coordinates using the ElapsedTimeCoordinates SetCoordinateBounds method 122 Scaling and Coordinate Systems Example of explicit scaling of a ElapsedTimeCoordinates object using the ElapsedTimeCoordinates SetCoordinateBounds method C Dim xMin As Double 0 starting elapsed time is 0 Dim xMax As Double 30 1000 ending elpase time is 30 seconds double yMin 0 double yMax 105 ElapsedTimeCoordinates simpleScale new ElapsedTimeCoordinates simpleScale SetCoordinateBounds xMin yMin xMax yMax Visual Basic Dim xMin As Double 0 starting elapsed time is 0 Dim xMax As Double 30 1000 ending elpase time is 30 seconds Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleScale As ElapsedTimeCoordinates New ElapsedTimeCoordinates simpleScale SetCoordinateBounds xMin yMin xMax yMax It is possible to scale the bounds of the coordinate system based on the data values in a dataset There are constructors and methods that take a single d
15. ChartText ChartTitle AxisTitle ChartLabel Class Architecture 53 This class defines the grid lines associated with an axis Grid lines are perpendicular to an axis extending the major and or minor tick marks of the axis across the width or height of the plot area of the chart This class works in conjunction with the LinearAxis LogAxis and TimeAxis classes This class defines the grid lines associated with a polar axis A polar chart grid consists of two sets of lines The first set is a group of concentric circles centered on the origin and passing through the major and or minor tick marks of the polar magnitude horizontal and vertical axes The second set is a group of radial lines starting at the origin and extending to the outermost edge of the polar plot circle passing through the major and minor tick marks of the polar angle circular axis This class works in conjunction with the PolarAxes class Analogous to the PolarGrid this class draws radial and circular grid lines for an Antenna chart NumericLabel TimeLabel StringLabel ElapsedTimeLabel The chart text classes draw one or more strings in the chart window Different classes support different numeric formats including floating point numbers date time values and multi line text strings International formats for floating point numbers and date time values are also supported ChartText This class draws a string in the current chart window It is the bas
16. Dp oF Lh Ga Windows Mobile 5 0 Pocket PC Emulat gl fal 4 v b Debug Any CPU Z Toolbox All Device Controls i Common Device Controls vax K Pointer ab Button Z CheckBox ZZ ComboBox Tf DateTimePicker ij DocumentList A Label A UnkLabel MonthCalendar 12 NumericUpDown li PictureBox ProgressBar RadioButton h Splitter abl TextBox 7 TrackBar E TreeView E WebBrowser SB chartview i Device Containers K Pointer Panel TabControl 7 Device Menus amp Toolbars K Pointer FE ContextMenu MainMenu Error List a v Qu 0 Errors 0 Warnings i 0 Messages Description 3 Error List E Output Sg Find Results 1 Ready Form1 cs Design z BY dashstyle WE iee E a HE 9 52 F l n com quinncurtis chart2dnecf ChartView mainMenut Column Project x Solution E Explorer UserChartExample1 1 4x RIS ELE A zy Solution UserChartExample11 1 project 9 UserChartExample11 X aj Properties iy References C3 mscorlib C3 QCChart2DNetCF 3 System 3 System Data System Drawing System Windows Forms System Xml E Formi cs Form1 Designer cs 2 Formi resx Program cs Properties lt X chartView1 com quinncurtis chart2dnetcF Chartvie pz ANENE Name Anchor
17. If the contourtype is CONTOUR LINE the colors of elements 0 numcontourlevels 1 set the colors of the contour lines If the contourtype is CONTOUR FILL elements 0 numcontourlevels set the colors of the contour regions blineflags An array size numcontourlevels of boolean flags specifying whether a contour line should be displayed blabelflags An array size numcontourlevels of boolean flags specifying whether a contour line should be labeled with the numeric value of the associated contour level numcontourlevels The number of contour levels contourtype Specifies 1f the contour plot uses contour lines CONTOUR LINE filled contour regions CONTOUR FILL or both CONTOUR LINEANDFILL Contour plots that use the CONTOUR FILL algorithm require one more color than the CONTOUR LINE algorithm Contour Plotting 293 The attributes for each contour line can set or modified using the SetSegment methods where the segment number parameter cooresponds to the contour value index These methods include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Contour line plot example extracted from the example program BigChartDemo class ContourLinePlot C double contourlevels 1000 1200 1400 1600 1800 1900 2000 2100 2200 2400 2600 2800 3000 chartVu chartViewl int i theFont new Font Microsoft Sans Serif 10 FontStyle Bold chartVu chartViewl Cartesian
18. InitializeComponent InstantiateChartView if chartViewl null chartViewl InitializeChart public void InstantiateChartView The Chart View 137 Allow room for a menu in the form Rectangle graphRect new Rectangle 1 1 this ClientRectangle Width 2 this ClientRectangle Height 2 Instantiate chart control chartViewl new UserControll chartViewl Location graphRect Location chartViewl Size graphRect Size chartViewl PreferredSize graphRect Size this Controls Add chartView1 In VB the constructor for the Form is in Form Designer vb module and not the user programmer Form vb module For that reason the chart creation code is place in the Form_Load event Visual Basic Public Class Forml SEE THE UserControll vb module for details of UserControll Dim ChartViewl As UserControll Nothing Public Sub InstantiateChartView Allow room for a menu in the form Dim graphRect As Rectangle New Rectangle 1 1 Me ClientRectangle Width 2 Me ClientRectangle Height 2 Instantiate chart control and add it to the form ChartViewl New UserControll ChartViewl Location graphRect Location ChartViewl Size graphRect Size ChartViewl PreferredSize graphRect Size Me Controls Add ChartViewl End Sub Private Sub Forml Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InstantiateChartView ChartViewl InitializeChart End Sub End Cla
19. Integrated data grids for viewing chart data The new DatasetViewer class displays chart datasets using a simple grid or table format Horizontal and vertical scrolling options are supported Numeric and time date based formats are also supported Row and column headers can be customized Individual grid Introduction 7 cells can be edited and the associated chart immediately updated using the synchronize feature SS ke aa eco Week 9 24 06 10 01 06 1ojosio6 10 15 06 10 22 06 10 29 06 L Eastem Central 9970 8838 913 6 907 4 8811 843 4 PadficMest DatasetViewer displaying the contents of a TimeSimpleDataset Daily Stock Price NASDAQ Price DatasetViewer display the contents of a TimeGroupDataset Visual Studio 2005 Projects All of the example program projects have been converted to the Visual Studio 2005 project format The VS 2005 project format is the oldest project format we expect to support in years moving forward While it may be possible to use the QCChart2D software with VS 2003 or VS 2002 it is not something we support any more You should assume that as we continue to enhance the software we will use features not supported under VS 2003 2002 We can still sell you a Revision 1 7 version of the 8 Introduction software with all of the original VS 2003 2002 projects however it will not include the features described above One difference betwee of VS 2005 and VS 2003 2002 i
20. Simple Plot Objects 237 Define and add axes axes labels and grids to chart ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid ChartAttribute attrib2 new ChartAttribute Color Blue 1 DashStyle Solid attrib2 SetFillColor Color Blue attrib2 SetFillFlag true attrib2 SetSymbolSize 10 SimpleLineMarkerPlot thePlotl new SimpleLineMarkerPlot pTransforml Datasetl ChartObj SQUARE attribl attrib2 0 1 chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New SimpleDataset First xl yl Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pIransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 7 Define and add axes axes labels and grids to chart Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid Dim attrib2 As New ChartAttribute Color Blue 1 DashStyle Solid attrib2 SetFillColor Color Blue attrib2 SetFillFlag True attrib2 SetSymbolSize 10 Dim thePlotl As New SimpleLineMarkerPlot pTransforml Datasetl ChartObj SQUARE attribl attrib2 0 1 chartVu AddChartObject thePlot1l Add the following lines to the program segment above to add data point labeling to the line marker plot C thePlotl SetShowDatapointValue true 238 Simple Plot Objects NumericLabel modellabel new NumericLabel modellabel SetXJust ChartO
21. chart View1 Top Left AutoScroll False AutoScrollMargin 0 0 AutoValidate EnablePreventFocusChar BackColor Control BackgroundDrawEnable False BorderStyle None ContextMenu none Dock None DoubleBufferEnable False Enabled True Font Tahoma 9pt ForeColor Bl cose GenerateMember True FH Location 58 v Name Indicates the name used in code to identify the object Ti 5 8 afi 234x259 e When you add a ChartView control to a Form it adds a reference to the DLL that the control is in to the project and places the default instantiation code in the form s Form Designer cs module Starting with VS 2005 Microsoft has decided to physically separate the designer generated code in a Form Designer cs module while keeping your user written code in a Form cs module If you can t see the Form Designer cs file in the Solution Explorer you must click in the Show All Files icon at the top of the Solution Explorer and expand the Form cs entry by clicking on the sign in front Form cs e The default name used for the first instance of the ChartView control added to a program is chartViewl The variable chartViewl becomes global to the entire Form class You will see a reference to chartViewl in all of our example programs You will find the definition of the chartView1 variable in the form s Designer cs module In our example programs in the form s user code area Form cs we typically assign chartView1 to a
22. int tickdir ChartObj AXIS CENTER polarAxes SetPolarAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor minorticlength majorticlength tigckdir Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes Visual Basic Dim polarmagnitude As Double 15 0 Dim polarscale As PolarCoordinates New PolarCoordinates polarmagnitude Dim polarAxes As PolarAxes New PolarAxes polarscale Dim axestickspace As Double 1 Dim axesntickspermajor As Integer Dim angletickspace As Double 50 Dim anglentickspermajor As Integer Dim minorticlength As Double 5 Dim majorticlength As Double 10 Dim tickdir As Integer ChartObj AXIS CENTER polarAxes SetPolarAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor 182 Axes minorticlength majorticlength _ tickdir Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes Antenna Axes Antenna axes provide the visual scale needed to compare data values that use antenna coordinates An antenna axis consists of two parts The first part is a linear y axis extending from the origin to the outer edge of the radial scale The second part of an antenna axis is a circle with a radius equal to the ra
23. new ElapsedTimeAxis simpleScale ChartObj Y AXIS Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Visual Basic Define the coordinate system Dim xMin As TimeSpan TimeSpan FromSeconds 0 Dim xMax As TimeSpan TimeSpan FromSeconds 15 Dim yMin As Double O0 Dim yMax As Double 15 Dim simpleScale As ElapsedTimeCoordinates New ElapsedTimeCoordinates xMin yMin xMax yMax Create the x and y axes Dim xAxis As ElapsedTimeAxis New ElapsedTimeAxis simpleScale ChartObj X AXIS Dim yAxis As ElapsedTimeAxis New ElapsedTimeAxis simpleScale ChartObj Y AXIS Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis 178 Axes Polar Axes Polar axes provide the visual scale needed to compare data values that use polar coordinates A polar axis consists of two parts The first part is a pair of linear x and y axes intersecting at the center Cartesian coordinate 0 0 The second part of a polar axis is a circle with radius R centered on the origin Class PolarAxes GraphObj T Axis Linear Axis Polar Axes The PolarAxes class creates a polar axes object that combines linear x and y axes for measurement of the polar magnitude and a circular axis for measurement of the polar angle The PolarAxes class extends the LinearAxis class This is useful because the LinearAxis alre
24. pol pol f arCoordinates polarscale new PolarCoordinates polarmagnitude arAxes polarAxes new PolarAxes polarscale arAxesLabels polarAxesLabels new PolarAxesLabels polarAxes arAxesLabels SetAxisLabelsFormat ChartObj DECIMALFORMAT arAxesLabels SetAxisLabelsDecimalPos 2 Create the ChartView object to place graph objects in ChartView chartVu chartViewl Axis Labels 209 Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarAxesLabels Visual Basic Dim polarmagnitude As Double 5 0 Dim polarscale As PolarCoordinates New PolarCoordinates polarmagnitude Dim polarAxes As PolarAxes New PolarAxes polarscale Dim polarAxesLabels As PolarAxesLabels New PolarAxesLabels polarAxes polarAxesLabels SetAxisLabelsFormat ChartObj DECIMALFORMAT polarAxesLabels SetAxisLabelsDecimalPos 2 Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarAxesLabels Antenna Axes Labels Class AntennaAxesLabels GraphObj ChartText AxisLabels NumericAxisLabels AntennaAxesLabels The AntennaAxesLabels class extends the NumericAxisLabels class and creates labels for objects of the AntennaAxes class The AntennaAxesLabels class labels the two parts of the antenna axes t
25. x Cartesian x coordinate y Cartesian y coordinate The PolarCoordinates class is an extension of the CartesianCoordinates class and it automatically handles these conversions The only important parameter that needed for the creation of a PolarCoordinates object is the polar magnitude since the polar angle always has a range 0 to 2 pi radians 0 to 360 degrees PolarCoordinates contructors The first way to create a PolarCoordinates object is to use the constructor that specifies the polar magnitude directly C double polarmagnitude 5 0 PolarCoordinates polarscale new PolarCoordinates polarmagnitude Visual Basic Dim polarmagnitude As Double 5 0 Dim polarscale AS PolarCoordinates New PolarCoordinates polarmagnitude Or you can use an auto scale routine to analyze a dataset and select the appropriate polar magnitude C double l angleData 20 60 1 40 1 70 2 50 4 0 5 0 6 0 In Radians double magnitudeData 20 33 44 55 46 33 54 64 SimpleDataset dataset new SimpleDataset Control angleData magnitudeData PolarCoordinates pPolarTransform new PolarCoordinates pPolarTransform AutoScale dataset ChartObj AUTOAXES FAR Visual Basic Scaling and Coordinate Systems 127 Dim angleData As Double 0 2 0 6 1 4 1 7 2 5 4 0 5 0 6 0 In Radians Dim magnitudeData As Double 20 33 44 55 46 33 54 64 Dim dataset As SimpleDataset _ New SimpleDataset C
26. 0 chartImage SetSizeMode ChartObj COORD SIZE chartImage SetImageSize New Dimension 1 1 chartVu AddChartObject chartImage End If Generic Arrow Class Class Arrow ChartObj Arrow The Arrow defines an arrow shape useable with the ChartShape class The Arrow class creates the arrows in the ArrowPlot class and it can also place individual arrows in a chart The class creates a base arrow with a custom arrowhead and shaft size Scale rotate and position the arrow in a chart The arrow is defined using device coordinates Arrow constructor Visual Basic Overloads Public Sub New _ ByVal arrowshafthalfwidth As Double ByVal arrayshaftlength As Double _ ByVal arrowheadhalfwidth As Double ByVal arrowheadlength As Double _ C public Arrow double arrowshafthalfwidth double arrayshaftlength double arrowheadhalfwidth double arrowheadlength Lines Shapes Images and Arrows 407 arrowshafthalfwidth Sets the half width of the arrow shaft default 1 arrayshaftlength Sets the length of the arrow shaft default 7 arrowheadhalfwidth Sets the half width of the arrow head default 2 arrowheadlength Sets the length of the arrow head default 3 The default arrow has a length of about 10 pixels and a width of 4 pixels at the head The size of the various parts can be set to whatever values you want to create an arrow of with an aspect ratio appropriate to your application You can scale t
27. 0 0 This often happens when a chart is initially setup with a linear scale with a minimum physical coordinate value of 0 0 and a maximum coordinate value equal to some large number The user changes to a logarithmic scale but forgets to change the minimum coordinate value of the scale from 0 0 to some positive non zero number The coordinate conversion routines will halt the first time the log 0 0 is in a calculation The same is also true if the minimum coordinate value is any negative number This software always checks for this condition and changes the minimum coordinate value using the following criteria If the minimum coordinate value for a logarithmic scale is less than or equal to 0 0 it is assumed that the user made an error and coordinate value is set to 1 0 If the minimum coordinate value is greater than 0 0 but less than the value of MIN LOG VALUE the minimum coordinate value is set to MIN LOG VALUE Scaling and Coordinate Systems 97 Positioning the Plot Area in Graph Area The WorkingCoordinates class has a group of methods SetGraphBorderFrame SetGraphBorderDiagonal and SetGraphBorderInsets that position the plot area of the chart in the graph viewport Since the coordinate system scaling classes are subclasses of WorkingCoordinates these methods are part of those classes These methods are redundant and only one need be called The default position of the plot area in the graph view port is at x 0 2 y 0 2 width 0 6
28. 1 angl i ChartSupport ToRadians CDbl i 360 0 CDb1 nump1 magl i Math Abs 30 Math Sin 2 angl i Math Cos 29 angl il l Next i theFont New Font Microsoft Sans Serif 10 FontStyle Bold chartVu ChartViewl Dim Datasetl As New SimpleDataset First magl angl Dim pPolarTransform As New PolarCoordinates pPolarTransform SetGraphBorderDiagonal 0 25 0 2 0 75 0 8 Dim background As New Background pPolarTransform ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject background pPolarTransform AutoScale Datasetl Dim pPolarAxis As PolarAxes pPolarTransform GetCompatibleAxes chartVu AddChartObject pPolarAxis Dim pPolarGrid As New PolarGrid pPolarAxis PolarGrid GRID MAJOR chartVu AddChartObject pPolarGrid Dim pPolarAxisLabels As PolarAxesLabels _ CType pPolarAxis GetCompatibleAxesLabels PolarAxesLabels Polar Charts chartVu AddChartObject pPolarAxisLabels Dim attribl As New ChartAttribute Color Blue 2 0 Dim thePlotl As New PolarLinePlot pPolarTransform Datasetl attribl chartVu AddChartObject thePlot1l Dim attrib2 As New ChartAttribute Color Red 1 0 Color Red attrib2 SetFillFlag True Dim thePlot2 As New PolarScatterPlot pPolarTransform Datasetl _ ChartObj CIRCLE attrib2 chartVu AddChartObject thePlot2 Polar Scatter Plots Class PolarScatterPlot GraphObj ChartPlot PolarPlot PolarScatter
29. 1 month major tick mark spacing 1 week minor tick mark spacing TIMEAXIS MONTHDAY TIMEAXIS WEEK TIMEAXIS WEEKDAY TIMEAXIS DAY TIMEAXIS DAY12HOUR TIMEAXIS DAYSHOUR TIMEAXIS DAY4HOUR TIMEAXIS DAY2HOUR TIMEAXIS DAYHOUR TIMEAXIS _ 12HOURHOUR TIMEAXIS SHOURHOUR TIMEAXIS 4HOURHOUR TIMEAXIS 2HOURHOUR TIMEAXIS HOUR TIMEAXIS HOUR30MINUTE TIMEAXIS HOURISMINUTE TIMEAXIS HOURIOMINUTE Axes 167 1 month major tick mark spacing 1 day minor tick mark spacing 1 week major tick mark spacing 1 week major tick mark spacing 1 day minor tick mark spacing 1 day major tick mark spacing 1 day major tick mark spacing 12 hour minor tick mark spacing 1 day major tick mark spacing 8 hour minor tick mark spacing 1 day major tick mark spacing 4 hour minor tick mark spacing 1 day major tick mark spacing 2 hour minor tick mark spacing 1 day major tick mark spacing 1 hour minor tick mark spacing 12 hour major tick mark spacing 1 hour minor tick mark spacing 8 hour major tick mark spacing hour minor tick mark spacing 4 hour major tick mark spacing 1 hour minor tick mark spacing 2 hour major tick mark spacing 1 hour minor tick mark spacing 1 hour major tick mark spacing 1 hour major tick mark spacing 30 minute minor tick mark spacing 1 hour major tick mark spacing 15 minute minor tick mark spacing 1 hour major tick mark spacing 10 minute minor tick mark spacing 168 Axes
30. 293 295 301 303 304 305 307 311 313 322 323 325 326 327 332 333 349 350 352 434 436 445 446 447 CartesianCoordinates 1 22 23 59 93 95 99 100 101 102 103 104 105 106 107 109 120 125 126 127 128 129 130 138 141 142 143 157 163 194 195 215 216 233 236 237 245 246 258 263 273 274 280 281 288 289 293 295 301 303 304 305 307 311 313 322 323 325 326 327 332 333 349 350 352 434 436 445 446 447 Cell plots 35 38 60 243 254 256 257 258 259 CellPlot 35 38 60 243 254 256 257 258 259 Chart object attributes 19 23 Chart titles 53 54 60 311 375 376 379 383 384 385 ChartAttribute 8 23 25 59 220 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 239 240 241 244 245 246 247 250 251 252 253 254 255 256 257 258 259 260 261 263 264 265 266 267 268 269 270 271 272 274 275 276 277 278 279 280 281 282 283 284 287 288 289 291 292 294 296 339 348 349 350 351 354 356 357 358 359 360 361 362 363 364 365 366 368 369 370 371 372 373 374 375 376 403 407 434 435 437 ChartCalendar 20 21 24 29 54 57 59 61 66 67 68 82 83 84 85 86 107 109 110 111 112 113 114 115 116 117 118 119 129 165 170 172 173 200 201 229 230 231 240 241 256 460 Index 262 264 265 267 268 2770 271 276 277 2778 283 285
31. 40 30 Dim Datasetl As SimpleDataset New SimpleDataset First xl yl Dim n2 As Integer 9 Dim x2 n2 1 As Double Dim d dimension is upper limit not size Dim y2 n2 1 As Double Dim d dimension is upper limit not size x2 0 5 x2 1 7 x2 n2 1 100 y2 0 15 y2 1 25 y2 n2 1 100 Dim Dataset2 As SimpleDataset New SimpleDataset Second x2 y2 C double xi 10 ZU 30 40 300 double yl 9 21 20 40 30 SimpleDataset Datasetl new SimpleDataset First xl yl int n2 2 9 double x2 new double n2 dimension is size not upper limit double y2 new double n2 dimension is size not upper limit x2 0 5 x2 1 7 ths ffs x2 n2 1 100 y2 0 15 y2 1 25 tie TE Chart Datasets 65 y2 n2 1 100 SimpleDataset Dataset2 new SimpleDataset Second x2 y2 Example of reading and writing a simple dataset from a CSV file C CSV csvdata new CSV SimpleDataset Datasetl new SimpleDataset csvdata SimpleDataset csv 0 0 Write out dataset as a CSV file under a different file name Datasetl WriteSimpleDataset csvdata SimpleDataset2 csv Visual Basic Dim csvdata As CSV New CSV Dim Datasetl As SimpleDataset New SimpleDataset csvdata SimpleDataset csv 0 0 Write out dataset as a CSV file under a different file name Datasetl WriteSimpleDataset csvdata SimpleDataset2 csv Example of
32. 46 60 353 360 361 362 366 Arrow vi vii 59 244 245 246 401 406 407 Arrow plots 34 35 60 243 244 245 246 254 401 406 ArrowPlot 34 35 60 243 244 245 246 254 401 406 Arrows vi vii 59 244 245 246 401 406 407 AutoScale 24 59 103 104 105 107 112 113 114 115 116 117 119 120 122 123 124 125 126 127 128 130 138 149 224 225 226 229 233 236 237 245 246 253 258 259 264 265 267 268 270 277 278 280 281 283 285 286 288 289 301 311 313 315 325 326 327 355 356 359 360 444 445 446 Auto scaling classes 24 59 103 104 105 107 112 113 114 115 116 117 119 120 122 123 124 125 126 127 128 130 138 149 224 225 226 229 233 236 237 245 246 253 258 259 264 265 267 268 270 277 278 280 281 283 285 286 288 289 301 311 313 315 325 326 327 355 356 359 360 444 445 446 Axis vi 25 26 31 32 54 60 139 151 152 153 154 159 160 165 166 169 174 178 182 189 190 191 193 196 202 213 311 385 Axis label classes 31 32 53 54 60 139 189 190 191 196 202 207 209 379 387 446 Axis titles 53 54 60 311 379 385 386 436 438 AxisLabels 31 32 60 139 189 190 191 196 202 207 209 379 446 AxisTitle 53 54 60 311 379 385 386 436 438 Background v 9 25 60 133 139 147 148 149 225 226 229 232 233 246 267 268 270 271 273 274 275 277 27
33. 52 53 60 139 213 215 216 217 219 271 293 294 295 436 438 449 Grids 52 53 60 139 213 215 216 217 219 271 293 294 295 436 438 449 Group bar plots 35 40 60 268 269 270 271 336 Group datasets 20 21 24 59 61 79 80 81 82 87 235 244 245 246 252 254 255 257 258 259 260 261 262 263 266 269 272 273 274 276 279 280 281 282 284 287 288 289 395 445 453 Group plot classes 18 33 34 35 36 37 38 39 40 41 42 43 44 60 139 243 244 246 247 252 254 256 257 259 261 265 266 268 269 272 275 276 278 279 281 282 284 286 287 GroupBarPlot 35 40 60 268 269 270 271 336 GroupDataset 20 21 24 59 61 79 80 81 82 87 235 244 245 246 252 254 255 257 258 259 260 261 262 263 266 269 272 273 274 276 2779 280 281 282 284 287 288 289 395 445 453 GroupPlot 18 33 34 35 36 37 38 39 40 41 42 43 44 60 139 243 244 246 247 252 254 256 257 259 261 265 266 268 269 272 275 276 278 279 281 282 284 286 287 GroupVersaPlot 1 3 35 40 60 Histogram plots 35 41 60 243 272 274 275 HistogramPlot 35 41 60 243 272 274 275 Image objects 54 60 148 401 404 405 406 Legend 51 52 60 139 367 379 Legend classes 51 52 60 139 367 379 Legend items 51 52 60 369 370 LegendlItem 51 52 60 369 370 Line gap plots 35 42 60 243 275 276 277 278 Lin
34. Browse Location C Quinn Curtis DotNet QCChart2D visual CSharp CF examples 2005 Solution Create new Solution v Create directory For solution Solution Name UserChartExamplell e Click OK and you end up looking at the basic template for a simple application 422 Using QCChart2D for Net CF to Create Windows Applications UserChartExample11 Microsoft Visual Studio Ele Edit View Project Build Debug Data Tools Window Community Help dl bru dd A gt Debug Any CPU gt jf dashstyle Windows Mobile 5 0 Pocket PC Emulat gt Se G oy A me cl 3 Toolbox H X Form1 cs Design All Device Controls i Common Device Controls K Pointer ab Button Z CheckBox E ComboBox Tf DateTimePicker ij DocumentList A Label A LinkLabel SZ ListBox 35 ListView I MonthCalendar 12 NumericUpDown lal PictureBox ProgressBar RadioButton splitter abi TextBox 7 TrackBar Treeview Sj WebBrowser SE Chartview i Device Containers K Pointer Panel C TabControl i Device Menus amp Toolbars K Pointer f mainMenut FE ContextMenu MainMenu Error List Q 0 Errors 0 Warnings i 0 Messages Description 3 Error List E Output Sg Find Results 1 Column z Aa A Solution UserChartExample11 1 project ERECT serchortexorolet aj Properties T E References lt E Formi cs
35. ByVal bgtype As Integer _ ByVal startcolor As Color _ ByVal stopcolor As Color ByVal dir As Integer gt C public Background PhysicalCoordinates transform int bgtype Color startcolor Color stopcolor int dir transform The coordinate system associated with the chart background The transform defines where the plot area fits in the graph area bgtype The chart background type Use one of the chart background type constants PLOT BACKGROUND or GRAPH BACKGROUND Specifying the PLOT BACKGROUND type fills the plot area of the chart while specifying the GRAPH BACKGROUND type fills the entire graph area of the chart startcolor Specifies the starting color value of the gradient stopcolor Specifies the ending color value of the gradient dir Specifies the direction of the gradient Should you want to use some sort of image as a background for the chart use the ChartImage class and size it to fill the entire view The example below defines a simple linear gradient for the graph background area extracted from the example program BigChartDemo class LineFill C Background Colors Textures and Gradients 149 pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 1 92 0 75 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 100
36. Datasetl SetStackMode ChartObj AUTOAXES STACKED Dim pTransforml As New TimeCoordinates ChartObj TIME SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 0 15 0 8 0 75 254 Group Plot Objects Define axes axes labels and grids Dim attribl As New ChartAttribute Color Black 0 DashStyle Solid attribl SerrillQolor Color From Argb 177 33 33 attribl SetFillFlag True Dim thePlotl As New BubblePlot pTransforml Datasetl _ ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChartObject thePlotl Note the use of the GroupDataset method SetStackMode This forces the auto scale routine to look at the sum of y values across groups as is needed to auto scale stacked plots It is useful for bubble plots of type SIZE BUBBLE RADIUS because the y 0 value represents the y position of the bubble and the y 1 value the radius in physical coordinates Adding the two for each bubble gives the maximum y value for the scale needed to display the bubble If SIZE BUBBLE AREA is used you may want to restrict the auto scale routines to the just look at the bubble position using SetAutoScaleNumberGroups 1 as seen in the ArrowPlot example You could then add in some fudge factor to make sure that the scale shows the entire bubble The example under CellPlot demonstrates this Candlestick Plots Class CandlestickPlot GraphObj ChartPlot
37. Net CF For unknown reasons starting with the Net CF 3 5 found in Visual Studio 2008 it does matter The VS 2008 Toolbox will not host a UserControl derived object that contains PInvoke calls Therefore we include two versions of the QCChart2DNetCF DLL one that uses PInvoke and supports XOR drawing and one that does not use PInvoke They are named QCChart2DNetCF XOR DLL uses PInvoke and support XOR drawing mode and QCChart2DNetCF NOXOR DLL does not use PInvoke and does not support XOR drawing mode The DLL you wish to use must copied and renamed to QCChart2DNetCF DLL and placed in the Quinn Curtis DotNetMib folder The default QCChart2DNetCF DLL file is a copy of QCChart2DNetCF NOXOR DLL Introduction 11 QCChart2D CF for Net Compact Framework Dependencies The QCChart2D CF for the Net Compact Framework class library is self contained It uses only standard classes that ship with the Microsoft Net Compact Framework API The software uses the major Net namespaces listed below System Windows Forms Namespace The System Windows Forms namespace contains classes for creating Net Forms Controls and Dialog boxes System Drawing Namespace The System Drawing namespace provides access to basic graphics functionality System Drawing Drawing2D Class The System Drawing Drawing2D namespace contains the DashStyle enumerication that is used by many of the programs The VS 2003 version of Net CF SDK did not support dash styles for line
38. Stock Data al arrays because we just have the selectedindex yet we want to display stock O H L C data volume and NASDAQ Only one of these datasets can be selected at a time by the tooltip Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim stoc stoc stog stoc stoc stoc stoc stoc Dim Dim open As Double high As Double low As Double close As Double nasdaq As Double volume As Double openObj As Stri stockPriceData 0 selectedindex stockPriceData 1 selectedindex stockPriceData 2 selectedindex stockPriceData 3 selectedindex NASDAQData selectedindex stockVolumeData selectedindex ng ChartSupport NumToString open ChartObj DECIMALFORMAT 2 highObj As Stri ng ChartSupport NumToString high ChartObj DECIMALFORMAT 2 lowObj As Strin g ChartSupport NumToString low ChartObj DECIMALFORMAT 2 closeObj As Str volumeObj As St nasdaqObj As St timelabel As New g2 As kpanel kpanel kpanel kpanel kpanel kpanel kpanel kpanel AddNewLin AddNewLin AddNewLin AddNewLin AddNewLin AddNewLin AddNewLin Graphics ing ChartSupport NumToString close ChartObj DECIMALFORMAT 2 ring ChartSupport NumToString volume ChartObj DECIMALFORMAT 0 ring ChartSupport NumToString nasdaq ChartObj DECIMALFORMAT 2 TimeLabel transform
39. calculated position the software does a check to see if the bounding box of the new axis label intersects the bounding box of the previous axis label If the new label is going to overlap the previous label the label is skipped You can override this default behavior by calling the objects SetOverlapLabelMode method SetOverlapLabelMode ChartObj OVERLAP LABEL DRAW Another option for horizontal axes only is to stagger the tick mark labels A stagger automatically alternates the line on which the tick mark label is placed SetOverlapLabelMode ChartObj OVERLAP LABEL STAGGER 17 How do I change the order the chart objects are drawn For example I want one of my grid objects to be drawn under the charts line plot objects and another grid object to be drawn top of the charts line plot objects There are two ordering methods used to render chart objects The first method renders the objects in order as added to the ChartView object Objects added to the view last are drawn on top of objects added first The second method renders the objects according to their z order Objects with the lowest z order values are rendered first Objects with equal z order values are rendered in the ordered they are added to the ChartView object The second method z order rendering is the default method of object rendering used by the ChartView class This default behavior can be changed by call the ChartView SetZOrderSortEnable false method You can chan
40. examples of manual scaling 444 FAQs 11 How do I update my data and auto rescale the chart scales and axes to reflect the new data after it has already been drawn Updating data was discussed in FAQ 6 If you want the chart to rescale based on the new data call the appropriate coordinate systems auto scale method followed by the auto axis methods of all related axes Then call the ChartView UpdateDraw method For example C Create the ChartView object to place graph objects in TimeSimpleDataset Datasetl new TimeSimpleDataset Sales x1 y1 TimeCoordinates simpleTimeCoordinates new TimeCoordinates simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR ChartView chartVu chartViewl Create the time axis x axis is assumed TimeAxis xAxis new TimeAxis simpleTimeCoordinates Create the linear y axis LinearAxis yAxis new LinearAxis simpleTimeCoordinates ChartObj Y AXIS The following code would be in the code handling the rescale event Rescale chart based on a modified Datasetl datset simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR xAxis CalcAutoAxis yAxis CalcAutoAxis Redraw the chart using the rescaled coordinate system and axes chartVu UpdateDraw Visual Basic Dim Datasetl As TimeSimpleDataset New TimeSimpleDataset Sales xl yl Dim simpleTimeCoordinates As TimeCoordinates N
41. fill color and fill mode Change the ChartAttribute object using the objects SetChartObjAttributes method Use the SetColor method to set the color of a simple plot object The line step style is using the SetStepMode method Individual line segments in a simple line plot object can have unique properties Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods Simple line plot example extracted from the example program BigChartDemo class LineFill C TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR ChartAttribute attribl new ChartAttribute Color Blue 3 ChartObj DashStyle Solid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlot1 Simple Plot Objects 225 Visual Basic Dim pTransforml As TimeCoordinates New TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Dim thePlotl As SimpleLinePlot _ New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Simple line plot example using segment colors extracted from the example program BigChartDemo class LineFill TimeSimpleDataset DatasetArray Datasetl Dataset2 Dataset3 T pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray
42. rRight The right inset of the plot area inside the graph area specified using graph normalized coordinates rBottom The bottom inset of the plot area inside the graph area specified using graph normalized coordinates The following examples all position the plot area of the chart in the upper right quadrant of the graph viewport C CartesianCoordinates simpleScale 100 Scaling and Coordinate Systems simpleScale new CartesianCoordinates xMin yMin xMax yMax Use ONE of the example below Example 1 simpleScale SetGraphBorderFrame new Rectangle2D 0 5 0 0 0 5 0 5 Example 2 simpleScale SetGraphBorderFrame 0 5 0 0 0 5 0 5 Example 3 simpleScale SetGraphBorderDiagonal 0 5 0 0 1 0 0 5 Example 4 simpleScale SetGraphBorderInsets 0 5 0 0 0 0 0 5 Visual Basic Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleScale As CartesianCoordinates simpleScale New CartesianCoordinates xMin yMin xMax yMax Use ONE of the example below Example 1 simpleScale SetGraphBorderFrame new Rectangle2D 0 5 0 0 0 5 0 5 Example 2 simpleScale SetGraphBorderFrame 0 5 0 0 0 5 0 5 Example 3 simpleScale SetGraphBorderDiagonal 0 5 0 0 1 0 0 5 Example 4 simpleScale SetGraphBorderInsets 0 5 0 0 0 0 0 5 Scaling and Coordinate Systems 101 Linear and Logarithmic Coordinate Scaling Cl
43. resizeMultiplier for any objects requiring a size change using the GraphObj SetResizeMultiplier method ChartView View Modes A ChartView window can interact with a parent container creating a couple of interesting view modes The first is to place the ChartView object in a Windows Form Size the ChartView window larger than the Form window size and the Form frame acts as a porthole through which the ChartView window is viewed Resizing the Form frame has no effect on the size of ChartView object within If the Form frame is smaller than the size of the ChartView window then the lower right portion of the ChartView window is not visible If the Form frame is larger than the ChartView window the lower right portion of the window just shows empty space Finding Chart Objects The ChartView class is the central container class of the chart library It keeps track of all of the objects in the chart It includes a routine that can compare a test point against all of the objects in the chart and return an instance of an object that intersects the test point The search can be restricted to a class and all subclasses of the specified class FindObj method The Chart View 145 Visual Basic Overloads Public Function FindObj _ ByVal testpoint As Point2D _ ByVal classname As String _ As GraphObj C4 public GraphObj FindObj Point2D testpoint String classname Parameters If the graph has multiple overlapping objects of
44. sampled every 15 seconds starting on June 12 2001 11 43 00 PM and continuing until June 15 2001 1 03 45 AM The major application for date time chart scaling on the Internet is the display of financial market data Multiply the number of on line investors using the charting tools of on line brokerage firms and financial web sites by the number of individual stocks bonds options and futures contracts that they are able to chart and it becomes apparent that the number of potential charts is almost infinite Many stocks have more than 50 years of hourly historical information associated with them A chart comparing the relative performance of General Electric IBM Dupont Ford and Kodak compared to the Dow Jones Industrial average since the dawn of the computer age in 1950 will quickly highlight the above average stock market gains that can be made by investing in the right stocks A user may start by looking at a fifty year window on a stock then through successive zoom operations narrow the window to two years one month one day one hour and perhaps even one minute 5 vs 7 Day Work Weeks Historically western cultures use a five day workweek Much of the data suitable for charting includes data for only the workdays of Monday through Friday excluding weekends Data associated with financial markets is the most common Stocks trade on Monday through Friday excluding weekends and holidays In the display of financial market information
45. textTemplate 340 Data ToolTips datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP OHLC datatooltip SetToolTipSymbol toolTipSymbol datatooltip SetEnable True chartVu SetCurrentMouseListener datatooltip Custom Tooltip displays It would be impossible to provide options for all possible tooltip displays The DataToolTip class includes an option that enables the programmer to override the existing behavior of the class The programmer is able to use the built in search routines to identify what plot object is selected the dataset the coordinate system and the actual data values associated with the plot object Using this information the programmer can customize the text displayed in the ChartText object used to display the tooltip text Use the following steps to create a custom tooltip e Subclass the DataToolTip class with one of your own e Enable the custom mode by calling DataToolTip SetDataToolTipFormat ChartObj DATA TOOLTIP CUSTOM method e Override the OnMouseDown and OnMouseUp events and add the code needed to customize the display In your custom OnMouseDown event make sure you call super OnMouseDown first since this selects the plot object for you and makes the plot objects coordinate system dataset and selected data point available using get methods You can place your tooltip text in the ChartText object internal
46. thePlotl floatingBarPlot Datasetl 0 75 attribl ChartObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR Visual Basic Dim Datasetl As New GroupDataset Actual Sales xl yl Dim pTransforml As New CartesianCoordinates pTransforml SetScaleStartX 0 prTransforml SetScaleStartY 0 pIransforml SetScaleStopX 12 pTransforml SetScaleStopY 7 Define axes axes labels and grids Dim attribl As New ChartAttribute Color Black 1 DashStyle Solid Color Green attribl SetFillFlag True Dim thePlotl As New FloatingBarPlot pTransforml Datasetl 0 75 attribl ChartObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR Floating bar plot example that uses date time values as the floating bar endpoints extracted from the example program BigChartDemo class FloatingBarChart method InitializeChart2 C int nnumpnts 18 int numgroups 2 264 Group Plot Objects double xl new double nnumpnts ChartCalendar yl new ChartCalendar numgroups nnumpnts x1 0 6 yl 0 0 new ChartCalendar 2002 ChartObj JANUARY 1 yl 1 0 new ChartCalendar 2003 ChartObj JANUARY 1 xl 1 5 yl 0 1 new ChartCalendar 2002 ChartObj JANUARY 1 yl 1 1 new ChartCalendar 2002 ChartObj MAY 1 x11117 1 yl 0 17 new ChartCalendar 2002 ChartObj JULY 1 yl 1 17 new ChartCalendar 2002 ChartObj OCTOBER 1 theFont new Font Microsoft Sans Serif 10 FontStyle Bold T
47. xValues selectedindex ChartObj TIMEDATEFORMAT STANDARD eTextString timelabel GetTextString eTextString Open openObj eTextString High highObj eTextString Low 1lowObj eTextString Close closeObj eTextString Volume volumeObj eTextString NASDAQ nasdaqObj SetChartObjEnable ChartObj OBJECT ENABLE GetToolTipGraphics Data ToolTips 345 Precalculates the text bounding box so that the size is known before it is drawn Stockpanel PreCalcTextBoundingBox g2 Dim boundingbox As Rectangle2D stockpanel GetTextBox Reposition tooltip text box if top of box near top of graph window You can do the same thing for all four sides of the graph window If mousepos GetY boundingbox GetHeight 1 Then mousepos SetLocation mousepos GetX mousepos GetY _ boundingbox GetHeight stockpanel SetLocation mousepos ChartObj DEV POS End If Draws the tooltip text panel to the chart graphics context stockpanel Draw GetToolTipGraphics End If End Sub OnMouseDown End Class CustomToolTip 17 Pie and Ring Charts PieChart RingChart Everyone is familiar with the ubiquitous pie chart Pie charts are 1 dimensional not because they are shallow but because they represent a simple 1 dimensional series of numbers 3 5 2 7 3 rather than the parametric set of data points 3 2 6 3 7 3 used in the other plot types described in this so
48. 09 1 26 09 2 02 09 FloatingStackedBarPlot This class is a concrete implementation of the Group Plot class and displays free floating stacked bars The bars are free floating because each bar does not reference a fixed base value as do simple bar plots stacked bar plots and group bar plots 40 Class Architecture 1997 Prozac 1999 2001 2003 1997 1998 1999 2 zoloft Paxil Celexa Group and the Stacked bars represent two different ways of displaying the same data GroupBarPlot StackedBarPlot GroupVeraPlot This class is a concrete implementation of the GroupPlot class and displays group data in a group bar format Individual bars the height of which corresponds to the group y values of the dataset display side by side as a group justified with respect to the x position value for each group The group bars share a common base value This class is a concrete implementation of the GroupPlot class and displays data as stacked bars In a stacked bar plot each group is stacked on top of one another each group bar a cumulative sum of the related group items before it The GroupVersaPlot is a plot type that can be any of the eight group plot types GROUPBAR STACKEDBAR CANDLESTICK OHLC MULTILINE STACKEDLINE FLOATINGBAR and FLOATING STACKED BAR Use it when you want to be able to change from one plot type to another without deleting the instance of the old plot object and creating an instance of the new Class A
49. 1 As Double Dim currentdate As New ChartCalendar 1998 ChartObj JANUARY 1 y1 0 100 Chart Datasets 69 y2 0 30 x1 0 currentdate Clone currentdate Add ChartObj MONTH 3 For i 1 To nnumpnts 1 xl i currentdate Clone yili yl i I 5 i 0 75 ChartSupport GetRandomDouble y2 y2 i 1 15 1 0 95 ChartSupport GetRandomDouble y currentdate Add ChartObj MONTH 3 Next i Dim Datasetl As New TimeSimpleDataset Sales xl yl Dim Dataset2 As New TimeSimpleDataset Expenses xl y2 Example of creating a simple time datasets from a CSV file C Default time date format is M dd yyyy CSV csvDataFile new CSV Create a dataset based on a previously saved csv file TimeSimpleDataset Datasetl new TimeSimpleDataset csvDataFile LineFill Datasetl csv 0 0 Write out dataset as a CVS file Datasetl WriteTimeSimpleDataset csv LineFill Datasetl csv Read it back in just as a test Datasetl ReadTimeSimpleDataset csv LineFill Datasetl csv 0 0 Visual Basic Default time date format is M dd yyyy Dim csvDataFile As CSV New CSV Create a dataset based on a previously saved csv file Dim Datasetl As TimeSimpleDataset _ New TimeSimpleDataset csvDataFile LineFill Datasetl csv 0 0 Write out dataset as a CVS file Datasetl WriteTimeSimpleDataset csvDataFile LineFill Datasetl csv Read it back in just as a test Data
50. 1 Introduction Charting Tools for the Net Compact Framework Charting Library 1 New Features found in the 2 0 version of OCChar2D l Differences between this and the previous 1 6 version 8 SS eT c E 9 Net Compact Framework Background essere enne 9 Limitation of the Net API Compact Framework API eee 9 QCChart2D CF for Net Compact Framework Dependencies sssss 11 Installation Directory Structure sos aede secs vo scent aee eager vd eu e course Ru legent 11 Chapter SIAR eoe eds eg dao ra des Ex dear eara us peau EE Pauci dus asas etie 14 2 Class Architecture of the QCChart2D CF for the Net Compact Framework Class EXE y dde ost sse de eaedem ina bes adea oA ese casu E ae f atcp eee 17 Major Design Considerations sss sese eee 17 QCChart2D CF for Net Compact Framework Class Summary sese eee eee eee 19 Chart Window Classes tis aeien arrena aa ta e ep Resa OR eA RAS eA tel EO S oa REA NR ROTH 20 Data CASS CS a secs eO GR NA E M NELLE CUM E CU Ld 20 Scale Classes NH E RNC ERE 21 Coordinate Lrans form Class 66 scs scien ied e des On BRANI IR iR NRI UR LIT NRI ste Dux TE 22 Auto Sealing Classes ec eder dee ntt ets tere ie eis edita vete te dece uen eden 23 Chart Object 6145965 be ao e gne Ee duce t redi eie aub ans que eU E 25 Mouse Enferdctiom Classes aded cT E ata mi AEn Fastest ftu eu Me ee 33 Miscellaneous Utility Classes sese 57 3 Chart Datasets ausa raa
51. 1 second minor tick mark spacing 15 second major tick mark spacing 1 second minor tick mark spacing Axes 169 TIMEAXIS 10SECONDSECOND 10 second major tick mark spacing 1 second minor tick mark spacing TIMEAXIS SSECONDSECOND 5 second major tick mark spacing 1 second minor tick mark spacing TIMEAXIS 2SECONDSECOND 2 second major tick mark spacing 1 second minor tick mark spacing TIMEAXIS SECOND 1 second major tick mark spacing Sunday is the first day of the week for 7 day weeks while Monday is the first day of the week for 5 day weeks It may not be immediately obvious but the major tick marks for date time scales do not necessarily fall on equal intervals If the tick marks are set to the TIMEAXIS MONTHDAY value there may be 28 29 30 or 31 days between each months major tick mark In most cases the major tick mark coincides with a minor tick mark For example if the TIMEAXIS MONTHDAY setting is used the major tick mark for a month falls at the first day of the month coinciding with the minor tick mark for that day If the TIMEAXIS WEEKDAY setting is used the major tick mark for a WEEK falls at the first day of the week coinciding with the minor tick mark for that day Situations where the major and minor tick marks do not coincide involve weeks as minor tick marks If the TIMEAXIS MONTHWEEK setting is used the first day of the month may or may not correspond to the first day of the week Sunday or Monday Major tick
52. 4 25 29 33 60 152 165 174 175 177 190 202 203 205 206 ElapsedTimeAxisLabels 1 4 32 33 60 120 165 189 190 202 203 204 205 206 ElapsedTimeGroupDataset 1 20 21 24 59 61 87 88 89 90 91 395 ElapsedTimeLabel 53 54 60 379 387 389 390 400 ElapsedTimeScale 4 21 22 59 93 ElapsedTimeSimpleDataset 1 20 21 24 59 61 70 71 72 73 122 123 124 125 205 206 395 Error bar plots 35 38 60 243 259 260 ErrorBarPlot 35 38 60 243 259 260 Finding graph objects 55 56 59 144 145 442 FindObj 55 56 59 144 145 442 Floating bar plots 35 39 60 243 260 261 263 264 265 FloatingBarPlot 35 39 60 243 260 261 263 264 265 Graph object class v 23 25 45 60 132 138 139 140 141 143 144 145 147 152 153 159 165 174 178 182 190 191 196 202 207 209 213 214 216 219 223 227 231 235 238 244 246 252 254 256 259 260 265 268 272 275 278 281 284 286 291 299 302 309 310 311 347 354 357 358 361 362 364 367 369 370 372 379 401 404 441 448 GraphObj v 23 25 45 60 132 138 139 140 141 143 144 145 147 152 153 159 165 174 178 182 190 191 196 202 207 209 213 214 216 219 223 227 231 235 238 244 246 252 254 256 259 260 265 268 272 275 278 281 284 286 291 299 302 309 310 311 347 354 357 358 361 362 364 367 369 370 372 379 401 404 441 448 Grid
53. 50 255 Color FromArgb 40 25 120 ChartObj Y AXIS chartVu AddChartObject background Visual Basic Dim pTransforml As TimeCoordinates New TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 0 1 0 92 0 75 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 100 50 255 Color FromArgb 40 25 120 ChartObj Y AXIS chartVu AddChartObject background 7 Axes Axis LinearAxis ElapsedTimeAxes PolarAxes AntennaAxes LogAxis TimeAxis Chart axes describe for the viewer the physical coordinate system used to scale the plot area of a chart A well defined visually appealing chart will display one or more axes with the following characteristics e Minimum and maximum values for axes endpoints that are appropriate for the displayed data e Appropriately spaced axis tick marks that permit the user to easily interpolate by simple inspection data values located between labeled tick marks e Axis tick mark labels that fall on logical even intervals e Flexible axis placement inside or outside the plot area e Axes for linear date time elapsed time logarithmic polar and antenna physical coordinate systems The programmer can explicitly set these characteristics or they can be calculated automatically based on an analysis of the associated chart data The axes of a chart do not define the phy
54. As Integer _ C public void SetAxisTicks double tickorigin double tickspace int ntickspermajor iz public void SetAxisTicks double tickorigin double tickspace int nminortickspermajor double minorticklength double majorticklength int tickdir intercept tickorigin tickspace ntickspermajor minorticklength majorticklength tickdir Sets the intercept of this axis with the perpendicular axis in physical coordinates The tick marks start at this value Specifies the spacing between minor tick marks Specifies the number of minor tick marks per major tick mark The length of minor tick marks in Net device coordinates The length of major tick marks in Net device coordinates The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX Axes 177 Use the SetLineWidth SetLineStyle and SetColor methods to customize the drawing properties of the lines used to draw the axis line and tick marks Simple elapsed time axis example C Define the coordinate system TimeSpan xMin TimeSpan FromSeconds 0 TimeSpan xMax TimeSpan FromSeconds 15 ll o double yMin double yMax 105 ElapsedTimeCoordinates simpleScale new ElapsedTimeCoordinates xMin yMin xMax yMax Create the x and y axes ElapsedTimeAxis xAxis new ElapsedTimeAxis simpleScale ChartObj X AXIS ElapsedTimeAxis yAxis
55. ByVal ByVal ByVal ByVal ByVal ByVal ByVal transform As PhysicalCoordinates tfont As Font _ tstring As String x As Double y As Double _ npostype As Integer _ xjust As Integer _ yjust As Integer _ rotation As Double _ public StringLabel PhysicalCoordinates transform Font tfont 392 Text Classes string tstring double x double y int npostype int xjust int vJjust double rotation tstring A reference to a string object Place text in is a time coordinate system TimeCoordinates by converting the time x position to milliseconds and using the milliseconds as the x position value NumericLabel and StringLabel example extracted from the example program BigChartDemo class MoveDatapoint C classlAverage Datasetl GetAverageY class2Average Dataset2 GetAverageY StringLabel classlLabel new StringLabel pTransforml subheadFont Class 1 An Average 0 9 0 3 ChartObj NORM GRAPH POS chartVu AddChartObject classlLabel classlAverageLabel new NumericLabel pTransform1 subheadFont classlAverage 0 9 0 35 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddChartObject classlAverageLabel StringLabel class2Label new StringLabel pTransforml subheadFont Class 2 An Average 0 9 0 5 ChartObj NORM GRAPH POS chartVu AddChartObject class2Label class2AverageLabel new NumericLabel pTransform
56. CF collection of standard components such as menus buttons check boxes etc The ChartView class contains a collection of all the chart objects displayed in the chart and will automatically update all chart objects when the underlying window moves resizes or otherwise needs to redraw in response to a UserControl paint event Since a ChartView derived window is a UserControl it can also be used as a container for any Net CF component that can be placed and positioned in UserControl windows using a Net CF layout managers Control ChartView The ChartView class has several constructors that position the ChartView class within a parent window ChartView constructor Visual Basic Overloads Public Sub New Overloads Public Sub New _ ByVal positionRect As Rectangle _ ByVal parent As Control _ Overloads Public Sub New _ ByVal positionRect As Rectangle _ ByVal parent As Form _ Overloads Public Sub New _ ByVal positionRect As Rectangle _ ByVal parent As Panel _ Overloads Public Sub New _ ByVal positionRect As Rectangle _ ByVal parent As TabPage _ C public ChartView public ChartView Rectangle positionRect System Windows Forms Form parent public ChartView Rectangle positionRect System Windows Forms UserControl parent 132 The Chart View public ChartView Rectangle positionRect System Windows Forms Panel parent public ChartView Rectangle positionRect System Windows Forms Ta
57. CartesianCoordinates ByVal n As Integer ByVal brescale As Boolean MyBase New component transforms brescale End Sub New Public Overrides Sub OnMouseDown ByVal mouseevent As MouseEventArgs If mouseevent Button And MouseButtons Right lt gt 0 Then Me PopZoomStack Else MyBase OnMouseDown mouseevent End If End Sub OnMouseDown End Class ZoomWithStack Dim Datasetl As New SimpleDataset First xl yl Dim Dataset2 As New SimpleDataset Second xl y2 Dim Dataset3 As New SimpleDataset Third xl y3 Zooming 327 Dim Dataset4 As New SimpleDataset Fourth xl y4 Dim Dataset5 As New SimpleDataset Fifth xl y5 Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim pTransform2 As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform2 AutoScale Dataset2 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim pTransform3 As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform3 AutoScale Dataset3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim pTransform4 As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform4 AutoScale Dataset4 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim pTransform5 As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform5 AutoScale Dataset
58. ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prransforml SetGraphBorderDiagonal 0 15 1 92 0 75 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 100 50 255 Color FromArgb 40 25 120 ChartObj Y AXIS chartVu AddChartObject background Background plotbackground new Background pTransforml ChartObj PLOT BACKGROUND Color Black chartVu AddChartObject plotbackground Define and add axes axes labels and grids to the chart ChartAttribute attribl new ChartAttribute Color Blue 3 DashStyle Solid Datasetl SortByX true thePlotl new SimpleLinePlot pTransform1 Datasetl attribl chartVu AddChartObject thePlot1 ChartAttribute attrib2 new ChartAttribute Color Yellow 3 DashStyle Solid Dataset2 SortByX true thePlot2 new SimpleLinePlot pTransforml1 Dataset2 attrib2 chartVu AddChartObject theP10ot2 226 Simple Plot Objects ChartAttribute lossAttrib new ChartAttribute Color Red 1 DashStyle Solid Color Red ChartAttribute profitAttrib new ChartAttribute Color Green 1 DashStyle Solid Color Green profitAttrib SetFillFlag true lossAttrib SetFillFlag true profitAttrib SetLineFlag false lossAttrib SetLineFlag false Must call the linePlot or similar function before setting segment attributes so that it know size of segment buffer to allocate thePlot3 new SimpleLinePlot pTransforml Dataset3 profitAttrib double y
59. ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 FAQs 443 double yMin 0 I m cy LH double yMax TimeCoordinates simpleTimeScale simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed TimeAxis xAxis new TimeAxis simpleTimeScale Create the linear y axis LinearAxis yAxis new LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Visual Basic Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed Dim xAxis As TimeAxis New TimeAxis simpleTimeScale Create the linear y axis Dim yAxis As LinearAxis New LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis The documentation for the various coordinate system and axis classes includes
60. ChartObj SQUARE attrib2 chartVu AddChartObject thePlot2 Class AntennaScatterPlot GraphObj ChartPlot AntennaPlot AntennaScatterPlot The AntennaScatterPlot class is a concrete implementation of the AntennaPlot class and displays data in a simple scatter plot format AntennaScatterPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As AntennaCoordinates ByVal dataset As SimpleDataset ByVal symtype As Integer _ ByVal attrib As ChartAttribute 362 Polar Charts Cf public AntennaScatterPlot AntennaCoordinates transform SimpleDataset dataset int symtype ChartAttribute attrib transform The coordinate system for the new AntennaScatterPlot object dataset The antenna scatter plot represents the antenna coordinate values in this dataset The x values of the dataset represent the radial values of the points and the y values the angular values in degrees symtype The symbol used in the scatter plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE attrib Specifies the attributes size line and fill color for the scatter plot See previous example for a programming example using AttennaScatter Plot Class AntennaLineMarkerPlot GraphObj ChartPlot AntennaPlot AntennaLineMarkerPlot The AntennaLineMarkerPlot class is a concrete implementation of the AntennaP
61. Double _ ByVal majorticklength As Double _ ByVal tickdir As Integer _ 162 Axes C4 public void SetAxisTicks double tickorigin int nlogtickformat ig public void SetAxisTicks double origin int nlogtickformat double minorticklength double majorticklength int tickdir intercept Sets the intercept of this axis with the perpendicular axis in physical coordinates nlogtickformat This parameter specifies which minor tick marks are flagged for labels Logarithmic axis minor tick mark labels can become very crowded It is possible to choose values that may overlap or not display Valid nlogtickformat values are 0 No minor tick mark labels 1 Place a label at tick mark 0 in each decade 2 Place a label at minor tick marks 1 3 and 5 in each decade 3 Place a label at minor tick marks 0 1 2 3 and 5 in each decade 4 Place a label at minor tick marks 0 1 2 3 4 and 5 in each decade 5 Place a label at minor tick marks 0 1 2 3 4 5 and 6 in each decade 6 Place a label at minor tick marks 0 1 2 3 4 5 6 and 7 in each decade 7 Place a label at minor tick marks 0 1 2 3 4 5 6 7 and 8 in each decade 8 Place a label at minor tick marks 0 1 2 3 4 5 6 7 8 and 9 in each decade minorticklength The length of minor tick marks in Net CF device coordinates majorticklength The length of major tick marks in Net CF device coordinates Axes 163 ticdir
62. Form1 Designer cs 22 Program cs Properties wax UserChartExample11 Project Properties SWE Output File Folder YCSIDL_PROGRAM_FILES 4 Policy File Project File UserChartExample11 csproj Target Device Windows Mobile 5 0 Pocket p Project Framework Version The Version of the NET Compact Framework this project targets Creating project UserChartExample11 project creation successful The previous steps apply to all Net Compact Framework applications The following steps are specific to adding QCChart2D CF charts to your application For purposes of this example the chart will placed in the initial default form Using ChartView with the Visual Studio Design Mode e Add the ChartView control to the Toolbox If it isn t there already add the ChartView UserControl to the Visual Studio Toolbox To add the ChartView control to the VS Toolbox right click on the Toolbox and select Choose Items From the Choose Toolbox Items dialog use the Browse button and go to the Quinn Curtis DotNet Lib folder and select QCChart2DNetCF DLL OK out of the Choose Toolbox Items dialog You will now see a ChartView control in the tool box list of controls e Click on the ChartView control in the Toolbox and drop in on the default form Using QCChart2D for Net CF to Create Windows Applications 423 2 UserChartExample11 Microsoft Visual Studio File Edit View Project Build Debug Data Format Tools Window Community Help
63. GetTimeXData method It returns an array of ChartCalendar objects and it is not a reference to the underlying data The underlying data is stored as double values that represent the millisecond equivalent of the date time values The TimeGroupDataset GetXData and GetYData methods return references to the underlying data You can also modify a point at a time using one of the TimeGroupDataset SetTimeXDataValue and SetYDataValue methods If you need to add new points to dataset increasing its size use one of the AddTimeGroupDataPoints or InsertTimeGroupDataPoints methods Delete data points using the DeleteDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a group time datasets C int nNumPnts 50 nNumGroups 4 int weekmode ChartObj WEEK 5D Chart Datasets 85 ChartCalendar xValues new ChartCalendar nNumPnts double stockPriceData new double nNumGroups nNumPnts double minval 0 0 maxval 0 0 ine iz ChartCalendar currentdate new ChartCalendar ChartCalendar SetTOD currentdate 0 0 1 currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode Make sure not to start on a weekend xValues 0 ChartCalendar currentdate Clone currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode stockPriceData 3 0 25 close stockPriceData 0 0 253 open stockPriceData 1 0 26 high
64. Labels int format font The font object used to display the axis label text rotation The rotation in degrees of label text in the normal viewing plane labdir The justification of the axis label AXIS MIN or AXIS MAX with respect to the tick mark endpoint decimal Sets the number of digits to the right of the decimal point for numeric axis labels labelends Specifies whether there should be labels for the axis minimum LABEL MIN maximum LABEL MAX or tick mark starting point LABEL ORIGIN The value of these constants can be OR d together The value of LABEL MIN LABEL MAX LABEL ORIGIN is LABEL ALL labcolor The color of the label text format Sets the numeric format for the axis labels Use one of the numeric format constants DECIMALFORMAT SCIENTIFICFORMAT EXPONENTFORMAT BUSINESSFORMAT ENGINEERINGFORMAT PERCENTFORMAT CURRENCEYFORMAT CURRENCYBUSINESSFORMAT Simple numeric axis labels example C Define the coordinate system double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale new CartesianCoordinates xMin yMin xMax yMax Create the x and y axes LinearAxis xAxis new LinearAxis simpleScale ChartObj X AXIS LinearAxis yAxis new LinearAxis simpleScale ChartObj Y AXIS NumericAxisLabels xAxisLabels new NumericAxisLabels xAxis Axis Labels 195 NumericAxisLabels yAxisLabels new NumericAxisLabels yAxis Creat
65. NEAR pTransforml SetGraphBorderDiagonal 0 15 15 82 0 75 SetInitialDates pTransforml Dim graphbackgroundl As New Background pTransforml ChartObj GRAPH BACKGROUND Color White Color LightGray ChartObj Y AXIS chartVu AddChartObject graphbackgroundl Dim plotbackgroundl1 As New Background pTransforml ChartObj PLOT BACKGROUND Color White Dim attribl As New ChartAttribute Color Red 1 DashStyle Solid Color Red Dim attrib2 As New ChartAttribute Color Yellow 1 DashStyle Solid Color Yellow Dim attrib3 As New ChartAttribute Color Blue 1 DashStyle Solid Color Blue Dim attrib4 As New ChartAttribute Color Green 1 DashStyle Solid Color Green Dim attribArray As ChartAttribute attribl attrib2 attrib3 attrib4 attribl SetFillFlag True thePlotl New FloatingStackedBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 75 attribArray ChartObj JUSTIFY CENTER thePlotl SetFastClipMode ChartObj FASTCLIP X chartVu AddChartObject thePlotl Group Bar Plots Class GroupBarPlot GraphObj ChartPlot GroupPlot GroupBarPlot Group Plot Objects 269 The GroupBarPlot class extends the GroupPlot class and displays data in a group bar format Individual bars the height of which corresponds to the group values Y 0 Y 1 Y 2 of the dataset are displayed side by side as a group justified with respect to the X position value for each group Gr
66. OnMouseDown event it draws the zoom rectangle using the XOR drawing mode during the OnMouseMove event and terminates the zoom operation on the mouse released event During the mouse released event the zoom rectangle is converted from device units into the chart physical coordinates and this information is stored and optionally used to rescale the chart scale and all axis objects that reference the chart scale If four axis objects reference a single chart scale for example when axes bound a chart on all for sides all four axes re scale to match the new chart scale ChartZoom constructor The constructor below creates a zoom object for a single chart coordinate system Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal transform As PhysicalCoordinates ByVal brescale As Boolean _ C public ChartZoom ChartView component PhysicalCoordinates transform bool brescale component A reference to the ChartView object that the chart is placed in transform The PhysicalCoordinates object associated with the scale being zoomed brescale True designates that the scale should be re scaled once the final zoom rectangle is ascertained Enable the zoom object after creation using the ChartZoom SetEnable true method Zooming 321 Retrieve the physical coordinates of the zoom rectangle using the ChartZoom GetZoomMin and GetZoomMax methods Restrict zooming in the x or y direction using the SetZoo
67. Plot The PolarScatterPlot class is a concrete implementation of the PolarPlot class and displays data in a simple scatter plot format PolarScatterPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PolarCoordinates ByVal dataset As SimpleDataset ByVal symtype As Integer _ ByVal attrib As ChartAttribute C public PolarScatterPlot PolarCoordinates transform SimpleDataset dataset int symtype ChartAttribute attrib transform The coordinate system for the new PolarScatterPlot object 357 358 Polar Charts dataset The polar scatter plot represents the polar coordinate values in this dataset The x values of the dataset represent the magnitudes of the points and the y values the polar angles in radians symtype The symbol used in the scatter plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE attrib Specifies the attributes size line and fill color for the scatter plot See previous example for a programming example using PolarScatterPlot Antenna Plots Class AntennaLinePlot GraphObj ChartPlot AntennaPlot AntennaLinePlot The AntennaLinePlot class is a concrete implementation of the AntennaPlot class and displays data in a simple line plot format The lines drawn between adjacent data points use antenna coordinate interpolation AntennaLinePlot constr
68. Rectangle2D ChartCalendar CSV Dimension Point2D This class contains utility routines used to process ChartCalendar date objects This is a utility class for reading and writing CSV Comma Separated Values files This is a utility class for handling dimension height and width information using doubles rather than the integers used by the Size class This class encapsulates an xy pair of values as doubles more useful in this software than the Net CF Point class 58 Class Architecture GroupPoint2D DoubleArray DoubleArray2D BoolArray Point3D NearestPointData TickMark Polysurface Rectangle2D This class encapsulates an x value and an array of y values representing the x and y values of one column of a group data set This class is used as an alternative to the standard Net CF Array class adding routines for resizing of the array and the insertion and deletion of double based data elements This class is used as an alternative to the standard Net CF 2D Array class adding routines for resizing of the array and the insertion and deletion of double based data elements This class is used as an alternative to the standard Net CF Array class adding routines for resizing of the array and the insertion and deletion of bool based data elements This class encapsulates an xyz set of double values used to specify 3D data values This is a utility class for returning data that results fro
69. SetChartObjAttributes attribl axis color matches line color chartVu AddChartObject yAxisl yAxis2 New LinearAxis pTransform2 ChartObj Y AXIS yAxis2 SetAxisIntercept 18 yAxis2 SetChartObjAttributes attrib2 axis color matches line color chartVu AddChartObject yAxis2 yAxis3 New LinearAxis pTransform3 ChartObj Y AXIS yAxis3 SetAxisIntercept 35 yAxis3 SetChartObjAttributes attrib3 axis color matches line color 438 FAQs chartVu AddChartObject yAxis3 yAxis4 New LinearAxis pTransform4 ChartObj Y AXIS yAxis4 SetAxisIntercept 52 yAxis4 SetChartObjAttributes attrib4 axis color matches line color chartVu AddChartObject yAxis4 yAxis5 New LinearAxis pTransform5 ChartObj Y AXIS yAxis5 SetAxisIntercept xAxis GetAxisMax yAxis5 SetAxisTickDir ChartObj AXIS MAX yAxis5 SetChartObjAttributes attrib5 axis color matches line color chartVu AddChartObject yAxis5 Dim xAxisLab As New NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab Dim yAxisLabl As New NumericAxisLabels yAxis1 yAxisLabl SetTextFont theFont yAxisLabl SetAxisLabelsFormat ChartObj BUSINESSFORMAT chartVu AddChartObject yAxisLabl Dim yAxisLab2 As New NumericAxisLabels yAxis2 yAxisLab2 SetTextFont theFont chartVu AddChartObject yAxisLab2 Dim yAxisLab3 As New NumericAxisLabels yAxis3 yAxisLab3 SetTextFont theFont chartVu AddChartObject yAxisLab3 Dim yAxisLab4
70. SetScaleStartX 0 pTransforml SetScaleStartY 0 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color FromArgb 255 255 255 chartVu AddChartObject background pIransforml SetGraphBorderDiagonal 0 15 15 90 0 70 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Blue 3 DashStyle Solid ChartAttribute attribArray new ChartAttribute numGroups for i20 i lt numGroups i attribArray i ChartAttribute attribl Clone MultiLinePlot thePlotl new MultiLinePlot pTransforml Datasetl attribArray chartVu AddChartObject thePlot1 Visual Basic Dim numPoints As Integer 100 Dim numGroups As Integer 7 Dim xl numPoints 1 As Double Dim yl numGroups 1 numPoints 1 As Double Dim i j As Integer For i 0 To numPoints 1 xl x b CDBbI zy 0 2 Group Plot Objects 281 For j 0 To numGroups 1 yl ud 9 a 9 01 CDbl j 1 5 0 1 0 Math Exp xl i 0 7 Next j Next i yl 0 5 ChartObj rBadDataValue yl 3 15 ChartObj rBadDataValue theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New GroupDataset First xl yl Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prTransforml SetScaleStartX 0 pIransforml SetScaleStartY 0 Dim backgroun
71. SetScaleStopX maxx pTransforml SetScaleStopY maxy Re auto scale to produce rounded axis values pTransforml AutoScale ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR Define axes axes labels and grids Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag True Dim thePlotl As New CellPlot pTransforml Datasetl attribl For i 0 To numPoints 1 thePlotl SetSegmentColor i Color FromArgb CInt x1 i _ CIntiyi 0 2 2 00 _ Crnt vl l Ly 4 yi1 2 19 TYI Next i chartVu AddChartObject thePlot1l Note the use of the GroupDataset method SetAutoScaleNumberGroups This forces the auto scale routine to look at just the first group of values Y 0 because those are the only absolute position values The maximum cell width and height are calculated and added to the initial scale The auto scale function is then rerun producing a coordinate system that takes into account the widths and heights of the cells Error Bar Plots Class ErrorBarPlot GraphObj ChartPlot GroupPlot ErrorBarPlot The ErrorBarPlot class extends the GroupPlot class and displays error bars Error bars are two lines positioned around a data point to signify the statistical error associated with the data point The number of groups must be two The X Y 0 values of the group dataset represent the xy position of the first error bar lines the X Y 1 values o
72. Wes w T F U we T w Day T Day Wei f T T T T T T T T T T T T T Wed Thu Fh Sat Sun Mon Tue Wed Thu Fh un Mon Yer Wed Thu 10503 11203 There are more than 40 derer h makiate axes types appropriate for scales ranging from 1 second to 100 years Date Axes Day pea 8 necha Peper rrr TSTST STET 10103 19303 10203 ies 000 va woo ow ra 10103 10203 A neuie Moss Mita f MA 4 4494 000 400 s 1200 1000 000 100 200 300 400 wows wows Nowe Minute 34 MinteMisute TTTTTTTTTTTTTTTTTITTTTTTTITTITETTTTT rr LAL RL RST 000 1 209 300 000 935 030 va 100 1003 10103 6 Mosule Minste aR AAA rrr 600 006 1005 om ow ow 024 Mirate Second 00000 00100 00200 003100 10103 Minule Seewads TUTTI f TIT 00000 60100 60200 00300 00400 10103 00000 onno 0 0 00014 00020 10103 There ee mora than 40 aterert tradite anne fos MEC eE Ma for sowas ranging tron 1 second to 100 yass TimeAxis Class Architecture 29 Time Date Axes with Custom Hour Range 8 30 AM to 4 00 PM This class is the most complex of the axis classes It supports time scales ranging from 1 millisecond to hundreds of years Dates and times are specified using the Net CF ChartCalendar class The major and minor tick marks can fall on any time base where a time base represents seconds minutes hours days weeks months or years The scale can exclude weekends for example Friday October 20 2000 is immediately follow
73. a Form Designer module while keeping your user written code in a Form vb module If you can t see the Form Designer vb file in the Solution Explorer you must click in the Show AII Files icon at the top of the Solution Explorer and expand the Form vb entry by clicking on the sign in front Form vb e The default name used for the first instance of the ChartView control added to a program is ChartView1 The variable ChartViewl becomes global to the entire Form class You will see a reference to ChartViewl in all of our example programs You will find the definition of the ChartView1 variable in the form s Designer vb module In our example programs in the form s user code area Form vb we typically assign ChartView1 to a local variable named chartVu and then customize the graph using the chartVu variable name You will also need to make sure that you reference com quinncurtis chart2dnetcf and System Drawing Drawing2D in the Imports section of any module that Using QCChart2D for Net CF to Create Windows Applications 417 references ChartView The reference to System Drawing Drawing2D is needed just for its definition of the DashStyle enumeration which is used by many of the example programs See the example program UserChartExamplel for a simple example Imports com quinncurtis chart2dnetcf Imports System Drawing Drawing2D Public Class Forml Public Sub InitializeChart Dim chartVu As ChartView ChartViewl Chart spe
74. a erai e aa ae aT E E a UE 61 simple Numeric Datasetasens scent M etu Vendee M pesar b dest 61 Simple Date Time DA sebo uoa erae ets adu seid abs db Res tenes B eines 66 Simple BlapsedTitie Datasetduaine tope entails eb ines ptas basi dud ptas ut Eain 70 Contour Plot Dataset rit n deett e teste eive etie bv PH ad i ira tariis 73 Nu me ric Gro p ata el occesotuce e AN Horae edel ee tans QNS deoe enea Mee va eheu Ne I Md 79 Date Time Group Dataset odas palais taa n copa todo doeet dedo dRea Ea aed 82 Elapsed Time Dataset uio de ges o eat rei e qe Ur tates Ue PY D Pe EEG RA dors 87 4 Scaling and Coordinate SySIems saei eee 93 Plot area and grapli dtem i coe koi che n tq NI E EE eas du 93 Coordinate Systems 45d quse tete cord i rudis E Lo pU Rd eo ae Kamath aaa 94 Important numeric considerationis usa reote less et torn deme Fa d epit em Mou 96 Positioning the Plot Area in Graph Area ebrei ettet eus ires p esie mts 97 Linear and Logarithmic Coordinate Scaling serene 101 Coordinate Systems using times and dates sese 107 Polar Coordinate Systems a a ute ride e ve RO HERO Ern bae Cdp tr Oeo Oa eta oce bd uxg 125 Antenna Coordinate Systems sese eee eee 127 Miscellaneous Coordinate System TOpIioSs uei eee itte etis ese ient 128 5 The Chart View soccer ved uie genis sie edens A o E ec atr ade NS 131 Rendering Order of GraphObi Objects ue o repa lareo enia 138 Dynamic or Real Time Updates of Chart Objects
75. can subclass an existing class and create new custom charting objects Examples of custom charting objects are specialized plots that extend the SimplePlot or GroupPlot classes to include new plot types for applications such as stock market technical analysis statistical process control and medical instrumentation to name a few e Third the library has no limits regarding the number of data points in a plot the number of plots in graph the number of axes in a graph and the number of coordinate systems in a graph A major weakness in many commercial graphics packages is that they have hard coded limits that restrict the number of data points axes or coordinate systems A simple business bar chart may only contain 3 or 4 data points depicting a sales forecast An audio mixer application may require 32 million plotted points represented by 32 traces of 1 million points each each trace representing 20 seconds of audio sampled at 50 kHz The most effective way to compare data is to overlay it in the same graph Often the data series have different dynamic ranges If the data series are plotting using the same scale it is difficult do see the correlation or lack of in the data A better solution is to create a unique scale for each data series with associated axes and plot each data series with respect to its own scale All of the plots will overlay the same area of the graph Many advanced charting packages do not support more than one co
76. chart in a separate window sees eee eee ee 328 Magnifying multiple physical coordinate systems sere 331 15 Data Tooltips annann e aret Pe det ede e Et ute detecte ee ves 335 Simple Data Tooltips a oett E artegn EEA EAEE eda HAE set ON pui TA 335 Custom Tooltip displays cose eu etia ti aet sente tSt d cuida arenis 340 Dr FP HS ATA ER ing Charts ela eb eA ch esa tau tA be esa abs mde inis 347 Usinethe Pie Chart Class eroinei buses eas tea ata ince setae mec bae tpm id 347 18 Polar and Antenna Plots eter rper reete se aides e are peg S 353 Polar PIoles osten APR UR Sve ee ADS 354 Polar Scatter Blois eser eaa mu dr LA DD ME I ME 357 Atena Plots ceteri yenit ive el iaaa inani e datei eee e o des 358 I E8Sends c obseibadulsts tbt omoia idis bt ocean e etd bat ec E MU 367 Standard Eesends si cobi sec ena bte tius e onsen Mana lee oc tees aas 367 B bble Plot Legends ence oce RS EE eerte NOE a REES 372 PONO UIMLII E 379 Simple Text Class S o rne Ree DR UNA itae b a Daten OP a Ne fait once 379 Chart Dile asses veronica dp uA ate E M EE 383 Numeric Time Elapsed Time and String Label Classes sss 387 21 Dataset VIS Wer recae etie eoi cbe iua e CHAR S GU ERR E QR TNNT a Ee de o ENS 395 22 Adding Lines Shapes Images and Arrows to a Chart sees 401 Generis ape Tasse eco a D epa be UN dece nena tesa cue debui tue c 401 Chart Image Cass iesu ideo abcr ed i roe ca ghe tiec bei abi be o toU Qu een Se 404 Generic
77. chartViewl in all of our example programs You will find the definition of the chartView1 variable in the form s Designer cs module In our example programs in the form s user code area Form cs or Form vb we typically assign chartViewl to a local variable named chartVu and then customize the graph using the chartVu variable name You will also need to make sure that you reference com quinncurtis chart2dnetcf in the using or Imports for VB section of any module that references ChartView See the example program UserChartExamplel for a simple example ChartView example extracted from the example program UserChartExamplel Form1 C ChartView chartVu chartViewl Background background new Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject background LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis VB Dim chartVu As ChartView ChartViewl Dim background As New Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject background Dim xAxis As New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis Once you place an instance of a ChartView object on a form at design time don t exepec
78. circular grid consists of a group of concentric circles centered on the origin and aligned with the y axis tick marks The antenna radial grid consists of a group of radial lines aligned with the angle tick marks and starting at the origin extending to the outer edge of the antenna coordinate system AntennaGrid constructors There are two AntennaGrid constructors Visual Basic Overloads Public Sub New _ ByVal baseaxis As AntennaAxes _ ByVal gridtype As Integer _ Overloads Public Sub New _ ByVal baseaxis As AntennaAxes _ ByVal gridmagtype As Integer _ ByVal gridangletype As Integer _ C public AntennaGrid AntennaAxes baseaxis int gridtype public AntennaGrid AntennaAxes baseaxis int gridmagtype int gridangletype baseaxis The antenna axes associated with the grid 220 Axis Grids gridtype Specifies if the radial and angular grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the major and minor tick marks GRID_ALL of the reference antenna axis gridmagtype Specifies if the radial grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the major and minor tick marks GRID ALL of the reference antenna axis gridangletype Specifies if the angular grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the major and minor tick marks GRID ALL of the reference antenna axis The SetLineWidth S
79. class contains basic color and line style information for the object while the PhysicalCoordinates maintains the coordinate system used by object The majority of classes in the library derive from the GraphObj class each class a specific charting object such as an axis an axis label a simple plot or a group plot Add GraphObj derived objects axes plots labels title etc to a graph using the ChartView AddChartObject method GraphObj This class is the abstract base class for all drawable graph objects It contains information common to all chart objects This class includes references to instances of the ChartAttribute and PhysicalCoordinates classes The ChartAttribute class contains basic color and line style information for the object while the PhysicalCoordinates maintains the coordinate system used by object The majority of classes in the library derive from the GraphObj class each class a specific charting object such as an axis an axis label a simple plot or a group plot Background This class fills the background of the entire chart or the plot area of the chart using a solid color or a color or a gradient Axis Classes Axis LinearAxis PolarAxes AntennaAxes ElapsedTimeAxis LogAxis TimeAxis Creating a PhysicalCoordinates coordinate system does not automatically create a pair of x and y axes Axes are separate charting objects drawn with respect to a specific PhysicalCoordinates object The coordinate system and t
80. dataset Some of the constructors require the data points form a regular grid in the xy plane A regular grid is one where the x increment between adjacent x values is fixed as is the y increment The x increment and the y increment do not have to be the same rows Specifies the number of rows in the y direction in the regular grid Also specifies the number of rows or y values to evaluate 76 Chart Datasets the function over in the constructor that uses a SurfaceFunction argument columns Specifies the number of columns in the x direction in the regular grid Also specifies the number of columns or y values to evaluate the function over in the constructor that uses a SurfaceFunction argument npoints Specifies the number of xyz data point triplets in the grid array x An array size npoints of double that specifies the x values of the dataset The length of the y and z arrays must equal x Length y An array size npoints of double that specifies the y values of the dataset Zz An array size npoints of double that specifies the z values of the dataset xl yl x2 y2 The SurfaceFunction sf is evaluated for the range x1 y1 to x2 y2 sf The dataset data points are created by evaluating the SurfaceFunction across the range x1 yl to x2 y2 csv An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation columnskip For each row of data skip this many co
81. double yDatal 10 22 33 44 55 46 33 25 14 97 double xData2 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double yData2 20 12 43 54 15 26 63 25 24 19 double xData3 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double yoatas 30 52 l3 64 25 76 l3 35 24 19 ElapsedTimeSimpleDataset datasetl new ElapsedTimeSimpleDataset Salesl1 xDatal yDatal ElapsedTimeSimpleDataset dataset2 new ElapsedTimeSimpleDataset Sales2 xData2 yData2 ElapsedTimeSimpleDataset dataset3 new ElapsedTimeSimpleDataset Sales3 xData3 yData3 ElapsedTimeSimpleDataset datasetsArray new ElapsedTimeSimpleDataset 3 datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 ElapsedTimeCoordinates simpleScale new ElapsedTimeCoordinates simpleScale AutoScale datasetsArray Visual Basic Dim xDatal As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Dim yDatal As Double 10 22 33 44 55 46 33 25 14 9 Dim xData2 As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Dim yData2 As Double 120 12 43 54 15 26 63 25 24 19 Scaling and Coordinate Systems 125 Dim xData3 As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Dim yData3 As Double i30 52 12 O1 25 Ty 13 35 24 9 Dim datasetl As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Sales1
82. draw the grid The default values of the grid use a black dotted line of thickness 1 0 Change the default values using the GraphObj methods below SetColor method Visual Basic Overridable Public Sub SetColor _ ByVal rgbcolor As Color _ C public virtual void SetColor Color rgbcolor SetLineWidth method Visual Basic Overridable Public Sub SetLineWidth _ ByVal linewidth As Double _ Ct public virtual void SetLineWidth double linewidth SetLineStyle method Visual Basic Overridable Public Sub SetLineStyle _ ByVal linestyle As DashStyle _ Ct public virtual void SetLineStyle Axis Grids 215 DashStyle linestyle rgbcolor Sets the primary line color for the chart object linewidth Sets the line width in device coordinates for the chart object linestyle Sets the line style for the chart object Grid example C Define the coordinate system double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale new CartesianCoordinates xMin yMin xMax yMax Create the x and y axes LinearAxis xAxis new LinearAxis simpleScale ChartObj X AXIS LinearAxis yAxis new LinearAxis simpleScale ChartObj Y AXIS Create the grids Grid gridX new Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR Change default grid line properties gridX SetColor Color Gray Grid gridY new G
83. drawing and the System Drawing Drawing2D ws not used System Drawing Imaging Namespace The System Drawing Imaging namespace implements basic imaging functionality Basic graphics functionality is provided by the System Drawing namespace System Drawing Color Class Provides a class to define colors in terms of their individual RGB Red Green Blue components System Drawing Font Class Defines a particular format for text including font face size and style attributes System IO Namespace The IO namespace contains types that allow synchronous and asynchronous reading and writing on data streams and files System Collections Namespace The System Collections namespace contains interfaces and classes that define various collections of objects such as lists queues bit arrays hash tables and dictionaries Installation Directory Structure 12 Introduction The QCChart2D CF for the Net Compact Framework class library uses the following directory structure Drive Quinn Curtis Root directory DotNet Quinn Curtis Net based products directory Docs Quinn Curtis Net related documentation directory QCChart2DNetCFCompiledHelpFile chm the QCChart2D CF compiled help file QCChart2DNetCFManual pdf PDF file of the QCChart2D CF Programming Manual Lib Quinn Curtis Net related compiled libraries and components directory QCChart2D CF Language specific code directory CSharp C specific directory CF Example
84. from the ZoomExamples MoveCoordinates example C TimeSimpleDataset Datasetl new TimeSimpleDataset First tradingDay StockPrice TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES FAR MoveCoordinates movecoords new MoveCoordinates chartVu pTransforml movecoords SetEnable true chartVu SetCurrentMouseListener movecoords Visual Basic Dim Datasetl As New TimeSimpleDataset First timeData dataValues Dim pTransforml As New TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES FAR 316 Moving Chart Objects and Data Points Dim movecoords As New MoveCoordinates chartVu pTransforml movecoords SetEnable True chartVu SetCurrentMouseListener movecoords 15 Zooming ChartZoom Zooming is the interactive re scaling of a charts physical coordinate system and the related axes based on limits defined by clicking and dragging a mouse inside the current graph window A typical use of zooming is in applications where the initial chart displays a large number of data points The user interacts with the chart defining smaller and smaller zoom rectangles zeroing in on the region of interest The final chart displays axis limits that have a very small range compared to the range of the original un zoomed chart Important zoom features include e Automatic recalculation of axis properties fo
85. greater than the close price CandlestickPlot This class is a concrete implementation of the GroupPlot class and displays stock market data in an open high low close format common in financial technical analysis 38 Class Architecture Cell Plot of Population Density 0 100 200 Mean Family Income 1000 The Cell plot will plot rectangles of any size color and postion CellPlot This class is a concrete implementation of the GroupPlot class and displays cell plots A cell plot is a collection of rectangular objects with independent positions widths and heights specified using the values of the associated group dataset ErrorBarPlot This class is a concrete implementation of the GroupPlot class and displays error bars Error bars are two lines positioned about a data point that signify the statistical error associated with the data point Class Architecture 39 Media Schedule WSJ DSP Journal EDN PC Mag Computer Week Info Age 1 2002 4 2002 7 2002 10 2002 1 2003 Year of 2003 Floating bars are useful for creating scheduling charts FloatingBarPlot This class is a concrete implementation of the GroupPlot class and displays free floating bars in a graph The bars are free floating because each bar does not reference a fixed base value as do simple bar plots stacked bar plots and group bar plots Daily Stock Price Price NASDAQ T T T T i T T T T T T T i T T T T i T 1 05 09 1 12 09 1 19
86. height 0 6 specified using graph normalized coordinates This method initializes the position and size of the plot area inside the graph area specified using a rectangle to specify graph normalized coordinates SetGraphBorder methods Visual Basic Overloads Public Sub SetGraphBorderFrame _ ByVal border As Rectangle2D _ Ct public void SetGraphBorderFrame Rectangle2D border border Specifies the rectangle defining the plot area border This method initializes the position and size of the plot area inside the graph area specified using graph normalized position and size values Visual Basic Overloads Public Sub SetGraphBorderFrame _ ByVal rLeft As Double _ ByVal rTop As Double _ ByVal width As Double _ ByVal height As Double _ Ct public void SetGraphBorderFrame double rLeft double rTop double width 98 Scaling and Coordinate Systems double height where rLeft The left x position of the plot area inside the graph area specified using graph normalized coordinates rTop The top y position of the plot area inside the graph area specified using graph normalized coordinates width The width of the plot area inside the graph area specified using graph normalized coordinates height The height of the plot area inside the graph area specified using graph normalized coordinates This method initializes the size and position of the plot area inside the graph area
87. i e an axis where the scale decreases from left to right or bottom to top by setting axis minimum to a value greater than the axis maximum The software swaps the values if this happens Create an inverted axis by first defining an inverted physical coordinate system using one of the PhysicalCoordinates derived classes Place the axis in the inverted coordinate system The minimum and maximum of a linear axis can assume any numeric values This differentiates the linear axis from logarithmic time and polar axes that have specific numeric ranges for which they are valid Linear Minor and Major Tick Mark Intervals Major tick marks perpendicular to the axis line divide the line into sub ranges suitable for labeling Minor tick marks also perpendicular to the axis line further subdivide the space between the major tick marks into even smaller intervals 154 Axes The major tick mark interval for a linear axis is set equal to a specified integer number of minor tick intervals forcing major tick marks to always fall on a minor tick mark It is important that the tick mark intervals fall on rounded values appropriate to the physical scale of the chart It is not appropriate to look at the range maximum value minimum value and divide by some integer For example an axis with endpoints 5 to 30 should have a major tick mark interval of 5 or 10 and a minor tick mark interval 1 0 Dividing the axis range 30 5 35 0 by 10 will re
88. invoke a move Create the DataToolTip object and then install it using the ChartView SetCurrentMouseListener method This adds the DataToolTip object as a Data ToolTips 337 MouseListener to the ChartView object Enable Disable the function using DataToolTip SetEnable method Call ChartView SetCurrentMouseListener null to remove the object as a mouse listener for the chart view Set the threshold distance for deciding if the nearest data point found is a hit using the DataToolTip SetHitTestThreshold method The default values for the DataToolTip class assume the following The left mouse button pressed event is the trigger for the tooltip Change this using the DataToolTip SetButtonMask method The numeric format for the x and y values are controlled by separate NumericLabel class templates that are both initially set to the ChartObj DECIMALFORMAT format with a decimal precision of 1 Change this by creating a NumericLabel or TimeLabel object that specifies how you want the number formatted Set the x and y value templates independently using the DataToolTip SetX ValueTemplate and DataToolTip SetY Value template methods The tooltip will display just the y value of the selected object Change this to display the x value or both the x and y values using the DataToolTip SetDataToolTipFormat method specifying one of the data tooltip format constants DATA TOOLTIP CUSTOM DATA TOOLTIP X DATA TOOLTIP Y DATA TOOLTIP XY ONELINE DAT
89. is valid Logarithmic Minor and Major Tick Mark Intervals The major tick marks for a logarithmic axis use an exponential interval The exponential interval in physical coordinates transforms to a linear interval in the working coordinate system Below are examples of the major tick mark locations for a logarithmic axis Axis Minimum and Maximum Axis Major Tick Mark Locations 0 1 to 100 0 0 1 1 0 10 0 100 0 20 to 50 000 20 200 2000 20000 10 to 1 0 10 10 107 10 1 0 The minor tick marks for a logarithmic axis use a linear interval between the tick marks For example a major tick mark interval has endpoints of 10 to 100 a logarithmic interval The minor ticks in between the 10 and the 100 use a linear interval of 10 and fall at 20 30 40 50 60 70 80 and 90 For the next major tick mark interval 100 to 1000 the minor tick mark interval becomes 100 and minor tick marks fall at 200 300 400 160 Axes 500 600 700 800 and 900 The minor tick mark intervals are set equal to the value of the preceding major tick mark interval If the major tick mark interval uses a non decade range for example 3 30 300 30000 the minor tick marks will track the major tick marks The major tick mark interval of 3 to 30 will use a minor tick mark range of 3 with minor tick marks at 6 9 12 15 18 21 24 and 27 Logarithmic Axis Intercept A logarithmic axis has an intercept value the same as a linear axis Since the intercept v
90. local variable named chartVu and then customize the graph using the chartVu variable name You will also need to make sure that you reference com quinncurtis chart2dnetcf and System Drawing Drawing2D in the using section of any module that references ChartView The reference to System Drawing Drawing2D is needed just for its 424 using using using using using using using using Using QCChart2D for Net CF to Create Windows Applications definition of the DashStyle enumeration used by many of the example programs See the example program UserChartExamplel for a simple example System System Collections Generic System ComponentModel System Drawing Drawing2D System Drawing System Text System Windows Forms com quinncurtis chart2dnetcf namespace UserChartExamplell public partial class Forml Form public Forml InitializeComponent InitializeChart public void InitializeChart ChartView chartVu chartViewl We placed all of the chart customization code in the InitializeChart method You can copy this part of the program from our own version of this example UserChartExamplel Form1 cs Until this method is called the UserChartControl11 appears as an empty shell We call this method from the the form s constructor Or you can initialize the graph from the forms Form_Load event similar to the way it is done using VB You should be able to compile the project without error Run the
91. modifying simple dataset elements using the indexed accessor property C Define a simple dataset SimpleDataset Datasetl new SimpleDataset First xl yl Point2D datapoint Dataset1 0 Get the xy point at index 0 in the dataset if datapoint X lt 0 datapoint X Math Abs datapoint X arbitrary Datasetl 0 datapoint Change the datapoint Visual Basic Dim Datasetl As SimpleDataset New SimpleDataset First xl yl Dim datapoint As Point2D Dataset1 0 Get the xy point at index 0 in the dataset If datapoint X 0 Then datapoint X Math Abs datapoint X arbitrary Datasetl1 0 datapoint Change the datapoint 66 Chart Datasets Simple Date Time Dataset Class TimeSimpleDataset ChartObj ChartDataset SimpleDataset TimeSimpleDataset The TimeSimpleDataset uses ChartCalendar dates as the x values and floating point numbers as the y values ChartCalendar values are actually stored internally as their equivalent millisecond values The TimeSimpleDataset class adds a large number of methods to the SimpleDataset class that make it easy to create and modify datasets that use ChartCalendar values It has two main constructors The following constructor creates a time dataset using the x and y values stored in arrays TimeSimpleDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As ChartCalendar ByVal y As Double _
92. mouse button and the data value associated with the selected data point updates to reflect the new physical coordinates of the data point and the plot is redrawn Since the algorithm searches through every data point of every plot object in the view do not expect it to work particularly fast with millions or even thousands of data points The practical number of data points that can be searched is obviously dependent on the speed of the host computer MoveData constructors Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal transform As PhysicalCoordinates ByVal buttonmask As MouseButtons _ C public MoveData ChartView component PhysicalCoordinates transform MouseButtons buttonmask component A reference to the ChartView object that the chart is placed in transform The PhysicalCoordinates object associated with the MoveData object buttonmask Specifies the mouse button that is trapped to invoke a move Moving Objects and Data Points 313 Create the MoveData object and then install it using the ChartView SetCurrentMouseListener method This adds the MoveData object as a MouseListener to the ChartView object Enable Disable the function using MoveData SetEnable method Call MoveData SetCurrentMouseL istener null to remove the object as a mouse listener for the chart view Set the threshold distance for deciding if the nearest data point found is a hit using the MoveData SetHitTest
93. objects when you want them to show up Use the chart objects SetChartObjEnable method to enable disable the object This is useful if you are creating an animated chart where you want the chart to sequence through a predefined series of steps The second way you add new chart objects to the ChartView using the ChartView AddChartObject method In both cases you need to call the ChartView UpdateDraw method after any changes are made The example below extracted from the CustomChartDataCursor class creates a new Marker object and NumericLabel object each time a mouse button clicked C Marker amarker new Marker GetChartObjScale MARKER BOX nearestPoint GetX nearestPoint GetY 10 0 PHYS POS chartVu AddChartObject amarker rNumericLabelCntr 1 0 Add a numeric label the identifies the marker pointLabel new NumericLabel GetChartObjScale textCoordsFont rNumericLabelCntr nearestPoint GetX nearestPoint GetY PHYS POS DECIMALFORMAT 0 Nudge text to the right and up so that it does not write over marker 440 FAQs pointLabel SetTextNudge 5 5 chartVu AddChartObject pointLabel chartVu UpdateDraw VB Dim amarker As New Marker GetChartObjScale MARKER BOX nearestPoint GetX nearestPoint GetY 10 0 PHYS POS chartview AddChartObject amarker rNumericLabelCntr 1 0 Add a numeric label the identifies the marker pointLabel New NumericLabel GetChartObjScale textCoordsF
94. of the antenna axes The AntennaAxes constructor assumes that the axis extents match the extents of the underlying coordinate system transform Other axis properties minor tick mark spacing number of minor tick marks per major tick mark tick mark direction and tick mark lengths are automatically calculated using an auto axis method These properties can be explicitly set 1f you need to override the automatically calculated values Visual Basic Overloads Public Sub SetAntennaAxesTicks _ ByVal axestickspace As Double _ ByVal axesntickspermajor As Integer _ ByVal angletickspace As Double _ ByVal anglentickspermajor As Integer _ Overloads Public Sub SetAntennaAxesTicks _ ByVal axestickspace As Double _ ByVal axesntickspermajor As Integer _ ByVal angletickspace As Double _ ByVal anglentickspermajor As Integer _ ByVal minorticklength As Double _ ByVal majorticklength As Double _ ByVal tickdir As Integer _ C public void SetAntennaAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor 12 public void SetAntennaAxesTicks double axestickspace int axesntickspermajor 184 Axes double angletickspace int anglentickspermajor double minorticklength double majorticklength int tickdir axestickspace Specifies the spacing between minor tick marks for the x and y axes axesntickspermajor Specifies the number
95. pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 75 Define axes axes labels and grids Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillFlag True attribl SetLineFlag False Dim attribArray numGroups As ChartAttribute For i 0 To numGroups 1 attribArray i attribl Clone Next i attribArray 0 SetFillColor Color Blue attribArray 1 SetFillColor Color Yellow attribArray 2 SetFillColor Color Magenta attribArray 3 SetFillColor Color Orange attribArray 4 SetFillColor Color Gray attribArray 5 SetFillColor Color Red attribArray 6 SetFillColor Color Green Dim thePlotl As New StackedLinePlot pTransforml Datasetl attribArray chartVu AddChartObject thePlotl 12 Contour Plotting ChartPlot ContourPlot The ContourPlot class displays contour data organized in a ContourDataset dataset The line contour graph draws contituous lines through the data at xy values representing equal values of z analogous to the equal pressure lines isobars of a weather map A filled contor graph fills the area between two contour levels with a specific color Line and Filled Contour Plots Class ContourPlot GraphObj ChartPlot ContourPlot The ContourPlot class is a concrete implementation of the ChartPlot class and displays a contour plot using either lines or regions filled with color The two constructors below differ only by the inclusion of the con
96. project and the graph should be visible on the output device either an actual Windows Mobile device or an emulator The eumulator can take 60 seconds or more to start the progam and display the default form Using QCChart2D for Net CF to Create Windows Applications 425 Adding a ChartView control at runtime The ChartView class can also be instantiated at runtime without placing it on a form at design time You can use the default ChartView constructor or one of the special constructors that simplify adding an instance of the control to a form at runtime See the list of ChartView constructors in Chapter 5 In general you pass the ChartView constructor a parent object Form Panel or TabbedControl and a positioning rectangle that defines the position and size of the ChartView object In order to add a ChartView control at runtime the ChartView control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNetMib folder and select it You will also need to make sure that you reference com quinncurtis chart2dnetcf and System Drawing Drawing2D in the using section of any module that references ChartView ChartView constructor example extracted from the example program UserChartExample2 Form1 The ChartView class is instantiated and then init
97. set the height of each histogram bar and the Y 1 values set the width of each histogram bar The histogram bars share a common base value Histogram constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rbarbase As Double _ ByVal attrib As ChartAttribute Ct public HistogramPlot PhysicalCoordinates transform GroupDataset dataset double rbarbase ChartAttribute attrib transform The coordinate system for the new HistogramPlot object dataset The histogram plot represents the values in this group dataset The number of groups must be two The X values of the group dataset represent the x position of the lower left corner of each histogram bar the Y 0 values set the height of each histogram bar and the Y 1 values set the width of each histogram bar Group Plot Objects 273 rbarbase The histogram bars start at the value rbarbase and extend to the histogram bar values represented by the dataset attrib Specifies the attributes line and fill color for the histogram bars An individual histogram bar in the histogram plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Each histogram bar can be labeled with the Y 0 group value bar bar height using the bar data point methods see the example below Histogram plot
98. specified radius value value The value of the annotation For an angular annotation specify the value in degrees For a radial annotation specify a value within the range of the antenna minimum and maximum radial values attrib Specifies the attributes size line and fill color for the annotation See previous example for a programming example using AntennaAnnotationPlot 19 Legends Legend StandardLegend BubblePlotLegend Charts containing multiple chart objects line plots bar graphs and scatter plots for example usually require a legend The legend provides a key so that the viewer of the chart can figure out what data is associated with what chart object The bounding box of the legend is rectangular and can reside anywhere in the chart window inside the plot area overlapping it or completely outside The legend rectangle can have a border and can be filled with a solid color or left transparent The legend object can hold one or more legend items where each legend item is a symbol text string combination providing the key for one of the plot objects in the graph The legend can also have a title and footer The Legend class is the abstract base class for chart legends It organizes a collection of legend items as a rectangular object The StandardLegend is a concrete implementation of the Legend class and it is the primary legend class for all plot objects except for bubble plots The legend items objects display in a ro
99. specified using graph normalized values for the opposite corners of the region Visual Basic Public Sub SetGraphBorderDiagonal _ ByVal rLeft As Double _ ByVal rTop As Double _ ByVal rRight As Double ByVal rBottom As Double Ct public void SetGraphBorderDiagonal double rLeft double rTop double rRight double rBottom rLeft The left x position of the plot area inside the graph area specified using graph normalized coordinates rTop The top y position of the plot area inside the graph area specified using graph normalized coordinates Scaling and Coordinate Systems 99 rRight The right x position of the plot area inside the graph area specified using graph normalized coordinates rBottom The bottom y position of the plot area inside the graph area specified using graph normalized coordinates This method initializes the insets of the plot area inside the graph area specified using graph normalized values Visual Basic Public Sub SetGraphBorderInsets _ ByVal rLeft As Double _ ByVal rTop As Double _ ByVal rRight As Double ByVal rBottom As Double C public void SetGraphBorderInsets double rLeft double rTop double rRight double rBottom rLeft The left inset of the plot area inside the graph area specified using graph normalized coordinates rTop The top inset of the plot area inside the graph area specified using graph normalized coordinates
100. the TimeCoordinates class when you want a time date scale for the x coordinate and a linear or logarithmic scale for the y coordinate Use the ElapsedTimeCoordinates class when you want a elapsed time scale no date information for the x coordinate and a linear or logarithmic scale for the y coordinate Use the PolarCoordinates for polar coordinates where the magnitude coordinate is linear and the polar angle coordinate extends from 0 to 360 degrees or 0 to 2 pi radians counter clockwise starting at 3 00 Use the AntennaCoordinates for antenna coordinates where the radius value is linear and the angle coordinate extends from 0 to 360 degrees clockwise starting at 12 00 96 Scaling and Coordinate Systems Normalized coordinates Normalized coordinates are a special case of linear physical coordinates where the linear physical scale 0 0 1 0 0 0 1 0 is applied to either the graph area or the plot area of the chart Graph normalized coordinates maps the upper left corner of the graph window to the xy coordinates 0 0 0 0 and the lower right corner of the graph area to the xy coordinate 1 0 1 0 Plot normalized coordinates maps the upper left corner of the plot area to the xy coordinates 0 0 0 0 and the lower right corner of the plot area to the xy coordinates 1 0 1 0 Important numeric considerations Value limiting A chart should be scaleable to any numeric range that a user wants to plot This incorporates the entire range o
101. the chart npostype Specifies whether the x and y position values are specified in normalized coordinates or physical coordinates Use one of the position constants NORM POS PHYS POS rotation The rotation of the image specified in degrees Not supported Lines Shapes Images and Arrows 405 ChartImage example extracted from the example program BigChartDemo class CloudsBackgroundPlot private Bitmap GetImageFile String imagefilename Bitmap result null try result new Bitmap imagefilename catch System ArgumentException result null return result Bitmap almage GetImageFile Program Files BigChartDemo ChartClouds jpg if aImage null ChartImage chartImage new ChartImage pTransforml aImage 0 0 ChartObj NORM GRAPH POS 0 chartImage SetSizeMode ChartObj COORD SIZE chartImage SetImageSize new Dimension 1 1 chartVu AddChartObject chartImage Visual Basic Private Function GetImageFile ByVal imagefilename As String As Bitmap Dim result As Bitmap Try result New Bitmap imagefilename Catch err As System ArgumentException 406 Lines Shapes Images and Arrows result Nothing End Try Return result End Function Dim aIlmage As Bitmap GetImageFile Program Files BigChartDemo ChartClouds jpg Dim almage As New Bitmap filename If Not almage Is Nothing Then Dim chartImage As New ChartImage pTransforml almage 0 0 _ ChartObj NORM GRAPH POS
102. the chart redraws one final time using the extents of the final coordinate system MoveCoordinates constructors Visual Basic Declaration Public Sub New _ component As ChartView _ transform As PhysicalCoordinates buttonmask As MouseButtons _ CT public MoveCoordinates ChartView component PhysicalCoordinates transform MouseButtons buttonmask component A reference to the ChartView object that the chart is placed in transform The coordinate system underlying the chart buttonmask Specifies the mouse button that is trapped to invoke a move Moving Objects and Data Points 315 Create the MoveCoordinates object and then install it using the ChartView SetCurrentMouseListener method This adds the MoveCoordinates object as a MouseListener to the ChartView object Enable Disable the function using MoveCoordinates SetEnable method Call MoveCoordinates SetCurrentMouseListener null to remove the object as a mouse listener for the chart view You can restrict the movement of the coordinate system to the x dimension MOVE X or the y dimension MovE v using the MoveMode property Set MoveMode to MOME XY for unrestricted movement If you have multiple coordinate systems in the chart you can move them all simultaneously by setting the MultiTransformMove property true Otherwise only the coordinate system passed into the constructor is updated with the move information Moving the coordinate system Extracted
103. the interface to the System Drawing classes and contains routines for drawing lines rectangles and text using Net CF device coordinates WorldCoordinates This class derives from the UserCoordinates class and maps a device independent world coordinate system on top of the Net CF device coordinate system WorkingCoordinates This class derives from the WorldCoordinates class and extends the physical coordinate system of the plot area the area typically bounded by the charts axes to include the complete graph area the area of the chart outside of the plot area PhysicalCoordinates This class is an abstract base class derived from WorkingCoordinates and defines the routines needed to map the physical coordinate system of a plot area into a working coordinate system Different scale objects Class Architecture 23 ChartScale derived are installed for converting physical x and y coordinate values into working coordinate values CartesianCoordinates This class is a concrete implementation of the PhysicalCoordinates class and implements a coordinate system used to plot linear logarithmic and semi logarithmic graphs TimeCoordinates This class is a concrete implementation of the PhysicalCoordinates class and implements a coordinate system used to plot GregorianCalenar time based data ElapsedTimeCoordinates This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot elapsed time da
104. the rotation origin of shape ChartShape constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal ashape As GraphicsPath _ ByVal shapecoordstype As Integer _ ByVal x As Double _ ByVal y As Double _ 402 Lines Shapes Images and Arrows ByVal npositiontype As Integer ByVal rotation As Integer _ Ct public ChartShape PhysicalCoordinates transform GraphicsPath ashape int shapecoordstype double x double y int npositiontype int rotation transform The shape object is placed in the coordinate system defined by transform ashape A reference to a GraphicsPath object shapecoordstype Specifies if the coordinate system defining the shape is specified in physical coordinates normalized coordinates or Net CF device coordinates Use one of the position constants DEV_POS PHYS POS NORM GRAPH POS NORM PLOT POS x Specifies the x value of the shape position y Specifies the y value of the shape position npostype Specifies the if the position of the shape is specified in physical coordinates normalized coordinates or Net CF device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS rotation The rotation in degrees of the shape in the normal viewing plane The rotation will take place about the objects 0 0 0 0 coordinate If the object is not defined with a center of 0 0 0 0 it may be rot
105. the same type you can return the n object intersecting the test point Visual Basic Overloads Public Function FindObj _ ByVal testpoint As Point2D _ ByVal classname As String _ ByVal nthhit As Integer _ As GraphObj Ct public GraphObj FindObj Point2D testpoint string classname int nthhit i testpoint The current position of the mouse in Net CF device coordinates classname The class name of the base class that is used to filter the desired class objects The string ChartPlot would cause the routine to return only objects derived from the ChartPlot class nthhit Specifies to return the n object that intersects the test point A value of 0 signifies that the first object found is returned a value of 1 specifies that the second item found is returned and so on The function returns a reference to the found object or null if unsuccessful 6 Background Colors and Gradients Background Two rectangular areas act as a backdrop for the other graphical elements of a chart The first is the rectangle formed by the ChartView class This rectangle is the graph area and all elements of the chart axes labels plots titles etc are within its bounds The second area is the plot area That area is within the graph area Its position within the graph area is set using one of the PhysicalCoordinates SetGraphBorder methods SetGraphBorder Diagonal SetGraphBorderFrame or SetGraphBorderlInsets Typically the chart plo
106. the x and y scales This way you can use the auto scale methods for the values of one scale the y scale in the example below but explicitly set the values for the other scale the x scale in the example below Example of modifying the minimum and maximum values selected by an auto scale method C double xData 1000 2000 3000 4000 5000 6000 7000 8000 9000 double yData 11 22 33 44 55 46 33 25 14 ElapsedTimeSimpleDataset dataset new ElapsedTimeSimpleDataset Sales xData yData ElapsedTimeCoordinates simpleScale new ElapsedTimeCoordinates simpleScale AutoScale dataset simpleScale SetScaleStartY 0 simpleScale SetScaleStopY 100 0 Visual Basic Dim xData As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 Dim yData As Double 110 22 2323 441 55 45 33 25 14 9 124 Scaling and Coordinate Systems Dim dataset As ElapsedTimeSimpleDataset xData yData New ElapsedTimeSimpleDataset Sales Dim simpleScale As ElapsedTimeCoordinates new ElapsedTimeCoordinates simpleScale AutoScale dataset simpleScale SetScaleStartY 0 simpleScale SetScaleStopY 100 0 The auto scale methods that use an array of datasets to determine the proper range are very similar Example of auto scaling a ElapsedTimeCoordinates object using the multiple datasets C double xDatal 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
107. to axis tick marks indicating the scale of the axis Axis labels are a separate class from the axis classes An axis class i e any class derived from Axis can exist independent of axis labels Many graphs use axes that do not have labels For example the y axis on the left side of a graph may have labels while an identical axis on the right hand side of the graph may not The axis label classes require a valid reference axis class and cannot exist independently There are six axis labels classes the AxisLabels abstract base class and concrete subclasses NumericAxisLabels TimeAxisLabels ElapsedTimeA xisLabels StringAxisLabels PolarAxesLabels and AntennaA xesLabels Label Formats An axis label can take many forms The various axis label formats are divided between the axis labels classes in the following manner NumericAxisLabels The LinearAxis and LogAxis axis types use this class Full decimal conversion 0 000015 Scientific notation 1 5e 5 Exponent notation 1 5x10 Percent format 76 Business format where B M and K are used to represent billions millions and thousands 1043M 11 0K Currency format 123432 e Business currency format The business format combined with the currency format 123K StringAxisLabels The LinearAxis and LogAxis axis types use this class 190 Axis Labels Arbitrary strings MA PA JEFF Sales TimeAxisLabels The TimeAxis axis types use this class e
108. to the DataToolTip class Get a reference to this object using the DataToolTip GetTextTemplate method In your custom OnMouseUp event call super OnMouseUp followed by a call to the ChartView repaint method chartVu UpdateDraw in the example below Custom DataToolTip example Adapted from the OHLCFinPlot example In this example a new class is derived from the DataToolTip class and the OnMouseDown and OnMouseUp events are overridden C ChartView chartVu class CustomToolTip DataToolTip Data ToolTips 341 ChartText stockpanel ChartCalendar xValues double stockPriceData double stockVolumeData double NASDAQData public CustomToolTip ChartView component ChartCalendar xvalues double stockpricedata double nasdaqdata double stockvolumedata base component xValues xvalues stockPriceData stockpricedata stockVolumeData stockvolumedata NASDAQData nasdaqdata stockpanel GetTextTemplate public override void OnMouseUp MouseEventArgs mouseevent base OnMouseUp mouseevent Redraws the chart Since the stockpanel object has not been added to the chart using addChartObject it will not be redrawn when the chart is redrawn GetChartObjComponent UpdateDraw public override void OnMouseDown MouseEventArgs mouseevent Point2D mousepos new Point2D mousepos SetLocation mouseevent X mouseevent Y base OnMouseDown mouseevent ChartPlot sel
109. used in this software library is to use a single coordinate system The physical coordinate system defined for the plot area is extended in all four directions left right top and bottom It is extended so that the physical coordinates of the four corners of the plot area remain unchanged The four corners of the graph area are assigned calculated physical coordinate values so that when it is overlaid on to the plot area there is an exact 1 1 correspondence for all points inside the plot area Once this calculation is made there is no need to use the physical coordinate system assigned to the plot area Instead the physical coordinate system of the graph area is used instead Chart axes objects and plotted data always align because they are plotted using the exact same physical coordinate system The only difference is that plotted data is clipped to the plot area while axes objects are not clipped For example assume a graph area with the dimensions of 400x400 units and a plot area with the dimensions 200x200 centered inside the graph area This implies that there is a 100 unit boundary around all four sides of the plot area The desired chart uses a physical coordinate system of 0 0 100 100 These coordinates apply to the plot area Instead of using the plot area coordinate system the coordinate system 50 50 150 150 is calculated and used to scale the graph area This does not guarantee that any point plotted in plot area coordinate sy
110. using the multiple datasets C ChartCalendar xData new ChartCalendar 1996 ChartObj FEBRUARY 5 new ChartCalendar 1996 ChartObj MARCH 5 new ChartCalendar 1996 ChartObj APRIL 5 new ChartCalendar 1996 ChartObj MAY 5 new ChartCalendar 1996 ChartObj JUNE 5 new ChartCalendar 1996 ChartObj JULY 5 new ChartCalendar 1996 ChartObj AUGUST 5 new ChartCalendar 1996 ChartObj SEPTEMBER 5 new ChartCalendar 1996 ChartObj OCTOBER 5 new ChartCalendar 1996 ChartObj NOVEMBER 5 double yDatal 110 22 33 44 55 46 33 25 l4 9 double yData 20 12 43 54 15 26 63 25 24 19 double yoaras 30 52 13 64 25 76 l3 3b 24 19 All of the datasets reference the same xData array of ChartCalendar dates though this does not have to be the case TimeSimpleDataset datasetl new TimeSimpleDataset Salesl xData yDatal TimeSimpleDataset dataset2 new TimeSimpleDataset Sales2 xData yData2 TimeSimpleDataset dataset3 new TimeSimpleDataset Sales3 xData yData3 TimeSimpleDataset datasetsArray new TimeSimpleDataset 3 datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale AutoScale datasetsArray Visual Basic Dim xData As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 _ New ChartCalendar 1996 C
111. xAxis new LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis yAxisl new LinearAxis pTransforml ChartObj Y AXIS yAxisl SetAxisIntercept 0 0 yAxisl SetChartObjAttributes attribl axis color matches line color chartVu AddChartObject yAxisl yAxis2 new LinearAxis pTransform2 ChartObj Y AXIS yAxis2 SetAxisIntercept 18 yAxis2 SetChartObjAttributes attrib2 axis color matches line color chartVu AddChartObject yAxis2 yAxis3 new LinearAxis pTransform3 ChartObj Y AXIS yAxis3 SetAxisIntercept 35 yAxis3 SetChartObjAttributes attrib3 axis color matches line color chartVu AddChartObject yAxis3 yAxis4 new LinearAxis pTransform4 ChartObj Y AXIS yAxis4 SetAxisIntercept 52 yAxis4 SetChartObjAttributes attrib4 axis color matches line color chartVu AddChartObject yAxis4 yAxis5 new LinearAxis pTransform5 ChartObj Y AXIS yAxis5 SetAxisIntercept xAxis GetAxisMax yAxis5 SetAxisTickDir ChartObj AXIS MAX yAxis5 SetChartObjAttributes attrib5 axis color matches line color chartVu AddChartObject yAxis5 NumericAxisLabels xAxisLab new NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLabl new NumericAxisLabels yAxis1 yAxisLabl SetTextFont theFont yAxisLabl SetAxisLabelsFormat ChartObj BUSINESSFORMAT chartVu AddChartObject yAxisLabl NumericAxisLabels yAx
112. y value represents the angle in radians of a point in polar coordinates Polar plot types include line plots and scatter plots PolarPlot This class is an abstract base class for the polar plot classes Class Architecture 45 Polar Line and Scatter Plots The polar line charts use true polar not linear interpolation between data points PolarLinePlot This class is a concrete implementation of the PolarPlot class and displays data in a simple line plot format The lines drawn between adjacent data points use polar coordinate interpolation PolarScatterPlot This class is a concrete implementation of the PolarPlot class and displays data in a simple scatter plot format Antenna Plot Classes AntennaPlot AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot GraphObj AntennaAnnotation Antenna plots that use data organized as arrays of x and y values where an x value represents the radial value of a point in antenna coordinates and the y value represents the angle in degrees of a point in antenna coordinates Antenna plot types include line plots scatter plots line marker plots and an annotation class AntennaPlot This class is an abstract base class for the polar plot classes 46 Class Architecture 270 AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot AntennaAnnotation 180 AntennaLineMarkerPlot This class is a concrete implementation of the AntennaPlot class and displays data in a sim
113. yMin As Double 0 Dim yMax As Double 105 Dim simpleTimeScale As TimeCoordinates simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Scaling and Coordinate Systems 111 Another technique uses the default constructor and scales the coordinates using the TimeCoordinates SetTimeCoordinateBounds method Example of explicit scaling of a TimeCoordinates object using the TimeCoordinates SetTimeCoordinateBounds method C ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 double yMax 105 TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale SetTimeCoordinateBounds xMin yMin xMax yMax Visual Basic Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale SetTimeCoordinateBounds xMin yMin xMax yMax It is possible to scale the bounds of the coordinate system based on the data values in a time based dataset TimeSimpleDataset and TimeGroupDataset There are constructors and methods that take a single dataset and others that take an array of datasets Example of auto scaling a TimeCoordinates object using a single dataset C ChartCalendar xData new Ch
114. 0 0 Marker amarker new Marker pTransforml ChartObj MARKER BOX xpos ypos 10 ChartObj PHYS POS theChartView AddChartObject amarker Visual Basic Dim pTransforml As CartesianCoordinates New CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim xpos As Double 5 0 Dim ypos As Double 10 0 Dim amarker As Marker New Marker pTransforml ChartObj MARKER BOX _ xpos ypos 10 ChartObj PHYS POS theChartView AddChartObject amarker 302 Data Markers and Data Cursors Data Cursors Class DataCursor GraphObj Marker DataCursor Data cursors are an extension of the marker class Data cursors combine the Net CF mouse event delegates with the Marker class creating a marker that tracks the mouse and updates dynamically using an XOR drawing mode This constructor creates a new DataCursor object using the specified coordinate system marker type and marker size DataCursor constructor Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal transform As PhysicalCoordinates ByVal nmarkertype As Integer _ ByVal rsize As Double _ C public DataCursor ChartView component PhysicalCoordinates transform int nmarkertype double rsize component A reference to the ChartView object that the chart is placed in transform The PhysicalCoordinates object associated with the data cursor n
115. 1 groupBarData 0 3 56 groupBarData 1 3 44 xValues 4 New ChartCalendar 2002 ChartObj JANUARY 1 groupBarData 0 4 58 groupBarData 1 4 40 Dim Datasetl As New TimeGroupDataset GroupTimeData xValues groupBarData Dim pTransforml As New TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES FAR prTransforml SetGraphBorderDiagonal 0 15 0 1 0 95 0 8 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FromArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject background Define axes axes labels and grids Dim attribl As New ChartAttribute Color Black 1 DashStyle Solid Color Red attribl SetFillFlag True attribl SetLineFlag False Dim thePlotl As New LineGapPlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Multi Line Plots Class MultiLinePlot GraphObj ChartPlot GroupPlot Group Plot Objects 279 MultiLinePlot The MultiLinePlot class extends the GroupPlot class and displays group data in multi line format A group dataset with eight groups will display eight separate line plots The y values for each group of the dataset are the y values for each line in the plot Each line plot share the same x values of the group dataset MultiLinePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As Group
116. 1 02 10 01 02 Logarithmic axes can be combined with linear logarithmic and time axes 28 Class Architecture LogAxis This class implements a logarithmic axis with major tick marks placed on logarithmic intervals for example 1 10 100 or 30 300 3000 The minor tick marks are placed within the major tick marks using linear intervals for example 2 3 4 5 6 7 8 9 20 30 40 50 90 An important feature of the LogAxis class is that the major and minor tick marks do not have to fall on decade boundaries A logarithmic axis must have a positive range exclusive of 0 0 and the tick marks can represent any logarithmic scale Date Axes Yea av Quader T vas 1000 wes 2000 ww meg 2000 2001 2009 wn Yeas Mor Scar T T 1000 1999 2000 200 2090 mn roo woz ree O ones Month Day 7 Day Week TT 90102 100102 10102 20102 10109 11102 120102 10103 Month ay f Day Weak weach O Day Week riri rT 10193 20103 3003 40103 gaet VIZOS VAOS 2009 waar 5 Day was reor mour eee E R a 10602 14202 19000 120742 19163 10203 10303 10 403 There are more than 40 diferent b rade axes types appropriate for scales ranging from 1 secondio 100 years Date Axes DuatesMonth a a GP RLH LRS ot o o o4 ot o o oa or 2001 2002 2003 Month FTT Jam feb Mar 2003 TT TT Apr May Jun Jw Aug Sep T T T T Oct New Des Jan 2004 T T fe TT TT T Mar Age May Jun Jul Aup Sep Day O Day
117. 19 328 335 337 442 MoveCoordinates 6 55 57 59 309 314 315 316 354 MoveData 55 56 59 309 312 313 354 MoveObj 55 59 309 310 311 442 Moving chart data 55 56 59 309 312 313 354 Moving graph objects 55 59 309 310 311 442 Multi line plots 35 43 60 243 278 279 280 281 336 MultiLinePlot 35 43 60 243 278 279 280 281 336 Index 461 Nearest point class 57 58 59 305 307 NearestPointData 57 58 59 305 307 Numeric axis labels 31 32 60 189 190 191 193 194 195 200 201 205 206 207 209 271 293 295 386 435 436 438 Numeric data point labels 60 Numeric labels 53 54 60 230 231 238 240 241 274 275 285 286 294 296 305 306 307 308 335 337 338 339 349 350 352 379 387 388 392 393 439 440 NumericAxisLabels 31 32 60 189 190 191 193 194 195 200 201 205 206 207 209 271 293 295 386 435 436 438 NumericLabel 53 54 60 230 231 238 240 241 274 275 285 286 294 296 305 306 307 308 335 337 338 339 349 350 352 379 387 388 392 393 439 440 OHLCPlot 35 43 60 243 281 282 283 336 Open High Low Close plots 35 43 60 243 281 282 283 336 Physical coordinates 21 22 23 25 59 93 95 101 110 120 125 127 147 148 151 153 155 159 160 161 175 224 228 231 235 239 244 247 252 255 257 260 261 266 269 272 276 279 282 284 287 291 292 299 302 312
118. 190 207 208 209 353 355 356 PolarCoordinates 22 23 59 93 95 125 126 127 141 179 180 181 208 209 218 353 354 355 356 357 447 PolarGrid 52 53 60 213 216 217 218 355 356 PolarLinePlot 44 45 60 353 354 356 357 462 Index PolarPlot 33 44 45 60 139 353 354 357 PolarScatterPlot 44 45 60 353 356 357 358 Polysurface 57 58 59 Polysurface class 57 58 59 Rectangle2D 57 58 59 97 100 342 345 396 398 399 400 403 RingChart 1 48 60 347 348 Scale classes 21 22 23 59 93 95 Scatter plots 48 51 60 223 231 232 233 234 235 236 309 Shapes 54 55 60 401 402 403 406 407 Simple datasets 20 21 24 59 61 62 63 64 65 66 70 73 103 104 105 107 126 127 128 130 138 224 228 231 236 237 239 325 326 327 348 350 352 353 354 355 356 357 358 359 360 361 362 363 395 453 Simple plot objects 18 33 48 49 50 51 55 56 60 139 223 228 231 235 238 245 253 255 251 260 262 2773 2776 282 347 SimpleBarPlot 48 49 60 223 227 228 229 230 231 309 336 SimpleDataset 20 21 24 59 61 62 63 64 65 66 70 73 103 104 105 107 126 127 128 130 138 224 228 231 236 237 239 325 326 327 348 350 352 353 354 355 356 357 358 359 360 361 362 363 395 453 SimpleLineMarkerPlot 48 50 60 223 235 236 237 238 309 SimpleLinePlot 48 51 60 223 224 225 226 227 2
119. 2 new ElapsedTimeSimpleDataset Second x1 y2 Visual Basic Dim numPoints As Integer 30 Dim x1 As TimeSpan New TimeSpan numPoints 1 Dim yl As Double New Double numPoints 1 Dim y2 As Double New Double numPoints 1 Dim i As Integer For i 0 To numPoints 1 Chart Datasets 73 xl i TimeSpan FromMilliseconds i 30 1000 30000 milliseconds increment Or you can use seconds and the FromSeconds method xl i TimeSpan FromSeconds i 30 30 seconds increment If Math Sin xl i TotalSeconds 20 0R 0 Then yl i 20 0R 50 0R 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeconds 5 Else yl i 20 0R 5 0R 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeconds 2 End If y2 1 yl i b 0 2 xl i TotalSeconds 0 5 ChartSupport GetRandomDouble Next Dim Datasetl As New ElapsedTimeSimpleDataset First xl yl Dim Dataset2 As New ElapsedTimeSimpleDataset Second x1 y2 Contour Plot Dataset Class ContourDataset ChartObj ChartDataset SimpleDataset ContourDataset The ContourDataset adds a third dimension z values to the x and y values of the simple dataset It is use exclusively with the contour plotting class ContourPlot This constructor creates a new ContourDataset object that represents a surface formed by a regular grid in the xy plane The number of objects in the Po
120. 22 323 324 325 326 328 354 440
121. 226 229 253 262 264 265 267 268 270 277 278 283 285 286 315 380 392 443 444 447 Time labels 53 54 60 335 337 338 339 342 344 379 387 389 Time scale 21 59 93 95 Time Date group datsets 7 20 21 24 59 61 82 83 84 85 86 87 111 253 255 256 262 264 265 267 268 270 277 278 283 399 453 Time Date simple datasets 7 20 24 59 61 66 67 68 69 111 112 113 114 115 116 119 120 225 226 229 315 395 444 453 454 TimeAutoScale 24 59 TimeAxis 25 29 32 53 60 151 152 165 170 172 173 190 196 198 200 201 213 271 433 443 444 TimeAxisLabels 31 32 60 189 190 196 198 200 201 203 271 TimeCoordinates 1 4 22 23 59 93 95 110 111 112 113 114 115 116 117 118 119 120 128 129 130 141 142 149 165 170 172 173 200 201 224 225 226 229 253 262 264 265 267 268 270 277 278 283 285 286 315 380 392 443 444 447 TimeGroupDataset 7 20 21 24 59 61 82 83 84 85 86 87 111 253 255 256 262 264 265 267 268 270 277 278 283 399 453 TimeLabel 53 54 60 335 337 338 339 342 344 379 387 389 TimeScale 21 59 93 95 TimeSimpleDataset 7 20 24 59 61 66 67 68 69 111 112 113 114 115 116 119 120 225 226 229 315 395 444 453 454 ToolTips 55 56 59 335 336 337 338 339 340 343 442 User coordinates 22 59 93 95 UserControl 8 10 17 19 20 59 131 13
122. 286 328 341 343 389 390 442 443 ChartImage 54 60 148 401 404 405 406 ChartLabel 53 54 60 379 387 ChartObj 59 61 66 68 69 70 73 79 82 84 85 87 103 105 106 107 110 111 112 113 114 115 116 117 118 119 120 123 125 126 127 128 129 133 138 139 140 149 157 158 163 164 172 173 174 177 181 185 194 195 196 200 201 202 205 206 208 209 211 215 216 218 224 225 226 229 230 231 232 233 234 235 236 237 238 240 241 245 246 250 251 253 254 256 258 259 263 264 265 267 268 270 271 272 274 275 276 277 278 280 281 283 285 286 288 289 293 294 295 296 301 304 306 307 310 311 313 314 315 321 322 323 325 326 327 328 337 338 339 340 341 342 343 344 345 350 351 352 355 356 357 359 360 361 364 371 372 375 376 377 381 382 384 385 386 392 393 399 400 403 404 405 406 407 408 433 434 435 436 437 438 440 442 443 444 445 446 448 449 453 454 ChartPlot 33 34 60 61 139 145 223 228 231 235 238 244 246 252 254 256 259 261 265 268 272 275 278 281 284 286 291 341 344 347 354 357 358 361 362 369 370 379 441 448 449 453 ChartScale 21 22 23 59 93 95 ChartShape 54 55 60 401 402 403 406 407 ChartSymbol 54 55 60 337 339 ChartText 53 60 139 190 191 196 202 207 209 293 295 308 310 311 337 339 340 341 343 349 3
123. 3 33 O DashStyle Solid attribl SerrillOolor Color From Argb l177 33 IJN Font legendFont new Font Microsoft Sans Serif 10 FontStyle Regular ChartAttribute legendAttributes new ChartAttribute Color Black 1 DashStyle Solid Color White legendAttributes SetFillFlag true legendAttributes SetLineFlag true BubblePlotLegend legend new BubblePlotLegend thePlotl 0 82 0 15 0 14 0 25 legendAttributes 376 Legends legend AddLegendItem 10 Million 10 attrib2 legendFont legend AddLegendItem 25 Million 25 attrib2 legendFont legend AddLegendItem 40 Million 40 attrib2 legendFont legend AddLegendGeneralText ChartObj LEGEND HEADER Bubble Size Color Black legendFont chartVu AddChartObject legend Visual Basic Dim attribl As New ChartAttribute Color Black 0 DashStyle Solid attribl SetrFillOolor Color FromArgb 177 33 33 attribl SetFillFlag True Dim thePlotl As New BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChartObject thePlotl Dim theTitleFont As New Font Microsoft Sans Serif 14 FontStyle Bold Dim mainTitle As New ChartTitle pTransforml theTitleFont DOT COM Bankruptcies and CEO Compensation mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH chartVu AddChartObject mainTitle Dim theFooterFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim footer A
124. 314 320 324 329 331 341 344 348 379 380 383 387 388 389 390 391 396 401 402 404 PhysicalCoordinates 21 22 23 25 59 93 95 101 110 120 125 127 147 148 151 153 155 159 160 161 175 224 228 231 235 239 244 247 252 255 257 260 261 266 269 272 276 279 282 284 287 291 292 299 302 312 314 320 324 329 331 341 344 348 379 380 383 387 388 389 390 391 396 401 402 404 Pie charts 33 47 60 347 348 349 350 352 379 PieChart 33 47 60 347 348 349 350 352 379 Plot object classes 33 34 60 61 139 145 223 228 231 235 238 244 246 252 254 256 259 261 265 268 272 275 278 281 284 286 291 341 344 347 354 357 358 361 362 369 370 379 441 448 449 453 Point3D 57 58 59 73 74 75 76 77 Polar axes 25 30 33 53 60 151 152 178 179 180 181 190 207 208 209 217 218 353 355 356 Polar axis labels 31 33 60 189 190 207 208 209 353 355 356 Polar coordinates 22 23 59 93 95 125 126 127 141 179 180 181 208 209 218 353 354 355 356 357 447 Polar grids 52 53 60 213 216 217 218 355 356 Polar line plots 44 45 60 353 354 356 357 Polar plot classes 33 44 45 60 139 353 354 357 Polar scatter plots 44 45 60 353 356 357 358 PolarAxes 25 30 33 53 60 151 152 178 179 180 181 190 207 208 209 217 218 353 355 356 PolarAxesLabels 31 33 60 189
125. 34 305 307 309 336 371 372 436 439 SimplePlot 18 33 48 49 50 51 55 56 60 139 223 228 231 235 238 245 253 255 257 260 262 273 276 282 347 SimpleScatterPlot 48 51 60 223 231 232 233 234 235 236 309 SimpleVersaPlot 1 3 51 60 223 238 239 240 241 Stacked bar plots 35 40 60 243 266 284 285 286 336 Stacked line plots 35 44 60 235 243 286 287 288 289 336 StackedBarPlot 35 40 60 243 266 284 285 286 336 StackedLinePlot 35 44 60 235 243 286 287 288 289 336 Standard legends 51 52 60 367 368 371 372 StandardLegend 51 52 60 367 368 371 372 String axis labels 31 32 60 189 446 String labels 53 54 60 379 387 389 391 392 393 StringAxisLabels 31 32 60 189 446 StringLabel 53 54 60 379 387 389 391 392 393 Symbols 54 55 60 337 339 Text classes 53 60 139 190 191 196 202 207 209 293 295 308 310 311 337 339 340 341 343 349 350 351 379 380 381 382 383 385 387 442 Tick mark class 57 58 60 TickMark 57 58 60 Time auto scaling 24 59 Time axis 25 29 32 53 60 151 152 165 170 172 173 190 196 198 200 201 213 271 433 443 444 Time axis labels 31 32 60 189 190 196 198 200 201 203 271 Time coordinates 1 4 22 23 59 93 95 110 111 112 113 114 115 116 117 118 119 120 128 129 130 141 142 149 165 170 172 173 200 201 224 225
126. 5 46 33 25 14 9 TimeSimpleDataset dataset new TimeSimpleDataset Sales xData yData TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale AutoScale dataset simpleTimeScale SetTimeScaleStart new ChartCalendar 1996 ChartObj JANUARY 5 simpleTimeScale SetTimeScaleStop new ChartCalendar 1997 ChartObj JANUARY 5 Visual Basic Dim xData As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 _ New ChartCalendar 1996 ChartObj MARCH 5 New ChartCalendar 1996 ChartObj APRIL 5 New ChartCalendar 1996 ChartObj MAY 5 New ChartCalendar 1996 ChartObj JUNE 5 New ChartCalendar 1996 ChartObj JULY 5 New ChartCalendar 1996 ChartObj AUGUST 5 New ChartCalendar 1996 ChartObj SEPTEMBER 5 New ChartCalendar 1996 ChartObj OCTOBER 5 New ChartCalendar 1996 ChartObj NOVEMBER 5 Dim yData As Double 10 22 33 44 55 46 33 25 14 9 Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale AutoScale dataset simpleTimeScale SetTimeScaleStart new ChartCalendar 1996 ChartObj JANUARY 5 simpleTimeScale SetTimeScaleStop new ChartCalendar 1997 ChartObj JANUARY 5 114 Scaling and Coordinate Systems The auto scale methods that use an array of datasets to determine the proper range are very similar Example of auto scaling a TimeCoordinates object
127. 5 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim transformArray As CartesianCoordinates pTransforml pTransform2 pTransform3 pTransform4 pTransform5 Dim zoomObj As New ZoomWithStack chartVu transformArray 5 True zoomObj SetButtonMask MouseButtons Left zoomObj SetZzoomYEnable True zoomObj SetZzoomXEnable True zoomObj SetZoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetZoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable True zoomObj SetZoomStackEnable True chartVu SetCurrentMouseListener zoomObj Limiting the Zoom Range A zoom window needs to have zoom limits placed on the minimum allowable zoom range for the x and y coordinates Unrestricted or infinte zooming can result in numeric under and overflows The default minimum allowable range resuling from a zoom 328 Zooming operation is 1 1000 of the original coordinate range Change this value using the ChartZoom SetZoomRangeLimitsRatio method The minimum allowable range for this value is approximately 1 0e 9 Another way to set the minimum allowable range is to specify explicit values for the x and y range using the ChartZoom SetZoomRangeLimits method Specify the minimum allowable zoom range for a time axis in milliseconds for example ChartZoom SetZoomRangeLimits new Dimension 1000 0 01 sets the minimum zoom range for the time axis to 1 second and for the y axis to 0 01 The utility method ChartCalendar GetCalendarWidthV alue is useful fo
128. 50 351 379 380 381 382 383 385 387 442 ChartTitle 53 54 60 311 375 376 379 383 384 385 ChartView v 5 8 14 17 20 25 55 57 59 63 68 72 81 84 89 131 132 133 134 135 136 138 139 140 141 142 143 144 147 157 158 163 164 172 173 174 180 181 182 195 200 201 208 209 215 216 218 302 303 304 305 307 309 310 311 312 313 314 315 320 322 323 324 325 326 329 331 336 338 340 341 343 395 396 402 413 415 416 417 418 419 422 423 424 425 426 427 432 439 440 441 443 444 445 447 448 449 Comma separated values 57 59 61 62 63 65 67 69 71 75 76 80 81 82 83 84 86 87 88 89 244 Contour plotting 20 21 59 61 73 74 75 77 78 79 291 292 ContourDataset 20 21 59 61 73 74 75 77 78 79 291 292 CSV 57 59 61 62 63 65 67 69 71 75 76 80 81 82 83 84 86 87 88 89 244 Data compression 453 Data cursors 55 56 59 299 302 303 304 305 307 314 DataCursor 55 56 59 299 302 303 304 305 307 314 Dataset 20 33 34 59 61 66 70 73 78 79 82 87 96 396 Dataset classes 20 33 34 59 61 66 70 73 78 79 82 87 96 396 DatasetViewer 1 6 7 15 395 396 397 398 399 400 DataToolTip 55 56 59 335 336 337 338 339 340 343 442 Dimension 57 59 322 323 328 329 330 331 332 333 405 406 ElapsedTimeAutoScale 4 24 59 205 206 ElapsedTimeAxis 1
129. 6 396 413 415 419 422 426 432 UserCoordinates 22 59 93 95 Visual Basic vii 9 15 62 63 65 66 67 68 69 70 71 72 73 74 75 77 78 80 81 82 83 85 86 87 88 97 98 99 100 101 102 103 104 106 107 110 111 112 113 114 115 116 117 118 119 121 122 123 124 126 127 128 129 130 131 135 137 138 140 142 143 145 147 148 149 152 153 155 156 157 158 160 161 163 164 170 171 172 173 175 176 177 179 180 181 183 184 185 193 195 196 198 199 201 202 203 204 205 207 208 209 210 211 213 214 216 217 218 219 220 224 225 226 228 229 230 231 233 234 235 237 238 239 241 244 245 247 250 252 253 255 256 257 258 260 261 262 263 264 266 268 269 270 272 274 276 277 279 280 282 283 284 286 287 288 291 295 299 301 302 304 307 309 311 312 313 314 315 320 322 324 326 328 329 330 331 336 338 339 343 347 348 351 354 356 357 358 360 361 362 365 368 369 372 373 374 376 379 381 382 383 384 385 386 387 389 390 391 393 396 398 399 400 401 403 404 405 406 407 413 414 442 443 444 445 446 447 449 451 454 Visual C vii 15 420 Working coordinates 22 59 93 95 97 Index 463 WorkingCoordinates 22 59 93 95 97 World coordinates 22 59 93 95 WorldCoordinates 22 59 93 95 Zoom vi 5 327 Zooming 1 5 55 56 59 60 319 320 321 3
130. 675 0 1 0 32 0 7 int rows 10 columns 2 startindex 0 DatasetViewer datasetViewerl new DatasetViewer chartVu pTransforml posrect Datasetl rows columns startindex ChartObj VERT DIR datasetViewerl EnableEdit true datasetViewerl DatasetTable TableBackgroundMode ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl UseStripedGridBackground true Need to override default numeric format template with elapsed time template ElapsedTimeLabel etimetemplate new ElapsedTimeLabel new Font Microsoft Sans Serif 7 FontStyle Regular ChartObj TIMEDATEFORMAT 24HMS datasetViewerl SetFormatTemplate 1 etimetemplate Visual Basic Dim posrect As New Rectangle2D 0 675 0 1 0 32 0 7 Dim rows As Integer 10 columns As Integer 2 startindex As Integer 0 Dim datasetViewerl As New DatasetViewer chartVu pTransforml posrect Datasetl rows columns startindex ChartObj VERT DIR datasetViewerl EnableEdit True datasetViewerl DatasetTable TableBackgroundMode _ ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl UseStripedGridBackground True Need to override default numeric format template with elapsed time template Dim etimetemplate as ElapsedTimeLabel new ElapsedTimeLabel new Font Microsoft Sans Serif 7 FontStyle Regular ChartObj TIMEDATEFORMAT 24HMS datasetViewerl SetFormatTemplate 1 etimetemplate 22 Adding Lines Sh
131. 8 280 281 288 289 293 295 350 352 355 356 359 360 395 437 Backgrounds v 9 25 60 133 139 147 148 149 225 226 229 232 233 246 267 268 270 271 273 274 275 277 278 280 281 288 289 293 295 350 352 355 356 359 360 395 437 Bar plots 48 49 60 223 227 228 229 230 231 309 336 BarDatapointValue 60 Box and Whisker 1 2 34 36 60 246 247 249 250 251 BoxWhiskerPlot 1 2 34 36 60 246 247 249 250 251 Bubble plot legend items 51 52 60 373 Bubble plot legends 52 60 367 372 373 374 375 377 Bubble plots 35 36 60 243 252 253 254 373 374 375 376 BubblePlot 35 36 60 243 252 253 254 373 374 375 376 BubblePlotLegend 52 60 367 372 373 374 375 377 BubblePlotLegendItem 51 52 60 373 Calendar utilities 20 21 24 29 54 57 59 61 66 67 68 82 83 84 85 86 107 109 110 111 112 113 114 115 116 117 118 119 129 165 170 172 173 200 201 229 230 231 240 241 256 262 264 265 267 268 270 271 276 277 278 283 285 286 328 341 343 389 390 442 443 Candlestick plots 35 37 60 243 254 255 256 336 CandlestickPlot 35 37 60 243 254 255 256 336 Cartesian coordinates 1 22 23 59 93 95 99 100 101 102 103 104 105 106 107 109 120 125 126 127 128 129 130 138 141 142 143 157 163 194 195 215 216 233 236 237 245 246 258 263 273 274 280 281 288 289
132. 999 1998 0 100 200 Millions A bar chart with vertical time date axis Elapsed Time support for linear and logarithmic coordinate systems The TimeCoordinates class proved less than optimal for the display of simple elapsed time scales The software now supports elapsed time scales with the addition of ElapsedTimeCoordinates ElapsedTimeScale ElapsedTimeAutoScale ElapsedTimeAxis ElapasedTimeLabel and ElapsedTimeAxisLabels classes For example you can now have a scale with a range of 00 00 00 to 12 00 00 without an explicit calendar date associated with it ChartZoom In Click and drag the left button ChartZoom Out Click the right button 150 100 0 00 00 0 02 00 0 04 00 0 06 00 0 08 00 0 10 00 0 12 00 0 14 00 0 16 00 X Subiect 41 Subject 2 The zoom stack undos previous zoom in operations Introduction 5 Elapsed Time support New User Interface Features Integrated MultiMouseListener The ChartView class supports multiple mouse listeners through the integration of our MultiMouseListener class The ChartZoom class Zoom stack processing has been added to the ChartZoom class You no longer have to subclass the ChartZoom class to add zoom stack processing to your application Also a new mode forces the aspect ratio of zoomed graphs to remain fixed traking either the x or y dimension of the zoom rectangle The MagniView class A new MagniView class is similar to zooming The mouse controls a magn
133. A TOOLTIP TWOLINE DATA TOOLTIP GROUP MULTILINE DATA TOOLTIP OHLC The tooltip popup window uses a default Sans Serif font with a size of 12 The text is justified above and to the right of the mouse cursor The default background color of the data tooltip is a pale yellow RGB 255 255 204 Change this by replacing the ChartText object used as the template for the tooltip popup window Use the DataToolTip SetTextTemplate method to replace the default template with your own The selected data point is highlighted using a ChartSymbol object set to a default shape of ChartObj SQUARE a size of 8 and a color of black Change this by replacing the ChartSymbol used as the template with one of your own Simple data tooltip example Adapted from the MultiAxes example In this example the tooltip will display the decimal y value of the nearest data point when the left mouse button is pressed C 338 Data ToolTips ChartView chartVu DataToolTip datatooltip new DataToolTip chartVu chartVu SetCurrentMouseListener datatooltip Visual Basic Dim chartVu As ChartView Dim datatooltip As DataToolTip New DataToolTip chartVu chartVu SetCurrentMouseListener datatooltip Medium complex data tooltip example Adapted from the LineFill example In this example the tooltip will display the x value of the data point as a date and the y value as currency The x and y values are displayed on two separate lines one above the other
134. ATOW CLASS asad dTa oth TE ea loa een eta Ren dr P pg Uns ee hu UE 406 23 Using QCChart2D CF for the Net Compact Framework to Create Windows SNO ANION LL EE 413 Visual Basic for Net Compact Framework eee eee eee 413 Visual C for Net Compact Framework sees eee eee eee eee 420 24 Frequently Asked QUESCOS oss ede tree prie eoe erui ae rupes n woes aen ead n DN 431 6 chess Qt Eu e NEM T alah a 431 1 Introduction Charting Tools for the Net Compact Framework Charting Library New Features found in the 2 0 version of QCChart2D Many new features have been added to Revision 2 0 of QCChart2D for Net CF Existing classes have been extended and new classes added Features new to Revision 2 0 include e Five new plot types for the Cartesian time and elapsed Time coordinate systems BoxWiskerPlot FloatingStackedBarPlot RingChart SimpleVersaPlot and GroupVersaPlot e Antenna Charts includes coordinate system AntennaCoordinates axes AntennaAxes axes labels AntennaAxesLabels grid AntennaGrid and plot objects AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot and AntennaAnnotation e Elapsed time scaling to compliment the time date scaling This includes new dataset types ElapsedTimeSimpleDataset ElapsedTimeGroupDataset a new coordinate system class ElapsedTimeCoordinates a new axis class ElapsedTimeAxis and a new axis labels class ElapsedTimeAxisLabels Vertical axis scaling for time
135. As New HistogramPlot pTransforml Datasetl 0 0 attribl Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj PERCENTFORMAT bardatavalue SetColor Color Black thePlotl SetBarDatapointLabelPosition ChartObj INSIDE BAR thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue True thePlotl SetSegmentAttributesMode True hePlotl SetSegmentFillColor 0 Color Red hePlotl SetSegmentFillColor 1 Color Magenta hePlotl SetSegmentFillColor 2 Color Blue hePlotl SetSegmentFillColor 3 Color Green hePlotl SetSegmentFillColor 4 Color Yellow hePlotl SetSegmentFillColor 5 Color Pink chartVu AddChartObject thePlot1l Line Gap Plots Class LineGapPlot GraphObj ChartPlot GroupPlot LineGapPlot 276 Group Plot Objects The LineGapPlot class extends the GroupPlot class and displays a line gap chart The number of groups must be two A line gap chart consists of two line plots where a contrasting color fills and highlights the area between the two lines The X Y 0 values of the group dataset represent the first of the bounding lines and the X Y 1 values of the group dataset represent the second of the bounding lines LineGapPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset ByVal attr
136. As New NumericAxisLabels yAxis4 yAxisLab4 SetTextFont theFont chartVu AddChartObject yAxisLab4 Dim yAxisLab5 As New NumericAxisLabels yAxis5 yAxisLab5 SetTextFont theFont chartVu AddChartObject yAxisLab5 Dim axisTitleFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim xaxistitle As New AxisTitle xAxis axisTitleFont Event Partition chartVu AddChartObject xaxistitle Dim xgrid As New Grid xAxis yAxisl ChartObj X AXIS ChartObj GRID MAJOR FAQs 439 chartVu AddChartObject xgrid Dim thePlotl As New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Dim thePlot2 As New SimpleLinePlot pTransform2 Dataset2 attrib2 chartVu AddChartObject thePlot2 Dim thePlot3 As New SimpleLinePlot pTransform3 Dataset3 attrib3 chartVu AddChartObject thePlot3 Dim thePlot4 As New SimpleLinePlot pTransform4 Dataset4 attrib4 chartVu AddChartObject thePlot4 Dim thePlot5 As New SimpleLinePlot pTransform5 Dataset5 attrib5 chartVu AddChartObject thePlot5 4 Can I add new axes text objects plot objects and images to a chart after it is already displayed or must I create a new chart from scratch taking into account the additional objects There are two ways to add new objects to a chart The first way is to create all objects when the chart is initially created but disable the ones that you do not want to show up when the chart is initially rendered Enable the
137. As String _ ByVal nsymbol As Integer _ ByVal chartobj As ChartPlot ByVal ngroup As Integer ByVal thefont As Font _ As Integer C public int AddLegendItem string stext int nsymbol ChartAttribute attrib Font thefont 370 Legends public int AddLegendItem string stext GraphicsPath symbolshape ChartAttribute attrib Font thefont public int AddLegendItem LegendItem legenditem public int AddLegendItem string stext int nsymbol GraphObj chartobj Font thefont public int AddLegendItem string stext GraphicsPath symbolshape GraphObj chartobj Font thefont public int AddLegendItem string stext int nsymbol ChartPlot chartobg int ngroup Font thefont stext Specifies the text string for the legend item nsymbol Specifies the symbol for the legend item Use one of the chart symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR or CIRCLE chartobj The color and fill attributes for the legend item are copied from the attributes of this ChartPlot object symbolshape Specifies a user defined shape to use as the legend item symbol attrib Specifies the ChartAttribute object to get the color and fill attributes of the legend item thefont Specifies the text font for the legend item The AddLegendltem returns the current number of legend items Legends 371 Simple legend example extrac
138. AxisMajorTickLength yAxisTickDirection Date Time Axes The date time axis is used in combination with a TimeCoordinates physical coordinate system The axis major and minor tick marks correspond to the common date time divisions of second minute hour day week month and year The date time axes supported with this software are very complex because they take into account the varying number of days in months and years The axes also take into account non continuous date time scales where a 5 day week is used or where a full day consists of a specific time interval that can be something less than a 24 hour day Note The TimeAxis class is not used to create an axis to display elapsed time Use a ElapsedTimeCoordinates system in combination with a ElapsedTimeAxis to create an elapsed time axis It is the ElapsedTimeAxisLabels that give the elapsed time axis its time axis look i e 10 30 22 Class TimeAxis GraphObj T Axis TimeAxis The TimeAxis class creates an axis with date time specific spacing between minor and major tick marks not necessarily uniform as with a LinearAxis The TimeAxis extends the Axis class Date Time Axis Minimum and Maximum The minimum and maximum values for a date time axis can have any valid date time value specified using the class ChartCalendar The axis maximum value should be later in time than the minimum Create an inverted axis by first defining an inverted physical coordinate system us
139. ByVal axis As Axis _ ByVal thefont As Font _ ByVal s As String _ C public AxisTitle Axis axis Font thefont string s E axis The base axis this title is associated with thefont The font object used to display the axis title S Sets the title string ChartTitle example extracted from the example program BigChartDemo class LabeledDatapoints C LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis 386 Text Classes NumericAxisLabels xAxisLab new NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLab new NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Font titleFont new Font Microsoft Sans Serif 12 FontStyle Bold AxisTitle yaxistitle new AxisTitle yAxis titleFont Score chartVu AddChartObject yaxistitle AxisTitle xaxistitle new AxisTitle xAxis titleFont Student 4 chartVu AddChartObject xaxistitle Visual Basic Dim xAxis As New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis Dim xAxisLab As New NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab Dim yAxisLab As New NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartV
140. CalendarWidthValue ChartObj MONTH 8 _ 0 0 attribl ChartObj JUSTIFY CENTER chartVu AddChartObject thePlot1l Note how the ChartCalendar GetCalendarWidthValue method calculates the width of the bars as a function of time in this case a width of 8 months Simple bar plot example that displays numeric data values extracted from the example program BigChartDemo class SimpleBarChart C ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag true SimpleBarPlot thePlotl new SimpleBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0 attribl ChartObj JUSTIFY CENTER NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue true chartVu AddChartObject thePlot1 Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green Simple Plot Objects 231 attribl SetFillFlag True Dim thePlotl As New SimpleBarPlot pTransforml1 Datasetl _ ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 _ 0 0 attribl ChartObj JUSTIFY CENTER Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bard
141. Chart Datasets tempx x 1 75 ChartSupport GetRandomDouble 0 5 tempy y 1 75 ChartSupport GetRandomDouble 0 5 z 2000 950 Math Sin Math Sqrt tempx tempx tempy tempy pointarray count SetLocation tempx tempy z x stepx count 1 Next j y stepy Next i datasetl New ContourDataset Contour Dataset pointarray This method uses the characteristic that the data is an even spaced grid Dim dataset2 As ContourDataset _ New ContourDataset Contour Dataset pointarray nrows ncols Example of creating a contour dataset from a function C ContourDataset datasetl null class ZValueFunctionClass SurfaceFunction public override double CalcZValue double x double y double z x x 1 75 ChartSupport GetRandomDouble 0 5 y y 4 4 1 75 ChartSupport GetRandomDouble 0 5 S 1500 1500 0 Math Sin Math Sqrt x x y y TS return z void CreateRegularGridPolysurface ZValueFunctionClass zValueFunction new ZValueFunctionClass datasetl new ContourDataset Contour ChartDataset 11 11 6 0 6 0 6 0 6 0 zValueFunction Visual Basic Class ZValueFunctionClass Inherits SurfaceFunction Chart Datasets 79 Public Overrides Function CalcZValue ByVal x As Double ByVal y As Double _ As Double Dim z As Double x x 0 5 ChartSupport GetRandomDouble 0 5 y y 0 5 ChartSupport GetRandomDouble 0 5 z 2000 950 Math
142. ChartObj BW IQR15 WHISKER OUTLIERS thePlotl BarDatapointLabelPosition ChartObj CENTERED BAR thePlotl PlotLabelTemplate TextFont _ New Font Microsoft Sans Serif 8 FontStyle Regular thePlotl PlotLabelTemplate DecimalPos 1 252 Group Plot Objects thePlotl ShowDatapointValue True label outliers thePlotl ScatterPlot ShowDatapointValue True thePlotl AutoBWChart chartVu AddChartObject thePlotl Bubble Plots Class BubblePlot GraphObj ChartPlot GroupPlot BubblePlot The BubblePlot class is a concrete implementation of the GroupPlot class It displays bubble plots A group dataset specifies the position and size of each bubble in a bubble plot The numer of groups must be two BubblePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal bubblesizetype As Integer _ ByVal attrib As ChartAttribute C public BubblePlot PhysicalCoordinates transform GroupDataset dataset int bubblesizetype ChartAttribute attrib transform The coordinate system for the new bubble plot object dataset A group dataset specifying the location and size of the bubbles in the bubble plot The number of groups must be two The dataset values for X and Y 0 set the position of the center of each bubble and the values for Y 1 set the size of each bubble either the area SIZE BUBBLE A
143. ChartObj JULY 1 pIransforml SetGraphBorderDiagonal 0 15 15 9 0 8 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 Color FromArgb 90 20 155 ChartObj AXIS chartVu AddChartObject background Define and add axes axes labels and grids to chart ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag true SimpleBarPlot thePlotl new SimpleBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0 attribl ChartObj JUSTIFY CENTER chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New TimeSimpleDataset Actual Sales xl yl Dim pTransforml As New TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prTransforml SetScaleStartY 0 pTransforml SetTimeScaleStart New ChartCalendar 1997 ChartObj JULY 1 pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 8 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 _ Color FromArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject background 230 Simple Plot Objects Define and add axes axes labels and grids to chart Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag True Dim thePlotl As New SimpleBarPlot pTransforml Datasetl ChartCalendar Get
144. ChartText currentLabel3 new ChartText pTransforml theLabelFont TI DSL 1500A 15 5 y1 2 85 41 ChartObJj PHYS POS chartVu AddChartObject currentLabel3 ChartText currentLabel4 new ChartText pTransforml theLabelFont I b 2000A 15 5 yL 3 85 ti ChartObj PHYS POS chartVu AddChartObject currentLabel4 ChartText currentLabel5 new ChartText pTransforml theLabelFont L b 250uA 15 5 y1 4 85 l ChartObj PHYS POS chartVu AddChartObject currentLabel5 Visual Basic Dim theLabelFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim currentLabell As New ChartText pTransforml theLabelFont I b 50uA 15 5 yl1 0 25 1 ChartObj PHYS POS chartVu AddChartObject currentLabell Dim currentLabel2 As New ChartText pTransforml theLabelFont I b 100uA 15 5 LVL 95 ly ChartObj PHYS POS chartVu AddChartObject currentLabel2 Dim currentLabel3 As New ChartText pTransforml theLabelFont I b 150uA 15 5 yl 23 85 1 ChartObj PHYS POS chartVu AddChartObject currentLabel3 382 Text Classes Dim currentLabel4 As New ChartText pTransforml theLabelFont I b 200uA 15 5 yl 3 85 I ChartObj PHYS POS chartVu AddChartObject currentLabel4 Dim currentLabel5 As New ChartText pTransforml theLabelFont I b 250uA 15 5 yl 4 985 Ly ChartObj PHYS POS chartVu AddChartObject currentLabel5 Dim currentLabel6 As New ChartText pTransforml
145. ChartTitle AxisTitle ChartLabel NumericLabel BarDatapointValue TimeLabel ElapsedTimeLabel StringLabel AxisLabels NumericAxisLabels TimeAxisLabels ElapsedTimeAxisLabels StringAxisLabels PolarAxesLabels AntennaAxesLabels Grid PolarGrid AntennaGrid LegendItem BubblePlotLegendItem Legend StandardLegend BubblePlotLegend ChartPlot SimplePlot SimpleLinePlot SimpleBarPlot SimpleScatterPlot SimpleLineMarkerPlot SimpleVersaPlot GroupPlot ArrowPlot BubblePlot CandlestickPlot CellPlot ErrorBarPlot FloatingBarPlot FloatingStackedBarPlot GroupBarPlot HistogramPlot LineGapPlot MultiLinePlot OHLCPlot StackedBarPlot StackedLinePlot BoxWhiskerPlot GroupVersaPlot PieChart RingChart PolarPlot PolarLinePlot PolarScatterPlot AntennaPlot AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot Background ChartImage ChartShape ChartSymbol Marker ChartZoom 3 Chart Datasets ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset GroupDataset TimeGroupDataset ElapsedTimeGroupDataset The dataset classes organize the numeric data associated with a plot object Plot objects are chart objects derived from the ChartPlot class There are two major types of data supported by the dataset classes The first is simple xy data where for every x value there is one y value The second data type is group data where every x value can have one or more y values A couple of variants of the simple xy data
146. ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Should want to customize the axis you can add the following lines after the yAxis object is created Custom logarithmic axis example C Place the y axis on the right side of the graph with tick marks point towards the right double yAxisIntercept 1000 Major tick marks at 0 2 2 20 200 and 2000 double yAxisOrigin 0 2 In addition to major tick marks labels flagged for some minor tick marks int yAxisLogFormat 1 double yAxisMinorTickLength 53 double yAxisMajorTickLength 10 int yAxisTickDirection ChartObj AXIS MAX yAxis SetAxisIntercept yAxisIntercept yAxis SetAxisTicks yAxisOrigin yAxisLogFormat yAxisMinorTickLength yAxisMajorTickLength yAxisTickDirection Visual Basic Place the y axis on the right side of the graph with tick marks point towards the right Dim yAxisIntercept As Double 1000 yAxisOrigin Major tick marks at 0 2 2 20 200 and 2000 Dim yAxisOrigin As Double 0 2 In addition to major tick marks labels flagged for some minor tick marks Dim yAxisLogFormat As Integer 1 Dim yAxisMinorTickLength As Double 5 Dim yAxisMajorTickLength As Double 10 Dim yAxisTickDirection As Integer ChartObj AXIS MAX yAxis SetAxisIntercept yAxisIntercept Axes 165 yAxis SetAxisTicks yAxisOrigin yAxisLogFormat yAxisMinorTickLength _ y
147. Coordinates pTransforml new CartesianCoordinates 7 7 7 7 CreateRegularGridPolysurface prransforml SetGraphBorderDiagonal 0 10 10 85 0 85 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject background ChartText checkBoxCaption new ChartText pTransforml theFont Contour Level 560 35 ChartObj DEV POS chartVu AddChartObject checkBoxCaption LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis NumericAxisLabels xAxisLab new NumericAxisLabels xAxis chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLab new NumericAxisLabels yAxis chartVu AddChartObject yAxisLab Grid xgrid new Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR chartVu AddChartObject xgrid Contour Plotting 294 Grid ygrid new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR chartVu AddChartObject ygrid ChartAttribute attribs new ChartAttribute numcontourlevels 1 for i20 i lt numcontourlevels i Color color Color FromArgb int 255 ChartSupport GetRandomDouble int 255 ChartSupport GetRandomDouble int 255 ChartSupport GetRandomDouble attribs i new ChartAttribute color 2 DashStyle Solid color attribs i SetF
148. Ct public TimeSimpleDataset string sname ChartCalendar x double y sname Specifies the name of the dataset x An array that specifies the ChartCalendar x values of a dataset y An array that specifies the y values of a dataset The length of the y array must match the length of the x array The number of data points is the value of x Length property The x and y arrays must be the same length and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped Chart Datasets 67 The next constructor creates a time dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the time values and the second column the y values If you use the ROW MAJOR format the first row represents the time values and the second row the y values Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal columnskip As Integer _ C public TimeSimpleDataset CSV csv string filename int rowskip int columnskip csv An instance of a CSV object filename The name of the file rowsk
149. Dataset _ ByVal attribs As ChartAttribute Cf public MultiLinePlot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attribs transform The coordinate system for the new MultiLinePlot object dataset The multi line plot represents the values in this group dataset attribs An array of ChartAttribute objects sized the same as the number of groups in the dataset t specify the attributes line color for each group of the multi line plot The attributes for each group can set or modified using the SetSegment methods where the segment number parameter cooresponds to the group number These methods include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Multi line plot example extracted from the example program BigChartDemo class MultiLine C int numPoints 100 int numGroups 7 280 Group Plot Objects double x1 new double numPoints double yl new double numGroups numPoints int 3 Jg for i20 i Z numPoints i xl i double i 0 2 for J 0 J lt numGroups j yl j t j i 0 01 double j41 5 0 1 0 Math Exp 1 4 0 7 GroupDataset Datasetl new GroupDataset First x1 y1 CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prransforml
150. Day stockPrice Dim startTime As Long 9 60 30 60 1000 msecs cooresponding to 9 30 AM Dim stopTime As Long 16 60 60 1000 msecs cooresponding to 4 00 PM Dim stockTimeScale As TimeCoordinates new TimeCoordinates stockTimeScale SetWeekType ChartObj WEEK 5D stockTimeScale SetScaleStartTOD startTime stockTimeScale SetScaleStopTOD stopTime stockTimeScale AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Class ElapsedTimeCoordinates PhysicalCoordinates CartesianCoordinates ElapsedTimeCoordinates The ElapsedTimeCoordinates class scales the chart plot area for a physical coordinate system which uses an elapsed time scale in combination with a linear or logarithmic scaling The elapsed time scale uses milliseconds as the time base so all time values should be represented using their milliseconds equivalent value i e a value of 30 seconds is represented by the value 30000 The axis labeling class ElapsedTimeAxisLabels converts the millisecond values to equivalent seconds values i e the value 30000 milliseconds will be displayed as 30 seconds in the format 00 00 30 There are three main ways to scale the plot area e Scale the minimum and maximum x and y values explicitly You can scale the the elapse time axis using TimeSpan objects or using millisecond values i e an elapsed time range of 0 30 seconds would be scaled for 0 30000 e Use an auto scale method to calcul
151. Dim xMaxl As Double 15 Dim yMinl As Double 0 Dim yMaxl As Double 105 Dim pTransforml As CartesianCoordinates _ New CartesianCoordinates xMinl yMinl xMaxl yMaxl pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 Dim xMin2 As Double 50 Dim xMax2 As Double 150 Dim yMin2 As Double 0 Dim yMax2 As Double 105 Dim pTransform2 As CartesianCoordinates New CartesianCoordinates xMin2 yMin2 xMax2 yMax2 pTransform2 SetGraphBorderDiagonal 0 1 15 90 0 6 ChartView Object Resize Modes Every GraphObj object has absolute size properties such as font size Resize a window and these absolute size parameters are NOT changed No matter how you resize a chart if you set a text object to a font size of 10 the text object will always return a font size of 10 regardless if the text now appears larger or smaller Instead the value of the resizeMultiplier adjusts to represent the proportional change in the window size In calculating the font size the current size properties are multiplied by the resizeMultiplier The initial value of the resizeMultiplier is 1 0 and the objects size properties correspond exactly to the initial settings Shrink the ChartView window and the resizeMultiplier for each object is set to a value that is less than 1 0 Enlarge the window and the resizeMultiplier is set to a value greater than 1 0 The ChartView class has three resize modes that it can use to resize graph objects placed in the graph N
152. FontStyle Bold Dim pTransforml As New CartesianCoordinates 7 7 7 7 CreateRegularGridPolysurface CreateRandomGridPolysurface pTransforml SetGraphBorderDiagonal 0 1 0 1 0 85 0 85 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND color White chartVu AddChartObject background Dim checkBoxCaption As New ChartText pTransforml theFont Contour Level 560 35 ChartObj DEV POS chartVu AddChartObject checkBoxCaption Dim xAxis As New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis Dim xAxisLab As New NumericAxisLabels xAxis chartVu AddChartObject xAxisLab Dim yAxisLab As New NumericAxisLabels yAxis chartVu AddChartObject yAxisLab Dim xgrid As New Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR chartVu AddChartObject xgrid Dim ygrid As New Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR 295 Contour Plotting 296 chartVu AddChartObject ygrid Dim attribs numcontourlevels As ChartAttribute For i 0 To numcontourlevels Dim color As Color color FromArgb CInt 255 _ ChartSupport GetRandomDouble CInt 255 ChartSupport GetRandomDouble CInt 255 ChartSupport GetRandomDouble attribs i New ChartAttribute color 2 DashStyle Solid color attribs i SetFillFlag True Next i attribs 0 SetColor color Black
153. From file UserControll vb Public Class UserControll Chance the inheritance in the UserControll Designer vb file Inherits ChartView Public Sub InitializeChart Dim chartVu As ChartView Me End Sub InitializeChart End Class Y From file Forml vb 420 Using QCChart2D for Net CF to Create Windows Applications Public Class Formi Dim ChartViewl As UserControll Nothing Public Sub InstantiateChartView m Me Allow room for a menu in the form Dim graphRect As Rectangle New Rectangle 1 1 Me ClientRectangle Width ClientRectangle Height 2 Instantiate chart control and add it to the form ChartViewl New UserControll ChartViewl Location graphRect Location ChartViewl Size graphRect Size ChartViewl PreferredSize graphRect Size Me Controls Add ChartView1 End Sub Private Sub Forml Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InstantiateChartView ChartViewl InitializeChart End Sub End Class Visual C for Net Compact Framework First if this is the first Net Compact Framework program you have every created make a few practice application programs using the Visual Studio defaults Don t try to add graphics to an application until you are able to create a simple Net Compact Framework applications using the New Project File New Project application wizard You start the New Project application wizard by selecting File New Proj
154. If Me Timerl Enabled False End Sub There are other examples of Form components interacting with charts In the OHLCFinPlot example a Scrollbar controls the time axis of a stock market OHLC chart The MultiAxes example uses Button objects to select the x axis range 19 I am The software runs as fast as we can make it We do not have any hidden switches that will speed up the software What you need to do is to step back and think about the trying to plot 100 000 data points and it takes too long to draw the graph What is wrong with the software and what can I do to make it faster best way to display your data FAQs 453 A fundamental issue that many programmers fail to consider is the relationship between the resolution of the rasterized screen image of the plot and the resolution of the data A typical mobile device chart image will have 300 600 pixels as the horizontal resolution of the plotting area This would imply that in the 100K data point example above every horizontal pixel would represent 1 6K to 3 3K data points Obviously this is a terrible mismatch In fact it is a bad match for datasets that have more than a couple of thousands points So what you do is compress the data before it is displayed Take the 100K data points and compress them down to 500 data points The data compression can take several forms You can take an average of every N points The resulting dataset will be reduced by a factor of N You can als
155. Labels 211 Antenna axes labels example C double minvalue 40 maxvalue 20 AntennaCoordinates antennascale new AntennaCoordinates minvalue maxvalue AntennaAxes antennaAxes new AntennaAxes antennascale chartVu AddChartObject antennaAxes AntennaAxesLabels antennaAxesLabels new AntennaAxesLabels antennaAxes antennaAxesLabels SetAxisLabelsFormat ChartObj DECIMALFORMAT antennaAxesLabels SetAxisLabelsDecimalPos 2 chartVu AddChartObject antennaAxesLabels Visual Basic Dim minvalue As Double 40 Dim maxvalue As Double 20 Dim antennascale As AntennaCoordinates _ New AntennaCoordinates minvalue maxvalue Dim antennaAxes As AntennaAxes New AntennaAxes antennascale chartVu AddChartObject antennaAxes Dim antennaAxesLabels As AntennaAxesLabels New AntennaAxesLabels antennaAxes antennaAxesLabels SetAxisLabelsFormat ChartObj DECIMALFORMAT antennaAxesLabels SetAxisLabelsDecimalPos 2 chartVu AddChartObject antennaAxesLabels 9 Axis Grids Grid PolarAxesGrid AntennaGrid Axis grids are solid dotted or dashed lines aligned with the axis tick marks and which extend across the plot area of a graph Axis grids are a separate class from the axis classes An axis class i e any class derived from Axis can exist independent of a grid Many graphs use axes that do not have grids For example the y axis may have a grid while the x axis may not The axis grid classes are not
156. Line AddLine 0 1f f 0 1f 0 9f 0 1f ChartShape titleLineShape new ChartShape pTransforml titleLine ChartObj NORM GRAPH POS 0 0 0 0 ChartObj NORM GRAPH POS 0 chartVu AddChartObject titleLineShape Visual Basic Dim titleLine As New GraphicsPath titleLine AddLine 0 1F 0 1F 0 9F 0 1F Dim titleLineShape As New ChartShape pTransforml titleLine 404 Lines Shapes Images and Arrows ChartObj NORM GRAPH POS 0 0 0 0 ChartObj NORM GRAPH POS 0 chartVu AddChartObject titleLineShape Chart Image Class Class ChartImage GraphObj ChartImage The ChartImage class will place a System Drawing Image object anywhere in a chart It can be a small element of the chart inside or outside of the plot area or it can be sized to fill the plot area or graph area and used as a background object ChartImage constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal aimage As Image _ ByVal x As Double ByVal y As Double _ ByVal npostype As Integer _ ByVal rotation As Integer _ C public ChartImage PhysicalCoordinates transform Image aimage double x double y int npostype int rotation transform The coordinate system for the new ChartImage object aimage A reference to the Image object that is to be placed in the chart x The x value for the position of the image in the chart y The y value for the position of the image in
157. MagniViewChartl SetCurrentMouseListener magnifyObj Zooming OZY Magnifying multiple physical coordinate systems The MagniView class also supports the magnifications of multiple physical coordinate systems If the source chart has multiple coordinate systems and you want to magnify all of the coordinate systems use the MagniView constructor which takes an array of PhysicalCoordinates systems as an argument MagniView constructor Visual Basic Declaration Public Sub New _ source As ChartView _ target As ChartView _ transforms As PhysicalCoordinates magnirect As Dimension _ ci public MagniView ChartView source ChartView target PhysicalCoordinates transforms Dimension magnirect source A reference to the source ChartView object that the chart 1s placed in 331 target A reference to the target ChartView object that the magnified view of the chart is placed in transforms magnified magnirect The rectangle in physical coordinates of the magnify cursor An arry of PhysicalCoordinates objects associated with the chart being Enable the magnify object after creation using the MagniView SetEnable true method 332 Zooming Retrieve the physical coordinates of the magnify rectangle using the MagniView GetMagniMin and GetMagniMax methods Restrict magnification in the x or y direction using the SetMagniXEnable and SetMagniY Enable methods Set the rounding mode associated with rescale
158. NTENNA ANNOTATION ANGULAR 180 attrib3 chartVu AddChartObject thePlot3 Dim thePlot4 As New AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION RADIUS 12 attrib4 chartVu AddChartObject thePlot4 Class AntennaAnnotation GraphObj Polar Charts 365 AntennaAnnotation The AntennaAnnotation class is used to highlight either a specific radius or angular value in an antenna chart The radius is highlighted using a circle and the angular value is highlighted using a line draw from the origin to the outer edge of the antenna chart 270 180 Two annotations a radius annotations dotted blue line at the radial value 12 and an angular annotations solid yellow line at the angular value 180 degrees AntennaAnnotationPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As AntennaCoordinates ByVal annotationtype As Integer _ ByVal value As Double _ ByVal attrib As ChartAttribute C public AntennaAnnotation AntennaCoordinates transform int annotationtype 366 Polar Charts double value ChartAttribute attrib transform The coordinate system for the new AntennaScatterPlot object annotationtype The annotation type Use one of the annotation type constants ANTENNA ANNOTATION ANGULAR draws a radial line at the specified angular value from the orign to the outer edge of the antenna chart or ANTENNA ANNOTATION RADIUS draws a circle at the
159. O_RESIZE OBJECTS The resizeMultiplier stays fixed at 1 0 Resizing the graph window does not affect the size and thickness of the charts graph objects Text will stay the same size and lines will stay the same thickness The overall chart shrinks it is just that size of the chart text and the thickness of the chart lines do not change Resize the window small enough and the chart text will overlap and the lines used to draw the chart will look thick when compared to the chart size 144 The Chart View AUTO RESIZE OBJECTS Resizing the graph window causes the size and thickness of the charts graph objects to resize The auto resize algorithm looks at which dimension changed the most x or y and uses the larger of the two changes to calculate new sizes for lines and text Text and lines will shrink the same percentage Resize the chart window with a minimum change in the charts aspect ratio the change in the chart size will be very close to the change in the font size If the charts aspect ratio changes drastically the font size will resize to reflect the dimension that was reduced the most This minimizes the condition where text overlaps though it may make the text unreadable if the chart size changes from large to a small with a large aspect ratio change MANUAL RESIZE OBJECTS The resizeMultiplier for each object has an initial value of 1 0 Unlike the NO RESIZE OBJECTS mode the value can be changed The programmer must explicitly set the
160. Points double yl new double numPoints int i for i20 i lt numPoints i attribs i new ChartAttribute Color Black 1 0 attribs i SetFillColor colorArray il XI 3 87 VIS 0 2 xl 1 2 2 yl 1 0 0 xI e yoI 9 9 Xxl 3 4 27 yl1 3 0 0 xl 4 3 7 yl 4 0 9 SimpleDataset Datasetl new SimpleDataset First x1 y1 CartesianCoordinates pTransforml new CartesianCoordinates pTransforml SetGraphBorderDiagonal 0 1 2 9 0 9 Background backgroundl new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FromArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject backgroundl PieChart thePlotl new PieChart pTransforml Datasetl sPieStrings attribs ChartObj PIELABEL OUTSLICE ChartObj PIELABEL STRINGNUMVAL thePlotl SetStartPieSliceAngle 45 NumericLabel labeltemplate new NumericLabel labeltemplate SetNumericFormat ChartObj CURRENCYFORMAT labeltemplate SetDecimalPos 1 labeltemplate SetTextFont theFont thePlotl SetPlotLabelTemplate labeltemplate thePlotl SetLabelInOut 0 ChartObj PIELABEL INSLICE thePlotl SetLabelInOut 1 ChartObj PIELABEL INSLICE thePlotl SetLabelInOut 2 ChartObj PIELABEL INSLICE thePlotl SetLabelInOut 3 ChartObj PIELABEL INSLICE thePlotl SetLabelInOut 4 ChartObj PIELABEL INSLICE chartVu AddChartObject thePlot1 Visual Basic Dim numPoints As Integer 5 D
161. PolarGrid GraphObj Axis Grids 217 Grid PolarGrid The PolarGrid class defines a grid for polar axes The polar grid consists of two parts the magnitude grid and the polar angle grid The magnitude grid consists of a group of concentric circles centered on the origin and aligned with the x and y axis tick marks The polar angle grid consists of a group of radial lines aligned with the angle tick marks and starting at the origin extending to the outer polar angle circle PolarGrid constructors There are two PolarGrid constructors Visual Basic Overloads Public Sub New _ ByVal polaraxis As PolarAxes _ ByVal gridtype As Integer _ Overloads Public Sub New _ ByVal polaraxis As PolarAxes ByVal gridmagtype As Integer _ ByVal gridangletype As Integer _ C public PolarGrid PolarAxes polaraxis int gridtype ye public PolarGrid PolarAxes polaraxis int gridmagtype int gridangletype polaraxis The polar axes associated with the grid gridtype Specifies if the magnitude and angular grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID_MINOR or the major and minor tick marks GRID_ALL of the reference polar axis gridmagtype Specifies if the magnitude grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the 218 Axis Grids major and minor tick marks GRID ALL of the reference polar axis gridangletype Specifies if
162. QCChart2D CF Charting Library ed d 5 22 XO Daily Stock Price soll west fo es Price Volume NASDAQ 4 25 05 5 02 05 5 09 05 5 16 05 5 23 05 for the Net Compact Framework Contact Information Company Web Site http www quinn curtis com Electronic mail General Information info quinn curtis com Sales sales quinn curtis com Technical Support Forum http www quinn curtis com ForumFrame htm Revision Date 6 1 2009 Rev 2 0 QCChart2D CF for Net Compact Framework Documentation and Software Copyright Quinn Curtis Inc 2009 Quinn Curtis Inc Tools for Net Compact Framework END USER LICENSE AGREEMENT IMPORTANT READ CAREFULLY This Software End User License Agreement EULA is a legal agreement between you either an individual or a single entity and Quinn Curtis Inc for the Quinn Curtis Inc SOFTWARE identified above which includes all Quinn Curtis Inc Net Compact Framework software on any media and related documentation on any media By installing copying or otherwise using the SOFTWARE you agree to be bound by the terms of this EULA If you do not agree to the terms of this EULA do not install or use the SOFTWARE If the SOFTWARE was mailed to you return the media envelope UNOPENED along with the rest of the package to the location where you obtained it within 30 days from purchase 1 The SOFTWARE is licensed not sold 2 GRANT OF LICENSE A Developer License After you have purc
163. REA or the radiusSIZE BUBBLE RADIUS Group Plot Objects 253 bubblesizetype Sets whether the circle representing each bubble plot has a radius or an area proportional to the Y 1 data values in the group dataset Set using one of the bubble plot type constants SIZE BUBBLE RADIUS or SIZE BUBBLE AREA attrib Specifies the attributes line color and fill color of the bubble plot circles An individual bubble in a bubble plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Bubble plot example extracted from the example program BigChartDemo class BubblePlotChart C TimeGroupDataset Datasetl new TimeGroupDataset First xl yl Datasetl SetStackMode ChartObj AUTOAXES STACKED TimeCoordinates pTransforml new TimeCoordinates ChartObj TIME SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR plransforml SetGraphBorderDiagonal 0 15 15 80 0 75 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Black 0 DashStyle Solid attribl SetrFillOolor Golor From amp rgb 177 33 33 attribl SetFillFlag true BubblePlot thePlotl new BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChartObject thePlotl Visual Basic Dim Datasetl As New TimeGroupDataset First xl yl
164. Sin Math SqgrE x x y wih Return z End Function CalcZValue End Class ZValueFunctionClass Sub CreateRegularGridPolysurface Dim zValueFunction As New ZValueFunctionClass datasetl New ContourDataset Contour Dataset 32 32 _ Telly 91 13 7 1 7 1 mValueFunction End Sub CreateRegularGridPolysurface Numeric Group Dataset Class GroupDataset ChartObj ChartDataset GroupDataset The GroupDataset class represents group data where every x value can have one or more y values The number of x values in a group plot is referred to as the number of columns or as numberDatapoints and the number of y values for each x value is referred to as the number of rows or numberGroups Think of spreadsheet file that looks like x values x 0 x1 x 2 x3 x 4 x 5 y values group 0 y 06 0 y 0 1 y 022 y 03 y 04 y 0 5 y values group 41 y 10 y L1 yv L2 y L3 y L4 y L5 y values group 2 y 2 0 y 2 1 y 2 2 yI23 y 24 yI2 5 number of x values numberDatapoints numberColumns 6 0 Chart Datasets number of y values for each x value numberGroups numberRows 3 This would be the ROW MAJOR format if the data were stored in a CSV file GroupDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As Double _ ByVal y As Double _ C4 public GroupDataset string sname double x double y sname Specifies the
165. TANDARD Stockpanel AddNewLineTextString timelabel GetTextString Stockpanel AddNewLineTextString Open openObj Stockpanel AddNewLineTextString High highObj stockpanel AddNewLineTextString Low lowObj Stockpanel AddNewLineTextString Close closeObj stockpanel AddNewLineTextString Volume volumeObj Stockpanel AddNewLineTextString NASDAQ nasdaqObj stockpanel SetChartObjEnable ChartObj OBJECT ENABLE Graphics g2 GetToolTipGraphics Precalculates the text bounding box so that the size is known before it is drawn Stockpanel PreCalcTextBoundingBox g2 Rectangle2D boundingbox stockpanel GetTextBox Reposition tooltip text box if top of box near top of graph window You can do the same thing for all four sides of the graph window if mousepos GetY boundingbox GetHeight 1 mousepos SetLocation mousepos GetX mousepos GetY boundingbox GetHeight stockpanel SetLocation mousepos ChartObj DEV POS Draws the tooltip text panel to the chart graphics context stockpanel Draw GetToolTipGraphics CustomToolTip stocktooltip new CustomToolTip chartVu stockVolumeData Data ToolTips 343 stockPriceData NASDAQData Stocktooltip SetDataToolTipFormat ChartObj DATA TOOLTIP CUSTOM stocktooltip SetEnable true chartVu SetCurrentMouseListener stocktooltip Visual Basic Class CustomToolTip Inherits DataToolTip Pri
166. TIMEAXIS HOURSMINUTE TIMEAXIS HOUR2MINUTE TIMEAXIS HOURMINUTE TIMEAXIS 30MINUTEMINUTE TIME AXIS 15MINUTEMINUTE TIMEAXIS 10MINUTEMINUTE TIMEAXIS SMINUTEMINUTE TIMEAXIS 2MINUTEMINUTE TIMEAXIS MINUTE TIMEAXIS MINUTE30SECOND TIMEAXIS MINUTEISSECOND TIMEAXIS MINUTEIOSECOND TIMEAXIS MINUTESSECOND TIMEAXIS MINUTE2SECOND TIMEAXIS MINUTESECOND TIMEAXIS 30SECONDSECOND TIMEAXIS 15SECONDSECOND 1 hour major tick mark spacing 5 minute minor tick mark spacing 1 hour major tick mark spacing 2 minute minor tick mark spacing 1 hour major tick mark spacing 1 minute minor tick mark spacing 30 minute major tick mark spacing 1 minute minor tick mark spacing 15 minute major tick mark spacing 1 minute minor tick mark spacing 10 minute major tick mark spacing 1 minute minor tick mark spacing 5 minute major tick mark spacing 1 minute minor tick mark spacing 2 minute major tick mark spacing 1 minute minor tick mark spacing 1 minute major tick mark spacing minute major tick mark spacing 30 second minor tick mark spacing 1 minute major tick mark spacing 15 second minor tick mark spacing 1 minute major tick mark spacing 10 second minor tick mark spacing minute major tick mark spacing 5 second minor tick mark spacing minute major tick mark spacing 2 second minor tick mark spacing minute major tick mark spacing 1 second minor tick mark spacing 30 second major tick mark spacing
167. Text causes the routine to move only objects derived from the ChartText class If you want to move only specific objects of a given class create a special subclass of that class Then create your moveable objects using that subclass Then specify your class name i e MyTextClass using the string MyTextClass Create the MoveObj object and then install it using the ChartView SetCurrentMouseListener method This adds the MoveObj object as a MouseListener to the ChartView object Enable Disable the function using MoveObj SetEnable method Call MoveObj SetCurrentMouseListener null to remove the object as a mouse listener for the chart view Not all GraphObj derived object are moveable Call the GraphObj GetMoveableType method and check to see if it returns ChartObj OBJECT MOVEABLE Alternatively you can call the MoveObj IsMoveableObject method passing in a reference to the object Moving Objects and Data Points 311 Most moveable objects move unrestricted in the x and y direction There are exceptions though Axis objects move in the direction parallel to their current position effectively changing the axis intercept but not the extents of the axis endpoints Axis labels always track their reference axis The base axis defines the position of an AxisTitle text object and the chart view defines the position of a ChartTitle text object Attemp to move these objects and they revert to their original centered positions If you require moveab
168. The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX The SetColor method is used to customize the drawing properties of the lines used to draw the axis line and tick marks Simple log axis example C double xMin 0 double xMax 1000 double yMin 0 2 double yMax 2000 CartesianCoordinates logYScale new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE logYScale SetCoordinateBounds xMin yMin xMax yMax Create a linear x axis and a logarithmic y axis LinearAxis xAxis new LinearAxis logYScale ChartObj X AXIS LogAxis yAxis new LogAxis logYScale ChartObj Y AXIS Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Visual Basic Dim xMin As Double 0 Dim xMax As Double 1000 Dim yMin As Double 0 2 Dim yMax As Double 2000 Dim logYScale As CartesianCoordinates _ New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE logYScale SetCoordinateBounds xMin yMin xMax yMax Create a linear x axis and a logarithmic y axis Dim xAxis As LinearAxis New LinearAxis logYScale ChartObj X AXIS Dim yAxis As LogAxis New LogAxis logYScale ChartObj Y AXIS 164 Axes Create the ChartView object to place graph objects in Dim chartVu As ChartView
169. This class is the abstract base class for the auto scale classes LinearAutoScale This class is a concrete implementation of the AutoScale class It calculates scaling values based on the numeric values in SimpleDataset and GroupDataset objects Linear scales and axes use it for auto scale calculations LogAutoScale This class is a concrete implementation of the AutoScale class It calculates scaling values based on the numeric values in SimpleDataset and GroupDataset objects Logarithmic scales and axes use it for auto scale calculations TimeAutoScale This class is a concrete implementation of the AutoScale class It calculates scaling values based on the ChartCalendar values in TimeSimpleDataset and TimeGroupDataset objects Date time scales and axes use it for auto scale calculations ElapsedTimeAutoScale This class is a concrete implementation of the AutoScale class It calculates scaling values based on the numeric values in ElapsedTimeSimpleDataset and ElapsedTimeGroupDataset objects The elapsed time classes use it for auto scale calculations Class Architecture 25 Chart Object Classes Chart objects are graph objects that can be rendered in the current graph window This is in comparison to other classes that are purely calculation classes such as the coordinate conversion classes All chart objects have certain information in common This includes instances of ChartAttribute and PhysicalCoordinates classes The ChartAttribute
170. Threshold method Moving datapoints example See the class MoveDatapoint for a more complicated example C ChartView chartVu chartViewl CartesianCoordinates pTransforml new CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR MoveData mouselistener new MoveData chartVu pTransforml mouselistener SetMarkerType ChartObj MARKER CROSS mouselistener SetMarkerSize 12 mouselistener SetMoveMode ChartObj MOVE Y mouselistener SetEnable true chartVu SetCurrentMouseListener mouselistener Visual Basic Dim chartVu As ChartView ChartViewl Dim pTransforml As CartesianCoordinates _ New CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR _ ChartObj AUTOAXES FAR Dim mouselistener As MoveData New MoveData chartVu pTransforml mouselistener SetMarkerType ChartObj MARKER CROSS 314 Moving Chart Objects and Data Points mouselistener SetMarkerSize 12 mouselistener SetMoveMode ChartObj MOVE Y mouselistener SetEnable True chartVu SetCurrentMouseListener mouselistener Moving the Chart Coordinate System Class MoveCoordinates MouseListener DataCursor MoveCoordinates The MoveCoordinates mouse listener traps a mouse pressed event While the mouse is button is held down the underlying coordinate system will track the move movements Release the mouse button and
171. Time formats hh mm ss hh mm mmiss etc e Date formats mm dd yy dd mm yy mm yy etc e Time Date formats mmm ddd yyy hh mm ss ElapsedTimeAxisLabels The ElapsedTimeAxisLabels are used in combination with the ElapsedTimeA xis type lapsed time formats hh mm ss hh mm mm ss mm ss fff etc PolarAxesLabels This class displays numeric labels exclusively for the PolarAxes class It uses labels in the same format as the NumericAxisLabels AntennaAxesLabels This class displays numeric labels exclusively for the AntennaAxes class It uses labels in the same format as the NumericAxisLabels Class AxisLabels GraphObj ChartText AxisLabels The AxisLabels class is the abstract base class for all axis label objects It contains the properties and methods common to subclasses implementing more specialized axis labels Axis Label Text Axis Labels 191 The AxisLabels class includes a reference to a Font object If a valid font is not supplied a default font is created and used Every axis labels object can have a unique font associated with it The Font object defines the font typeface size and style The font for any of the axis labels can be set using the AxisLabels SetTextFont method The AxisLabels class manages other text attributes not directly associated with the font These include the text foreground color the text background color and the rotation of the text if it is different from the normal horizontal
172. Tips The tooltip data point search algorithm works with both simple and group data When used with simple plot objects SimpleLinePlot SimpleBarPlot etc it locates the xy data point associated with the mouse event When used with group plot objects it locates the x value and the y group value associated with the mouse event It is able to differentiate between stacked group plot objects StackedBarPlot StackedLinePlot and the other group plot objects that are not stacked GroupBarPlot MultiLinePlot OHLCPlot CandlestickPlot etc The tooltip values displayed in the tooltip window reflect the actual data values stored in the associated dataset and do not reflect the implicit summation that goes on in the display of stacked plot objects You should not use symbols to highlight the tooltip data point for stacked objects since the position of the tooltip symbol in the chart will not take into account the stacked object summation DataToolTip constructors The constructors below create a DataToolTip object Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ Overloads Public Sub New _ ByVal component As ChartView _ ByVal buttonmask As MouseButtons _ Ct public DataToolTip ChartView component public DataTOoolTip ChartView component MouseButtons buttonmask component A reference to the ChartView object that the chart is placed in buttonmask Specifies the mouse button that is trapped to
173. U FOR ANY CONSEQUENTIAL SPECIAL INCIDENTAL OR INDIRECT DAMAGES OF ANY KIND ARISING OUT OF THE DELIVERY PERFORMANCE OR USE OF THE SUCH DAMAGES IN ANY EVENT QUINN CURTIS S LIABILITY FOR ANY CLAIM WHETHER IN CONTRACT TORT OR ANY OTHER THEORY OF LIABILITY WILL NOT EXCEED THE GREATER OF U S 1 00 OR LICENSE FEE PAID BY YOU 10 U S GOVERNMENT RESTRICTED RIGHTS The SOFTWARE is provided with RESTRICTED RIGHTS Use duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph c 1 11 of The Rights in Technical Data and Computer SOFTWARE clause of DFARS 252 227 7013 or subparagraphs c 1 and 2 of the Commercial Computer SOFTWARE Restricted Rights at 48 CFR 52 227 19 as applicable Manufacturer is Quinn Curtis Inc 18 Hearthstone Dr Medfield MA 02052 USA 11 MISCELLANEOUS If you acquired the SOFTWARE in the United States this EULA is governed by the laws of the state of Massachusetts If you acquired the SOFTWARE outside of the United States then local laws may apply Should you have any questions concerning this EULA or if you desire to contact Quinn Curtis Inc for any reason please contact Quinn Curtis Inc by mail at Quinn Curtis Inc 18 Hearthstone Dr Medfield MA 02052 USA or by telephone at 508 359 6639 or by electronic mail at support Quinn Curtis com iv Contact INFOrmation eee eeeecccccccecesssssnsccecceccssssssstcacecececcesssnstcceesevesssstsntnaceseess 1
174. Values Dataset3 GetYData thePlot3 SetSegmentAttributesMode true for i20 i lt Dataset3 GetNumberDatapoints i if yValues i gt 0 0 thePlot3 SetSegmentAttributes i profitAttrib else thePlot3 SetSegmentAttributes i lossAttrib chartVu AddChartObject thePlot3 Visual Basic Dim DatasetArray As TimeSimpleDataset Datasetl Dataset2 Dataset3 Dim pTransforml As TimeCoordinates New TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 0 1 0 92 0 75 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND _ Color FromArgb 100 50 255 Color FromArgb 40 25 120 ChartObj Y AXIS chartVu AddChartObject background Dim plotbackground As New Background pTransforml ChartObj PLOT BACKGROUND Color Black chartVu AddChartObject plotbackground Define and add axes axes labels and grids to the chart Simple Plot Objects 227 Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Datasetl SortByX True Dim thePlotl As SimpleLinePlot _ New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlot1l Dim attrib2 As New ChartAttribute Color Yellow 3 DashStyle Solid Dataset2 SortByX True Dim thePlot2 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 Dim lossAttrib As New ChartAttribu
175. Visual Basic Public Sub UpdateXScaleAndAxes ByVal index As Integer Dim startindex As Integer index pTransforml SetScaleStartX CDbl startindex pTransforml SetScaleStopX CDbl startindex 50 xAxis CalcAutoAxis yAxis CalcAutoAxis xAxisLab CalcAutoAxisLabels yAxisLab CalcAutoAxisLabels Me UpdateDraw End Sub UpdateXScaleAndAxes Public Sub UpdateYScaleAndAxes ByVal index As Integer Dim startindex As Integer index pTransforml SetScaleStartyY CDbl startindex pTransforml SetScaleStopY CDb1 startindex xAxis CalcAutoAxis System EventArgs e FAQs 451 452 FAQs yAxis CalcAutoAxis xAxisLab CalcAutoAxisLabels yAxisLab CalcAutoAxisLabels Me UpdateDraw End Sub UpdateYScaleAndAxes Private Sub HScrollBarl Scroll ByVal sender As System Object ByVal e As System EventArgs Handles HScrollBarl ValueChanged hScrollActive True Me Timerl Enabled True End Sub Private Sub VScrollBarl Scroll ByVal sender As System Object ByVal e As System EventArgs Handles VScrollBarl ValueChanged vScrollActive True Me Timerl Enabled True End Sub Private Sub Timerl Tick ByVal sender As System Object ByVal e As System EventArgs Handles Timerl Tick If hScrol llActive Then UpdateXScaleAndAxes HScrollBarl Value hScrol End If llActive False If vScrol llActive Then UpdateYScaleAndAxes VScrollBarl Value vScrollActive False End
176. a A typical stock market display is a one month chart of daily closing values for one or more stocks You want to be able to click on a point in the chart and have the open high low and closing value for that day displayed in a pop up box The example program OHLCFinPlot demonstrates how to use a ChartText object as a popup box to display this type of data In another related example the program LabeledPieChart shows how to trap a click on a specific pie slice and display additional data for that slice using a ChartText object 14 Moving Chart Objects Data Points and Coordinate Systems MoveObj MoveData MoveCoordinates Many of the subclasses of GraphObj are moveable using the mouse This includes the axis legend text image shape classes If you add the necessary support to your program you can click and drag the object around in the chart This may or not be desirable since a user can ruin a carefully constructed chart by dragging objects around It is just an option though that you can add to the program It is also possible to select a single data point in a simple plot object SimpleLinePlot SimpleBarPlot SimpleLineMarkerPlot and SimpleScatterPlot and move it with a click and drag operation of the mouse Again it is an option that you can add to the program if you want Starting in Revision 2 0 we have added the capability of moving the coordinates system of a graph using the MoveCoordinates class The move operation i
177. a points This class encapsulates a System Drawing Image class defining a rectangle in chart coordinates that the image is Class Architecture 55 placed in JPEG and other image files can be imported using the System Drawing Image class and displayed in a chart ChartShape This class encapsulates a GraphicsPath class placing the shape in a chart using a position defined in chart coordinates A chart can display any object that can be defined using GraphicsPath class ChartSymbol This class defines symbols used by the SimplePlot scatter plot functions Pre defined symbols include square triangle diamond cross plus star line horizontal bar vertical bar 3D bar and circle Mouse Interaction Classes MouseListener MoveObj FindObj DataToolTip DataCursor MoveData MagniView MoveCoordinates MultiMouseListener ChartZoom Several classes implement delegates for mouse events The MouseListener class implements a generic interface for managing mouse events in a graph window The DataCursor MoveData MoveObj ChartZoom MagniView and MoveCoordinates classes also implement mouse event delegates that use the mouse to mark move and zoom chart objects and data MouseListener This class implements Net CF delegates that trap generic mouse events button events and mouse motion events that take place in a ChartView window A programmer can derive a class from MouseListener and override the methods for mouse events creating a cus
178. abelsEnds ChartObj LABEL ALL Color xAxisLabelsColor Color Black int xAxisNumericFormat ChartObj DECIMALFORMAT xAxisLabels SetAxisLabels labelfont xAxisLabelsRotation xAxisLabelsDir xAxisLabelsDecimal xAxisLabelsEnds xAxisLabelsColor xAxisLabels SetAxisLabelsFormat xAxisNumericFormat Visual Basic Dim labelfont As Font New Font Helvetica 10 FontStyle Bold Dim xAxisLabelsRotation As Double 0 0 Dim xAxisLabelsDir As Integer ChartObj AXIS MIN Dim xAxisLabelsDecimal As Integer 1 Dim xAxisLabelsEnds As Integer ChartObj LABEL ALL Dim xAxisLabelsColor As Color Color Black Dim xAxisNumericFormat As Integer ChartObj DECIMALFORMAT xAxisLabels SetAxisLabels labelfont xAxisLabelsRotation xAxisLabelsDir xAxisLabelsDecimal xAxisLabelsEnds xAxisLabelsColor xAxisLabels SetAxisLabelsFormat xAxisNumericFormat Time and Date Axis Labels Class TimeA xisLabels GraphObj ChartText AxisLabels TimeAxisLabels The TimeAxisLabels class extends the AxisLabels class adding extensive time and date formatting capability Use it to label axes created using the TimeAxis class Label formats Axis Labels 197 A time axis label can take many forms Variations on these forms include Time formats hh mm ss hh mm mm ss etc e Date formats mm dd yy dd mm yy mm yy etc There are more ways to format time and date information than numeric data The QCChart2D CF for the Ne
179. ady has member variables that define properties and draw the tick marks for the circular axis The PolarAxes class also includes uses two additional Linear Axis objects in support of the x and y linear axes used in the drawing of the polar magnitude axes Polar Axis Minimum and Maximum Polar axes have only one scaling value the maximum value of the polar magnitude designated R The minimum value is always 0 0 The limits of the x and y axis are set to t R with the intercept for each axis set to 0 0 The polar angle scale is always 360 degrees corresponding to a full circle Polar Axis Minor and Major Tick Mark Intervals Polar axes use two sets of tick mark properties one set for the x and y axes and the other set for the circular axis The x and y axes use the same values for the major and minor tick mark spacing partitioning the axes between R endpoints The circular axis also uses major and minor tick marks analogous to the hour and minute marks of a clock Creating polar axes There is only one constructor for PolarAxes objects Axes 179 PolarAxes PolarCoordinates transform transform The transform coordinate system defines the axis extents of the polar axes The PolarAxes constructor assumes that the axis extents match the extents of the underlying coordinate system transform Other axis properties minor tick mark spacing number of minor tick marks per major tick mark tick mark direction and tick mark lengths are au
180. al Basic pTransforml New TimeCoordinates plransforml SetGraphBorderDiagonal 0 1 15 90 0 6 pTransform2 New TimeCoordinates pTransform2 SetGraphBorderDiagonal 0 1 7 90 0 875 Multiple Coordinate Systems in the Same Chart Often a chart needs more than one coordinate system to in order to support multiple x and y axes each with different scales As in the preceding section this involves creating multiple coordinate systems The plot areas for the coordinate systems can occupy separate space in the chart view or they can overlap at the exact same position As in the previous section the position of each coordinate systems plot area in the chart view is set using one of the coordinate systems SetGraphBorder methods Many of the examples use this technique including OHLFinPlot MultiAxes LinearAxes LogAxes and DateAxes1 and DateAxes2 Multiple coordinate systems in a ChartView example C double xMinl 5 double xMaxl 15 double yMinl 0 double yMax1 105 CartesianCoordinates pTransforml new CartesianCoordinates xMinl yMinl xMaxl yMaxl pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 double xMin2 50 double xMax2 150 double yMin2 0 double yMax2 1050 CartesianCoordinates pTransform2 new CartesianCoordinates xMin2 yMin2 xMax2 yMax2 The Chart View 143 pIransform2 SetGraphBorderDiagonal 0 1 15 90 0 6 Visual Basic Dim xMinl As Double 5
181. al rowskip As Integer _ ByVal columnskip As Integer C4 public GroupDataset CSV csv string filename int rowskip int columnskip csv An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation columnskip For each row of data skip this many columns before reading the first value from the row You can retrieve references to the internal arrays used to store the data using the GroupDataset methods GetXData and GetGroupData Change the values in the data arrays using these references You can also modify a point at a time using one of the SetYDataValue and SetXDataValue methods If you need to add new points to dataset increasing its size use one of the AddGroupDataPoints or InsertGroupDataPoints methods Delete data points using the DeleteDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a group datasets from numeric arrays C double xl 10 20 30 40 50 double yl 1 9 21 20 40 30 55 15 35 10 561 15 25 15 30 490114 GroupDataset Datasetll new GroupDataset First x1l yl Visual Basic Dim xl1 As Double 10 20 30 40 50 Dim yl As Double 19 21 20 40 30 2 Chart Datasets 55 I5 35 10 Bet 1594 Z9 15 39 AFI Dim Datasetl As GroupDataset New GroupDataset First xl yl Example of creating a g
182. alculated using an auto axis method These properties can be explicitly set if you need to override the automatically calculated values SetAxisIntercept method Visual Basic Public Sub SetAxisIntercept _ ByVal intercept As Double _ Cf public void SetAxisIntercept double intercept SetAxisTicksAttributes method Visual Basic Public Sub SetAxisTicksAttributes _ ByVal minorticklength As Double _ ByVal majorticklength As Double _ ByVal tickdir As Integer _ C public void SetAxisTicksAttributes double minorticklength double majorticklength int tickdir intercept Sets the intercept of this axis with the perpendicular axis in physical coordinates minorticklength Specifies the length of a minor tick mark in Net CF device coordinates majorticklength Specifies the length of a major tick mark in Net CF device coordinates tickdir Specifies the direction of the tick marks with respect to axis line Use one of the following tick direction constants AXIS MIN AXIS CENTER AXIS MAX Customize the line and tick mark drawing properties of the axis using the SetColor method Simple time axis example C Define a Time coordinate system 172 Axes ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 ll La o LH double yMax TimeCoordinates simpleTimeScale sim
183. ale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 15 15 82 0 75 SetInitialDates pTransforml Background graphbackgroundl new Background pTransforml ChartObj GRAPH BACKGROUND Color White Color LightGray ChartObj Y AXIS chartVu AddChartObject graphbackgroundl Background plotbackgroundl new Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject plotbackground1 ChartAttribute attribl new ChartAttribute Color Red 1 DashStyle Solid Color Red ChartAttribute attrib2 new ChartAttribute Color Yellow 1 DashStyle Solid Color Yellow ChartAttribute attrib3 new ChartAttribute Color Blue 1 DashStyle Solid Color Blue ChartAttribute attrib4 new ChartAttribute Color Green 1 DashStyle Solid Color Green ChartAttribute attribArray attribl attrib2 attrib3 attrib4 attribl SetFillFlag true thePlotl new FloatingStackedBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 75 attribArray ChartObj JUSTIFY CENTER thePlotl SetFastClipMode ChartObj FASTCLIP X chartVu AddChartObject thePlotl1 268 Group Plot Objects Visual Basic Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData pTransforml New TimeCoordinates pTransforml SetWeekType weekmode pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES
184. alue is specified using the scale of the perpendicular axis if the perpendicular axis is linear as in the case of semi log graphs the intercept value can be positive negative or 0 0 If the perpendicular axis is logarithmic the intercept value is restricted to a positive range Logarithmic Axis Tick Mark Origin The starting value for the major tick marks does not need to fall at the end of the axis range For example the axis may have a range of 0 175 to 195 It would not make sense to start the major tick mark placement at 0 175 The major tick marks would end up placed at 0 175 1 75 17 5 and 175 The minor tick marks would make even less sense A better major tick mark placement is 0 2 2 20 and 200 The minor tick marks will also fall on even values The logarithmic axis tick mark origin controls the placement of the first major tick mark The other major and minor tick mark positions are automatically calculated based on the initial position of the first major tick mark The tick mark origin must reside in the bounds defined by the axis minimum and maximum inclusive of the endpoints It does not need to be near an endpoint however LogAxis Constructors There are two constructors for LogAxis objects Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal axtype As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal axtype As Integer _ ByVal minval A
185. alues as the box BW IQRI5 WHISKER OUTLIERS Plot the minimum value within q25 1 5 IQR and maximum value within q75 1 5 IQR as whiskers the median q25 and q75 values as the box and outliers as scatter plot symbols BW IQRIS5 WHISKER ALLPOINTS Plot the minimum value within q25 1 5 IQR and maximum value within q75 1 5 IQR as the whiskers the median q25 and q75 values as the box and plot all points as scatter plot symbols Where q25 fora given population q25 is the 25th percentile point in the population q75 fora given population q75 is the 75th percentile point in the population IOR fora given population IQR is the value q75 q25 Group Plot Objects 249 Outlier 130 0 es Caen ers Eee Whisker i908 q75 75th percentile 736 Median 57 5 q25 25th percentile 39 5 Whisker 31 5 Turn on the numeric labeling of the Box and Whisker summary values high whisker q75 median q25 low whisker by setting the BoxWhiskerPlot ShowDatapointValue property true Turn on the numeric labeling of the scatter plot symbols used for outliers by setting the the BoxWhiskerPlot ScatterPlot ShowDatapointValue property true You should not combine numeric labeling with the W IORI5 WHISKER ALLPOINTS option unless you are working with a very small number of data points otherwise the labels will all overlap one another Box and whisker plot example extracted from the example program NewDemosRev2 BoxAndWhiskerChart C N
186. am incorporates 50 different examples into a single program selectable as items in a menu While this is a good program for us to use as a test suite to test and demonstrate the software it probably does not reflect you own intended use The following steps describe techniques you can use to incorporate the QCChart2D CF classes into your program These are not the only way to add charts to an application In general any technique that works with UserControl derived classes will work We found the technique described below this to be the most flexible ES Form1 Energy A Software Predicted Scatter plots usually display some form of sampled data UserChartExamplel UserChartExample2 and UserChartExample3 all produce this chart Visual Basic for Net Compact Framework 414 Using QCChart2D for Net CF to Create Windows Applications First if this is the first Net Compact Framework program you have every created make a few practice application programs using the Visual Studio defaults Don t try to add graphics to an application until you are able to create a simple Net Compact Framework applications using the New Project File New Project application wizard e You start the New Project application wizard by selecting File New Project bringing up the New Project dialog box e From this dialog select Visual Basic Projects Smart Device Windows Mobile 5 0 folder on the left and the Device Application template on
187. ant A single coordinate system can have one or more x and or y axes The most common use for multiple axes in a single coordinate system is to place y axes on both the left and the right sides of a chart and x axes above and below The left and bottom axes usually have numeric or date labels and the top and right axes just tick marks This does not hav to be the case though every axis can have axis labels if you want In general the axis position in the chart is determined by its intercept The default value of the intercept is set to the minimums of the coordinate system that the axis is placed in Adjusting the intercept using the SetAxisIntercept method changes the position of the axis in the chart The axis intercept value is set using units of the coordinate system at right angles to the axis The example below extracted from the LineFill example places y axes on both the left and right of the chart C TimeAxis xAxis new TimeAxis pTransforml chartVu AddChartObject xAxis TimeAxis xAxis new TimeAxis pTransforml xAxis SetColor Color White chartVu AddChartObject xAxis LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS Default places y axis at miniumum of x coordinate scale yAxis SetColor Color White chartVu AddChartObject yAxis LinearAxis yAxis2 new LinearAxis pTransforml ChartObj Y AXIS yAxis2 SetAxisIntercept xAxis GetAxisMax yAxis2 SetAxisTickDir ChartObj AXIS MAX
188. apes Images and Arrows to a Chart ChartShape Arrow ChartImage It is not possible to take into account every possible graphical object that a programmer wants to add to a graph Specialized applications require specialized objects Rather than create a large group of classes that duplicate the functions of arcs rectangles and other classes a generalized class has been created ChartShape that can place and display in a chart any object that can be expressed as a GraphicsPath The Arrow defines an arrow shape useable with the ChartShape class The Arrow class creates the arrows in the ArrowPlot class and it can also place individual arrows in a chart The class creates a base arrow with a custom arrowhead and shaft size Scale rotate and position the arrow in a chart The ChartImage class places a System Drawing Image object anywhere in a chart It can be a small element of the chart inside or outside of the plot area or it can be sized to fill the plot area or graph area and used as a background object Generic Shape Class Class ChartShape GraphObj ChartShape The ChartShape class places arbitrary GraphicsPath objects in a chart If the shape includes absolute positioning information use 0 0 as the xy position parameters of the shape If the shape coordinates are relative coordinates with the object centered on 0 0 place the shape at the position you want using the xy position parameters The xy position parameters are
189. ar PolarAxes Antenna AntennaAxes The four axis types derive directly or indirectly from the Axis abstract base class that provides a core set of properties and methods All axis objects use the same set of methods found in the base GraphObj class to set the drawing properties of the lines used to draw the axis line and tick marks The default values use a black solid line of thickness 1 0 Change the default values using the GraphObj methods below SetColor method Visual Basic Overridable Public Sub SetColor _ ByVal rgbcolor As Color _ Ct public virtual void SetColor Color rgboolor SetLineWidth method Visual Basic Overridable Public Sub SetLineWidth _ ByVal linewidth As Double _ C public virtual void SetLineWidth double linewidth Axes 153 SetLineStyle method Visual Basic Overridable Public Sub SetLineStyle _ ByVal linestyle As DashStyle _ Cf public virtual void SetLineStyle DashStyle linestyle rgbcolor Sets the primary line color for the chart object linewidth Sets the line width in device coordinates for the chart object linestyle Sets the line style for the chart object Linear Axes Class LinearAxis GraphObj Axis LinearAxis Linear Axis Minimum and Maximum The axes minimum and maximum are the physical coordinate values that define the starting and ending points of the axis line It is a mistake to try to invert the axis
190. arrow plots histogram plots cell plots and bubble plots The number of x values in a group plot is referred to as the number of columns or as numberDatapoints and the number of y values for each x value is referred to as the number of rows or numberGroups Think of spreadsheet that looks like x values x 0 x 1 x 2 x 3 x 4 x 5 y values group 0 y 0 0 y 0 1 y 02 y 03 y 0 4 v 0 5 y values group 1 y LO y 1l 1 y 1 2 y L3 v L4 v L5 y values group 2 y 2 0 y 2 1 y 2 2 y 2 3 y 2 4 y 2 5 number of x values numberDatapoints numberColumns 6 number of y values for each x value numberGroups numberRows 3 244 Group Plot Objects This would be the ROW MAJOR format if the data were stored in a CSV file Example program segments presented in this documentation are not complete programs and contain uninitialized and or undefined objects and variables Do not attempt to copy them into your own program Refer to the referenced example program that the code is extracted from Arrow Plots Class ArrowPlot GraphObj ChartPlot GroupPlot ArrowPlot The ArrowPlot class is a concrete implementation of the GroupPlot class It displays a collection of arrows as defined by the data in a group dataset The position size and rotation of each arrow in the collection is independently controlled The numer of groups of the group dataset must be three ArrowPlot constructor Visual Basic Over
191. art2D CF for Net Compact Framework Class Summary The following categories of classes realize these design considerations Chart view class Data classes Scale transform classes The chart view class is a UserControl subclass that manages the graph objects placed in the graph There are data classes for simple xy and group data types There are also data classes that handle System DateTime date time data and contour data The scale transform classes handle the conversion of physical coordinate values to working coordinate values for a single dimension Coordinate transform classes The coordinate transform classes handle the conversion Attribute class Auto Scale classes Charting object classes Mouse interaction classes Miscellaneous utility classes of physical coordinate values to working coordinate values for a parametric 2D coordinate system The attribute class encapsulates the most common attributes line color fill color etc for a chart object The coordinate transform classes use the auto scale classes to establish the minimum and maximum values used to scale a 2D coordinate system The axis classes also use the auto scale classes to establish proper tick mark spacing values The chart object classes includes all objects placeable in a chart That includes axes axes labels plot objects line plots bar graphs scatter plots etc grids titles backgrounds images and arbitrary shapes These class
192. artCalendar 1996 ChartObj FEBRUARY 535 new ChartCalendar 1996 ChartObj MARCH 5 new ChartCalendar 1996 ChartObj APRIL 5 new ChartCalendar 1996 ChartObj MAY Sys new ChartCalendar 1996 ChartObj JUNE 5 new ChartCalendar 1996 ChartObj JULY 5 112 Scaling and Coordinate Systems new ChartCalendar 1996 ChartObj AUGUST 5 new ChartCalendar 1996 ChartObj SEPTEMBER 5 new ChartCalendar 1996 ChartObj OCTOBER 5 new ChartCalendar 1996 ChartObj NOVEMBER DJ double Beta 10 22 33 44 595 46 33 25 l4 9 TimeSimpleDataset dataset new TimeSimpleDataset Sales xData yData TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale AutoScale dataset Visual Basic Dim xData As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 _ New ChartCalendar 1996 ChartObj MARCH 5 _ New ChartCalendar 1996 ChartObj APRIL 5 _ New ChartCalendar 1996 ChartObj MAY 5 _ New ChartCalendar 1996 ChartObj JUNE 5 _ New ChartCalendar 1996 ChartObj JULY 5 _ New ChartCalendar 1996 ChartObj AUGUST 5 _ New ChartCalendar 1996 ChartObj SEPTEMBER 5 _ New ChartCalendar 1996 ChartObj OCTOBER 5 _ New ChartCalendar 1996 ChartObj NOVEMBER 5 Dim yData As Double 10 22 33 44 55 46 33 25 14 9 Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpl
193. artObjAttributes method For a simple color change of the scatter plot symbol use the scatter plot objects SetColor method Should you need additional symbols create your own Any GraphicsPath object can be used as a symbol The coordinates of the symbol should assume that 1 0 is the standard symbol size with a symbol center at the relative coordinates 0 5 0 5 The example below demonstrates how to create a diamond symbol public GraphicsPath GetDiamondShape GraphicsPath result new GraphicsPath result AddLine 0 5f 0 0f 0 0f 0 5f result AddLine 0 0f 0 5f 0 5f 1 0f result Addnine 0 5f 1 0 1 0 0 5 result CloseFigure return result Set the custom symbol using SimpleScatterPlot SetCustomScatterPlotSymbol method after the SimpleScatterPlot object is created Individual scatter plot symbols in a scatter plot object can have unique properties Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods Simple scatter plot example extracted from the example program BigChartDemo class ScatterPlot C pTransforml SetGraphBorderDiagonal 0 15 15 90 0 725 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color White Simple Plot Objects 233 chartVu AddChartObject background Define and add axes axes labels and grids to chart ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetrillColor Color Blue attrib
194. artObject yAxisLabl Dim xgridl As New Grid xAxisl yAxisl ChartObj X AXIS ChartObj GRID MAJOR xgridl SetColor Color White chartVu AddChartObject xgridl Dim ygridl As New Grid xAxisl yAxisl ChartObj Y AXIS ChartObj GRID MAJOR ygridl SetColor Color White chartVu AddChartObject ygridl Dim attribl As New ChartAttribute Color Red 1 DashStyle Solid Color Red Dim attrib2 As New ChartAttribute Color Yellow 1 DashStyle Solid Color Yellow Dim attrib3 As New ChartAttribute Color Blue 1 DashStyle Solid Color Blue Dim attrib4 As New ChartAttribute Color Green 1 DashStyle Solid Color Green Dim attribArray As ChartAttribute attribl attrib2 attrib3 attrib4 Dim thePlotl As New GroupBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj YEAR 0 75 0 0 272 Group Plot Objects attribArray ChartObj JUSTIFY CENTER thePlot1l SetBarOverlap 0 0 chartVu AddChartObject thePlot1l Histogram Plots Class HistogramPlot GraphObj ChartPlot GroupPlot HistogramPlot The HistogramPlot class extends the GroupPlot class and displays histogram plots A histogram plot is a collection of rectangular objects with independent positions widths and heights specified using the values of the associated group dataset The number of groups must be two The X values of the group dataset represent the x position of the lower left corner of each histogram bar the Y 0 values
195. asetViewer ChartView chartvu PhysicalCoordinates transform Rectangle2D posrect ChartDataset dataset int rows int cols int start chartvu The ChartView object the DatasetViewer is placed in transform The coordinate system the DatasetViewer is placed in posrect A positioning rectangle using normalized chart coordinates for the dataset viewer use null if not used dataset A simple or group dataset to add to the dataset viewer rows Number of rows to display cols Number of columns to display start Starting column of the dataset viewer Text Classes 397 Set unique fonts for the column headers row headers and grid cells using the ColumnHeaderFont RowHearderFont and GridCellFont properties Turn on the edit feature of the grid cells using the EnableEdit property Turn on the striped background color of the grid cells using the UseStripedGridBackground property Foreground and background attributes of the column headers row headers and grid cells can be set using the ColumnHeaderAttribute RowHeaderAttribute GridAttribute and AltGridAttribute properties You can add multiple datasets to a DatasetViewer using the DatasetViewer AddDataset method When adding additional datasets it only adds the y values of the dataset It is assumed the x values of the datasets are the same otherwise the columns would lose synchronization The row header string for the first grid row the x values is picked up from the fi
196. ass CartesianCoordinates PhysicalCoordinates CartesianCoordinates The CartesianCoordinates class scales the chart plot area for a physical coordinate system that uses linear and or logarithmic scaling There are three main ways to scale the plot area e Scale the minimum and maximum x and y values explicitly e Use an auto scale method that calculates appropriate minimum and maximum x and y values based on the x and y values in one or more datasets e Use a combination of the first two methods It is useful to be able to run an auto scale function and then change the minimum or maximum value of one or more coordinate endpoints Linear Coordinate Scaling The default coordinate system for the CartesianCoordinates class is linear for both x and y If you already know the range for x and y for the plot area you can scale the plot area explicitly The example below uses a CartesianCoordinates constructor to initialize the coordinates to the proper values CartesianCoordinates constructor with explicit scaling C double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale simpleScale new CartesianCoordinates xMin yMin xMax yMax Visual Basic Dim xMin As Double 5 102 Scaling and Coordinate Systems Dim xMax As Double 15 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleScale As CartesianCoordinates simpleScale New CartesianCoordinates
197. ataset and others that take an array of datasets Example of auto scaling a ElapsedTimeCoordinates object using a single dataset C double xData 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double yData 10 22 33 44 S55 46 33 25 14 9 ElapsedTimeSimpleDataset dataset new ElapsedTimeSimpleDataset Sales xData yData ElapsedTimeCoordinates simpleScale new ElapsedTimeCoordinates simpleScale AutoScale dataset Visual Basic Dim xData As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Dim yData As Double 10 22 33 44 55 46 33 25 14 39 Scaling and Coordinate Systems 123 Dim dataset As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Sales xData yData Dim simpleScale As ElapsedTimeCoordinates New ElapsedTimeCoordinates simpleScale AutoScale dataset You can control the tightness of the auto scale values about the dataset values using other versions of the ElapsedTimeCoordinates AutoScale method that take rounding mode parameters Example of auto scaling a ElapsedTimeCoordinates object using a single dataset and explicit rounding mode parameters simpleScale AutoScale dataset ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR You can auto scale the bounds of the coordinate system using a dataset and then explicitly modify the range the auto scale selected There are methods that set the minimum and maximum values of
198. atavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue True chartVu AddChartObject thePlot1l Simple Scatter Plots Class SimpleScatterPlot GraphObj ChartPlot SimplePlot SimpleScatterPlot The SimpleScatterPlot class is a concrete implementation of the SimplePlot class and displays simple datasets in scatter plot format where each data point is a symbol SimpleScatterPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDataset ByVal symtype As Integer _ ByVal attrib As ChartAttribute C public SimpleScatterPlot PhysicalCoordinates transform SimpleDataset dataset int symtype ChartAttribute attrib 232 Simple Plot Objects transform The coordinate system for the new SimpleScatterPlot object dataset The scatter plot represents the values in this dataset symtype The symbol used in the scatter plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE attrib Specifies the attributes size line and fill color for the scatter plot A ChartAttribute object sets the objects global outline and fill attributes Change the simple plot objects ChartAttribute object using the objects SetCh
199. ated AntennaAxes object The y axis is labeled from the radius minimum to the radius maximum The circular axis is labeled clockwise from 0 to 360 degrees starting at 12 00 Chart Plot Classes ChartPlot ContourPlot GroupPlot PieChart PolarPlot AntennaPlot SimplePlot Plot objects are objects that display data organized in a ChartDataset class There are six main categories simple group polar antenna contour and pie plots Simple plots graph data organized as a simple set of xy data points The most common examples of simple plots are line plots bar graphs scatter plots and line marker plots Group plots graph data organized as multiple y values for each x value The most common examples of group plots are stacked bar graphs open high low close plots candlestick plots floating stacked bar plots and box and whisker plots Polar charts plot data organized as a simple set of data points where each data point represents a polar magnitude and angle pair rather than xy Cartesian coordinate values The most common example of polar charts is the display of complex numbers a bi and it is used in many engineering disciplines Antenna charts plot data organized as a simple set of data points where each data point represents a radius value and angle pair rather than xy Cartesian coordinate 34 Class Architecture values The most common example of antenna charts is the display of antenna performance and specification graphs The conto
200. ated out of the current viewing plane ChartShape example extracted from the example program BigChartDemo class MultiLine C ChartView chartVu chartViewl Lines Shapes Images and Arrows 403 Color alphaColor Color FromArgb 170 100 50 ChartAttribute attrib2 new ChartAttribute alphaColor 1 DashStyle Solid alphaColor attrib2 SetFillFlag true Rectangle2D linearRegionRect new Rectangle2D 0 1 0 1 1 5 50 GraphicsPath rectpath new GraphicsPath rectpath AddRectangle linearRegionRect GetRectangleF ChartShape linearRegionShape new ChartShape pTransforml rectpath ChartObj PHYS POS 0 0 0 0 ChartObj PHYS POS 0 linearRegionShape SetChartObjAttributes attrib2 chartVu AddChartObject linearRegionShape Visual Basic Dim alphaColor As Color Color FromArgb 170 100 50 Dim attrib2 As New ChartAttribute alphaColor 1 DashStyle Solid alphaColor attrib2 SetFillFlag True Dim linearRegionRect As New Rectangle2D 0 1 0 1 1 5 50 Dim rectpath As New GraphicsPath rectpath AddRectangle linearRegionRect GetRectangleF Dim linearRegionShape As New ChartShape pTransforml rectpath ChartObj PHYS POS 0 0 0 0 ChartObj PHYS POS 0 linearRegionShape SetChartObjAttributes attrib2 chartVu AddChartObject linearRegionShape ChartShape example extracted from the example program BigChartDemo class LabeledDatapoints C GraphicsPath titleLine new GraphicsPath title
201. ates normalized coordinates or Net CF device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS The marker constants signify MARKER NULL An invisible marker MARKER VLINE The marker is a vertical line extending from the top of the plot area to the bottom passing through the x value of the marker position MARKER HLINE The marker is a horizontal line extending from the left of the plot area to the right passing through the y value of the marker position MARKER HVLINE The marker combines both MARKER VLINE and MARKER HLINE marking the data point with horizontal and vertical lines MARKER CROSS The marker is a cross hair centered on the marker position Set the size of the cross hair using Net CF device coordinates in the object constructor or later using the setMarkerSize method MARKER BOX The marker is a box centered on the marker position Set the size of the box using Net CF device coordinates in the Data Markers and Data Cursors 301 object constructor or later using the setMarkerSize method Drop a marker anywhere on a plot by specifying the coordinates The example below places a 10 pixel wide marker in the center of the plot area Simple marker example C CartesianCoordinates pTransforml new CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR double xpos 5 0 double ypos 1
202. ates appropriate minimum and maximum x and y values based on the x and y values in one or more datasets e Use a combination of the first two methods It is useful to be able to run an auto scale function and then change the minimum or maximum value of one or more coordinate endpoints ElapsedTime Coordinate Scaling Scaling and Coordinate Systems 121 The default coordinate system for the ElapsedTimeCoordinates class is elapsed time for the x dimension and linear for the y dimension If you already know the range for x and y for the plot area you can scale the plot area explicitly The example below uses a ElapsedTimeCoordinates constructor to initialize the coordinates to the proper values Scale for elapsed time using the ElapsedTimeCoordinates constructor with explicit scaling for a range of 30 seconds C double xMin 0 starting elapsed time is 0 double xMax 30 1000 ending elpase time is 30 seconds double yMin 0 double yMax 105 ElapsedTimeCoordinates simpleScale simpleScale new ElapsedTimeCoordinates xMin yMin xMax yMax TimeSpan xTSMin TimeSpan FromSeconds 0 starting elapsed time is 0 TimeSpan xTSMax TimeSpan FromSeconds 30 ending elpase time is 30 seconds simpleScale new ElapsedTimeCoordinates xTSMin yMin xTSMax yMax Visual Basic Dim xMin As Double 0 starting elapsed time is 0 Dim xMax As Double 30 1000 ending elpase time is 30 seconds Dim yMin As Double
203. ath Abs 30 Math Sin 2 angl i Math Cos 2 angl i theFont new Font Microsoft Sans Serif 10 FontStyle Bold chartVu chartViewl SimpleDataset Datasetl new SimpleDataset First magl angl PolarCoordinates pPolarTransform new PolarCoordinates pPolarTransform SetGraphBorderDiagonal 0 25 20 75 0 8 Background background new Background pPolarTransform ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject background pPolarTransform AutoScale Datasetl PolarAxes pPolarAxis pPolarTransform GetCompatibleAxes chartVu AddChartObject pPolarAxis PolarGrid pPolarGrid new PolarGrid pPolarAxis PolarGrid GRID MAJOR chartVu AddChartObject pPolarGrid PolarAxesLabels pPolarAxisLabels PolarAxesLabels pPolarAxis GetCompatibleAxesLabels chartVu AddChartObject pPolarAxisLabels 356 Polar Charts ChartAttribute attribl new ChartAttribute Color Blue 2 0 PolarLinePlot thePlotl new PolarLinePlot pPolarTransform Datasetl attribl chartVu AddChartObject thePlot1 ChartAttribute attrib2 new ChartAttribute Color Red 1 0 Color Red attrib2 SetFillFlag true PolarScatterPlot thePlot2 new PolarScatterPlot pPolarTransform Datasetl ChartObj CIRCLE attrib2 chartVu AddChartObject theP10ot2 Visual Basic Dim numpl As Integer 100 Dim magl numpl 1 As Double Dim angl numpl 1 As Double Dim i As Integer For i 0 To numpl
204. attribs 1 SetColor color Blue attribs 2 SetColor color DarkGray attribs 3 SetColor color Green attribs 4 SetColor color Red attribs 5 SetColor color Cyan attribs 6 SetColor color Magenta attribs 7 SetColor color Orange attribs 8 SetColor color Yellow For i 0 To numcontourlevels 1 If i Mod 3 0 Then lineflags i True Else lineflags i False End If If i Mod 3 0 Then labelflags i True Else labelflags i False End If Next i thePlotl New ContourPlot pTransforml datasetl contourlevels thePlotl SetPolygonGridOn True thePlotl SetContourLineAlgorithm ChartObj CONTOUR LINEWALK attribs lineflags labelflags numcontourlevels ChartObj CONTOUR LINE Dim contourlabel As NumericLabel thePlotl GetPlotLabelTemplate Dim contourLabelFont As New Font Microsoft Sans Serif 8 FontStyle Regular contourlabel SetDecimalPos 0 contourlabel SetTextFont contourLabelFont contourlabel TextBgMode True contourlabel TextBgColor color White Contour Plotting 297 thePlotl SetPlotLabelTemplate contourlabel chartVu AddChartObject thePlot1l 13 Data Markers and Data Cursors Marker DataCursor Data markers are symbols and lines that can be dropped on to the data presented in a graph much like a bookmark in a word processing document Place the markers in a chart under program control or in response to a mouse event in the graph window Data cursors are temporar
205. aw and international treaty provisions You acknowledge that no title to the intellectual property in the SOFTWARE is transferred to you You further acknowledge that title and full ownership rights to the SOFTWARE will remain the exclusive property of Quinn Curtis Inc and you will not acquire any rights to the SOFTWARE except as expressly set forth in this license You agree that any copies of the SOFTWARE will contain the same proprietary notices which appear on and in the SOFTWARE 7 EXPORT RESTRICTIONS You agree that you will not export or re export the SOFTWARE to any country person entity or end user subject to U S A export restrictions Restricted countries currently include but are not necessarily limited to Cuba Iran Iraq Libya North Korea Sudan and Syria You warrant and represent that neither the U S A Bureau of Export Administration nor any other federal agency has suspended revoked or denied your export privileges 8 NO WARRANTIES Quinn Curtis Inc expressly disclaims any warranty for the SOFTWARE THE SOFTWARE AND ANY RELATED DOCUMENTATION IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS OR IMPLIED INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OR MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE REMAINS WITH YOU 9 LIMITATION OF LIABILITY IN NO EVENT SHALL QUINN CURTIS INC OR ITS SUPPLIERS BE LIABLE TO YO
206. bPage parent positionRect A rectangle that specifies the size and position of the ChartView in the parent window parent The parent window of the ChartView This parent window can take the form of System Windows Forms Form Control Panel or TabPage class All chart objects that have a graphical representation i e that consist of lines bars arcs text etc are subclasses of the GraphObj abstract base class This includes all of the axis classes axis label classes plot classes text classes and legend classes among others You must explicitly add objects of this type to the ChartView object using the ChartView AddChartObject method after they have been created and initialized Otherwise the object will not be included in the draw list of the ChartView The example below adds an axis object to the ChartView draw list There are two princible methods of adding a ChartView object to a Net CF Form The first is to add the ChartView control to the program at design time This is the mode most programmers are familiar with since they are used to populating an empty form with butons text boxes etc in order to build their displays The second method is to add the ChartView to the form under program control bypassing the design mode instantiation of the control completely The second method is useful if you need to customize the size and position of the ChartView control based on the resolution of the target device Using ChartView with t
207. basic template for a simple application Using QCChart2D for Net CF to Create Windows Applications 415 7 UserChartExample11 Microsoft Visual Studio Elle Edit View Project Build Debug Data Tools Window Community Help al d lt ld i X 3a 4 dL b Debug Any CPU pM preferredsize zu sai Bl o Windows Mobile 5 0 Pocket PC Emulat lt a A e wem Bil 3iz e 3 2 L h a NO eld a Toolbox X Formi vb Design Solution Explorer UserChart xample1 1 anm i 4 n 4 ke StatusBar a j TabControl od Solution UserChartExample11 1 project abl TextBox E 49 UserChartExample11 3 Sa My Project Timer EE parmi vb 38 ToolBar 9 TrackBar TreeView VScrollBar rel WebBrowser 22 chartview i Common Device Controls K Pointer ab Button v CheckBox E ComboBox T DateTimePicker E DocumentList A Label A LinkLabel S ListBox Properties H X UserChartExample11 Project Properties lt pma J MonthCalendar d 1 ex 1 amp 3 NumericUpDown lal Pctorenox Output File Folder amp CSIDL PROGRAM FILES d ED ProgressBar RadioButton Ehe Policy File Md Splitter Project File UserChartExample11 vbproj abl TextBox L Target Device Windows Mobile 5 0 Pocket P o D Errors A 0 Warnings i 0 Messages Description i Column Project Framework Version The Version of the NET Compact Framework this Error List E Output 159 Find Results 1 pr
208. bj DAY OF YEAR 0 8 defsultattrib fillattrib Visual Basic Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData Define axes axes labels and grids Dim defaultattrib As New ChartAttribute Color Black 1 DashStyle Solid Color White defaultattrib SetFillFlag True Dim fillattrib As New ChartAttribute Color Black 1 DashStyle Solid Color Red fillattrib SetFillFlag True Dim thePlotl As New CandlestickPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 8 defaultsttrib fillattrib chartVu AddChartObject thePlot1l Note how the ChartCalendar GetCalendarWidthValue method calculates the width of the bars as a function of time in this case a width of 0 8 months Cell Plots Class CellPlot GraphObj ChartPlot GroupPlot Group Plot Objects 257 CellPlot The CellPlot class extends the GroupPlot class and displays cell plots A cell plot is a collection of rectangular objects with independent positions widths and heights specified using the values of the associated group dataset The number of groups must be three The X Y 0 values of the group dataset represent the xy position of the lower left corner of each cell the Y 1 values set the width of the cell and the Y 2 values set the height of the cell Each cell can be filled using a color or an image CellPlot constructor Visual Basic Overloads Public Sub New _ ByVal
209. bj JUSTIFY CENTER modellabel SetYJust ChartObj JUSTIFY MIN Font modellabelfont new Font Microsoft Sans Serif 10 FontStyle Regular modellabel SetTextFont modellabelfont modellabel SetTextNudge 0 5 thePlotl SetPlotLabelTemplate modellabel Visual Basic Dim modellabel As New NumericLabel modellabel SetXJust ChartObj JUSTIFY CENTER modellabel SetYJust ChartObj JUSTIFY MIN Dim modellabelfont As New Font Microsoft Sans Serif 10 FontStyle Regular modellabel SetTextFont modellabelfont modellabel SetTextNudge 0 5 thePlotl SetPlotLabelTemplate modellabel chartVu AddChartObject thePlot1 Simple Versa Plots Class SimpleVersaPlot GraphObj ChartPlot SimplePlot SimpleLineMarkerPlot SimpleVersaPlot The SimpleVersaPlot is a plottype that can be any of the four simple plot types LINE MARKER PLOT LINE PLOT BAR PLOT SCATTER PLOT It is used when you want to be able to change from one plot type to another without deleting the instance of the old plot object and creating an instance of the new SimpleLineMarkerPlot constructor Simple Plot Objects 239 Visual Basic Overloads Public Sub New ByVal ByVal ByVal PhysicalCoordinates As PhysicalCoordinates SimpleDataset As SimpleDataset ChartAttribute As ChartAttribute Overloads Public Sub New ByVal ByVal ByVal ByVal ByVal ByVal PhysicalCoordinates As PhysicalCoor
210. ble 10 22 33 44 55 46 33 25 14 9 Dim xData2 As Double 10 9 8 7 6 Sy 4 3 2 1 Dim yData2 As Double 20 12 43 54 15 26 63 25 24 19 Dim xData3 As Double 5 Te Se Be tS Be S 3 Dim yDatra3 As Double 30 52 13 4 25 T6 13 35 24 19 Dim datasetl As SimpleDataset New SimpleDataset Salesl xDatal yDatal Dim dataset2 As SimpleDataset New SimpleDataset Sales2 xData2 yData2 Dim dataset3 As SimpleDataset New SimpleDataset Sales3 xData3 yData3 Dim datasetsArray 2 As SimpleDataset datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 Dim simpleScale As CartesianCoordinates New CartesianCoordinates simpleScale AutoScale datasetsArray There is a version of the multiple dataset auto scale routine that also specifies rounding mode parameters simpleScale AutoScale datasetsArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Logarithmic Coordinate Scaling The previous examples assume that both the x and y scales are linear If the x and or y scale are to be logarithmic then use the CartesianCoordinates constructor that has scale mode parameters Example of explicit scaling of three different logarithmic CartesianCoordinates objects C double xMin 1 double xMax 1000 double yMin 0 2 double yMax 2000 CartesianCoordinates logYScale logYScale SetCoordinateBounds xMin CartesianCoordinates logXScale logXScale SetCoo
211. cific initialization End Sub InitializeChart Private Sub Forml Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InitializeChart End Sub End Class e We placed all of the chart customization code in the InitializeChart method You can copy this part of the program from our own version of this example UserChartExamplel Forml vb Until this method is called the UserChartControll appears as an empty shell We call this method from the Form Load event You can easily add the Form Load event to your program by double clicking on the Form in design mode e You should be able to compile the project without error Run the project and the graph should be visible on the output device either an actual Windows Mobile device or an emulator The emulator can take 60 seconds or more to start the program and display the default form Adding a ChartView control at runtime The ChartView class can also be instantiated at runtime without placing it on a form at design time You can use the default ChartView constructor or one of the special constructors that simplify adding an instance of the control to a form at runtime See the list of ChartView constructors in Chapter 5 418 Using QCChart2D for Net CF to Create Windows Applications In general you pass the ChartView constructor a parent object Form Panel or TabbedControl and a positioning rectangle that defines the position and size of the ChartView objec
212. ckMode ChartObj AUTOAXES STACKED pTransform2 AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransform2 SetTimeScaleStart new ChartCalendar 1997 ChartObj JANUARY 1 pTransform2 SetTimeScaleStop new ChartCalendar 2003 ChartObj JANUARY 1 pTransform2 SetGraphBorderDiagonal 0 55 1 95 0 75 prTransform2 S8etScaleStartY 0 Define axes axes labels and grids StackedBarPlot thePlot2 new StackedBarPlot pTransform2 Datasetl ChartCalendar GetCalendarWidthValue ChartObj YEAR 0 75 0 0 attribArray ChartObj JUSTIFY CENTER NumericLabel bardatavalue thePlot2 GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 1 bardatavalue SetColor Color Black thePlot2 SetPlotLabelTemplate bardatavalue 286 Group Plot Objects thePlot2 SetBarDatapointLabelPosition ChartObj CENTERED BAR thePlot2 SetShowDatapointValue true chartVu AddChartObject theP10ot2 Visual Basic Stacked Bar Graph Dim pTransform2 As New TimeCoordinates User same dataset as Group bar plot set stacked mode flag Datasetl SetStackMode ChartObj AUTOAXES STACKED pTransform2 AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransform2 SetTimeScaleStart New ChartCalendar 1997 ChartObj JANUARY 1 pTransform2 SetTimeScaleStop New ChartCalendar 2003 ChartObj JANUARY 1 pTransform2 Se
213. cked bar plots open high low close plots candlestick plots arrow plots histogram plots cell plots box and whisker plots and bubble plots GroupPlot This class is an abstract base class for all group plot classes ArrowPlot This class is a concrete implementation of the GroupPlot class and it displays a collection of arrows as defined by the data in a group dataset The position size and rotation of each arrow in the collection is independently controlled 36 Class Architecture Bubble Size t 5 on 40 Million 2001 2002 Time of bankruptcy The size radius or area of the bubble adds an additional dimension to the graph BubblePlot This class is a concrete implementation of the GroupPlot class and displays bubble plots The values in the dataset specify the position and size of each bubble in a bubble chart Box and Whisker Plots are used in Descriptive Statistics 150 New York Houston San Francisco Boston Pittsburgh BoxWhiskerPlot This class is a concrete implementation of the GroupPlot class and displays box and whisker plots The BoxWhiskerPlot class graphically depicts groups of numerical data through their five number summaries the Class Architecture 37 smallest observation lower quartile Q1 median Q2 upper quartile Q3 and largest observation Candlestick Plots in Technical Analysis 4 01 05 The Open Close box is filled if the open price is
214. control horizontal scrolling of the data in my chart 19 I am trying to plot 100 000 data points and it takes too long to draw the graph What is wrong with the software and what can I do to make it faster 20 How do I get data from my database into a chart 21 Are you going to add additional real time routines to the QCChart2D CF for the Net Compact Framework library 22 Are you going to add 3D routines to the QCChart2D CF for the Net Compact Framework library 1 Is the QCChart2D CF for the Net Compact Framework software compatible with the QCChart2D for Net software Yes assuming you do not use any of the features that are not supported in QCChart2D CF such as rotated text printer output and output of image files 2 Why doesn t your QCChart2D CF software appear on the Net Compact Framework toolbox And why can t I add it there Starting with Version 1 8 of the QCChart2D software the ChartView UserControl can be added to the Toobox To add the ChartView control to the VS Toolbox right click on the Toolbox and select Choose Items From the Choose Toolbox Items dialog use the Browse button and go to the Quinn Curtis DotNet Lib folder and select QCChart2DNetCF DLL OK out of the Choose Toolbox Items dialog You will now see a ChartView control in the tool box list of controls 3 How do you create a chart with multiple coordinate systems and axes FAQs 433 A chart can have as many coordinate systems and axes as you w
215. ct xAxis chartVu AddChartObject yAxis Visual Basic Define the coordinate system Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double O0 Dim yMax As Double 15 Dim simpleScale As CartesianCoordinates New CartesianCoordinates xMin yMin xMax yMax Create the x and y axes Dim xAxis As LinearAxis New LinearAxis simpleScale ChartObj X AXIS Dim yAxis As LinearAxis New LinearAxis simpleScale ChartObj Y AXIS chartVu Create the ChartView object to place graph objects in 158 Axes Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Customize the axis by adding the following lines after the creation of the xAxis object Custom linear axis example C double xAxisIntercept 5 double xAxisOrigin 0 0 double xAxisMinorTickSpace 1 0 I ol int xAxisMinorTicksPerMajor double xAxisMinorTickLength 5 double xAxisMajorTickLength 10 int xAxisTickDirection ChartObj AXIS MIN xAxis SetAxisIntercept xAxisIntercept xAxis SetAxisTicks xAxisOrigin xAxisMinorTickSpace xAxisMinorTicksPerMajor xAxisMinorTickLength xAxisMajorTickLength xAxisTickDirection Visual Basic Dim xAxisIntercept As Double 5 Dim xAxisOrigin As Double 0 0 Dim xAxisMinorTickSpace As Double 1 0 Dim xAxisMinorTicksPerMajor As Integer 5 Dim xAxisMinorTickLength As D
216. ctors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal tstring As String _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal tstring As String _ ByVal ntitietype As Integer _ ByVal ntitiepos As Integer _ C public ChartTitle PhysicalCoordinates transform Font tfont string tstring public ChartTitle t PhysicalCoordinates transform Font tfont string tetring int ntitletype int ntitlepos transform Places the text in the coordinate system defined by transform ffont A reference to a Font object tstring A reference to a string object ntitletype The title can be a header subhead or footer Use one of the title type constants CHART HEADER CHART SUBHEAD or CHART FOOTER 384 Text Classes ntitlepos The title can be centered with respect to the entire graph area or the plot area Use one of the title position constants CENTER GRAPH or CENTER PLOT ChartTitle example extracted from the example program BigChartDemo class LineFill C Font theTitleFont new Font Microsoft Sans Serif 16 FontStyle Bold mainTitle new ChartTitle pTransforml theTitleFont Profits are Expected to Rise mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color White chartVu AddChartObject mainTit
217. d Bubble double Plot plot Ex double ry double rwidth double rheight ChartA public Bu ttribute attrib bblePlotLegend Bubble double Plot plot Eu double ry ChartA plot rx ry rwidth ttribute attrib The bubble plot object the legend is associated with The x position in chart normalized coordinates of the legend rectangle The y position in chart normalized coordinates of the legend rectangle The width in chart normalized coordinates of the legend rectangle 374 Legends rheight The height in chart normalized coordinates of the legend rectangle attrib Specifies the outline color and fill color for the legend rectangle Add legend items to a legend using one of the AddLegendItem methods AddLegendItem methods Visual Basic Overloads Public Function AddLegendItem _ ByVal stext As String ByVal rsize As Double _ ByVal attrib As ChartAttribute ByVal thefont As Font _ As Integer Overloads Public Sub New _ ByVal plot As BubblePlot ByVal rx As Double _ ByVal ry As Double ByVal rwidth As Double _ ByVal rheight As Double _ ByVal attrib As ChartAttribute Ct public int AddLegendItem string stext double rsize ChartAttribute attrib Font thefont public BubblePlotLegend BubblePlot plot double rx double ry double rwidth double rheight ChartAttribute a
218. d As New Background pTransforml ChartObj PLOT BACKGROUND Color FromArgb 255 255 255 chartVu AddChartObject background Define axes axes labels and grids Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Dim attribArray numGroups As ChartAttribute For i 0 To numGroups 1 attribArray i attribl Clone Next i Dim thePlotl As New MultiLinePlot pTransforml Datasetl attribArray chartVu AddChartObject thePlot1l Open High Low Close Plots Class OHLCPlot GraphObj ChartPlot GroupPlot OHLCPlot 282 Group Plot Objects The OHLCPlot class extends the GroupPlot class and displays stock market data in an open high low close format common in financial technical analysis Every item of the plot is a vertical line representing High and Low values with two small horizontal flags one left and one right extending from the vertical High Low line and representing the Open and Close values The number of groups must be four The Y 0 values of the group dataset represent the values for Open the Y 1 values for High the Y 2 values for Low and the Y 3 values for Close OHLCPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rflagwidth As Double _ ByVal attrib As ChartAttribute Ct public OHLCPlot PhysicalCoordinates transform GroupDataset dataset double rflagwidth ChartAttribut
219. d additional lines to each string used to define the string axis labels The example below is from the AxisLabels example program C String xstringlabels n Western n Sales n Region Bastern n Sales n Region Southern n Sales n Region Northern n Sales n Region StringAxisLabels xAxisLab5 new StringAxisLabels xAxis5 xAxisLab5 SetAxisLabelsStrings xstringlabels 5 xAxisLab5 SetTextFont graph5Font chartVu AddChartObject xAxisLab5 Visual Basic Dim astringlabels As String Western ControlChars Lf Sales _ ControlChars Lf Region Eastern ControlChars Lf Sales _ Control Chars Lf Region Southern ControlChars Lf Sales 4 ControlChars Lf Region Northern C ntrolChars Lf Sales Controlthars Lf Region Dim xAxisLab5 As New StringAxisLabels xAxis5 xAxisLab5 SetAxisLabelsStrings xstringlabels 5 FAQs 447 xAxisLab5 SetTextFont graph5Font chartVu AddChartObject xAxisLab5 14 How do I place more than one graph in a view One way to create multiple charts is to create multiple instances of the ChartView class and add each ChartView object to a container object such as a Control A layout manager manages the position and size of each ChartView Another way is to place multiple charts in the same ChartView object This makes it easier to guarantee alignment between the axes
220. d to be made because of the limitations listed above In some cases work arounds were devised to overcome these limitations When compared to the original QCChart2D for Net software the QCChart2D CF for the Net Compact Framework has the following limitations e While the Brush class only supports a simple color i e no gradients or textures we were able to implement simple linear gradients for our ChartBackground class e Only simple RGB colors are supported with no alpha blending no transparency e Because much of the original software was written using the GraphicsPath class we created our own simple GraphicsPath class to maintain source compatibility e Asimple Matrix class along with related 2D coordinate transformation routines were added so that we could rotate scale and translate geometric shapes and symbols defined using GraphicsPath objects e Image objects incorporated in a chart can be scaled and translated but not rotated e Text still cannot be rotated not even 90 degrees for y axis titles e Weimplemented XOR drawing so that we could properly draw zoom rectangles and data cursor objects e No printer and image output support The XOR drawing is optional We implement XOR drawing by calling a Net CF PInvoke function that permits calling drawing routines in the underlying oprerating system Strickly speaking this violates the Net managed memory paradigm though it never really mattered in Revisions 1 0 1 1 and 2 0 of
221. d to create a NumericAxisLabels object for the class This object draws the labels for the positive section of the x axis PolarAxisLabels contructor There is only one main constructor for PolarAxesLabels objects Visual Basic Overloads Public Sub New ByVal baseaxis As PolarAxes _ Ct public PolarAxesLabels PolarAxes baseaxis baseaxis This is the axis the axis labels are for Other axis label properties font rotation numeric format axis labels direction and numeric precision are automatically set These properties can be explicitly set if you need to override the automatically calculated values SetAxisLabels method 208 Axis Labels Visual Basic Overloads Public Sub SetAxisLabels _ ByVal font As Font _ ByVal labcolor As Color _ Ct public void SetAxisLabels Font font Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ C4 public void SetAxisLabelsFormat int format font The font object used to display the axis label text labcolor The color of the label text format Sets the numeric format for the axis labels Use one of the numeric format constants DECIMALFORMAT SCIENTIFICFORMAT EXPONENTFORMAT BUSINESSFORMAT ENGINEERINGFORMAT PERCENTFORMAT CURRENCEYFORMAT CURRENCYBUSINESSFORMAT Polar axes labels example C double polarmagnitude 5 0 Pol Pol Pol
222. date and elapsed time A DatasetViewer class for the grid like display of dataset information in a table The MagniView class represents a new way to zoom data A CoordinateMove class is used to pan the coordinate system left right up down e New ChartZoom feature add integrated zoom stack processing and fixed aspect ratio zooming New Plot Types Five new general plot types have been added to the software for use with CartesianCoordinates TimeCoordinates and ElapsedTimeCoordinates box and whisker plots BoxWhiskerPlot floating stacked bar plots FloatingStackedBarPlot ring charts simple versa plots SimpleVersaPlot group versa plots GroupVersaPlot 2 Introduction Box and Whisker Plots A Box and Whisker plot The BoxWhiskerPlot class graphically depicts groups of numerical data through their five number summaries the smallest observation lower quartile Q1 median Q2 upper quartile Q3 and largest observation Daily Stock Price 5 11 09 5 18 09 5 25 09 6 01 09 Press and hold left mouse button over a stock value to get details for that date A Floating Stacked Bar plot In the FloatingStackedBarPlot the bars are free floating because each bar does not reference a fixed base value as do simple bar plots stacked bar plots and group bar plots Introduction 3 Aetius Mutual Fund Asset Allocation Click on any pie wedge to see a detail A Ring chart The ring chart is a similar to a
223. design mode you can now drop and drag the ChartView control onto a Net CF form Also starting with Net CF 2 0 line drawing supports line thicknesses greater than one and line styles solid and dashed We have enabled this feature in the ChartAttribute class so your Net CF charts can now have thick lines and lines styles solid and dashed In the original 1 6 version of the software the QCChart2DNetCF library defined a DashStyle enumeration to make up for the one included with Net 1 0 but not Net CF 1 0 Since Net CF 2 0 now includes a DashStyle enumeration we have removed the one in the QCChart2DNetCF library and use the System Drawing Drawing2D enumeration of DashStyle exclusively So any modules that reference DashStyle must include a reference to System Drawing Drawing2D in the using C or Imports VB section of the program We have eliminated the QCLicense license file from the software and with it the need to purchase additional Redistributable Licenses Once you purchase the software you the developer can create application programs that use this software and redistribute the programs and our libraries royalty free As a development tool 1 e using this software in Introduction 9 conjunction with a compiler the software is still governed by a single user license and cannot be shared by multiple individuals unless additional copies or a site license have been purchased We have discontinued support for program
224. diate value between the minimum and maximum value of the axis In the example above the data may range from 0 88769 to 19 9 and the chart is to have exactly that range It is still appropriate that the tick mark origin be set to 0 0 rather than the axis minimum value of 0 88769 The tick mark origin should reside in the bounds defined by the axis minimum and maximum inclusive of the endpoints It does not need to be near an endpoint however For example an axis with endpoints 16 to 19 should use a minor tick mark interval of 1 0 or 2 0 a major tick mark interval of 5 0 or 10 0 and a tick mark origin of 0 0 Usually if the axis minimum and maximum bracket 0 0 i e the axis minimum is less than or equal to 0 0 and the axis maximum is greater than or equal to 0 0 the best tick mark origin to use is 0 0 Creating a Linear Axis There are two main constructors for LinearAxis objects The first LinearAxis constructor assumes that the axis extents match the extents of the underlying coordinate Axes 155 system transform The second LinearAxis constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system LinearAxis constructors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal axtype As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal axtype As Integer ByVal minval As Double B ByVa
225. dinates SimpleDataset As SimpleDataset Double As Double Double As Double _ ChartAttribute As ChartAttribute Int32 As Integer Overloads Public Sub New ByVal ByVal ByVal ByVal PhysicalCoordinates As PhysicalCoordinates SimpleDataset As SimpleDataset Int32 As Integer _ ChartAttribute As ChartAttribute Overloads Public Sub New ByVal ByVal ByVal ByVal ByVal ByVal C PhysicalCoordinates As PhysicalCoordinates SimpleDataset As SimpleDataset Int32 As Integer _ ChartAttribute As ChartAttribute ChartAttribute As ChartAttribute Double As Double _ public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset ChartAttribute lineattrib public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset Double barwidth Double barbase ChartAttribute attrib Int32 barjust public SimpleVersaPlot TQ hysicalCoordinates transform SimpleDataset dataset nt32 symtype ChartAttribute symbolattrib public SimpleVersaPlot las hysicalCoordinates transform SimpleDataset dataset nt32 symtype ChartAttribute lineattrib ChartAttribute symbolattrib Double barwidth transform The coordinate system for the new SimpleVersaPlot object 240 Simple Plot Objects dataset The versa plot represents the values in this dataset symtype The symbol used in the l
226. ds as the underlying time base for all date time coordinate system When a scale is created using two ChartCalendar dates as end points the software calculates the number of milliseconds seconds between the starting date and the ending date If the coordinate system is based on a 5 day week the milliseconds associated with the missing weekends are not counted If the coordinate system does not use 24 hours a day the milliseconds associated with the missing part of the day are not counted A linear coordinate system is scaled using the range of calculated milliseconds Data points plotted in this coordinate system have their date time value converted to milliseconds seconds by subtracting the starting date of the scale from the data point date making sure to exclude the seconds associated with weekends and fractional days if necessary The data point is plotted in the milliseconds based linear coordinate system Since the QCChart2D CF for the Net Compact Framework library uses milliseconds as the underlying time base the minimum allowable displayable range is one millisecond For ranges smaller than one second the programmer needs to convert the ChartCalendar values to seconds or milliseconds and use the CartesianCoordinates class to scale the chart You loose the date time formatting of the axis labels but this should not matter if you are dealing in the sub millisecond realm 110 Scaling and Coordinate Systems Class TimeCoordinates PhysicalCo
227. e Percent format 76 e Business format where B M and K are used to represent billions millions and thousands 1043M 11 0K e Currency format 123432 e Business currency format The business format combined with the currency format 123K Depending on the scaling of the associated axis the numeric values of the axis labels may be very large or very small numbers requiring a great deal of space to display Various techniques are used to abbreviate the numeric value reducing the space requirements Expressing a numeric value in scientific notation can reduce the amount of space a label requires if the numeric value requires eight or more digits If the label values end in a lot of zeros 10000000 9000000 8000000 a major reduction in space is achieved by using the business format which replaces all of the zeros with a letter 10M 9M 8M The axis numeric labels constants are listed below Numeric Format Constant Description DECIMALFORMAT Decimal format i e 1234 563 SCIENTIFICFORMAT Scientific or exponential format 1 23e3 BUSINESSFORMAT Business format where the letters K M B or T are appended on the end a truncated numeric value i e 1 23 14K 44M 32B 3 0T ENGINEERINGFORMAT If the absolute value of the label is greater than 1 0e6 or less than 1 0e 6 the scientific format is used else the decimal format is used PERCENTFORMAT The value of a label is multiplied by 100 and the character Ha is appended o
228. e attrib transform The coordinate system for the new OHLCPlot object dataset The OHLCPlot plot will represent the group open high low close values in this group dataset The number of groups must be four The Y 0 values of the group dataset represent the values for Open the Y 1 values for High the Y 2 values for Low and the Y 3 values for Close rflagwidth The width of the open and close markers in units of the independent axis attrib Specifies the attributes line color for the open high low close plot An individual OHLC element in an OHLC plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects OHLC plot example extracted from the example program BigChartDemo class OHLCFinPlot C Group Plot Objects 283 TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData TimeCoordinates pTransforml new TimeCoordinates pTransforml SetWeekType ChartObj WEEK 5D pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Red l ChartObj DashStyle Solid Color Red attribl SetFillFlag true OHLCPlot thePlotl new OHLCPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 75 attribl chartVu AddChartObject thePlot1
229. e class for the ChartTitle AxisTitle and ChartLabel classes The ChartText class also creates 54 Class Architecture ChartTitle AxisTitle ChartLabel NumericLabel TimeLabel ElapsedTimeLabel StringLabel independent text objects Other classes that display text also use it internally This class displays a text string as the title or footer of the chart This class displays a text string as the title for an axis The axis title position is outside of the axis label area Axis titles for y axes are rotated 90 degrees This class is the abstract base class of labels that require special formatting This class is a concrete implementation of the ChartLabel class and it displays formatted numeric values This class is a concrete implementation of the ChartLabel class and it displays formatted ChartCalendar dates This class is a concrete implementation of the ChartLabel class and it displays numeric values formatted as elapsed time strings 12 32 21 This class is a concrete implementation of the ChartLabel class that formats string values for use as axis labels Miscellaneous Chart Classes Marker ChartImage ChartShape ChartSymbol Various classes are used to position and draw objects that can be used as standalone objects in a graph or as elements of other plot objects Marker ChartImage This class displays one of five marker types in a graph The marker is used to create data cursors or to mark dat
230. e example below extracted from the MultiAxes example creates one x axis common to all of the charts because the x scaling for all of the coordinate systems match and five y axes one for each of the five different coordinate systems C CartesianCoordinates pTransforml CartesianCoordinates pTransform2 CartesianCoordinates pTransform3 CartesianCoordinates pTransform4 CartesianCoordinates pTransform5 Initialize datasets coordinate system ranges The x scale range for pTransforml to pTransform5 are The y scale range for pTransforml to pTransform5 are The plotting area for each pTransform is indentical to the left for extra axes all the same 0 100 all different leaving a large open pIransforml SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform2 SetGraphBorderDiagonal 0 35 15 9 65 3 pTransform3 SetGraphBorderDiagonal 0 35 15 9 4 553 3 pTransform4 SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform5 SetGraphBorderDiagonal 0 35 15 9 265 7 ChartAttribute attribl new ChartAttribute ChartAttribute attrib2 new ChartAttribute ChartAttribute attrib3 new ChartAttribute ChartAttribute attrib4 new ChartAttribute Color Blue Color Red 2 DashStyle Solid 2 DashStyle Solid Color Green 2 DashStyle Solid Color Orange 2 DashStyle Solid FAQs 435 ChartAttribute attrib5 new ChartAttribute Color Magenta 2 DashStyle Solid
231. e ignita een pela diss E du Size aa eise ed noa uU E 213 Linear Logarithmic and Time Axis QrdS sss 213 Polar GIT wast c ut eee ste aded oue sae etnies LM EC 216 Antenna GENS con e e xietetucehee Missed rect uie b aiu e bs idea den bind 219 LO Simple Plot Objects Qu iso sdeo d dean Net ae asiento a a a pa piti 223 Simple Eine N eRe ea occi en tee E re Petre aire eke ci eo bes 223 SIPS TA PIOS S etes vet eei etu alas asses adu io cian ea tuns 221 Simple Scatter PIOUS zie bai oid en totecHakdema eise tapas E ARE ada casu teobz ARE 231 Simple Line Marker PIOIS e negra CA It or E Rm Ce Ub de MIN E 235 Simple Versa Plots sen cat Gh aci baee up med uen e et a i tn 238 TL Group Plot Objects nnsa eps tha qe pola oa et oaa despe qu De E venta asses rd 243 JAEtOW PIOUS descente entia a iru od ot ute e dua duo rod d rca der AU TRU Ete 244 Bovand Ww hisker PIOS este piti bey nar ras ien i Pus PARE eaae nid EN 246 Bubble Plots 5c p ERES Ede c D ree one ec de Dupuis ees cue 252 Candlestick PIOS 36i e eei ete peto poe tec eA vA auri edes 254 Cell Plots esi epe sedan cd I Du To hate oat mu vete n ti br PUES UE 256 Ertot Bar Plots ose tec tos an ote ben datis ei eter cade aa neat tara al a tito 259 Floatine Bar Plots quos us encor e pete aret te vitae E ese dre ie E 260 Floating Stacked Bar Na ss ceteasu pisi eria teskla toten ge ciao seguido egy 265 Group Bar Plots Suse br ada duca RTE E EE E E E kept UN vbi aU aba 268 ELIS CORY PIOS ume devenue e
232. e in the dataset you can do that point by point or create a new dataset and swap that in for the old dataset using the plot objects SetDataset or SetGroupDataset method Call the ChartView UpdateDraw method to force the chart to update using the new values 8 How do I prevent flicker when updating my charts on real time Flicker is the result of erasing and redrawing all or part of a chart in the current display buffer Double buffering of screen images can minimize any flicker The ChartView class does the actual work of rendering a chart image to the underlying Control display buffer The ChartView class uses double buffering for the display of all screen images When a chart is updated it is automatically rendered to an off screen bitmap When drawing is complete the off screen bitmap is copied to the screen display buffer minimizing the effect of flicker 9 How do you implement drill down or data tool tips in a chart Implementing drill down or tool tips consists of three major parts a Trapping a mouse event and determining the mouse cursor position in device and physical coordinates b Identifying the chart object that intersects the mouse event 442 FAQs c Displaying appropriate information about the chart object There are many classes that aid in one or more of these functions The MouseListener class will trap a mouse event in the chart view The FindObj class will filter and return the chart object if any that inters
233. e marker plots 48 50 60 223 235 236 237 238 309 Line plots 48 51 60 223 224 225 226 227 234 305 307 309 336 371 372 436 439 Linear auto scaling 24 59 Linear axis 25 27 32 53 60 133 138 139 140 151 152 153 154 155 157 158 163 165 172 173 174 178 182 189 191 194 195 200 201 205 206 213 215 216 271 293 295 385 386 433 435 436 437 438 443 444 Linear scale 21 59 93 95 LinearAutoScale 24 59 LinearAxis 25 27 32 53 60 133 138 139 140 151 152 153 154 155 157 158 163 165 172 173 174 178 182 189 191 194 195 200 201 205 206 213 215 216 271 293 295 385 386 433 435 436 437 438 443 444 LinearScale 21 59 93 95 LineGapPlot 35 42 60 243 275 276 277 278 Log scale 21 59 93 95 Logarithmic auto scaling 24 59 Logarithmic axis 25 28 32 53 60 151 152 159 160 161 163 189 191 213 445 446 LogAutoScale 24 59 LogAxis 25 28 32 53 60 151 152 159 160 161 163 189 191 213 445 446 LogScale 21 59 93 95 MagniView 1 5 6 13 14 55 56 59 328 329 330 331 332 333 354 Marker vi 54 56 60 235 299 301 302 304 305 306 308 439 440 Markers vi 54 56 60 235 299 301 302 304 305 306 308 439 440 MouseListener 55 56 57 59 303 309 310 312 313 314 315 319 328 335 337 442 MouseListeners 55 56 57 59 303 309 310 312 313 314 315 3
234. e the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject xAxisLabels chartVu AddChartObject yAxisLabels Visual Basic Define the coordinate system Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleScale As CartesianCoordinates _ New CartesianCoordinates xMin yMin xMax yMax Create the x and y axes Dim xAxis As LinearAxis _ New LinearAxis simpleScale ChartObj X AXIS Dim yAxis As LinearAxis New LinearAxis simpleScale ChartObj Y AXIS Dim xAxisLabels As NumericAxisLabels New NumericAxisLabels xAxis Dim yAxisLabels As NumericAxisLabels New NumericAxisLabels yAxis Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject xAxisLabels chartVu AddChartObject yAxisLabels Should want to customize the axis you can add the following lines after the xAxisLabels object is created Custom numeric axis labels example C Font labelfont new Font Helvetica 10 FontStyle BOLD 196 Axis Labels double xAxisLabelsRotation 0 0 int xAxisLabelsDir ChartObj AXIS MIN int xAxisLabelsDecimal 1 int xAxisL
235. e x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject xAxisLabels chartVu AddChartObject yAxisLabels Custom time axis labels example C Font labelfont new Font Helvetica 10 FontStyle BOLD Axis Labels 201 5 5 202 Axis Labels double xAxisLabelsRotation 0 0 int xAxisLabelsDir ChartObj AXIS MIN int xAxisLabelsEnds ChartObj LABEL ALL Color xAxisLabelsColor Color Black int xAxisNumericFormat ChartObj TIMEDATEFORMAT MY xAxisLabels SetAxisLabels labelfont xAxisLabelsRotation xAxisLabelsDir xAxisLabelsEnds xAxisLabelsColor xAxisLabels SetAxisLabelsFormat xAxisNumericFormat Visual Basic Dim labelfont As Font New Font Helvetica 10 FontStyle Bold Dim xAxisLabelsRotation As Double 0 0 Dim xAxisLabelsDir As Integer ChartObj AXIS MIN Dim xAxisLabelsEnds As Integer ChartObj LABEL ALL Dim xAxisLabelsColor As Color Color Black Dim xAxisNumericFormat As Integer ChartObj TIMEDATEFORMAT MY xAxisLabels SetAxisLabels labelfont xAxisLabelsRotation _ xAxisLabelsDir xAxisLabelsEnds xAxisLabelsColor xAxisLabels SetAxisLabelsFormat xAxisNumericFormat Elapsed Time Axis Labels Class ElapsedTimeAxisLabels GraphObj ChartText AxisLabels ElapsedTimeAxisLabels The ElapsedTimeAxisLabels class extends the AxisLabels class and provides for elapsed time labels It adds exte
236. e y values ChartDataset The abstract base class for the other dataset classes It contains data common to all of the dataset classes such as the x value array the number of x values the dataset name and the dataset type SimpleDataset Represents simple xy data where for every x value there is one y value TimeSimpleDataset A subclass of SimpleDataset it uses ChartCalendar dates a wrapper around the System DateTime value class as the x values and floating point numbers as the y values Class Architecture 21 ElapsedTimeSimpleDataset A subclass of SimpleDataset it is initialized with TimeSpan objects or milliseconds in place of the x or y values ContourDataset A subclass of SimpleDataset it adds a third dimension z values to the x and y values of the simple dataset GroupDataset Represents group data where every x value can have one or more y values TimeGroupDataset A subclass of GroupDataset it uses ChartCalendar dates a wrapper around the System DateTime value class as the x values and floating point numbers as the y values ElapsedTimeGroupDataset A subclass of GroupDataset it uses TimeSpan objects or milliseconds as the x values and floating point numbers as the y values Scale Classes ChartScale LinearScale LogScale TimeScale ElapsedTimeScale The ChartScale abstract base class defines coordinate transformation functions for a single dimension It is useful to be able to mix and match differ
237. eChart From file Form1 cs using System using System Collections Generic using System ComponentModel using System Drawing Drawing2D 428 Using QCChart2D for Net CF to Create Windows Applications using System Drawing using System Text using System Windows Forms using com quinncurtis chart2dnetcf namespace UserChartExample3 public partial class Forml Form UserControll chartViewl null public Forml InitializeComponent InstantiateChartView if chartViewl null chartViewl InitializeChart public void InstantiateChartView Allow room for a menu in the form Rectangle graphRect new Rectangle 1 1 this ClientRectangle Width 2 this ClientRectangle Height 2 Instantiate chart control chartViewl new UserControll chartViewl Location graphRect Location chartViewl Size graphRect Size chartViewl PreferredSize graphRect Size this Controls Add chartView1 24 Frequently Asked Questions FAQs 10 11 12 13 14 Is the QCChart2D CF for the Net Compact Framework software compatible with the QCChart2D for Net software Why doesn t your QCChart2D CF software appear on the Net Compact Framework toolbox How do you create a chart with multiple coordinate systems and axes Can I add new axes text objects plot objects and images to a chart after it is already displayed or must I create a new chart from scratch taking into account t
238. eTimeScale AutoScale dataset You can control the tightness of the auto scale values about the dataset values using other versions of the TimeCoordinates AutoScale method that take rounding mode parameters Example of auto scaling a TimeCoordinates object using a single dataset and explicit rounding mode parameters simpleTimeScale AutoScale dataset ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR You can auto scale the coordinate bounds using a dataset and then explicitly modify the range the auto scale selected There are methods for setting the minimum and maximum values of the x and y scales This way you can use the auto scale methods for the values of one scale the y scale in the example below but explicitly set the values for the other scale the x scale in the example below Scaling and Coordinate Systems 113 Example of modifying the minimum and maximum values selected by an auto scale method C ChartCalendar xData new ChartCalendar 1996 ChartObj FEBRUARY 5 new ChartCalendar 1996 ChartObj MARCH 5 new ChartCalendar 1996 ChartObj APRIL 5 new ChartCalendar 1996 ChartObj MAY 5 new ChartCalendar 1996 ChartObj JUNE 5 new ChartCalendar 1996 ChartObj JULY 5 new ChartCalendar 1996 ChartObj AUGUST 5 new ChartCalendar 1996 ChartObj SEPTEMBER 5 new ChartCalendar 1996 ChartObj OCTOBER 5 new ChartCalendar 1996 ChartObj NOVEMBER 5 double yData 10 22 33 44 5
239. each line of the line plot represent the y values for each group of the group dataset Each line plot share the same x values of the group dataset 4 18 05 4 25 05 5 02 05 5 09 05 The classic stock price chart combines a open high low close plot line plot and bar plot Press and hold left mouse button over a stock value to get details for that date OHLCPlot This class is a concrete implementation of the GroupPlot class and displays stock market data in an open high low close format common in financial technical analysis Every item of the plot is a vertical line representing High and Low values with two small horizontal flags one left and one right extending from the vertical High Low line and representing the Open and Close values 44 Class Architecture Cumulative Plot of Noise vs Time from 7 Sources 2000 1500 1000 Amp 500 0 5 10 15 20 Time The Stacked Line Plot will plot the cumulative sum of multiple y vectors vs a single x vector StackedLinePlot This class is a concrete implementation of the GroupPlot class and displays data in a stacked line format In a stacked line plot each group is stacked on top of one another each group line a cumulative sum of the related group items before it Polar Plot Classes PolarPlot PolarLinePlot PolarScatterPlot Polar plots that use data organized as arrays of x and y values where an x value represents the magnitude of a point in polar coordinates and the
240. ecify a starting and ending time for a days worth of data In the NYSE stock market example the starting time is 9 30 AM EST and the ending time is 4 00 PM EST Any data outside of this range is invalid and not plotted In terms of the resulting chart one minute after 4 30 PM is 9 31 AM Combine the starting and ending time parameters with the option of deleting weekends from consideration and one minute after 4 30 PM Friday is 9 31 AM Monday Non Uniformity of Date Time Tick Marks There even more complications associated with date time scales The axis that delineates a date time scale must take into account the non uniform nature of date time tick marks and tick mark labels A month has a variable number of days When months are used as the major tick mark interval and days are the minor tick mark interval the software must be capable of plotting 28 29 30 or 31 minor tick marks days for every major tick mark months depending on the month Another example is the use of months as the major tick mark interval and weeks as the minor tick mark interval Some months will have four minor tick marks start of each new week while others will have five The software also needs to take into the variable number of days year due to leap years Date time axis tick marks and labels become even more complicated when the 5 day 7 day option and the working hours day options are used The QCChart2D CF for the Net Compact Framework library uses millisecon
241. ecomes invalid 30 days after downloaded from our web site or one of our sponsor s web sites If you wish to redistribute the 30 day trial version of the SOFTWARE you should arrange to have it redistributed directly from our web site If you are using SOFTWARE on an evaluation basis you may make copies of the evaluation SOFTWARE as you wish give exact copies of the original evaluation SOFTWARE to anyone and distribute the evaluation SOFTWARE in its unmodified form via electronic means Internet BBS s Shareware distribution libraries CD ROMS etc You may not charge any fee for the copy or use of the evaluation SOFTWARE itself You must not represent in any way that you are selling the SOFTWARE Itself You must distribute a copy of this EULA with any copy of the SOFTWARE and anyone to whom you distribute the SOFTWARE is subject to this EULA C Redistributable License The standard Developer License permits the programmer to deploy and or distribute applications that use the Quinn Curtis SOFTWARE royalty free We cannot allow developers to use this SOFTWARE to create a graphics toolkit a library or any type of graphics component that will be used in combination with a program development environment for resale to other developers If you utilize the SOFTWARE in an application program or in a web site deployment should we ask you must supply Quinn Curtis Inc with the name of the application program and or the URL where the SOFTWARE is instal
242. ect bringing up the New Project dialog box From this dialog under Project types select Visual C Smart Device Windows Mobile 5 0 folder on the left and the Device Application template on the right The default Device Application targets a Net CF 2 0 device Do NOT target a Net 1 0 device by selecting the Device Application 1 0 since this software is not compatible with Net 1 0 and 1 1 Using QCChart2D for Net CF to Create Windows Applications 421 e Assign a name to the application in the name box either the default DeviceApplication1 or your own pick UserChartExample11 in the example below Select a location which in the cases of our examples is the folder C Quinn Curtis DotNet QCChart2D Visual CSharp CF examples 2005 New Project Project types E Visual Cat Visual Studio installed templates Windows Smart Device Pocket PC 2003 Templates Efi Device Application Class Library Smartphone 2003 Windows CE 5 0 igi Control Library Empty Project glass Library 1 0 EE Console Application Gi Device Application 1 0 Ef Console Application 1 0 Windows Mobile 5 0 Pocket Starter Kits Web Other Languages Other Project Types js Empty Project 1 0 MyTemplates gd Search Online Templates lt L 4 project For creating a NET Compact Framework 2 0 Forms application For Windows Mobile 5 0 Pocket PC and later Mame UserChartExample1 1
243. ectangle Height 2 Instantiate chart control chartViewl New ChartView graphRect Me End Sub 136 The Chart View Public Sub InitializeChart Dim chartVu As ChartView chartViewl End Sub InitializeChart End Class Adding a UserControl derived from ChartView at runtime You can derive your own chart class from ChartView and use that control instead of the base ChartView class Right click on the project in the Solution Explorer and select Add User Control Choose the UserControl template This will add a basic template for a user defined UserControll to your project Go to the UserControll cs or UserControll vb and change the inheritance from UserControl to ChartView In order to add a ChartView control at runtime the ChartView control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNetMib folder and select it You will also need to make sure that you reference com quinncurtis chart2dnetcf in the using or Imports for VB section of any module that references ChartView ChartView constructor example extracted from the example program UserChartExample3 Form1 C public partial class Forml Form SEE THE UserControll cs module for details of UserControll UserControll chartViewl null public Forml
244. ectedPlot ChartPlot GetSelectedPlotObj if selectedPlot null int selectedindex GetNearestPoint nearestPointIndex PhysicalCoordinates transform GetSelectedCoordinateSystem stockpanel SetChartObjScale transform stockpanel SetLocation mousepos ChartObj DEV POS Stockpanel SetTextString Stock Data Looking to the original arrays because we just have the selectedindex yet we want to display stock O H L C data volume and NASDAQ Only one of these datasets can be selected at a time by the tooltip double open stockPriceData 0 selectedindex 342 Data ToolTips double high stockPriceData 1 selectedindex double low stockPriceData 2 selectedindex double close stockPriceData 3 selectedindex double nasdaq NASDAQData selectedindex double volume stockVolumeData selectedindex String openObj ChartSupport NumToString open ChartObj DECIMALFORMAT 2 String highObj ChartSupport NumToString high ChartObj DECIMALFORMAT 2 String lowObj ChartSupport NumToString low ChartObj DECIMALFORMAT 2 String closeObj ChartSupport NumToString close ChartObj DECIMALFORMAT 2 String volumeObj ChartSupport NumToString volume ChartObj DECIMALFORMAT 0 String nasdaqObj ChartSupport NumToString nasdaq ChartObj DECIMALFORMAT 2 TimeLabel timelabel new TimeLabel transform xValues selectedindex ChartObj TIMEDATEFORMAT S
245. ects the mouse cursor when a mouse button is pressed The MoveObj class will filter select and move a chart object as the mouse is dragged across the chart The DataToolTip class will find the data point in a chart nearest the mouse cursor and display xy information about the data point as a popup ChartText display The DataToolTip can also be customized for the display of custom information about the selected data point It only takes a few lines to add a simple y value tool tip to an existing chart C DataToolTip datatooltip new DataToolTip chartVu datatooltip SetEnable true chartVu SetCurrentMouseListener datatooltip Visual Basic Dim datatooltip As New DataToolTip chartVu datatooltip SetEnable True chartVu SetCurrentMouseListener datatooltip Some of the example programs that include tool tips include LineFill Multiline LinePlotSegments StackedLineChart Logarithmic SimpleBarChart GroupBarPlotChart DoubleBarPlot OpeningScreen OHLCFinPlot and LabeledPieChart 10 I do not want to my graph to auto scale How do I setup the graph axes for a specific range Auto scaling has two parts The first is the auto scaling of the coordinate system based on one or more datasets The second part is the auto scaling of the axes that reside in the coordinate system Manually scale the coordinate system and axes by calling the appropriate constructors For example C ChartCalendar xMin new ChartCalendar 1996
246. ed by Monday October 23 2000 A day can also have a custom range for example a range of 9 30 AM to 4 00 PM The chart time axis excludes time outside of this range This makes the class very useful for the inter day display of financial market information stock bonds commodities options etc across several days months or years 0 00 00 ElapsedTimeAxis 8 00 00 16 00 00 1D 0 00 00 Time The elapsed time axis is very similar to the linear axis and is subclassed from that class The main difference is the major and minor tick mark spacing calculated by the CalcAutoAxis method takes into account the base 60 of seconds per minute and minutes per hour and the base 24 of hours per day It is a continuous linear scale 30 Class Architecture Polar Axes 4 polar axis consists of the x and y axis for magnitude and the outer circle for the angle PolarAxes This class has three separate axes two linear and one circular The two linear axes scaled for the magnitude of the polar scale form a cross with the center of both axes at the origin 0 0 The third axis is a circle centered on the origin with a radius equal to the magnitude of the polar scale This circular axis represents 360 degrees or 2 Pi radians of the polar scale and the tick marks that circle this axis are spaced at equal degree intervals 270 AntennaAxes Axis Label Classes AxisLabels NumericAxisLabels StringAxisLabels PolarAxesLabels AntennaAxe
247. ed using the SetSegment methods where the segment number parameter cooresponds to the group number These methods 270 Group Plot Objects include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Group bar plot example extracted from the example program BigChartDemo class GroupBarPlotChart C TimeGroupDataset Datasetl new TimeGroupDataset GroupTimeData xValues groupBarData TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetTimeScaleStart new ChartCalendar 1997 ChartObj JANUARY 1 pTransforml SetTimeScaleStop new ChartCalendar 2003 ChartObj JANUARY 1 pIlransforml SetGraphBorderDiagonal 0 1 1 45 0 75 Background backgroundl new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FromArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject backgroundl Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Red 1 DashStyle Solid Color Red ChartAttribute attrib2 new ChartAttribute Color Yellow 1 DashStyle Solid Color Yellow ChartAttribute attrib3 new ChartAttribute Color Blue 1 DashStyle Solid Color Blue ChartAttribute attrib4 new ChartAttribute Color Green 1 DashStyle Solid Color Green ChartAttribute attribArray attribl attrib2 attrib3 attrib4 GroupBarPlot thePl
248. egion Region This class is the abstract base class for all axis label objects It places numeric labels date time labels or arbitrary text labels at the major tick marks of the associated axis object In addition to the standard font options type size style color etc This class labels the major tick marks of the LinearAxis and LogAxis classes The class supports many predefined and user definable formats including numeric exponent percentage business and currency formats This class labels the major tick marks of the LinearAxis and LogAxis classes using user defined strings This class labels the major tick marks of the associated TimeAxis object The class supports many time 23 59 59 Class Architecture 33 and date 5 17 2001 formats It is also possible to define custom date time formats ElapsedTimeAxisLabels This class labels the major tick marks of the associated ElapsedTimeAxis object The class supports HH MM SS and MM SS formats with decimal seconds out to 0 00001 i e 12 22 43 01234 It also supports a cumulative hour format 101 51 22 and a couple of day formats 4 5 51 22 4D 5 51 22 PolarAxesLabels This class labels the major tick marks of the associated PolarAxes object The x axis is labeled from 0 0 to the polar scale magnitude and the circular axis is labeled counter clockwise from 0 to 360 degrees starting at 3 00 AntennaAxesLabels This class labels the major tick marks of the associ
249. ements making up the chart Chapter 20 describes generalized classes for displaying formatted text in a chart Chapter 21 describes how the DatasetViewer class is used to display simple and group datasets in a table format Chapter 22 describes how to use a generalized shape class for the display of arbitrary lines shapes images and arrows Chapter 23 is a tutorial that describes how to use QCChart2D CF to create Windows applications using Visual Studio Net Visual CZ and Visual Basic Chapter 24 is a collection of Frequently Asked Questions about QCChart2D CF for Net Compact Framework 2 Class Architecture of the QCChart2D CF for the Net Compact Framework Class Library Major Design Considerations This chapter presents an overview of the QCChart2D CF for the Net Compact Framework class architecture It discusses the major design considerations of the architecture It is based on the Net System Drawing API model and the System Windows Forms classes New charting objects can be added to the library without modifying the source of the base classes There are no limits regarding the number of data points in a plot the number of plots in graph the number of axes in a graph the number of coordinate systems in a graph There are no limits regarding the number of legends arbitrary text annotations bitmap images geometric shapes titles data markers cursors and grids in a graph Users can interact with charts using cla
250. ent scale transform functions for x and y dimensions of the PhysicalCoordinates class The job of a ChartScale derived object is to convert a dimension from the current physical coordinate system into the current working coordinate system LinearScale A concrete implementation of the ChartScale class It converts a linear physical coordinate system into the working coordinate system LogScale A concrete implementation of the ChartScale class It converts a logarithmic physical coordinate system into the working coordinate system TimeScale A concrete implementation of the ChartScale class converts a date time physical coordinate system into the working coordinate system 22 Class Architecture ElapsedTimeScale A concrete implementation of the ChartScale class converts an elapsed time coordinate system into the working coordinate system Coordinate Transform Classes UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates ElapsedTimeCoordinates PolarCoordinates AntennaCoordinates TimeCoordinates The coordinate transform classes maintain a 2D coordinate system Many different coordinate systems are used to position and draw objects in a graph Examples of some of the coordinate systems include the device coordinates of the current window normalized coordinates for the current window and plotting area and scaled physical coordinates of the plotting area UserCoordinates This class manages
251. entMouseListener magnifyObj VB InitializeData Define charts using data Zooming 333 SuperMagniViewChartl InitializeChart Datasetl Dataset2 Dataset3 Dataset4 Dataset5 Click and drag on the top graph using left mouse button mmy SuperMagniViewChart2 InitializeChart Datasetl Dataset2 Dataset3 Dataset4 Dataset5 The area bounded by the mouse magnify icon is displayed full scale in the bottom graph Hook up the MagniView class to the source and target classes Dim transformArray As CartesianCoordinates SuperMagniViewChartl pTransforml SuperMagniViewChartl pTransform2 SuperMagniViewChartl pTransform3 SuperMagniViewChartl pTransform4 SuperMagniViewChartl pTransform5 Dim magnifyObj As New MagniView SuperMagniViewChartl SuperMagniViewChart2 transformArray New Dimension 0 1 0 2 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable True SuperMagniViewChartl SetCurrentMouseListener magnifyObj 16 Data Tooltips DataToolTip Tooltip is a catchall phrase for a popup window that displays useful information about an object A data tooltip is a popup box that displays the value of a data point in a chart The data value can consist of the x value the y value or both values for a given point in a chart The tooltip values are displayed using the numeric and time formats supported by the NumericLabel and TimeLabel classes Simple Data Tooltips Class DataToolTip MouseLis
252. es Dim pTransform2 As CartesianCoordinates Dim pTransform3 As CartesianCoordinates Dim pTransform4 As CartesianCoordinates Dim pTransform5 As CartesianCoordinates Dim xAxis As LinearAxis FAQs 437 Dim yAxisl As LinearAxis Dim yAxis2 As LinearAxis Dim yAxis3 As LinearAxis Dim yAxis4 As LinearAxis Dim yAxis5 As LinearAxis Initialize datasets coordinate system ranges The x scale range for pTransforml to pTransform5 are all the same 0 100 The y scale range for pTransforml to pTransform5 are all different pTransforml SetGraphBorderDiagonal 0 35 0 15 0 9 0 65 pTransform2 SetGraphBorderDiagonal 0 35 0 15 0 9 0 65 pTransform3 SetGraphBorderDiagonal 0 35 0 15 0 9 0 65 pTransform4 SetGraphBorderDiagonal 0 35 0 15 0 9 0 65 pTransform5 SetGraphBorderDiagonal 0 35 0 15 0 9 0 65 Dim background As New Background pTransforml ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject background Dim attribl As New ChartAttribute Color Blue 2 DashStyle Solid Dim attrib2 As New ChartAttribute Color Red 2 DashStyle Solid Dim attrib3 As New ChartAttribute Color Green 2 DashStyle Solid Dim attrib4 As New ChartAttribute Color Orange 2 DashStyle Solid Dim attrib5 As New ChartAttribute Color Magenta 2 DashStyle Solid xAxis New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis yAxisl New LinearAxis pTransforml ChartObj Y AXIS yAxisl SetAxisIntercept 0 0 yAxisl
253. es directly and indirectly System EventHandler delegates that trap mouse events and permit the user to create and move data cursors move plot objects display tooltips and select data points in all types of graphs Other classes use these for data storage file I O and data processing A summary of each category appears in the following section 20 Class Architecture Chart Window Classes System Windows Forms UserControl ChartView The starting point of a chart is the ChartView class The ChartView class derives from the Net CF System Windows Forms UserControl class where the Control class is the base class for the Net CF collection of standard components such as menus buttons check boxes etc The ChartView class manages a collection of chart objects in a chart and automatically updates the chart objects when the underlying window processes a paint event Since the ChartView class is a subclass of the Control class it acts as a container for other Net CF components too Data Classes ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset GroupDataset TimeGroupDataset ElapsedTimeGroupDataset The dataset classes organize the numeric data associated with a plotting object There are two major types of data supported by the ChartDataset class The first is simple xy data where for every x value there is one y value The second data type is group data where every x value can have one or mor
254. et2 new ElapsedTimeSimpleDataset Second xl y2 ElapsedTimeCoordinates pTransforml new ElapsedTimeCoordinates ChartObj ELAPSEDTIME SCALE ChartObj LINEAR SCALE pTransforml ElapsedTimeAutoScale Dataset2 ChartObj X AXIS ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR 2 pTransforml SetGraphBorderDiagonal 0 15 15 90 0 70 ElapsedTimeAxis xAxis new ElapsedTimeAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis ElapsedTimeAxisLabels xAxisLab new ElapsedTimeAxisLabels xAxis xAxisLab SetTextFont theFont xAxisLab AxisLabelsDayFormat ChartObj ELAPSEDTIMEFORMAT NEXTTODAYSTRING chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLab new NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Visual Basic 206 Axis Labels Dim x1 As TimeSpan New TimeSpan numPoints 1 Dim yl As Double New Double numPoints 1 Dim y2 As Double New Double numPoints 1 Dim i As Integer For i 0 To numPoints 1 Next theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New ElapsedTimeSimpleDataset First xl yl Dim Dataset2 As New ElapsedTimeSimpleDataset Second xl y2 Dim pTransforml As New ElapsedTimeCoordinates ChartObj ELAPSEDTIME SCALE ChartObj LINEAR SCALE pTransforml Elap
255. etLineStyle and SetColor methods are used to customize the drawing properties of the lines used to draw the axes lines and tick marks Antenna grid example C AntennaAxes pAntennaAxis pAntennaTransform GetCompatibleAxes pAntennaAxis LineColor Color Black chartVu AddChartObject pAntennaAxis AntennaGrid pAntennaGrid new AntennaGrid pAntennaAxis AntennaGrid GRID ALL pAntennaGrid ChartObjAttributes new ChartAttribute Color LightBlue 1 DashStyle Solid chartVu AddChartObject pAntennaGrid Visual Basic Dim pAntennaAxis As AntennaAxes pAntennaTransform GetCompatibleAxes pAntennaAxis LineColor Color Black chartVu AddChartObject pAntennaAxis Dim pAntennaGrid As New AntennaGrid pAntennaAxis AntennaGrid GRID ALL pAntennaGrid ChartObjAttributes New ChartAttribute Color LightBlue 1 DashStyle Solid Axis Grids 221 chartVu AddChartObject pAntennaGrid 10 Simple Plot Objects SimplePlot SimpleBarPlot SimpleLineMarkerPlot SimpleLinePlot SimpleScatterPlot SimpleVersaPlot The SimplePlot class is an abstract class representing plot types that use data organized as a simple array of xy points where there is one y for every x Simple plot types include line plots scatter plots bar graphs and line marker plots When used in the simplest mode simple plot objects use a single ChartAttribute object to control the plot objects color line and fill styles In terms of memory usage this i
256. ets GroupDataset TimeGroupsDataset ElapsedTimeGroupDataset When a DatasetViewer is added to a chart it can be printed as part of that chart Background colors row and column headers can be customized The DatasetViewer can be scrolled updated in real time and synchronized to the chart so that scrolling of the DatasetViewer can scroll the chart o o5 146 147 148 149 150 151 152 153 154 Central 13747 16021 19239 15844 16560 15447 16169 16526 15367 17099 La gt A DatasetViewer displaying three TimeSimpleDatasets Class Dataset Viewer ChartView DatasetViewer 396 Text Classes The DatasetViewer is a ChartView derived object and as such is an independent UserControl object Use it to view one or more datasets in a chart Since it is usually not possible or practical to display the entire dataset the DatasetViewer windows a rectangular section of the dataset for display Scroll bars are used to scroll the rows and columns of the dataset The DatasetViewer constructor defines the size position source matrix the number of rows and columns of the DatasetViewer grid and the starting position of the DatasetViewer scrollbar DatasetViewer constructor Visual Basic Declaration Public Sub New _ chartvu As ChartView _ transform As PhysicalCoordinates posrect As Rectangle2D _ dataset As ChartDataset _ rows As Integer cols As Integer _ start As Integer _ C public Dat
257. ew Font Microsoft Sans Serif 10 FontStyle Regular DataToolTip datatooltip new DataToolTip chartVu TimeLabel xValueTemplate new TimeLabel ChartObj TIMEDATEFORMAT MDY NumericLabel yValueTemplate new NumericLabel ChartObj CURRENCYFORMAT 2 ChartText textTemplate new ChartText toolTipFont textTemplate SetTextBgColor Color FromArgb 255 255 204 textTemplate SetTextBgMode true ChartSymbol toolTipSymbol new ChartSymbol null ChartObj SQUARE new ChartAttribute Color Black toolTipSymbol SetSymbolSize 5 0 datatooltip SetTextTemplate textTemplate datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA_TOOLTIP_OHLC datatooltip SetToolTipSymbol toolTipSymbol datatooltip SetEnable true chartVu SetCurrentMouseListener datatooltip Visual Basic Dim toolTipFont As New Font Microsoft Sans Serif 10 FontStyle Regular Dim datatooltip As New DataToolTip chartVu Dim xValueTemplate As New TimeLabel ChartObj TIMEDATEFORMAT MDY Dim yValueTemplate As New NumericLabel ChartObj CURRENCYFORMAT 2 Dim textTemplate As New ChartText toolTipFont textTemplate SetTextBgColor Color FromArgb 255 255 204 textTemplate SetTextBgMode True Dim toolTipSymbol As New ChartSymbol Nothing ChartObj SQUARE New ChartAttribute Color Black toolTipSymbol SetSymbolSize 5 0 datatooltip SetTextTemplate
258. ew TimeCoordinates simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim chartVu As ChartView ChartViewl Create the time axis x axis is assumed Dim xAxis As TimeAxis New TimeAxis simpleTimeCoordinates Create the linear y axis Dim yAxis As LinearAxis New LinearAxis simpleTimeCoordinates ChartObj Y AXIS FAQs 445 The following code would be in the code handling the rescale event Rescale chart based on a modified Datasetl datset simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR _ ChartObj AUTOAXES FAR xAxis CalcAutoAxis yAxis CalcAutoAxis Redraw the chart using the rescaled coordinate system and axes chartVu UpdateDraw 12 When I use the auto scale and auto axis routines my semi log chart has the log axis scaled using powers of 10 1 10 100 1000 etc as the starting and ending values or as the major tick interval for labeling How do I make my log graphs start at 20 and end at 50 000 with major tick marks at 20 200 2000 and 20000 The auto scale routines for logarithmic coordinate systems will always select a power of 10 for the minimum and maximum value of the scale You can use the auto scale routine and then override the minimum and or maximum values for the logarithmic scale The default LogAxis constructor will pick up on the minimum of the coordinate system and use that as the axis tick mark origin Or you can leave the coordinate sys
259. ew York City double NXYGity 31 5 23 6 42 4 52 5 62 7 71 0 130 76 8 75 5 08 2 Sieg 4304 36 0 I Houston double Houston 50 4 53 9 60 6 68 3 74 5 90 4 5 100 92 06 92 3 78 2 569 6 Oly 53 5 Jj San Francisco double SanFrancisco I 18 7 52 2 53 3 55 0 58 1 76 61 5 62 7 63 7 64 5 61 54 8 49 4 Bouston 250 Group Plot Objects double Boston 32 4 53 9 44 6 59 3 621 5 70 4 73 90 72 6 72 3 49 6 41 39 5 3 Pittsburgh double Pittsburgh 41 4 54 24 06 38 3 44 5 61 4 63 105 72 0 12 68 2 49 6 41 33 5 Jy double minval 0 0 maxval 0 0 inte ud int numpnts NYCity Length Houston Length SanFrancisco Length Boston Pittsburgh Length ChartAttribute defaultattrib new ChartAttribute Color Black 1 DashStyle Color Red defaultattrib SetFillFlag true Length Solid ChartAttribute fillattrib new ChartAttribute Color Black 3 DashStyle Solid Color Red fillattrib SetFillFlag true BoxWhiskerPlot thePlotl new BoxWhiskerPlot pTransform1 0 25 fillattrib hePlotl AddPopulation NYCity 1 hePlotl AddPopulation Houston 2 hePlotl AddPopulation SanFrancisco 3 hePlotl AddPopulation Boston 4 hePlotl AddPopulation Pittsburgh 5 hePlotl BWFormat 1 hePlotl BarDatapointLabelPosition ChartObj CENTERED BAR hePlotl PlotLabelTemplate TextFont new Font Microsoft Sans Serif 8 ontStyle Regular
260. example extracted from the example program BigChartDemo class HistogramChart C int nnumpnts 6 int numgroups 2 double xl new double nnumpnts double yl new double numgroups nnumpnts ff height width x1 0 0 y1 0 0 127 y1 1 0 13 xl 1 13 yl1 0 1 97 yl 1 1 7 SSL ST 20 yl 0 2 80 y1 1 2 10 xi 3 30 yl1 0 3 44 yl 1 3 10 xl 4 40 y1 0 4 28 y1 1 4 290 xi 5 607 y1 0 5 47 yl 1 5 20 theFont new Font Microsoft Sans Serif 10 FontStyle Bold GroupDataset Datasetl new GroupDataset Actual Sales x1 yl CartesianCoordinates pTransforml new CartesianCoordinates pTransforml SetScaleStartY 0 pTransforml SetScaleStartxX 0 pTransforml SetScaleStopxX 80 pTransforml SetScaleStopy 1 00 pIransforml SetGraphBorderDiagonal 0 15 15 9 0 75 Background graphbackground 274 Group Plot Objects new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 Color FromaArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject graphbackground Background plotbackground new Background pTransforml ChartObj PLOT BACKGROUND Color Black chartVu AddChartObject plotbackground Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Black 0 DashStyle Solid Color Green attribl Setrillslagitrue HistogramPlot thePlotl new Hi
261. f floating point numbers support under Net CF A range of 10 30 is just as valid as a range of 10 30 even though there is 60 orders of magnitude of difference A user can attempt to plot data with an extremely large dynamic range the 10 30 range in a chart scaled for an extremely small range the 10 30 range The resulting user coordinate values resulting from such an extreme case can easily exceed the numeric range supported by the plotting functions Bad value checking Invalid data often finds its way into chart Invalid data can take many different forms The most obvious is the introduction of numeric values that do not fit the Net CF floating point format These types of numbers are often found in databases and representing non initialized or improperly initialized data Net CF cannot include an invalid floating point number in a calculation so it is best to try and avoid them Another type of invalid data is data that is a valid floating point number but is never less considered invalid by the user Often when data is outside of a predetermined range it is invalid Mark a data value in a dataset invalid using the ChartDataset SetValidData method If a data value equals Double MAX VALUE it is also considered invalid Taking the logarithm of 0 or a negative number If a charting package is capable of logarithmic and semi logarithmic plotting it must be protected against the error condition of taking the log of any number lt
262. f the 260 Group Plot Objects group dataset represent the xy position of the second error bar lines The error bar lines center on the X Connecting the error bar lines with a perpendicular line is an option ErrorBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rbarwidth As Double _ ByVal attrib As ChartAttribute Ct public ErrorBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth ChartAttribute attrib transform The coordinate system for the new ErrorBarPlot object The number of groups must be two dataset The error bar plot represents the values in this group dataset The number of groups must be two The X Y 0 values of the group dataset represent the xy position of the first error bar lines the X Y 1 values of the group dataset represent the xy position of the second error bar lines rbarwidth The width of the error bars attrib Specifies the attributes line color for the error bars An individual set of error bars in an error bar plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Floating Bar Plots Class FloatingBarPlot GraphObj Group Plot Objects 261 ChartPlot GroupPlot t FloatingBarPlot The FloatingBarPlot class extends the F
263. from the example program UserChartExample2 Form1 C public Forml InitializeComponent InstantiateChartView InitializeChart public void InstantiateChartView Allow room for a menu in the form Rectangle graphRect new Rectangle 1 1 this ClientRectangle Width 2 this ClientRectangle Height 2 Instantiate chart control chartVu new ChartView graphRect this Set preferred size of graph forces rescaling of fonts for smaller displayes chartVu PreferredSize chartViewl ClientSize The Chart View 135 public void InitializeChart Font theFont int numPoints 25 double x1 new double numPoints double yl new double numPoints double y2 new double numPoints double y3 new double numPoints int ij In VB the constructor for the Form is in Form Designer vb module and not the user programmer Form vb module For that reason the chart creation code is placed in the Form Load event Visual Basic Imports com quinncurtis chart2dnetcf Public Class Forml Dim chartViewl As ChartView Nothing Private Sub Formi Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InstantiateChartView If chartViewl IsNot Nothing Then InitializeChart End If End Sub Public Sub InstantiateChartView Allow room for a menu in the form Dim graphRect As Rectangle New Rectangle 1 1 Me ClientRectangle Width 2 Me ClientR
264. from the row The only supported format for elapsed time values in a CSV file is d hh mm ss fff 3 14 23 12 333 as an example of an elapsed time of three days 14 hours 23 minutes 12 seconds and 333 milliseconds You can also modify a point at a time using SetElapsedTimeXDataValue or SetElapsedTimeYDataValue if you are using TimeSpan objects and SetYDataValue or SetXDataValue if you use millisecond values If you need to add new points to the dataset increasing its size use one of the AddDataPoint or InsertDataPoint methods Delete data points using the DeleteDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a group datasets from numeric arrays int nNumPnts 5 nNumGroups 4 TimeSpan xValues new TimeSpan nNumPnts double groupBarData new double nNumGroups nNumPnts xValues 0 TimeSpan FromMinutes 1 groupBarData 0 0 6 3 groupBarData 1 0 3 1 groupBarData 2 0 2 2 groupBarData 3 0 1 8 xValues 1 TimeSpan FromMinutes 2 groupBarData 0 1 5 8 groupBarData 1 1 4 3 groupBarData 2 1 2 8 groupBarData 3 1 1 5 xValues 2 TimeSpan FromMinutes 3 90 Chart Datasets groupBarData 0 2 5 5 groupBarData 1 2 4 5 groupBarData 2 2 2 5 groupBarData 3 2 2 1 xValues 3 TimeSpan FromMinutes 4 groupBarData 0 3 4 1 groupBarData 1 3 5 4 groupBarData 2 3 4 1 g
265. ftware The best use of pie charts involves data that has 10 or fewer elements Otherwise the text used to label the pie charts starts to overlap in adjacent small pie wedges The x values of a dataset represent the datavalues for each pie wedge The y values of the dataset explode a pie wedge from its normal centered position A ring chart is a variant of the pie chart Instead an entire circle or pie being the basis of the chart a ring is used instead Using the Pie Chart Class Class PieChart GraphObj i PieChart RingChart The PieChart and RingChart classes extends the ChartPlot class and displays pie ring charts The x values of the simple dataset used for data storage specify the pie ring wedge values The y values of the dataset specify the explode percentage for each pie ring wedge PieChartConstructor Visual Basic Overloads Public Sub New _ 348 Pie Charts ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDataset ByVal spiestringis As String _ ByVal attribs As ChartAttribute ByVal labelinoutl1 As Integer _ ByVal pielabelformat As Integer _ C4 public PieChart PhysicalCoordinates transform SimpleDataset dataset string spiestringis ChartAttribute attribs int labelinoutl int pielabelformat RingChart Constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDa
266. g the new FAQs 441 values Objects can be added or modified based on some external event or in response to a timer event created using System Windows Forms Timer Make all changes for a given event and call the ChartView UpdateDraw method once The position of most GraphObj derived objects is set or modified using one of the objects SetLocation methods New data points can be added to an existing dataset using one of the datasets AddDataPoint AddTimeDataPoint AddGroupDataPoints or AddTimeGroupDataPoints methods ChartPlot derived objects that use datasets will update to reflect the new values when the ChartView UpdateDraw method is called If the coordinates of the new data points are outside of the x and y limits of the current coordinate system it may be necessary to rescale the coordinate system so that the new points show up otherwise the new data points will be clipped The new scale values can be set explicitly or calculated using one of the auto scale methods The example programs SpectrumAnalyzer DataLogger DynPieChart and ScrollingMixedPlot all demonstrate various ways to update charts in real time If you want to change points in an existing dataset but not the size of the dataset call the datasets appropriate SetXDataValue SetYDataValue or SetDataPoint methods The dataset has its own copy of the data so you must change these values not the original values you used to initialize the dataset If you plan to change every valu
267. ge the default z order value on an object by object basis Call the GraphObj SetZOrder method to change the z order for any given object See the section in the manual titled Rendering Order of GraphObj Objects for information about the default z values for all chart objects The example below sets the z order value of grid1 to something less than the default value 50 of ChartPlot objects and the z order value of grid2 to something greater than the default value C ChartView chartVu chartViewl FAQs 449 Grid gridl new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR gridl SetZOrder 40 This is actually the default value for the grid z order chartVu AddChartObject gridi Grid grid2 new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MINOR grid2 SetZOder 150 Grid is drawn after ChartPlot objects which have default z value of 50 chartVu AddChartObject grid2 Visual Basic Dim chartVu As ChartView ChartViewl Dim gridl As Grid new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR gridl SetZOrder 40 This is actually the default value for the grid z order chartVu AddChartObject gridl Dim grid2 As Grid new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MINOR grid2 SetZOder 150 Grid is drawn after ChartPlot objects which have default z value of 50 chartVu AddChartObject grid2 18 How to I use a ScrollBar object to control horizontal scrolling of the data in
268. gend BubblePlotLegend Grid Classes Grid PolarGrid AntennaGrid This class is the abstract base class for chart legends This class is the legend item class for all plot objects except for bubble plots Each legend item manages one symbol and descriptive text for that symbol The StandardLegend class uses objects of this type as legend items This class is the legend item class for bubble plots Each legend item manages a circle and descriptive text specifying the value of a bubble of this size The BubblePlotLegend class uses objects of this type as legend items This class is a concrete implementation of the Legend class and it is the legend class for all plot objects except for bubble plots The legend item objects display in a row or column format Each legend item contains a symbol and a descriptive string The symbol normally associates the legend item to a particular plot object and the descriptive string describes what the plot object represents This class is a concrete implementation of the Legend class and it is a legend class used exclusively with bubble plots The legend item objects display as offset concentric circles with descriptive text giving the key for the value associated with a bubble of this size Grid lines are perpendicular to an axis extending the major and or minor tick marks of the axis across the width or height of the plot area of the chart Grid PolarGrid AntennaGrid Chart Text Classes
269. hartObj MARCH 5 New ChartCalendar 1996 ChartObj APRIL 5 New ChartCalendar 1996 ChartObj MAY 5 Scaling and Coordinate Systems 115 New ChartCalendar 1996 ChartObj JUNE 5 _ New ChartCalendar 1996 ChartObj JULY 5 _ New ChartCalendar 1996 ChartObj AUGUST 5 New ChartCalendar 1996 ChartObj SEPTEMBER 5 _ New ChartCalendar 1996 ChartObj OCTOBER 5 _ New ChartCalendar 1996 ChartObj NOVEMBER 5 Dim yDatal As Double 110 22 33 44 55 46 33 25 14 9 Dim DE aZ VL As Double 20 12 43 54 15 26 63 25 24 19 Dim yData3 As Double 30 52 13 64 25 76 13 35 24 19 All of the datasets reference the same xData array of ChartCalendar dates though this does not have to be the case Dim datasetl As TimeSimpleDataset New TimeSimpleDataset Sales1 xData yDatal Dim dataset2 As TimeSimpleDataset New TimeSimpleDataset Sales2 xData yData2 Dim dataset3 As TimeSimpleDataset New TimeSimpleDataset Sales3 xData yData3 Dim datasetsArray 2 As TimeSimpleDataset datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale AutoScale datasetsArray There is a version of the multiple dataset auto scale routine that also specifies rounding mode parameters simpleTimeScale AutoScale datasetsArray ChartObj AUTOAXES FAR ChartObj AUTOAXE S FAR The p
270. hartObject thePlot3 Dim legendFont As New Font Microsoft Sans Serif 14 FontStyle Bold Dim legendAttributes As New ChartAttribute Color Gray 1 DashStyle Solid Color From rgb 155 155 155 legendAttributes SetFillFlag True legendAttributes SetLineFlag True Undersized legend rectangle tests auto legend rectangle Dim legend As New StandardLegend 0 2 0 15 0 25 0 3 legendAttributes StandardLegend VERT DIR legend AddLegendItem Expenses ChartObj LINE thePlotl legendFont legend AddLegendItem Revenue ChartObj LINE thePlot2 legendFont legend AddLegendItem Profit ChartObj HBAR thePlot3 legendFont legend AddLegendItem Loss ChartObj HBAR lossAttrib legendFont chartVu AddChartObject legend Bubble Plot Legends Class BubblePlotLegend GraphObj BubblePlotLegend Legends 373 The BubblePlotLegend is the primary legend class for bubble plots The class manages a list of BubblePlotLegendItem that holds the symbols and descriptive text for the symbols BubblePlotLegend constructors Visual B Overloads ByVal ByVal ByVal ByVal ByVal ByVal Overloads ByVal ByVal ByVal ByVal Ct public Bu asic Public Sub New _ Pilot As BubblePlot _ rx As Double _ ry As Double _ rwidth As Double rheight As Double _ attrib As ChartAttribute Public Sub New _ piot As BubblePlot _ rx As Double ry As Double _ attrib As ChartAttribute bblePlotLegen
271. hased the license for SOFTWARE and have received the file containing the licensed copy you are licensed to copy the SOFTWARE only into the memory of the number of computers corresponding to the number of licenses purchased The primary user of the computer on which each licensed copy of the SOFTWARE is installed may make a second copy for his or her exclusive use on a portable computer Under no other circumstances may the SOFTWARE be operated at the same time on more than the number of computers for which you have paid a separate license fee You may not duplicate the SOFTWARE in whole or in part except that you may make one copy of the SOFTWARE for backup or archival purposes You may terminate this license at any time by destroying the original and all copies of the SOFTWARE in whatever form B 30 Day Trial License You may download and use the SOFTWARE without charge on an evaluation basis for thirty 30 days from the day that you DOWNLOAD the trial version of the SOFTWARE The termination date of the trial SOFTWARE is embedded in the downloaded SOFTWARE and cannot be changed You must pay the license fee for a Developer License of the SOFTWARE to continue to use the SOFTWARE after the thirty 30 days If you continue to use the SOFTWARE after the thirty 30 days without paying the license fee you will be using the SOFTWARE on an unlicensed basis Redistribution of 30 Day Trial Copy Bear in mind that the 30 Day Trial version of the SOFTWARE b
272. he MouseUp events don t work So we cheat when a scrollbar value changes we start a timer and only update the graph one second after the initial change This gives the user time to complete the scrollbar movement and does not bog things down with multiple updates of the graph for intermediate values C public void UpdateXScaleAndAxes int index int startindex index pIransforml SetScaleStartX double startindex pTransforml SetScaleStopX double startindex 50 xAxis CalcAutoAxis yAxis CalcAutoAxis xAxisLab CalcAutoAxisLabels yAxisLab CalcAutoAxisLabels this UpdateDraw public void UpdateYScaleAndAxes int index int startindex index pTransforml SetScaleStartY double startindex pTransforml SetScaleStopY double startindex xAxis CalcAutoAxis yAxis CalcAutoAxis xAxisLab CalcAutoAxisLabels yAxisLab CalcAutoAxisLabels this UpdateDraw private void hScrollBarl ValueChanged object sender System EventArgs e hScrollActive true this timerl Enabled true private void vScrollBarl ValueChanged object sender vScrollActive true this timerl Enabled true private void timerl Tick object sender System EventArgs e if hScrollActive UpdateXScaleAndAxes hScrollBarl Value hScrollActive false if vScrollActive UpdateYScaleAndAxes vScrollBarl Value vScrollActive false this timerl Enabled false
273. he Visual Studio Design Mode Display the Form where you want the ChartView control using the Visual Studio design mode Select the ChartView control from the Toolbox and drop it on the form Resize the control to the size you want If you size the control larger than the viewable area of the underlying form horizontal and vertical scrollbars will automatically appear so that you can pan the form left right and up down Most of our example programs size the ChartView larger than the underlying form This assumes that you have explicity added the ChartView control to the Visual Studio Toolbox To add the ChartView control to the VS Toolbox right click on the Toolbox and select Choose Items From the Choose Toolbox Items dialog use the Browse button and go to the Quinn Curtis DotNet Lib folder and select QCChart2DNetCF DLL OK out of the Choose Toolbox Items dialog You will now see a ChartView control in the tool box list of controls When you add a ChartView control to a Form it places the default instantiation code in the form s Form Designer cs module Starting with VS 2005 Microsoft has decided to physically separate the designer generated code in a Form Designer module while The Chart View 133 keeping your user written code in a Form cs module The default name used for the first instance of the ChartView control added to a program is chartView1 The variable chartView1 becomes global to the entire Form class You will see a reference to
274. he additional objects How do you zoom charts that use multiple coordinate systems How do you handle missing data points in a chart How do you update a chart in real time How do I prevent flicker when updating my charts on real time How do you implement drill down or data tool tips in a chart I do not want to my graph to auto scale How do I setup the graph axes for a specific range How do I update my data and auto rescale the chart scales and axes to reflect the new data after it has already been drawn When I use the auto scale and auto axis routines my semi log chart has the logarithmic axis scaled using powers of 10 1 10 100 1000 etc as the starting and ending values or as the major tick interval for labeling How do I make my log graphs start at 20 and end at 50 000 with major tick marks at 20 200 2000 and 20000 How do I create and use custom multi line string labels as the axis labels for my graph How do I place more than one graph in a view 432 FAQs 15 How do I use the QCChart2D CF software to generate JPG DIB BMP GIF EMF WMF etc files 16 Sometimes the major tick marks of an axis are missing the associated tick mark label 17 How do I change the order the chart objects are drawn For example I want one of my grid objects to be drawn under the charts line plot objects and another grid object to be drawn top of the charts line plot objects 18 How to I use a Forms scrollbar object to
275. he arrow by setting the ArrowScaleFactor property Get a GraphicsPath object defining the arrow shape by calling the GetArrowShape method Arrow example extracted from the example program BigChartDemo class MultiLine C Arrow regionArrow new Arrow 1 40 6 15 ChartAttribute arrowAttrib new ChartAttribute Color Black 1 DashStyle Solid Color Black arrowAttrib SetFillFlag true ChartShape arrowShape new ChartShape pTransforml regionArrow GetArrowShape ChartObj DEV POS 1 5 40 0 ChartObj PHYS POS 195 arrowShape SetChartObjAttributes arrowAttrib chartVu AddChartObject arrowShape Visual Basic Dim regionArrow As New Arrow 1 40 6 15 Dim arrowAttrib As New ChartAttribute Color Black 1 _ DashStyle Solid Color Black arrowAttrib SetFillFlag True Dim arrowShape As New ChartShape pTransforml regionArrow GetArrowShape _ 408 Lines Shapes Images and Arrows ChartObj DEV POS 1 5 40 0 ChartObj PHYS POS 195 arrowShape SetChartObjAttributes arrowAttrib chartVu AddChartObject arrowShape 23 Using QCChart2D CF for the Net Compact Framework to Create Windows Applications The primary view class of the QCChart2D CF library is the ChartView class The ChartView class is derived from the Net System Windows Forms UserControl class It has the properties and methods of the underlying Control class The main example program for the QCChart2D CF library is the BigChartDemo program This progr
276. he axes do not need to have the same limits In general the limits of the coordinate system should be greater than or 26 Class Architecture equal to the limits of the axes The coordinate system may have limits of 0 to 15 while you may want the axes to extend from 0 to 10 13 500 12 400 11 10 300 9 200 8 7 100 Axis Widget Tolerances by Worker Click on one of the buttons below to change the x axis range 1400 14 0K 00 1200 1000 800 600 0 20 40 60 80 100 Event Partition Graphs can have an UNLIMITED number of x and y axes This class is the abstract base class for the other axis classes It contains data and drawing routines common to all axis classes Class Architecture 27 Linear Axes 100 0 00004 50 0 00002 0 0 00000 sog HH 0 02 003 0 04 005 0 00002 0 00004 100 0 4 0 2 0 0 0 2 0 4 EA Is eg E N H E T5 37 a5 0 10000 20000 30000 40000 10 80 80 2800 15 2 40 40 2400 25 0 0 2000 0 20 40 60 80 100 0 5 10 15 The positioning of axes is very flexible Axes can have an inverted scale LinearAxis This class implements a linear axis with major and minor tick marks placed at equally spaced intervals Logarithmic Axes 1000 50000 100 l 400 5000 Linear X Log X Log X 10 Log Y 200 Linear Y 500 Log Y 1 0 50 0 1 0 5 0 20 40 60 80 100 0 02 0 2 2 20 200 1 10 100 1000 40 Log X 20 Linear Y 0 Q2 0406 1 gt 4 6 10 p 40 60 100 499 400600 1000 100 Time X 10 Log Y 8 01 02 9 0
277. he form of time and date records The creation of a powerful yet flexible time and date physical coordinate system for scaling charts is a major challenge Important design goals include e The programmer scales the graph using objects of the ChartCalendar class e The scale should support a continuous range of date time scaling from milliseconds to hundreds of years e The scale should have a 5 7 day week option e A day does not have to be 24 hours long instead it can have a specific range for example 8 30 AM to 4 00 PM e Time and date axes used to delineate a date time scale must be able to display and label tick marks for days weeks months and years taking into account the non uniformity of years months weeks and days in the Gregorian calendar The ChartCalendar Class The ChartCalendar class represents time and date information in the format used by the majority of the world It is a universal time class capable of representing time with a 108 Scaling and Coordinate Systems resolution of milliseconds and a dynamic range of hundreds of years It contains time and date fields that specify an exact moment in time i e November 7 2000 20 43 22 554 Since the ChartCalendar class represents both time of day and calendar dates is not necessary to use separate time of day and date classes to manage data collected every few seconds yet spans a day or more An example of this type of date time range is a graph of experimental data
278. he text justification constants Text Classes 389 JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX yjust Specifies the vertical justification of the text Use one of the text justification constants JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX rotation The rotation of the text Not supported The TimeLabel ElapsedTimeLabel and StringLabel classes are similar unique properties for each are listed below TimeLabel contructors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal date As ChartCalendar ByVal timeformat As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal date As ChartCalendar ByVal x As Double ByVal y As Double _ ByVal npostype As Integer _ ByVal timeformat As Integer _ ByVal xjust As Integer _ ByVal yjust As Integer _ ByVal rotation As Double _ Ct public TimeLabel PhysicalCoordinates transform ChartCalendar date int timeformat public TimeLabel PhysicalCoordinates transform Font tfont ChartCalendar date double x double y int npostype int timeformat int xjust ink vyjust double rotation 390 Text Classes date The calendar value used to initialize the label timeformat The format used to convert the calendar value to a text string Use one of the calendar format constants TIMEDATEFORMAT XXX ElapsedTimeLabel constructors
279. he y axis displaying the radius limits and the angular circle bounding the y axis The class extends the NumericAxisLabels class and uses that class s methods and properties for managing the label properties AntennaAxisLabels constructor There is only one main constructor for AntennaAxesLabels objects 210 Axis Labels Visual Basic Overloads Public Sub New _ ByVal baseaxis As AntennaAxes _ Cf public AntennaAxesLabels AntennaAxes baseaxis baseaxis This is the axis the axis labels are for Other axis label properties font rotation numeric format axis labels direction and numeric precision are automatically set These properties can be explicitly set if you need to override the automatically calculated values SetAxisLabels method Visual Basic Overloads Public Sub SetAxisLabels _ ByVal font As Font _ ByVal labcolor As Color _ C public void SetAxisLabels Font font Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ C public void SetAxisLabelsFormat int format font The font object used to display the axis label text labcolor The color of the label text format Sets the numeric format for the axis labels Use one of the numeric format constants DECIMALFORMAT SCIENTIFICFORMAT EXPONENTFORMAT BUSINESSFORMAT ENGINEERINGFORMAT PERCENTFORMAT CURRENCEYFORMAT CURRENCYBUSINESSFORMAT Axis
280. hite chartVu AddChartObject background AntennaAxes pAntennaAxis pAntennaTransform GetCompatibleAxes pAntennaAxis LineColor Color Black chartVu AddChartObject pAntennaAxis AntennaGrid pAntennaGrid new AntennaGrid pAntennaAxis AntennaGrid GRID ALL pAntennaGrid ChartObjAttributes new ChartAttribute Color LightBlue 1 DashStyle Solid chartVu AddChartObject pAntennaGrid AntennaAxesLabels pAntennaAxisLabels AntennaAxesLabels pAntennaAxis GetCompatibleAxesLabels chartVu AddChartObject pAntennaAxisLabels 360 Polar Charts ChartAttribute attribl new ChartAttribute Color Red 1 DashStyle Solid attribl SymbolSize 7 ChartAttribute attrib2 new ChartAttribute Color Blue 1 DashStyle Solid Color Blue attrib2 SymbolSize 7 ChartAttribute attrib3 new ChartAttribute Color Yellow 3 DashStyle Solid Color Yellow ChartAttribute attrib4 new ChartAttribute Color MediumPurple 2 DashStyle Dash Color MediumPurple AntennaLinePlot thePlotl new AntennaLinePlot pAntennaTransform thePlotl InitAntennaLinePlot Datasetl attribl chartVu AddChartObject thePlot1 AntennaScatterPlot thePlot2 new AntennaScatterPlot pAntennaTransform thePlot2 InitAntennaScatterPlot Datasetl ChartObj SQUARE attrib2 chartVu AddChartObject thePlot2 Visual Basic Datasetl New SimpleDataset First magl angl Dataset2 New SimpleDataset Second mag2 angl Dim data
281. ialized from calls in the forms constructor Or you can initialize the graph from the forms Form Load event similar to the way it is done using VB using System using System Collections Generic using System ComponentModel using System Drawing Drawing2D using System Drawing using System Text using System Windows Forms using com quinncurtis chart2dnetcf namespace UserChartExample2 public partial class Forml Fornt ChartView chartViewl null public Forml InitializeComponent InstantiateChartView if chartViewl null 426 Using QCChart2D for Net CF to Create Windows Applications InitializeChart public void InstantiateChartView Allow room for a menu in the form Rectangle graphRect new Rectangle 1 1 this ClientRectangle Width 2 this ClientRectangle Height 2 Instantiate chart control chartViewl new ChartView graphRect this public void InitializeChart ChartView chartVu chartViewl Adding a UserControl derived from ChartView at runtime You can derive your own chart class from ChartView and use that control instead of the base ChartView class Right click on the project in the Solution Explorer and select Add User Control Choose the UserControl template This will add a basic template for a user defined UserControll to your project Go to the UserControll cs and change the inheritance from UserControl to ChartView You can then customize the UserC
282. ib As ChartAttribute Ct public LineGapPlot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attrib transform The coordinate system for the new LineGapPlot object dataset The line gap plot represents the values in this group dataset The number of groups in this group dataset must be two attrib Specifies the attributes line and fill color for the fill area A segment between adjacent x values in the line gap plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Line gap bar plot example extracted from the example program BigChartDemo class LineGapChart C int nNumPnts 5 nNumGroups 2 ChartCalendar xValues new ChartCalendar nNumPnts double groupBarData new double nNumGroups nNumPnts theFont new Font Microsoft Sans Serif 10 FontStyle Bold xValues 0 new ChartCalendar 1998 ChartObj JANUARY 1 groupBarData 0 0 43 groupBarData 1 0 71 Group Plot Objects 277 xValues 1 new ChartCalendar 1999 ChartObj JANUARY 1 groupBarData 0 1 40 groupBarData 1 1 81 xValues 2 new ChartCalendar 2000 ChartObj JANUARY 1 groupBarData 0 2 54 groupBarData 1 2 48 xValues 3 new ChartCalendar 2001 ChartObj JANUARY 1 groupBarData 0 3 56 groupBarData 1 3 44 xValues 4 new ChartCalendar 2002 ChartObj JANUARY 1 gr
283. ibl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillFlag true attribl SetLineFlag false ChartAttribute attribArray new ChartAttribute numGroups for i20 i lt numGroups i attribArray i ChartAttribute attribl Clone attribArray 0 SetFillColor Color Blue attribArray 1 SetFillColor Color Yellow attribArray 2 SetFillColor Color Magenta attribArray 3 SetFillColor Color Orange attribArray 4 SetFillColor Color Gray attribArray 5 SetFillColor Color Red attribArray 6 SetFillColor Color Green StackedLinePlot thePlotl new StackedLinePlot pTransforml Datasetl attribArray chartVu AddChartObject thePlot1 Visual Basic Dim numPoints As Integer 100 Group Plot Objects 289 Dim numGroups As Integer 7 Dim xl numPoints 1 As Double Dim yl numGroups 1 numPoints 1 As Double Initialize data theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New GroupDataset First xl yl Datasetl SetStackMode ChartObj AUTOAXES STACKED Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pIransforml SetScaleStartx 0 pIransforml SetScaleStartyY 0 Dim background As New Background pTransforml ChartObj PLOT BACKGROUND C olor FromArgb 255 255 255 chartVu AddChartObject background
284. id SetAxisLabelsFormat int format font The font object used to display the axis label text rotation The rotation in degrees of label text in the normal viewing plane labdir The justification of the axis label AXIS MIN or AXIS MAX with respect to the tick mark endpoint decimal Sets the number of digits to the right of the decimal point for numeric axis labels labelends Ignored for time axis labels labcolor The color of the label text format Sets the numeric format for the axis labels Use one of the time format constants 200 Axis Labels TIMEDATEFORMAT MSDDD TIMEDATEFORMAT MSDD TIMEDATEFORMAT MSD TIMEDATEFORMAT MS TIMEDATEFORMAT 12HMSDD TIMEDATEFORMAT 12HMSD TIMEDATEFORMAT 12HMS TIMEDATEFORMAT 12HM TIMEDATEFORMAT 24HMSDD TIMEDATEFORMAT 24HMSD TIMEDATEFORMAT 24HMS TIMEDATEFORMAT 24HM TIMEDATEFORMAT STANDARD TIMEDATEFORMAT MDY TIMEDATEFORMAT DMY TIMEDATEFORMAT MY TIMEDATEFORMAT Q TIMEDATEFORMAT MMMM TIMEDATEFORMAT MMM TIMEDATEFORMAT M TIMEDATEFORMAT DDDD TIMEDATEFORMAT DDD TIMEDATEFORMAT D TIMEDATEFORMAT Y TIMEDATEFORMAT MDY2000 TIMEDATEFORMAT DM Y2000 TIMEDATEFORMAT MY2000 TIMEDATEFORMAT Y2000 Simple time axis labels example C Define a Time coordinate system ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 double yMax 105 TimeCoordinates simpleTimeScale
285. ifying rectangle as it passes over an existing chart The area of the chart within the bounds of the magnifying rectangle is magnified and continuously redrawn in a separate window Click thetop graph using left button D 100 200 110 115 Subject 1 Subject 2 In use the MagniView class is similar to passing a magnifving glass over your data 6 Introduction 3000 3 flick the top graph using left mouse button 2000 1000 2000 100 0 20K 0 2000 10K 1000 4000 50 0 20 40 60 80 100 The bottome graph contains the magnified plot 0 1400 cog 20 0K 7 1200 1000 800 0 1000 vo 0 1500 iud 55 60 The MagniView class works with an unlimited number of coordinate systems and axes The MoveCoordinates class A new MoveCoordinates class is analogous to panning of the graph Instead of using a scroll bar to set the starting point of the scale in a graph the mouse now moves the coordinate system without changing the range of the x and y scales The x and y axes are continuously redrawn as the mouse is dragged reinforcing the look and feel of the move operation This is similar to the way you use a mouse to move a map under Map Quest or Google Click and drag left mouse button Move the coordinate system using the mouse 1 03 02 1 04 02 1 05 02 1 06 02 The MoveCoordinates class is an alternative to using scroll bars to pan the graph left right up down Additional Chart Objects
286. illFlag true attribs abtrxbs atrraibs attribs attribs attribs attribs attribs attribs 0 8etColor Color Bl ack 1 SetColor Color Blue 2 SetColor Color DarkGray 3 SetColor Color Green 4 SetColor Color Red 5 SetColor Color Cyan 6 SetColor Color Magenta 7 SetColor Color Orange 8 SetColor Color Yellow for i 0 i lt numcontourlevels i if i 3 0 lineflags i true else lineflags i false if i 3 0 labelflags i true else labelflags i false thePlotl new ContourPlot pTransforml datasetl contourlevels attribs lineflags labelflags numcontourlevels ChartObj CONTOUR LINE thePlotl SetPolygonGridOn true thePlotl SetContourLineAlgorithm ChartObj CONTOUR LINEWALK NumericLabel contourlabel thePlotl GetPlotLabelTemplate Font contourLabelFont new Font Microsoft Sans Serif 8 FontStyle Regular contourl contourl label SetDecimalPos 0 label SetTextFont contourLabelFont contour label TextBgMode true Contour Plotting contourlabel TextBgColor Color White thePlotl SetPlotLabelTemplate contourlabel chartVu AddChartObject thePlot1 Visual Basic Dim contourlevels As Double _ 1000 1200 1400 1600 1800 1900 2000 2100 2200 2400 2600 2800 3000 Dim theFont As Font chartVu ChartViewl Dim i As Integer theFont New Font Microsoft Sans Serif 10
287. im sPieStrings As String Technology Retail Banking Automotive Aerospace Dim attribs 5 As ChartAttribute Dim theFont As Font Dim colorArray As Color Color Red Color Blue Color Cyan Color Yellow Color Green Color DarkGray Color LightGray Color Magenta Color Orange Color Pink Dim techLabel As ChartText Dim retailLabel As ChartText Dim bankLabel As ChartText Dim aeroLabel As ChartText Dim autoLabel As ChartText theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim xl numPoints 1 As Double Dim yl numPoints 1 As Double Dim i As Integer For i 0 To numPoints 1 attribs i New ChartAttribute Color Black 1 0 attribs i SetFillColor colorArray i Next i x1 0 5 8 yl 0 Q 2 xl 1 2 2 y1 1 0 0 x12 3 5 yl 2 0 0 x1 3 4 2 Pie Charts 351 352 Pie Charts yia e 0 0 xl 4 3 7 yl 4 0 0 Dim Datasetl As New SimpleDataset First xl yl Dim pTransforml As New CartesianCoordinates pTransforml SetGraphBorderDiagonal 0 1 0 2 0 9 0 9 Dim backgroundl As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FromArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject backgroundl Dim thePlotl As New PieChart pTransforml Datasetl sPieStrings attribs ChartObj PIELABEL OUTSLICE ChartObj PIELABEL STRINGNUMVAL thePlotl SetStartPieSliceAngle 45 Dim labeltemplate As New NumericLabel labeltem
288. imeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES NEAR pTransforml SwapScaleOrientation pTransforml SetScaleStartY 0 pTransforml SetGraphBorderDiagonal 0 22 0 15 0 95 0 8 Define axes axes labels and grids Dim thePlotl As FloatingBarPlot New FloatingBarPlot pTransforml Dim attribl As ChartAttribute New ChartAttribute Color Black 1 DashStyle Solid Color Green attribl SetFillFlag True thePlotl InitFloatingBarPlot Datasetl 0 75 attribl Ch artObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR chartVu AddChartObject thePlot1 Floating Stacked Bar Plots Class FloatingStackedBarPlot GraphObj ChartPlot GroupPlot 266 Group Plot Objects FloatingStackedBarPlot The FloatingStackedBarPlot class extends the GroupPlot class and displays floating stacked bar plots The bars are free floating because each bar does not reference a fixed base value as do the simple bar plots stacked bar plots and group bar plots The starting value for each stacked bar is Y 0 Each bar after that is defined by the succeeding value in the group value array Y 1 Y 2 Unlike the StackedBarPlot plot the displayed values are not a cumulative sum of the group values All bars in a given FloatingStackedBarPlot object have the same width FloatingStackedBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordi
289. imeCoordinates object you can proceed as in all the other examples that use a date time x axis If you need to use the auto scaling capability you will need to add a few additional steps Place the data in a TimeGroupDataset dataset and use it to auto scale a TimeCoordinates scaling object The only problem here is that since the y values are the time values the chart y axis will end up as the time axis and the x axis will end up the numeric axis Call the TimeCoordinates SwapScaleOrientation in order to get it back to the orientation we want This swaps the scale orientation so the x axis is the time axis and the y axis is the numeric axis See the second of the two examples below for more details about how to use date time values to specify the bar ends of a floating bar plot Floating bar plot example that uses numeric values as the floating bar endpoints extracted from the example program BigChartDemo class FloatingBarChart C GroupDataset Datasetl Group Plot Objects 263 new GroupDataset Actual Sales x1 y1 CartesianCoordinates pTransforml new CartesianCoordinates pTransforml SetScaleStartx 0 pTransforml SetScaleStartyY 0 pTransforml SetScaleStopxX 12 prransforml SetScaleStopY 7 Define axes axes labels and grids FloatingBarPlot thePlotl new FloatingBarPlot pTransforml ChartAttribute attribl new ChartAttribute Color Black 1 ChartObj DashStyle Solid Color Green attribl SetFillFlag true
290. imeGroupDataset Datasetl new TimeGroupDataset Actual Sales xl yl TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES NEAR pTransforml SwapScaleOrientation prIransforml SetScaleStartY 0 pIransforml SetGraphBorderDiagonal 0 22 15 95 0 8 Define axes axes labels and grids FloatingBarPlot thePlotl new FloatingBarPlot pTransforml ChartAttribute attribl new ChartAttribute Color Black 1 DashStyle Solid Color Green attribl SetFillFlag true thePlotl InitFloatingBarPlot Datasetl 0 75 attribl Ch rtObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR chartVu AddChartObject thePlot1 Visual Basic Dim nnumpnts As Integer 18 Dim numgroups As Integer 2 Dim xl nnumpnts 1 As Double Dim yl numgroups 1 nnumpnts 1 As ChartCalendar x1 0 6 Group Plot Objects 265 yl 0 0 New ChartCalendar 2002 ChartObj JANUARY 1 yl 1 0 New ChartCalendar 2003 ChartObj JANUARY 1 xl 1 5 yl 0 1 New ChartCalendar 2002 ChartObj JANUARY 1 yl 1 1 New ChartCalendar 2002 ChartObj MAY 1 xl 17 1 yl 0 17 New ChartCalendar 2002 ChartObj JULY 1 SKL T7 New ChartCalendar 2002 ChartObj OCTOBER 1 theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As TimeGroupDataset New TimeGroupDataset Actual Sales xl yl Dim pTransforml As TimeCoordinates New T
291. independent and they require valid references to both an x and y axis The three axis grid classes are Grid PolarGrid and AntennaGrid Linear Logarithmic and Time Axis Grids Class Grid GraphObj Grid The Grid class defines a grid for LinearAxis LogAxis and TimeAxis classes A grid object needs a reference to both an x and y axis The grid aligns with the tick marks of one axis and extends across the plot area using the minimum and maximum values of the other axis For example an x axis grid has lines aligned with the tick marks of the x axis and extending from the minimum y value to the maximum y value of the y axis parallel to the y axis Grid constuctor Visual Basic Overloads Public Sub New _ ByVal xaxis As Axis ByVal yaxis As Axis _ ByVal gridaxistype As Integer _ ByVal gridtype As Integer _ C public Grid Axis xaxis Axis yaxis int gridaxistype 214 Axis Grids int gridtype xaxis yaxis gridaxistype gridtype The x axis associated with the grid The y axis associated with the grid The grid is aligned with the tick marks of this axis The grid is parallel to the other axis Use one of the axis constants X AXIS or Y AXIS Specifies if the grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the major and minor tick marks GRID ALL of the reference axis Other grid properties are associated with the line properties used to
292. indow that cannot be removed Developer Version The subscription version of QCChart2D CF for the Net Compact Framework is downloaded as a zip file name something similar to NETCFCHTDEV1R1x0x353x1 zip The developer version does not time out and you can use it to create application programs that you can distribute royalty free You can download free updates for a period of 2 years When you placed your order you were e mailed download link s that will download the software Those download links will remain active for at least 2 years and should be used to download current versions of the software After 2 years you may have to purchase an upgrade to continue to download current versions of the software Chapter Summary The remaining chapters of this book discuss the QCChart2D CF for the Net Compact Framework interactive charting package Chapter 2 presents the overall class architecture of the QCChart2D CF for the Net Compact Framework and summarizes all of the classes found in the software Chapter 3 describes the dataset classes that hold chart data Chapter 4 describes the various classes that implement the Cartesian time and polar coordinate systems supported by the software Chapter 5 describes the ChartView container class that manages the chart objects Chapter 6 describes a class that will create simple one color gradient and texture backgrounds for a chart Introduction 15 Chapters 7 8 and 9 describe the classes tha
293. ine marker plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE lineattrib Specifies the attributes line color and line style for the line part of the line marker plot symbolattrib Specifies the attributes line and fill color for the symbol part of the line marker plot nsymbolstart Specifies the starting index for symbols in the line marker plot nsymbolskip Specifies the skip factor for placing symbols in the line marker plot barwidth Specifies the width of the bar A ChartAttribute object sets the objects global line color line width and line style attributes Change the ChartAttribute object using the objects SetChartObjAttributes method Use the objects setSymbolAttributes to change the attributes of the marker symbol Change the plot type using the PlotT ype property Use one of the plot type constants LINE MARKER PLOT LINE PLOT BAR PLOT SCATTER PLOT Simple versa plot example extracted from the example program NewDemosRev2 SimpleVersaChart C ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag true thePlotl new SimpleVersaPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0 attribl ChartObj JUSTIFY CENTER NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNume
294. ing data The underlying data is stored as double values that represent the millisecond equivalent of the date time values The TimeSimpleDataset GetXData and GetYData methods return references to the underlying data You can also modify a point at a time using one of the SetTimeDataPoint SetTimeXDataValue and SetYDataValue methods If you need to add new points to the dataset increasing its size use one of the AddTimeDataPoint or InsertTimeDataPoint methods Delete data points using the DeleteTimeDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a simple time datasets C int nnumpnts 32 ChartCalendar xl new ChartCalendar nnumpnts double yl new double nnumpnts double y2 new double nnumpnts yl 0 100 y2 0 30 x1 0 ChartCalendar currentdate Clone currentdate Add ChartObj MONTH 3 for i121 i lt nnumpnts i xl i ChartCalendar currentdate Clone yl i yl i 1 5 i 0 75 ChartSupport GetRandomDouble y2 i y2 i 1 15 i 0 95 ChartSupport GetRandomDouble 0 currentdate Add ChartObj MONTH 3 TimeSimpleDataset Datasetl new TimeSimpleDataset Sales x1 yl TimeSimpleDataset Dataset2 new TimeSimpleDataset Expenses x1 y2 Visual Basic Dim nnumpnts As Integer 32 Dim xl nnumpnts 1 As ChartCalendar Dim yl nnumpnts 1 As Double Dim y2 nnumpnts
295. ing the TimeCoordinates class The axis minimum and maximum do not have to fall on even time or date intervals and can assume any date compatible with the ChartCalendar class For example Starting Date and Time Ending Date and Time Range 166 Axes 1 1 1972 00 00 00 11 04 1997 8 30 00 11 28 2000 8 31 22 11 04 1997 16 00 00 1 14 2001 15 14 33 1 1 1999 00 00 00 27 years 7 hours 30 minutes 48 days 6 hours 43 minutes 11 sec Date Time Minor and Major Tick Mark Intervals The predefined date time axis tick mark constants listed below specify both major and minor tick mark spacing Date Time Axis Tick Mark Constants TIMEAXIS 50YEARIOYEAR TIMEAXIS 20YEARSYEAR TIMEAXIS 1OYEARYEAR TIMEAXIS SYEARYEAR TIMEAXIS YEAR TIMEAXIS YEARQUARTER TIMEAXIS YEARMONTH TIMEAXIS QUARTER TIMEAXIS QUARTERMONTH TIMEAXIS MONTH TIMEAXIS MONTHWEEK Description 50 year major tick mark spacing 10 year minor tick mark spacing 20 year major tick mark spacing 5 year minor tick mark spacing 10 year major tick mark spacing 1 year minor tick mark spacing 5 year major tick mark spacing year minor tick mark spacing 1 year major tick mark spacing 1 year major tick mark spacing 1 quarter minor tick mark spacing 1 year major tick mark spacing 1 month minor tick mark spacing 1 quarter major tick mark spacing 1 quarter major tick mark spacing 1 month minor tick mark spacing 1 month major tick mark spacing
296. int3D array must equal rows columns and must form an even grid in the xy plane ContourDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal grid As Point3D ByVal rows As Integer _ 74 Chart Datasets ByVal columns As Integer _ Ct public ContourDataset String sname pPoint3DI gero int rows int columns This constructor creates a new ContourDataset object that represents a surface not necessarily a regular grid A triangularization alorithm calculates the interconnection of the vertices defining the surface Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal grid As Point3D _ C4 public ContourDataset string sname Point SDIT grig This constructor creates a new ContourDataset object that represents a surface not necessarily a regular grid A triangularization algorithm calculates the interconnection of the vertices defining the surface The length of the x y and z arrays must match Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As Double ByVal y As Double _ ByVal z As Double _ Ct public ContourDataset string sname double x double y double z This constructor creates a new ContourDataset object defined using the supplied SurfaceFunction class evaluated for the range x1 y1 to x2 y2 at intervals equal to x2 x1 columns for the x directi
297. io new Dimension 1 0 1 0 chartVu SetCurrentMouseListener zoomObj Visual Basic Private Class ZoomWithStack Inherits ChartZoom Zooming 323 Public Sub New ByVal component As ChartView _ ByVal transform As CartesianCoordinates ByVal brescale As Boolean MyBase New component transform brescale End Sub New Public Overrides Sub OnMouseDown ByVal mouseevent As MouseEventArgs If mouseevent Button And MouseButtons Right lt gt 0 Then Me PopZoomStack Else MyBase OnMouseDown mouseevent End If End Sub OnMouseDown End Class ZoomWithStack Dim zoomObj As New ZoomWithStack chartVu pTransforml True zoomObj SetButtonMask MouseButtons Left zoomObj SetZzoomYEnable True zoomObj SetZzoomXEnable True zoomObj SetZoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetZoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable True zoomObj SetZzoomStackEnable True set range limits to 1000 ms 1 degree zoomObj SetZzoomRangeLimitsRatio New Dimension 1 0 1 0 chartVu SetCurrentMouseListener zoomObj Super Zooming of multiple physical coordinate systems The ChartZoom class also supports the zooming of multiple physical coordinate systems super zooming During the mouse released event the zoom rectangle is converted from device units into the physical coordinates of each scale and this information is used to re scale each coordinate system and the axis objects associated with them Use the co
298. ip Skip this many rows before starting the read operation columnskip For each row of data skip this many columns before starting this read operation A DateTimeFormatInfo object and a date time format string in the CSV class control the interpretation of the ChartCalendar values The format in the file must match the format specified for the CSV class The underlying conversion mechanism calls the DateTime ToString String formatstring DateTimeFormatInfo info method for the conversion The default format for the date time formatstring object is M dd yy Call the SetDateTimeFomatString method to change the default date time format See the documentation for the Net CF DateTime ToString method to figure out the various formatting options for the date time format string If you are into internationalization and difficult to understand Net CF documentation you can also create your own DateTimeFormatInfo object installing it in the CSV object using CSV SetTimeDateFormat method The date time format string and the DateTimeFormatInfo object apply to both CSV files used for input and CSV files used for output If an attempt is made to read date time values that do not match the desired format the data values are set to invalid date time values 68 Chart Datasets You can retrieve a copy of the date time data using the TimeSimpleDataset GetTimeXData method It returns an array of ChartCalendar objects and it is not a reference to the underly
299. isLab2 new NumericAxisLabels yAxis2 yAxisLab2 SetTextFont theFont chartVu AddChartObject yAxisLab2 436 FAQs NumericAxisLabels yAxisLab3 new NumericAxisLabels yAxis3 yAxisLab3 SetTextFont theFont chartVu AddChartObject yAxisLab3 NumericAxisLabels yAxisLab4 new NumericAxisLabels yAxis4 yAxisLab4 SetTextFont theFont chartVu AddChartObject yAxisLab4 NumericAxisLabels yAxisLab5 new NumericAxisLabels yAxis5 yAxisLab5 SetTextFont theFont chartVu AddChartObject yAxisLab5 Font axisTitleFont new Font Microsoft Sans Serif 10 FontStyle Bold AxisTitle xaxistitle new AxisTitle xAxis axisTitleFont Event Partition chartVu AddChartObject xaxistitle Grid xgrid new Grid xAxis yAxisl ChartObj X AXIS ChartObj GRID MAJOR chartVu AddChartObject xgrid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlot1 SimpleLinePlot thePlot2 new SimpleLinePlot pTransform2 Dataset2 attrib2 chartVu AddChartObject theP1ot2 SimpleLinePlot thePlot3 new SimpleLinePlot pTransform3 Dataset3 attrib3 chartVu AddChartObject thePlot3 SimpleLinePlot thePlot4 new SimpleLinePlot pTransform4 Dataset4 attrib4 chartVu AddChartObject thePlot4 SimpleLinePlot thePlot5 new SimpleLinePlot pTransform5 Dataset5 attrib5 chartVu AddChartObject thePlot5 VB Dim pTransforml As CartesianCoordinat
300. it is not useful and in many cases misleading to scale a graph using a seven day work week and then only plot data using five of the seven days The gaps left in the chart waste valuable chart space For line plots if a line is drawn from the last data point on Friday to the first data point on Monday the result gives a visual impression that the trend from Friday to Monday lasted two days Friday midnight to Sunday midnight when in fact it may have only lasted minutes The QCChart2D CF for the Net Compact Framework date time scaling axes and auto axes classes support dropping weekends as an option from the scale One minute after Friday midnight is 12 01 AM Monday morning Non 24 Hour Days Similarly a full day of time stamped data may not fill an entire 24 hour day Financial markets have specific trading hours For example the NYSE is open from 9 30 AM EST to 4 00 PM EST Stocks traded on the NYSE will have a time stamp in this time range Plotting NYSE stock data for several days using data points sampled every fifteen minutes will result in large gaps in a traditional chart where 2 3 of the day stock trading Scaling and Coordinate Systems 109 is inactive It is possible to treat the unused portion of the day in a manner analogous to weekends It is possible to eliminate unused hours and minutes of a day from the chart coordinate system The QCChart2D CF for the Net Compact Framework coordinate system allows the programmer to sp
301. j FEBRUARY 5 Dim dstop As ChartCalendar New ChartCalendar 1997 ChartObj JANUARY 5 Dim yl As Double 0 0 Dim y2 As Double 55 0 Dim stockTimeScale As TimeCoordinates New TimeCoordinates StockTimeScale SetTimeCoordinateBounds dstart starttod yl dstop stoptod y2 ChartObj WEEK 5D If you use the auto scale routines set the week type and the time of day range before you call the TimeCoordinates AutoScale method because the auto scale routines need to take into account the number of seconds per day and the week type For example C the tradingDay array is initialized with the stock trading dates the stockPrice array is initialized with stock price data TimeSimpleDataset Datasetl new TimeSimpleDataset First tradingDay stockPrice long startTime 9 60 30 60 1000 msecs cooresponding to 9 30 AM long stopTime 16 60 60 1000 msecs cooresponding to 4 00 PM TimeCoordinates stockTimeScale new TimeCoordinates stockTimeScale SetWeekType ChartObj WEEK 5D stockTimeScale SetScaleStartTOD startTime StockTimeScale SetScaleStopTOD stopTime StockTimeScale AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Visual Basic the tradingDay array is initialized with the stock trading dates 120 Scaling and Coordinate Systems the stockPrice array is initialized with stock price data Dim Datasetl As TimeSimpleDataset _ New TimeSimpleDataset First trading
302. k marks in Net CF device coordinates majorticlength The length of major tick marks in Net CF device coordinates tickdir The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX Use the SetColor method to customize the drawing properties of the lines used to draw the axes lines and tick marks Simple polar axes example C double polarmagnitude 5 0 PolarCoordinates polarscale new PolarCoordinates polarmagnitude PolarAxes polarAxes new PolarAxes polarscale Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes Visual Basic Dim polarmagnitude As Double 5 0 Dim polarscale As PolarCoordinates New PolarCoordinates polarmagnitude Dim polarAxes As PolarAxes New PolarAxes polarscale Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes Axes 181 Custom polar axes example C double polarmagnitude 15 0 PolarCoordinates polarscale new PolarCoordinates polarmagnitude PolarAxes polarAxes new PolarAxes polarscale double axestickspace 1 int axesntickspermajor 5 double angletickspace 50 int anglentickspermajor 6 ET double minorticlength double majorticlength 10
303. l subheadFont class2Average 0 9 0 55 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddChartObject class2AverageLabel Text Classes 393 Visual Basic classlAverage Datasetl GetAverageY class2Average Dataset2 GetAverageY Dim classlLabel As New StringLabel pTransforml subheadFont Class 1 ControlChars Lf Average 0 9 0 3 ChartObj NORM GRAPH POS chartVu AddChartObject classlLabel classlAverageLabel New NumericLabel pTransforml subheadFont classlAverage 0 9 0 35 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddChartObject classlAverageLabel Dim class2Label As New StringLabel pTransforml subheadFont Class 2 ControlChars Lf Average 0 9 0 5 ChartObj NORM GRAPH POS hartVu AddChartObject class2Label class2AverageLabel New NumericLabel pTransforml subheadFont class2Average 0 9 0 55 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddChartObject class2AverageLabel 21 Dataset Viewers DatasetViewer Charts and data grids are probably the two most popular ways to display numeric data While Net includes some basic grid controls they tend to be hard to use and database oriented We have created our own grid class that integrates with our chart dataset classes The DatasetViewer can display simple numeric and time based datasets SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset and group numeric and time based datas
304. l SetFillFlag true attribl SetSymbolSize 10 SimpleScatterPlot thePlotl new SimpleScatterPlot pTransforml Dataset2 ChartObj CROSS attribl chartVu AddChartObject thePlot1 ChartAttribute attrib3 new ChartAttribute Color Red 1 DashStyle Solid attrib3 SetFillColor Color Red attrib3 SetFillFlag true attrib3 SetSymbolSize 6 SimpleScatterPlot thePlot3 new SimpleScatterPlot pTransforml Dataset3 ChartObj CIRCLE attrib3 chartVu AddChartObject theP10ot3 Visual Basic Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Dataset3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 125 0 15 0 95 0 725 Dim background As New Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject background Define and add axes axes labels and grids to chart Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag True attribl SetSymbolSize 10 Dim thePlotl As New SimpleScatterPlot pTransforml Dataset2 ChsrtObj CROSS attkribl chartVu AddChartObject thePlotl Dim attrib2 As New ChartAttribute Color Green 3 DashStyle Solid 234 Simple Plot Objects Dim thePlot2 As New SimpleLinePlot pTransforml Datasetl attrib2 chartVu AddChartObject thePlot2 Dim attrib3 As New ChartAttribute Color Red 1 DashStyle S
305. l maxval As Double BE C4 public LinearAxis PhysicalCoordinates transform int axtype public LinearAxis PhysicalCoordinates transform int axtype double minval double maxval transform Places the axes in the coordinate system defined by transform axtype Specifies if the axis is an x axis X AXIS or a y axis Y AXIS minval Sets the minimum value for the axis maxval Sets the maximum value for the axis Other axis properties minor tick mark spacing number of minor tick marks per major tick mark axis intercept tick mark lengths tick mark direction and axis tick mark origin are automatically calculated using an auto axis method Set these properties explicitly if you need to override the automatically calculated values SetAxisIntercept method Visual Basic Public Sub SetAxisIntercept ByVal intercept As Double B 156 Axes Cf public void SetAxisIntercept double intercept SetAxisTicks method Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal tickspace As Double _ ByVal ntickspermajor As Integer _ Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal tickspace As Double _ ByVal nminortickspermajor As Integer ByVal minorticklength As Double _ ByVal majorticklength As Double _ ByVal tickdir As Integer _ C public void SetAxisTicks double tickorigin double tickspace int
306. l set of axes and plot ojects Simple magnify example Adapted from the ZoomExamples MagniViewUserControl1 example C InitializeData Define charts using data magniViewChartl InitializeChart Datasetl Dataset2 Click and drag on the top graph using left mouse button false magniViewChart2 InitializeChart Datasetl Dataset2 The area bounded by the mouse magnify icon is displayed full scale in the bottom graph true Hook up the MagniView class to the source and target classes MagniView magnifyObj new MagniView magniViewChartl magniViewChart2 magniViewChartl pTransforml new Dimension 0 05 0 2 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable true magnifyObj UpdateDuringDrag true magniViewChartl SetCurrentMouseListener magnifyObj Visual Basic InitializeData Define charts using data MagniViewChartl InitializeChart Datasetl Dataset2 _ Click and drag on the top graph using left mouse button False MagniViewChart2 InitializeChart Datasetl Dataset2 _ The area bounded by the mouse magnify icon is displayed full scale in the bottom graph True 1 Hook up the MagniView class to the source and target classes Dim magnifyObj As New MagniView MagniViewChartl MagniViewChart2 _ MagniViewChartl pTransforml New Dimension 0 05 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable True magnifyObj UpdateDuringDrag True
307. le Font theFooterFont new Font Microsoft Sans Serif 9 FontStyle Bold footer new ChartTitle pTransforml theFooterFont Graphs can have background gradients legends titles and data tooltips footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer Visual Basic Dim theTitleFont As New Font Microsoft Sans Serif 16 FontStyle Bold mainTitle New ChartTitle pTransforml theTitleFont Profits are Expected to Rise mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color White chartVu AddChartObject mainTitle Dim theFooterFont As New Font Microsoft Sans Serif 10 FontStyle Bold footer New ChartTitle pTransforml theFooterFont Graphs can have background gradients legends titles and data tooltips footer SetTitleType ChasrtObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 Text Classes 385 footer SetColor Color White chartVu AddChartObject footer Class AxisTitle ChartText AxisTitle The AxisTitle class creates a title for an axis The text is horizontal for both the x axis titles and y axis titles Net CF does not support rotated text The most common constructor is AxisTitle Constructor Visual Basic Overloads Public Sub New _
308. le ChartObj Y AXIS Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Elapsed Time Axes Class ElapsedTimeAxis GraphObj Axis Linear Axis t ElapsedTimeA xes The ElapsedTimeAxis is subclassed from the LinearAxis class and has much in common with it The only difference between the two is the way in which major and minor tick marks are calculated in the CalcAutoAxis method The ElapsedTimeAxis takes into account the base 60 of seconds per minute and minutes per hour and the base 24 of hours per day Read the sections e Linear Axis Minimum and Maximum e Linear Minor and Major Tick Mark Intervals e Linear Axis Intercept e Linear Axis Tick Mark Origin under the discussion of LinearAxis Creating a Elapsed Time Axis There are two main constructors for ElapsedTimeAxes objects The first ElapsedTimeAxes constructor assumes that the axis extents match the extents of the underlying coordinate system transform The second ElapsedTimeA xes constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system Axes 175 ElapsedTimeAxes constructors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal axtype As Integer _ Overloads Public Sub New _ ByVal transf
309. le chart and axis titles use the generic ChartText class instead of the title classes Moving objects example Adapted from the MoveObjects class C ChartView chartVu chartViewl CartesianCoordinates pTransforml new CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR MoveObj mouselistener new MoveObj chartVu mouselistener SetEnable true mouselistener SetMoveObjectFilter GraphObj chartVu SetCurrentMouseListener mouselistener Visual Basic Dim chartVu As ChartView ChartViewl Dim pTransforml As CartesianCoordinates New CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR _ ChartObj AUTOAXES FAR Dim mouselistener As MoveObj New MoveObj chartVu mouselistener SetEnable True mouselistener SetMoveObjectFilter GraphObj chartVu SetCurrentMouseListener mouselistener 312 Moving Chart Objects and Data Points Moving Simple Plot Object Data Points Class MoveData MouseListener MoveData The MoveData mouse listener traps a mouse pressed event and searches through all of the data points of the plot objects in the view The data point closest to the mouse cursor location is compared against a threshold value 10 device units or pixels by default If the data point is within the threshold and as long as the moue buttons is held down it tracks the mouse Release the
310. led and being used ii 3 RESTRICTIONS You may not reverse engineer de compile or disassemble the SOFTWARE except and only to the extent that such activity 1s expressly permitted by applicable law notwithstanding this limitation You may not rent lease or lend the SOFTWARE You may not use the SOFTWARE to perform any illegal purpose 4 SUPPORT SERVICES Quinn Curtis Inc may provide you with support services related to the SOFTWARE Use of Support Services is governed by the Quinn Curtis Inc polices and programs described in the user manual in online documentation and or other Quinn Curtis Inc provided materials as they may be modified from time to time Any supplemental SOFTWARE code provided to you as part of the Support Services shall be considered part of the SOFTWARE and subject to the terms and conditions of this EULA With respect to technical information you provide to Quinn Curtis Inc as part of the Support Services Quinn Curtis Inc may use such information for its business purposes including for product support and development Quinn Curtis Inc will not utilize such technical information in a form that personally identifies you 5 TERMINATION Without prejudice to any other rights Quinn Curtis Inc may terminate this EULA if you fail to comply with the terms and conditions of this EULA In such event you must destroy all copies of the SOFTWARE 6 COPYRIGHT The SOFTWARE is protected by United States copyright l
311. loads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal basearrow As Arrow _ ByVal attrib As ChartAttribute Ct public ArrowPlot PhysicalCoordinates transform GroupDataset dataset Arrow basearrow ChartAttribute attrib transform The coordinate system for the new ArrowPlot object dataset The group dataset sets the position size and rotation of individual arrows The numer of groups must be three Orgainize the data in the dataset in the following manner X x position of the arrow point Group Plot Objects 245 Y 0 y position of the arrow point Y 1 Size of the arrow A size of 0 05 creates an arrow with a length equal to 0 05 in NORM PLOT POS coordinates Y 2 The rotation of the arrow using the point of the arrow as the rotation origin in degrees basearrow An instance of an Arrow object used to draw the arrows in this ArrowPlot object attrib Sets the color line and fill characteristics for the arrows in this ArrowPlot object An individual arrow in an arrow plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Arrow plot example extracted from the example program BigChartDemo class ArrowPlotChart C GroupDataset Datasetl new GroupDataset First x1 y1 Datasetl SetAutoScaleNumberGroups 1 CartesianCoordinates pTransforml
312. loatingBarPlot class and displays floating bar plots The bars are free floating because each bar does not reference a fixed base value as do the simple bar plots stacked bar plots and group bar plots The number of groups must be two The X Y 0 values of the group dataset represent the starting points of each bar the X Y 1 values of the group dataset represent the ending points of each bar All bars in a given FloatingBarPlot object have the same width FloatingBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rbarwidth As Double _ ByVal attrib As ChartAttribute ByVal nbarjust As Integer _ Ct public FloatingBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth ChartAttribute attrib int nbarjust transform The coordinate system for the new FloatingBarPlot object dataset The floating bar plot represents the values in this group dataset The number of groups must be two The X Y 0 values of the group dataset represent the starting points of each bar the X Y 1 values of the group dataset represent the ending points of each bar rbarwidth The width of the floating bars in units of the independent axis attrib Specifies the attributes line and fill color for the floating bars nbarjust Specifies the justification with respect to the independent data value Use one of
313. lot class and displays data in a simple line marker plot format AntennaScatterPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As AntennaCoordinates _ ByVal dataset As SimpleDataset ByVal symtype As Integer _ ByVal lineattrib As ChartAttribute Polar Charts 363 ByVal symbolattrib As ChartAttribute Ct public AntennaLineMarkerPlot AntennaCoordinates transform SimpleDataset dataset int symtype ChartAttribute lineattrib ChartAttribute symbolattrib transform dataset symtype lineattrib symbolattrib Antenna line marker The coordinate system for the new AntennaLineMarkerPlot object The line marker plot represents the values in this dataset The symbol used in the line marker plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE Specifies the attributes line color and line style for the line part of the line marker plot Specifies the attributes line and fill color for the symbol part of the line marker plot plot extracted from the example program Antenna AntennaLineMarkerChart C ChartAttribute attribl attribl SymbolSize 7 ChartAttribute attrib2 Color Blue attrib2 SymbolSize 7 ChartAttribute attrib3 Color Yellow ChartAttribute attrib4 Color MediumPurple new ChartAttribute Color Red 1 DashStyle Solid new ChartAt
314. lot class is an abstract class representing plot types that use data organized as arrays of x and y values where an x value represents the radial value of a point in antenna coordinates and the y value represents the angle of a point in antenna coordinates Antenna plots types include line plots scatter plots line marker plots and annotations The antenna angle values stored as the y values in the SimpleDataset should be specified in degrees If the raw data is in radians convert the data to degrees using the ChartSupport ToDegrees method If you plan to create polar charts you need to also familiarize yourself with the polar charting classes describe in the other chapters of this manual These are the chapters on coordinate systems PolarCoordinates in Chapter 4 axes PolarAxes in Chapter 7 axis labels PolarAxesLabels in Chapter 8 and grids PolarGrids in Chapter 9 The same is true if you plan to create antenna charts Refer to the documentation in the chapters on coordinate systems AntennaCoordinates in Chapter 4 axes AntennaAxes in Chapter 7 axis labels AntennaAxesLabels in Chapter 8 and grids AntennaGrids in Chapter 9 354 Polar Charts The ChartZoom MagniView and MoveCoordinates classes require a rectangular coordinate system and will not work with polar and antenna charts The MoveData class does work with polar and antenna charts Polar Plots Class PolarLinePlot GraphObj ChartPlot PolarPlo
315. lumns before reading the first value from the row Example of creating a contour dataset from an array of Point3D C int nrows 11 ncols 11 int i j count 0 double x y z double tempx tempy double startx 6 0 starty 6 0 double stepx 12 0 nrows 1 stepy 12 0 ncols 1 Point3D pointarray Chart Datasets pointarray new Point3D nrows ncols x startx y 7 starty for i 0 i nrows i x startx for js0 j necolsr 34 pointarray count new Point3D z 2000 950 Math Sin Math Sqrt x x y y pointarray count SetLocation tempx tempy Zz x stepx count 4 y stepy This method triangulates data into a surface ContourDataset datasetl new ContourDataset Contour Dataset pointarray This method uses the characteristic that the data is an even spaced grid ContourDataset dataset2 new ContourDataset Contour Dataset pointarray nrows ncols Visual Basic Dim nrows As Integer 11 Dim ncols As Integer 11 Dim count As Integer 0 Dim i j As Integer Dim x y z As Double Dim tempx tempy As Double Dim startx As Double 6 0 Dim starty As Double 6 0 Dim stepx As Double 12 0 nrows 1 Dim stepy As Double 12 0 ncols 1 Dim pointarray nrows ncols 1 As Point3D x startx y starty For i 0 To nrows 1 X startx For j 0 To ncols 1 pointarray count New Point3D 77 78
316. m nearest point calculations The axis classes use this class to organize the location of the individual tick marks of an axis This is a utility class that defines complex 3D shapes as a list of simple 3 sided polygons The contour plotting routines use it This is a utility class that extends the RectangleF class using doubles as internal storage Class Architecture 59 A diagram depicts the class hierarchy of the QCChart2D CF for the Net Compact Framework library ChartObj BoolArray Arrow ChartCalendar CSV Dimension Point3D NearestPointData Polysurface ChartScale LinearScale LogScale TimeScale ElapsedTimeScale UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates PolarCoordinates AntennaCoordinates TimeCoordinates ElapsedTimeCoordinates ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset GroupDataset TimeGroup Dataset ElapsedTimeGroupDataset AutoScale LinearAutoScale LogAutoScale TimeAutoScale ElapsedTimeAutoScale MouseListener MoveObj FindObj DataToolTip ChartZoom MagniView MoveCoordinates MultiMouseListener DataCursor MoveData ChartAttribute System Windows Forms UserControl ChartView Rectangle2D Point2D Point3D GroupPoint2D DoubleArray DoubleArray2D Polysurface 60 Class Architecture GraphObj TickMark Axis LinearAxis PolarAxes AntennaAxes LogAxis TimeAxis ElapsedTimeAxis ChartText
317. mXEnable and SetZoomY Enable methods Set the rounding mode associated with rescale operations using the SetZoomXRoundMode and SetZoomY RoundMode methods Call the ChartZoom PopZoomStack method at any time and the chart scale reverts to the minimum and maximum values of the previous zoom operation Repeated calls to the PopZoomStack method return the chart scale is to its original condition after which the PopZoomStack method has no effect Integrated zoom stack processing Starting with Revision 2 0 zoom stack processing is internal to ChartZoom class There is no need to subclass the ChartZoom class in order to implement a zoom stack Just set the ChartZoom InternalZoomStackProcessing property true zoomObj InternalZoomStackProcesssing true Return to a previous zoom level by right clicking the mouse Change the zoom stack button using the ZoomStackButtonMask property Setting it to MouseButtons Left MouseButtons Right or MouseButtons Middle Aspect Ratio Correction Starting with Revision 2 0 you can force the zoom rectangle to maintain a fixed aspect ratio Use the ChartZoom ArCorrectionMode property to specify the aspect ratio correction mode ZOOM NO AR CORRECTION Allow the x and y dimension of the zoom rectangle to change the overall charts physical aspect ratio This is the default mode and the only mode supported prior to Revision 2 0 ZOOM X AR CORRECTION Track the x dimension of the zoom rectangle and calculate the y dime
318. markdertype The marker type Use one of the Marker marker type constants MARKER VLINE MARKER BOX rsize The size in Net CF device coordinates of the MARKER BOX and MARKER CROSS style cursors See the Marker constructor description for more information about the Marker type constants Create the DataCursor object and then install it using the ChartView SetCurrentMouseListener method This adds the DataCursor object as a Data Markers and Data Cursors 303 MouseListener to the ChartView object Enable Disable the function using DataCursor SetEnable method Call DataCursor SetCurrentMouseListener null to remove the object as a mouse listener for the chart view Since the DataCursor class implements mouse event delegates it has methods implementing the mouse events OnMouseMove OnDoubleClick OnClick OnMouseDown and OnMouseUp The default usage of the DataCursor class creates the data marker when the mouse is pressed As long as the mouse is pressed the data cursor tracks the mouse position Release the mouse button and the marker disappears When using data markers it is often desirable to do additional things during the mouse events In this case you derive a new class from DataCursor override the mouse events that you want to intercept and add your own code to these events Make sure you call the parents version of the same mouse event function so that the data cursor continues to track the mouse Simple data cursor example Adap
319. marks fall on the first day of each month and minor tick marks fall on the first day of each week Combine these irregularities with a 5 or 7 day workweek option and the non 24 hour day option and you can see that a generalized algorithm to define the positions of tick marks is a difficult task For example you are a stock trader and you want to track the price volume characteristics of a stock from the last 5 minutes of the regular trading day to the first 5 minutes of the next regular trading day specifically from 3 55 PM Friday Sept 29 2000 to 9 35 AM Monday Oct 2 2000 The time range under consideration is only 10 minutes since the market closes Friday at 4 00 PM and opens Monday at 9 30 PM The resulting axis should reflect this 10 minute range even though the actual time elapsed is 3 930 minutes You should be able to specify the axis minimum and maximum values using the actual dates and times You also need to set a 5 day workweek mode and establish a day that has a time range of 9 30 AM to 4 00 PM Date Time Axis Intercept A date time axis has an intercept value the same as a linear axis Since the intercept value is specified using the scale of the perpendicular axis if the perpendicular axis is linear the intercept value can be positive negative or 0 0 If the perpendicular axis is logarithmic the intercept value is restricted to a positive range 170 Axes There are three main constructors for TimeAxis objects The firs
320. maxvalue AntennaAxes antennaAxes new AntennaAxes antennascale double axestickspace 1 int axesntickspermajor 5 double angletickspace 5 int anglentickspermajor 6 T double minorticlength double majorticlength 10 int tickdir ChartObj AXIS CENTER antennaAxes SetAntennaAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor minorticlength majorticlength tickdir Add the Antenna axes to the chartVu object chartVu AddChartObject antennaAxes Visual Basic Dim minvalue As Double 40 Dim maxvalue As Double 20 Dim antennascale As AntennaCoordinates _ New AntennaCoordinates minvalue maxvalue Dim antennaAxes As AntennaAxes New AntennaAxes antennascale Dim axestickspace As Double 1 Dim axesntickspermajor As Integer 5 Dim angletickspace As Double 5 Dim anglentickspermajor As Integer 6 Dim minorticlength As Double 5 Dim majorticlength As Double 10 Dim tickdir As Integer ChartObj AXIS CENTER 186 Axes antennaAxes SetAntennaAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor minorticlength majorticlength tickdir Add the Antenna axes to the chartVu object chartVu AddChartObject antennaAxes 8 Axis Labels AxisLabels NumericAxisLabels TimeA xisLabels ElapsedTimeAxisLabels StringAxisLabels PolarAxesLabels AntennaAxesLabels Axis Labels Axis labels are numeric or text strings placed next
321. ming Net CF applications using Visual Studio 2003 and no projects for VS 2003 have been included with the software The current version of the software has been tested to be compatible with VS 2005 and VS 2008 Tutorials Tutorials that describe how to get started with the QCChart2D CF for the Net Compact Framework charting software are found in Chapter 23 Using QCChart2D CF for the Net Compact Framework to Create Windows Applications Net Compact Framework Background The goal of the Microsoft Net Compact Framework is according to Microsoft The Net Framework and the Net Compact Framework provide a consistent programming model across the full range of Windows platforms and expose that programming model through a single unified tool set Visual Studio Net Together Visual Studio and the Net Compact Framework enable millions of desktop Visual Basic developers and the rapidly growing market of C developers to begin building smart mobile applications Features of the Net Compact Framework and Visual Studio Net include support for XML and Web services the ability to integrate components written in multiple programming languages and developer productivity features such as integrated rich device emulator support a visual drag and drop forms designer a comprehensive set of user interface controls remote debugging support and simplified application deployment Limitation of the Net API Compact Framework API Microsoft Ne
322. mpleTimeScale simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed TimeAxis xAxis new TimeAxis simpleTimeScale xAxisTickMarkFormat xAxis SetAxisTicksAttributes xAxisMinorTickLength xAxisMajorTickLength xAxisTickDirection Create the linear y axis LinearAxis yAxis new LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Visual Basic Define a Time coordinate system Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim yMin As Double 0 Dim yMax As Double 105 Dim xAxisTickMarkFormat As Integer ChartObj TIMEAXIS MONTHWEEK Dim xAxisMinorTickLength As Double 5 Dim xAxisMajorTickLength As Double 10 Dim xAxisTickDirection As Integer ChartObj AXIS MIN Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed Dim xAxis As TimeAxis New TimeAxis simpleTimeScale xAxisTickMarkFormat xAxis SetAxisTicksAttributes xAxisMinorTickLength xAxisMajorTickLength xAxisTickDirection Create the linear y axis 174 Axes Dim yAxis As LinearAxis New LinearAxis simpleTimeSca
323. my chart You can place the ChartView object and the scroll bar in a parent container and use a layout manager to position everything If you place the scroll bar in the ChartView you can still position it using a layout manager The ChartView will always use the entire content area of the underlying Control for its canvas and the scroll bars will sit on top of this not side by side The example program LinePlotScrollBar uses two scroll bars a horizontal scroll bar to control scrolling of the x axis and a vertical scroll bar that controls the magnitude of the y axis You need to add hScrollBarl Scroll and vScrollBarl Scroll event listeners to the ChartView class to process changes in scroll bar values As of this writing there seems to be serious problems with the Net scrollbars largely due to the circumstance that they do not support trapping MouseDown and MouseUp 450 FAQs events Since Net Compact Framework devices are relatively slow you do not want to place CPU intensive code in the HScrollBar1 ValueChanged or VScrollBarl ValueChanged event handler as we do in the regular Net version of QCChart2D This is because that event is triggered for every pixel change in the value of the scrollbar causing it to get bogged down when you try and move the scrollbar A better technique is to only process changes in the graph when the MouseUp event is triggered by the scrollbar signifying that the scroll operation is complete But as we said t
324. n the end of the label EXPONENTFORMAT The value of a label is multiplied by 100 and the character is appended on the end of the label CURRENCEYBUSINESSFORMAT A character is appended to the front of the label and the values are abbreviated the same as the BUSINESSFORMAT CURRENCEYFORMAT A character is appended to the front of the label Axis Labels 193 NumericAxisLabels constructor There is only one main constructor for NumericAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As Axis _ C public NumericAxisLabels Axis baseaxis baseaxis This is the axis the axis labels are for Other axis label properties font rotation numeric format axis labels direction and numeric precision are automatically set These properties can be explicitly set if you need to override the automatically calculated values SetAxisLabels method Visual Basic Overloads Public Sub SetAxisLabels _ ByVal font As Font _ ByVal rotation As Double _ ByVal labdir As Integer _ ByVal decimalpos As Integer _ ByVal labelends As Integer _ ByVal labcolor As Color _ C public void SetAxisLabels Font font double rotation int labdir int decimalpos int labelends Color laboolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ C public void SetAxisLabelsFormat 194 Axis
325. n this group dataset The number of groups must be four Orgainize the data in the following manner The x values of the group dataset set the x positions of the candlestick objects The Y 0 values of the group dataset represent the values for Open the Y 1 values for High the Y 2 values for Low and the Y 3 values for Close The width of the candlestick box in physical coordinates Specifies the default attributes line color and fill color of the candlestick lines and box Specifies the attributes line color and fill color of the candlestick lines when the close value is greater than the open value An individual candlestick in a candlestick plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Candlestick plot example extracted from the example program BigChartDemo class CandlestickFinPlot C TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData 256 Group Plot Objects Define axes axes labels and grids ChartAttribute defaultattrib new ChartAttribute Color Black 1 DashStyle Solid Color White defaultattrib SetFillFlag true ChartAttribute fillattrib new ChartAttribute Color Black 1 DashStyle Solid Color Red fillattrib SetFillFlag true CandlestickPlot thePlotl new CandlestickPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartO
326. name Specifies the name of the dataset x An array of ChartCalendar dates that specifies the x values of a dataset The length of the x array sets the number of columns for the group dataset y An array that specifies the y values of a group dataset where y has the dimensions number of rows number of columns The number of rows in the y array sets the number of groups in the group dataset The number of columns in the y array must match the length of the x array The number of columns in the group dataset is the value of x Length property The number of columns in the y array must match the length of the x array and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal columnskip As Integer _ C4 public TimeGroupDataset CSV csv string filename int rowskip int columnskip CSV An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation 64 Chart Datasets columnskip For each row of data skip this many columns before reading the There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the time values and subsequent columns represent the
327. name of the dataset x An array that specifies the x values of a group dataset The length of the x array sets the number of columns for the group dataset y An array that specifies the y values of a group dataset where y has the dimensions number of rows number of columns The number of rows in the y array sets the number of groups in the group dataset The number of columns in the y array must match the length of the x array The number of columns in the group dataset is the value of x Length property The number of columns in the y array must match the length of the x array and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped The next constructor creates a dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the x values and subsequent columns represent the y values where each column is a group If you use the ROW MAJOR format the first row represents the x values and subsequent rows represent the y values where each row is a group Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Chart Datasets 81 Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String ByV
328. nates ByVal dataset As GroupDataset _ ByVal rbarwidth As Double _ ByVal attrib As ChartAttribute ByVal nbarjust As Integer _ C public FloatingStackedBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth ChartAttribute attrib int nbarjust transform The coordinate system for the new FloatingStackedBarPlot object dataset The starting value for each stacked bar is Y 0 Each bar after that is defined by the succeeding value in the group value array Y 1 Y 2 rbarwidth The width of the floating bars in units of the independent axis attrib An array of ChartAttribute specifying the color for each bar The number of colors and the length of the array should be one less than the number of groups in the source dataset nbarjust Specifies the justification with respect to the independent data value Use one of the justification constants JUSTIFY MIN JUSTIFY CENTER JUSTIFY MAX Group Plot Objects 267 FloatingStackedBarPlot plots can be used in place of OHLCPlots or CandlestickPlots for the display of financial information See the example below Floating stacked bar plot example for displaying stock data Extracted from the NewDemosRev2 FloatingStackedBars example C TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData pTransforml new TimeCoordinates pTransforml SetWeekType weekmode pTransforml AutoSc
329. nates of the legend rectangle ry The y position in chart normalized coordinates of the legend rectangle rwidth The width in chart normalized coordinates of the legend rectangle rheight The height in chart normalized coordinates of the legend rectangle attrib Specifies the outline color and fill color for the legend rectangle nlayoutmode Specifies if the legend has a horizontal or vertical layout Use one of the orientation constants HORIZ DIR row major or VERT DIR column major Legends 369 Add legend items to a legend using one of the AddLegendItem methods AddLegendItem methods Visual Basic Overloads Public Function AddLegendItem ByVal stext As String _ ByVal nsymbol As Integer _ ByVal attrib As ChartAttribute ByVal thefont As Font _ As Integer Overloads Public Function AddLegendItem ByVal stext As String _ ByVal symbolshape As GraphicsPath ByVal attrib As ChartAttribute ByVal thefont As Font _ As Integer Overloads Public Function AddLegendItem ByVal legenditem As LegendItem _ As Integer Overloads Public Function AddLegendItem ByVal stext As String _ ByVal nsymbol As Integer _ ByVal chartobj As GraphObj ByVal thefont As Font _ As Integer Overloads Public Function AddLegendItem ByVal stext As String _ ByVal symbolshape As GraphicsPath ByVal chartobj As GraphObj ByVal thefont As Font _ As Integer Overloads Public Function AddLegendItem ByVal stext
330. nd y arrays must be the same length and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped The next constructor creates an elapsed time dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the time values and the second column the y values If you use the ROW MAJOR format the first row represents the time values and the second row the y values Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal columnskip As Integer _ C public ElapsedTimeSimpleDataset CSV csv string filename int rowskip int columnskip csv An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation columnskip For each row of data skip this many columns before starting this read operation The only supported format for elapsed time values in a CSV file is d hh mm ss fff 3 14 23 12 333 as an example of an elapsed time of three days 14 hours 23 minutes 12 seconds and 333 milliseconds You can also modify a p
331. nge of the radial scale centered on the origin Class AntennaAxes GraphObj Axis Linear Axis AntennaAxes The AntennaAxes class creates an antenna axes object that combines a linear y axis for measurement of the radial values and a circular axis for the measurement of the angular values The AntennaAxes class extends the LinearAxis class This is useful because the LinearAxis already has member variables that define properties and draw the tick marks for the circular axis Antenna Axis Minimum and Maximum Antenna axes use two scaling values a minimum and maximum radius value The radius minimum value is set at the origin of the coordinate system and the radius maximum value at the outer edge The radius starting and ending values can be positive or negative The maximum value should always be greater than the minimum value though The angular scale is always 360 degrees corresponding to a full circle The angular scale starts with 0 degrees at 12 00 and increases clockwise Antenna Axis Minor and Major Tick Mark Intervals Antenna axes use two sets of tick mark properties one set for the y axis and the other set for the circular axis The y axis has major and minor tick mark properties as does the circular axis Axes 183 Creating antenna axes There is only one constructor for AntennaAxes objects AntennaAxes AntennaCoordinates transform transform The transform coordinate system defines the axis extents
332. nk of a spreadsheet file that looks like x values x 0 x 1 x 2 x 3 x 4 x 5 y values yO y y yB yl4 yi5 number of xy data pairs numberDatapoints numberColumns 6 This would be the ROW_MAJOR format if the data were stored in a CSV file It has two main constructors This constructor creates a dataset using the x and y values stored in arrays SimpleDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String ByVal x As Double _ ByVal y As Double C public SimpleDataset string sname double x double y sname Specifies the name of the dataset x An array that specifies the x values of a dataset y An array that specifies the y values of a dataset The length of the y array must match the length of the x array The number of data points is the value of x Length property The x and y arrays must be the same length and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped Chart Datasets 63 The next constructor creates a dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the x values and the second column the y values If you use the ROW MAJOR format
333. nsion in order to maintain a fixed aspect ratio ZOOM Y AR CORRECTION Track the y dimension of the zoom rectangle and calculate the x dimension in order to maintain a fixed aspect ratio The target aspect ratio is the aspect ratio of the coordinate system s at the time the ChartZoom object is intitialized zoomObj ArCorrectionMode ChartObj ZOOM X AR CORRECTION 322 Zooming Simple zoom example Adapted from the SimpleZoom example In this example a new class derives from the ChartZoom class and the MousePressed event overridden The event invokes the PopZoomStack method Otherwise the default operation of the ChartZoom class controls everything else C private class ZoomWithStack ChartZoom public ZoomWithStack ChartView component CartesianCoordinates transform bool brescale base component transform brescale public override void MousePressed MouseEventArgs mouseevent if mouseevent Button amp MouseButtons Right 0 this PopZoomStack else base MousePressed mouseevent ZoomWithStack zoomObj new ZoomWithStack chartVu pTransforml true zoomObj SetButtonMask MouseButtons Left zoomObj SetZzoomYEnable true zoomObj SetZzoomXEnable true zoomObj SetZoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetzoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable true zoomObj SetZzoomStackEnable true set range limits to 1000 ms 1 degree zoomObj SetZzoomRangeLimitsRat
334. nsive time formatting capability Use it to label axes created using the ElapsedTimeAxis class Elapsed Time Label formats Axis Labels 203 A time axis label can take several forms The TimeFormat property controls the elapsed time format TimeFormat Format Constant Example String Result TIMEDATEFORMAT MS 12 33 TIMEDATEFORMAT 24HMS 23 12 33 TIMEDATEFORMAT 24HM 23 12 The TIMEDATEFORMAT MS and TIMEDATEFORMAT formats can also have a decimal precision appending a decimal point and the specified number of significant digits to the right of the time lable seconds i e 12 33 7432 This is set using the AxisLabelsDecimalPos property ElapsedTimeAxis Labels constructor There is only one main constructor for TimeAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As ElapsedTimeAxis Ct public ElapsedTimeAxisLabels ElapsedTimeAxis baseaxis baseaxis This is the elapsed time axis the axis labels are for Other axis label properties font rotation time format axis labels direction and numeric precision are automatically set These properties can be explicitly set if you need to override the automatically calculated values SetAxisLabels method Visual Basic Overloads Public Sub SetAxisLabels _ ByVal font As Font _ ByVal rotation As Double _ ByVal labdir As Integer _ ByVal decimalpos As Integer _ ByVal timeformat As Integer _ ByVal labelends As Integer _ ByVal labcolor As Colo
335. nstructor below in order to super zoom a chart that has multiple coordinate systems and axes ChartZoom constructor 324 Zooming Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal transforms As PhysicalCoordinates ByVal brescale As Boolean _ Ct public ChartZoom ChartView component PhysicalCoordinates transforms bool brescale component A reference to the ChartView object that the chart is placed in transforms An array size numtransforms of the PhysicalCoordinates objects associated with the zoom operation brescale True designates that the all of the scales should be re scaled once the final zoom rectangle is ascertained Call the ChartZoom SetEnable true method to enable the zoom object Restrict zooming in the x or y direction using the SetZoomXEnable and SetZoomY Enable methods Set the rounding mode associated with rescale operations using the SetZoomXRoundMode and SetZoomYRoundMode methods Call the ChartZoom PopZoomStack method at any time and the chart scale reverts to the minimum and maximum values of the previous zoom operation Repeated calls to the PopZoomStack method return the chart scale is to its original condition after which the PopZoomStack method has no effect Starting with Revision 2 0 zoom stack processing is internal to ChartZoom class There is no need to subclass the ChartZoom class in order to implement a zoom stack Just set the ChartZoom Inte
336. nt mouseevent Button And GetButtonMask lt gt 0 Then Find nearest point for each line plot object Dim location As Point2D GetLocation bfoundl cplotl CalcNearestPoint location ChartObj FNP NORMDIST nearestPointObjl bfound2 cplot2 CalcNearestPoint location ChartObj FNP NORMDIST nearestPointObj2 If bfoundl And bfound2 Then choose the nearest point If nearestPointObjl GetNearestPointMinDistance _ nearestPointObj2 GetNearestPointMinDistance Then 307 308 Data Markers and Data Cursors nearestPoint nearestPointObjl GetNearestPoint Else nearestPoint nearestPointObj2 GetNearestPoint End If create marker object at place it at the nearest point Dim amarker As New Marker GetChartObjScale MARKER BOX _ n arestPoint G tx nearestPoint GetY 10 0 PHYS POS chartview AddChartObject amarker rNumericLabelCntr 1 0 Add a numeric label the identifies the marker pointLabel New NumericLabel GetChartObjScale textCoordsFont _ rNumericLabelCntr nearestPoint oetX nearestPoint GCetY _ PHYS POS DECIMALFORMAT 0 Nudge text to the right and up so that it does not write over marker pointLabel SetTextNudge 5 5 chartview AddChartObject pointLabel chartview UpdateDraw End If End If End Sub OnMouseUp End Class CustomChartDataCursor Another common reason for locating a data point is to display information associated with that data point A good example is stock market dat
337. ntickspermajor public void SetAxisTicks double tickorigin double tickspace int nminortickspermajor double minorticklength double majorticklength int tickdir intercept tickorigin tickspace ntickspermajor minorticklength majorticklength tickdir Sets the intercept of this axis with the perpendicular axis in physical coordinates The tick marks start at this value Specifies the spacing between minor tick marks Specifies the number of minor tick marks per major tick mark The length of minor tick marks in Net CF device coordinates The length of major tick marks in Net CF device coordinates The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX Axes 157 Use the SetColor method to customize the drawing properties of the lines used to draw the axis line and tick marks Simple linear axis example C Define the coordinate system double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale new CartesianCoordinates xMin yMin xMax yMax Create the x and y axes LinearAxis xAxis new LinearAxis simpleScale ChartObj X AXIS LinearAxis yAxis new LinearAxis simpleScale ChartObj Y AXIS Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObje
338. o find the sum for every N points the minimum value of every N points the maximum of every N points or both the minimum and maximum of every 2N points The last compression method minimum and maximum will always capture any minimums and maximum in the data The result is a 1000 point compressed dataset where there are at least two data points per pixel of horizontal resolution will look just like the 100K point dataset only display a hundred of times faster The Datset classes all include compression methods SimpleDataset CompressSimpleDataset GroupDataset CompressGroupDataset TimeSimpleDataset CompressTimeSimpleDataset and TimeGroupDataset CompressTimeGroupDataset TimeGroupDataset CompressTimeFieldSimpleDataset TimeGroupDataset CompressTimeFieldGroupDataset that operate on the existing dataset and return a new compressed dataset The CompressTimeFieldSimpleData and CompressTimeFieldGroupDataset are particular useful because they do not use a fixed sample size of N instead they compress data so that adjacent time values are an increment of a specific time field ChartObj DAY OF YEAR ChartObj WEEK OF YEAR ChartObj MONTH ChartObj Y ear Compressing data by month and year obviously requires a varying sample size Once created connect the compressed dataset to the ChartPlot object used to display the dataset C nNumPnts 100000 TimeSimpleDataset RawDataset new TimeSimpleDataset Raw xtimedata ydata nNumPn
339. object in the ChartView draw list but disable its display by calling that objects GraphObj SetChartObjEnable method If you disable an object you will still need to call the ChartView UpdateDraw method to redraw the chart without that object Placing Multiple Charts in a ChartView One way to create multiple charts is to create multiple instances of the ChartView class and add each ChartView object to a Net CF container object such as a Control A Net CF layout manager manages the position and size of each ChartView Another way is to place multiple charts in the same ChartView object This makes it easier to guarantee alignment between the axes of separate graphs The trick to doing this is to create separate coordinate system objects CartesianCoordinates TimeCoordinates or PolarCoordinates for each chart and to position the plot area of each coordinate system so that they do not overlap Use one of the coordinate systems SetGraphBorder methods Many of the examples use this technique including GroupBarPlotChart DoubleBarPlot OHLFinPlot FinOptions DynPieChart PieAndLineChart and PieAndBarChart Multiple charts in a ChartView example extracted from the example program BigChartDemo class OHLCFinPlot C 142 The Chart View pTransforml new TimeCoordinates plransforml SetGraphBorderDiagonal 0 1 15 90 0 6 pTransform2 new TimeCoordinates pTransform2 SetGraphBorderDiagonal 0 1 7 90 0 875 Visu
340. ockPriceData 0 0 25 open StockPriceData 1 0 26 high stockPriceData 2 0 24 low For i 1 To nNumPnts 1 xValues i currentdate Clone StockPruceDara 3 x StockPriceData s 2 1 _ 3 0 52 ChartSupport GetRandomDouble close stockPriceData Q i stockPriceDsata 3 i _ 2 0 5 ChartSupport GetRandomDouble open minval Math Min stockPriceData 3 i stockPriceData 0 i maxval Math Max stockPriceData 3 i stockPriceData 0 i StockPriceData 1 i maxval 1 5 ChartSupport GetRandomDouble high stockPriceData 2 i minval 1 5 ChartSupport GetRandomDouble low currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode Next i Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData Example of creating a simple time datasets from a CSV file CSV csvDataFile new CSV TimeGroupDataset Datasetl new TimeGroupDataset csvDataFile TimeGroupDataset csv 0 0 Write out dataset as a CSV file under a different file name Datasetl WriteTimeGroupDataset csvDataFile TimeGroupDataset2 csv Visual Basic Chart Datasets 87 Default time date format is M dd yyyy Dim csvDataFile As CSV New CSV Create a dataset based on a previously saved csv file Dim Datasetl As TimeGroupDataset _ New TimeGroupDataset csvDataFile TimeGroupDataset csv 0 0 Write out dataset as a CVS file Datasetl WriteTimeGroupDataset csvDa
341. of minor tick marks per major tick mark for the x and y axes angletickspace Specifies the spacing in degrees between minor tick marks for the radial axis anglentickspermajor Specifies the number of minor tick marks per major tick mark for the radial axis minorticlength The length of minor tick marks in Net device coordinates majorticlength The length of major tick marks in Net device coordinates tickdir The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX Use the SetLineWidth SetLineStyle and SetColor methods to customize the drawing properties of the lines used to draw the axes lines and tick marks Simple antenna axes example C double minvalue 40 maxvalue 20 AntennaCoordinates antennascale new AntennaCoordinates minvalue maxvalue AntennaAxes antennaAxes new AntennaAxes antennascale Add the Antenna axes to the chartVu object chartVu AddChartObject antennaAxes Visual Basic Dim minvalue As Double 40 Dim maxvalue As Double 20 Dim antennascale As AntennaCoordinates _ New AntennaCoordinates minvalue maxvalue Axes 185 Dim antennaAxes As AntennaAxes New AntennaAxes antennascale Add the Antenna axes to the chartVu object chartVu AddChartObject antennaAxes Custom antenna axes example C double minvalue 40 maxvalue 20 AntennaCoordinates antennascale new AntennaCoordinates minvalue
342. of separate graphs The trick to doing this is to create separate coordinate system objects CartesianCoordinates TimeCoordinates or PolarCoordinates for each chart and to position the plot area of each coordinate system so that they do not overlap Use one of the coordinate systems SetGraphBorder methods Many of the examples use this technique including GroupBarPlotChart DoubleBarPlot OHLFinPlot FinOptions DynPieChart PieAndLineChart and PieAndBarChart The example below was extracted from the OHLCFinPlot class C pTransforml new TimeCoordinates pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 pTransform2 new TimeCoordinates prransform2 SetGraphBorderDiagonal 0 1 7 90 0 875 Visual Basic pTransforml new TimeCoordinates pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 pTransform2 new TimeCoordinates pTransform2 SetGraphBorderDiagonal 0 1 7 90 0 875 15 How doI use the QCChart2D CF software to generate JPG DIB BMP GIF EMF WMF etc files The Net Compact Framework does not support the imaging routines needed to save charts as bitmap image files or metafiles If you need to save charts as image files or metafiles you should be using the related product QCChart2D for Net 448 FAQs 16 Sometimes the major tick marks of an axis are missing the associated tick mark label The axis labeling routines are quite intelligent Before the label is drawn at its
343. oint at a time using SetElapsedTimeXDataValue or SetElapsedTimeYDataValue if you are using TimeSpan objects and SetYDataValue 72 Chart Datasets or SetXDataValue if you use millisecond values If you need to add new points to the dataset increasing its size use one of the AddDataPoint or InsertDataPoint methods Delete data points using the DeleteDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a simple elapsed time datasets extracted from the NewDemosRev2 ElapsedTimeChart example program int numPoints 30 TimeSpan xl new TimeSpan numPoints double yl new double numPoints double y2 new double numPoints int i for i20 i lt numPoints i xl i TimeSpan FromMilliseconds i 30 1000 30000 milliseconds increment Or you can use seconds and the FromSeconds method xl i TimeSpan FromSeconds i 30 30 seconds increment if Math Sin xl i TotalSeconds 20 0 gt 0 yl i 20 0 50 0 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeconds 5 else yl i 20 0 5 0 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeconds 2 y2 lil yl i 5 0 2 xl1 i Total5econds 0 5 ChartSupport GetRandomDouble ElapsedTimeSimpleDataset Datasetl new ElapsedTimeSimpleDataset First xl yl ElapsedTimeSimpleDataset Dataset
344. oject targets Creating project UserChartExample11 project creation successful The previous steps apply to all Net Compact Framework applications The following steps are specific to adding QCChart2D CF charts to your application For purposes of this example the chart will placed in the initial default form Using ChartView with the Visual Studio Design Mode e Add the ChartView control to the Toolbox If it isn t there already add the ChartView UserControl to the Visual Studio Toolbox To add the ChartView control to the VS Toolbox right click on the Toolbox and select Choose Items From the Choose Toolbox Items dialog use the Browse button and go to the Quinn Curtis DotNet Lib folder and select QCChart2DNetCF DLL OK out of the Choose Toolbox Items dialog You will now see a ChartView control in the tool box list of controls e Click on the ChartView control in the Toolbox and drop in on the default form UserChartExample1 Microsoft Visual Studio Eile Edit View Project Build Debug Data Tools Window Community Help Sr Pay OF el A da S Me b Debug Any CPU 416 Using QCChart2D for Net CF to Create Windows Applications TOR gt g preferredsize z ELS ER 3b PL ELI Windows Mobile 5 0 Pocket PC Emulat a A l y ELE S si x A Toolbox xX Le StatusBar M TabControl Form1 b Design Form1 Designer vb abl TextBox Timer E ToolBar Form1 vb 9 TrackBar gt T
345. olid attrib3 SetFillColor Color Red attrib3 SetFillFlag True attrib3 SetSymbolSize 6 Dim thePlot3 As New SimpleScatterPlot pTransforml Dataset3 ChartObj CIRCLE attrib3 chartVu AddChartObject thePlot3 Simple scatter plot example that uses SetSegmentAttributesMode to change the size and color of individual scatter plot symbols in the plot extracted from the example program BigChartDemo class ScatterPoints C ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetLineFlag true attribl SetSymbolSize 10 SimpleScatterPlot thePlotl new SimpleScatterPlot pTransforml Datasetl ChartObj SQUARE attribl thePlotl SetSegmentAttributesMode true ChartAttribute segmentAttrib new ChartAttribute Color Red 1 DashStyle Solid Color Red segmentAttrib SetSymbolSize 20 thePlotl SetSegmentAttributes 8 segmentAttrib thePlotl SetSegmentAttributes 9 segmentAttrib thePlotl SetSegmentAttributes 10 segmentAttrib thePlotl SetSegmentAttributes 11 segmentAttrib chartVu AddChartObject thePlot1 Visual Basic Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid Simple Plot Objects 235 attribl SetFillColor Color Blue attribl SetLineFlag True attribl SetSymbolSize 10 Dim thePlotl As New SimpleScatterPlot pTransforml _ Datasetl ChartObj SQUARE attribl thePlotl SetSegmentAttributesMode True Dim segmentAt
346. on and y2 y1 rows in the y direction This forms a regular grid surface Chart Datasets 75 Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal rows As Integer _ ByVal columns As Integer _ ByVal x1 As Double ByVal y1 As Double ByVal x2 As Double ByVal y2 As Double _ ByVal sf As SurfaceFunction Ct public ContourDataset string sname int rows int columns double x1 double yl double x2 double y2 SurfaceFunction sf The next constructor creates a dataset using the x y and z values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the x values and the second and third columns the y and z values If you use the ROW MAJOR format the first row represents the x values and the second and third row the y and z values Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String ByVal rowskip As Integer 2 ByVal columnskip As Integer _ C4 public ContourDataset CSV csv string filename int rowskip int columnskip sname Specifies the name of the dataset grid An array size npoints or size rows columns of Point3D points that specifies the xyz values of a
347. ont rNumericLabelCntr nearestPoint GetX nearestPoint GetY PHYS POS DECIMALFORMAT 0 Nudge text to the right and up so that it does not write over marker pointLabel SetTextNudge 5 5 chartview AddChartObject pointLabel chartview UpdateDraw 5 How do you zoom charts that use multiple coordinate systems The ChartZoom class will zoom one or more simultaneous coordinate systems The example program SuperZoom zooms a chart that has one x axis and five y axes Use the ChartZoom constructor that accepts an array of coordinate system objects 6 How do you handle missing data points in a chart There are two ways to handle missing or bad data The first is to mark the data point in the dataset invalid using the datasets SetValidData method The second is to set the x and or y value of the bad data point to the designated bad data value ChartObj rBadDataValue Currently this value is set equal to the value of System Double MaxValue Either method will prevent the data point from being displayed in a chart If the bad data value is part of a line plot a gap will appear in the line plot at that point Bad data points are not deleted from a dataset 7 How do you update a chart in real time In general real time updates involve adding new objects to a chart or modifying existing objects that are already in the chart Once the object is added or changed call the ChartView UpdateDraw method to force the chart to update usin
348. ontStyle Regular datasetViewerl ColumnHeaderFont new Font Microsoft Sans Serif 7 FontStyle Regular datasetViewerl GridCellFont new Font Microsoft Sans Serif 7 FontStyle Regular datasetViewerl SyncChart true Visual Basic Dim posrect As New Rectangle2D 0 05 0 63 0 9 0 36 Dim rows As Integer 4 columns As Integer 6 startindex As Integer initialstartindex Dim datasetViewerl As New DatasetViewer chartVu pTransforml posrect Datasetl rows columns startindex datasetViewerl AddDataset Dataset2 datasetViewerl AddDataset Dataset3 datasetViewerl EnableEdit True datasetViewerl DatasetTable TableBackgroundMode _ ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl UseStripedGridBackground True datasetViewerl RowHeaderFont _ New Font Microsoft Sans Serif 7 FontStyle Regular datasetViewerl ColumnHeaderFont _ New Font Microsoft Sans Serif 7 FontStyle Regular datasetViewerl GridCellFont _ New Font Microsoft Sans Serif 7 FontStyle Regular datasetViewerl SyncChart True Group DatasetViewer example extracted from the example program NewDemosRev2 GroupDatasetViewer Daily Stock Price NASDAQ Price Text Classes 399 pomo e 6i02i03 6 03 08 244 s Close 255 235 228 213 252 se 233 230 220 206 z25 243 2 23 cad 2 3 A DatasetViewer displaying a TimeGrou
349. ontrol angleData magnitudeData Dim pPolarTransform As PolarCoordinates New PolarCoordinates pPolarTransform AutoScale dataset ChartObj AUTOAXES FAR Antenna Coordinate Systems Class AntennaCoordinates PhysicalCoordinates CartesianCoordinates AntennaCoordinates An antenna coordinate s point is defined by its radial and angular values The radial and angle values can be positive or negative An angle range of 0 to 360 degrees clockwise starting at 12 00 sweeps a complete circle in antenna coordinates AntennaCoordinates are defined by specifying a starting and ending value for the radius Unlike a polar chart these values can be positive or negative Antenna coordinates always have an angular range 0 to 360 degrees AntennaCoordinates constructors The first way to create a AntennaCoordinates object is to use the constructor that specifies the minimum and maximum values of the radius AntennaCoordinates minvalue maxvalue double minvalue 40 double maxvalue 20 AntennaCoordinates antennacoords new AntennaCoordinates minvalue maxvalue Visual Basic Dim minvalue As Double 40 Dim maxvalue As Double 20 Dim antennacoords As AntennaCoordinates new AntennaCoordinates minvalue maxvalue 128 Scaling and Coordinate Systems Or you can use an auto scale routine to analyze a dataset and select the appropriate antenna radius limits C double angleData 0 30 60 90 120 150 180
350. ontroll class to produce a specific chart See the UserControll cs code in the UserChartExample3 example program In order to add a ChartView derived control at runtime the ChartView derived control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNetMib folder and select it You will also need to make sure that you reference com quinncurtis chart2dnetcf and System Drawing Drawing2D in the using section of any module that references ChartView Using QCChart2D for Net CF to Create Windows Applications 427 ChartView constructor example extracted from the example program UserChartExample3 The UserControll class is instantiated and initialized from the forms constructor Or you can initialize the graph from the forms Form Load event similar to the way it is done using VB From file UserControll1 cs using System using System Collections Generic using System ComponentModel using System Drawing using System Drawing Drawing2D using System Text using System Windows Forms using com quinncurtis chart2dnetcf namespace UserChartExamplel public partial class UserControll ChartView public UserControll InitializeComponent public void InitializeChart ChartView chartVu this Initializ
351. oordinate location in a graph It is often desirable to place a marker at the exact location of a data point in one of the datasets plotted in the graph Many applications require the user to click on the approximate location of a point and then the software must find the data point nearest that click and mark it The DataCursor and Marker classes in combination with the plot objects CalcNearestPoint methods accomplish this The DataCursor class positions the mouse cursor and retrieves the initial xy coordinates The CalcNearestPoint method for each plot object Data Markers and Data Cursors 305 SimpleLinePlot ScatterPlot etc in the graph determines the nearest data point to the mouse cursor for that object Once all the plot objects are checked the data point nearest the mouse cursor position is marked by placing a Marker object at that exact xy location The example below extends the previous Marker and DataCursor examples In this example the OnMouseUp event of the subclassed DataCursor object processes the plot objects looking for the nearest point and then places a Marker object and a numeric label at that point Marking a data point Adapted from the DataCursorView and CustomChartDataCursor classes C public class CustomChartDataCursor DataCursor NumericLabel pointLabel Font textCoordsFont new Font Microsoft Sans Serif 8 FontStyle Regular double rNumericLabelCntr 0 0 SimpleLinePlot thePlotl SimpleLinePl
352. operations using the SetMagniXRoundMode and SetMagniY RoundMode methods In order to use the MagniView class you need two instances of the underlying chart Place one above or next to the other on a parent form as done in the example The first instance of the chart should be considered the source chart and the second instance of the chart should be considered the target This way you end up with two charts with an identical set of axes and plot ojects Super magnify example Adapted from the ZoomExamples SuperMagniViewUserControll example C InitializeData Define charts using data superMagniViewChartl InitializeChart Datasetl Dataset2 Dataset3 Dataset4 Dataset5 Click and drag on the top graph using left mouse button superMagniViewChart2 InitializeChart Datasetl Dataset2 Dataset3 Dataset4 Dataset5 The area bounded by the mouse magnify icon is displayed full scale in the bottom graph Hook up the MagniView class to the source and target classes CartesianCoordinates transformArray superMagniViewChartl pTransforml superMagniViewChartl pTransform2 superMagniViewChartl pTransform3 superMagniViewChartl pTransform4 superMagniViewChartl pTransform5 MagniView magnifyObj new MagniView superMagniViewChartl superMagniViewChart2 transformArray new Dimension 0 1 0 2 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable true superMagniViewChartl SetCurr
353. or a single chart coordinate system Visual Basic Declaration Public Sub New _ source As ChartView _ target As ChartView _ transform As PhysicalCoordinates magnirect As Dimension _ CT public MagniView ChartView source ChartView target PhysicalCoordinates transform Dimension magnirect source A reference to the source ChartView object that the chart is placed in target A reference to the target ChartView object that the magnified view of the chart is placed in transform The source PhysicalCoordinates object associated with the scale being magnified magnirect The rectangle in physical coordinates of the magnify cursor Enable the magnify object after creation using the MagniView SetEnable true method Retrieve the physical coordinates of the magnify rectangle using the MagniView GetMagniMin and GetMagniMax methods Restrict magnification in the x or y direction using the SetMagniXEnable and SetMagniY Enable methods Set the rounding mode associated with rescale operations using the SetMagniXRoundMode and SetMagniY RoundMode methods 330 Zooming In order to use the MagniView class you need two instances of the underlying chart Place one above or next to the other on a parent form as done in the example The first instance of the chart should be considered the source chart and the second instance of the chart should be considered the target This way you end up with two charts with an identica
354. ordinate system per graph while most others have some fixed limit such as 2 4 or 8 scales per graph The number of coordinate systems for a graph can be as large as the number of data series plotted in the graph Charts can have hundreds of data series at once therefore a flexible charting package needs to allow for an equal number of simultaneous coordinate systems e Fourth a well constructed chart often displays more than just data Other common chart objects include legends arbitrary text annotations bitmap images geometric shapes titles data markers cursors and grids A chart can contain zero or more of these objects It may contain 100 of one type 5 of another type and 1 of a third QCChart2D CF for the Net Compact Framework contains no limits restricting the number of instances of a given chart object in a graph and no limit on the total number of chart objects in a graph e Fifth an end user needs to interact with the graph using the mouse and or keyboard The QCChart2D CF for the Net Compact Framework architecture includes classes that implement the Net CF System EventHandler delegate event driven model A user can use the mouse to select data points text annotations axes image objects and other shapes and position them in the graph Create data markers and move them around the chart under mouse or program control Automatically rescale one or more chart axes using mouse controlled zooming Class Architecture 19 QCCh
355. ordinates t TimeCoordinates The TimeCoordinates class scales the chart plot area for physical coordinate systems that use date time scaling The basic techniques are essentially the same as those used with linear and logarithmic scaling only the TimeCoordinates class uses ChartCalendar dates in place of numeric values for the x axis scale values The minimum and maximum values of the x and y scales can be set explicitly set using one of the auto scale methods or set using a combination of the two The default coordinate system for the TimeCoordinates class is time for the x scale and linear for the y scale scale The y scale can be logarithmic and you can set that mode using the explicit scale mode version of the TimeCoordinates constructor If you already know the range for x and y for the plot area you can scale the plot area explicitly In the example below a TimeCoordinates constructor initializes the coordinates to the proper values TimeCoordinates constructor with explicit scaling C ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 double yMax 105 TimeCoordinates simpleTimeScale simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Visual Basic Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim
356. ordinates xMax yMin xMin yMax Scaling and Coordinate Systems 129 Visual Basic Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double 0 Dim yMax AS double 15 Dim simpleScale As CartesianCoordinates simpleScale New CartesianCoordinates xMax yMin xMin yMax Use the CartesianCoordinates SetCoordinateBounds method in the same manner The example below inverts the y scale simpleScale SetCoordinateBounds xMin yMax xMax yMin Invert the x and y scale of a TimeCoordinates object in an analogous fashion Example of inverted scaling using a TimeCoordinates constructor C ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY BI ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 ll e double yMin double yMax 155 TimeCoordinates simpleTimeScale simpleTimeScale new TimeCoordinates xMax yMin xMin yMax Visual Basic Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim yMin As Double 0 Dim yMax As Double 15 Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMax yMin xMin yMax Use the TimeCoordinates SetCoordinateBounds method in the same manner The example below inverts the y scale 130 Scaling and Coordinate Systems C TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale SetCoo
357. orientation It is common to rotate x axis labels 90 degrees so that they are vertical rather than horizontal in order to squeeze more tick mark labels in along the x axis Axis Labels Positioning The AxisLabels class manages the placement of the axis labels with respect to the underlying axis tick marks Labels can be place above or below the tick marks of a horizontal x axis and to the left or right of the tick marks for a vertical y axis The axis label justification constants AXIS MIN and AXIS MAX are used for this purpose The AXIS MIN constant places the text label on the side of the tick mark that is in the direction of the perpendicular axis coordinate system minimum The AXIS MAX is much the same except that it places the label on the side that is in the direction of the perpendicular axis coordinate system maximum Axis labels should not actually touch the tick marks so x and y offsets are factored in The programmer can modify these offsets Numeric Axis Labels Class NumericAxisLabels GraphObj ChartText AxisLabels NumericAxisLabels The NumericAxisLabels class extends the AxisLabels class adding extensive numeric formatting capability It labels axes created using the LinearAxis and LogAxis classes Label formats An axis label can take many forms Variations on these forms include e Full decimal conversion 0 000015 e Scientific notation 1 5e 5 e Exponent notation 1 5x10 192 Axis Labels
358. orm As PhysicalCoordinates ByVal axtype As Integer ByVal minval As TimeSpan ByVal maxval As TimeSpan i C public ElapsedTimeAxis PhysicalCoordinates transform int axtype Ye public ElapsedTimeAxis PhysicalCoordinates transform int axtype double minval double maxval transform Places the axes in the coordinate system defined by transform axtype Specifies if the axis is an x axis X AXIS or a y axis Y AXIS minval Sets the minimum value for the axis maxval Sets the maximum value for the axis Other axis properties minor tick mark spacing number of minor tick marks per major tick mark axis intercept tick mark lengths tick mark direction and axis tick mark origin are automatically calculated using an auto axis method Set these properties explicitly if you need to override the automatically calculated values SetAxisIntercept method Visual Basic Public Sub SetAxisIntercept _ ByVal intercept As Double _ C public void SetAxisIntercept 176 Axes double intercept SetAxisTicks method Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal tickspace As Double _ ByVal ntickspermajor As Integer _ Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal tickspace As Double _ ByVal nminortickspermajor As Integer ByVal minorticklength As Double _ ByVal majorticklength As Double _ ByVal tickdir
359. ositioning in the chart window Some chart objects axis objects in particular often reside on the edge or outside of the plot area Important parts of the axis the tick marks and tick mark labels are usually outside of the plot area The tick marks and tick mark labels must align perfectly with the coordinate system inside the plot area 94 Scaling and Coordinate Systems There are many different techniques to align the coordinate system inside the plot area with the coordinate system used in drawing chart objects outside of the plot area One technique is to maintain the physical coordinate system inside the plot area and use a normalized coordinate system for the graph area Whenever a chart object in the graph area a y axis tick mark for example needs to be aligned with the coordinate system inside the plot area the software converts the tick mark placement value from physical coordinates to normalized coordinates using standardized coordinate conversion routines The drawback of this technique is what I will call the odd pixel problem The odd pixel problem shows up when you try map physical normalized and user coordinate systems based on floating point numbers onto a pixel coordinate system using an integer coordinate system Unless the corners of the plot area fall on exact pixel boundaries converting from plot area coordinates to graph area coordinates once translated to pixels can be up to one pixel off The alternative technique
360. ot thePlot2 public CustomChartDataCursor ChartView achartview CartesianCoordinates thetransform SimpleLinePlot plotl SimpleLinePlot plot2 int nmarkertype double rsize base achartview thetransform nmarkertype rsize thePlotl plotl thePlot2 plot2 public override void MouseReleased MouseEventArgs mouseevent NearestPointData nearestPointObjl new NearestPointData NearestPointData nearestPointObj2 new NearestPointData Point2D nearestPoint new Point2D 0 0 ChartView chartVu GetChartObjComponent bool bfoundl false 306 Data Markers and Data Cursors bool bfound2 false base MouseReleased mouseevent if mouseevent Button amp GetButtonMask 0 Find nearest point for each line plot object Point2D location GetLocation bfoundl thePlot1 CalcNearestPoint location ChartObj FNP NORMDIST nearestPointObjl bfound2 thePlot2 CalcNearestPoint location ChartObj FNP NORMDIST nearestPointObj2 if bfoundl amp amp bfound2 choose the nearest point if nearestPointObjl GetNearestPointMinDistance lt nearestPointObj2 GetNearestPointMinDistance nearestPoint nearestPointObj1 GetNearestPoint else nearestPoint nearestPointObj2 GetNearestPoint create marker object at place it at the nearest point Marker amarker new Marker GetChartObjScale MARKER BOX nearestPoint GetX nearestPoint GetY 10 0 PHYS POS chartVu AddChartObjec
361. otl new GroupBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj YEAR 0 75 0 0 attribArray ChartObj JUSTIFY CENTER thePlotl SetBarOverlap 0 0 chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New TimeGroupDataset GroupTimeData xValues groupBarData Group Bargraph Dim pTransforml As New TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetTimeScaleStart New ChartCalendar 1997 ChartObj JANUARY 1 Group Plot Objects 271 pTransforml SetTimeScaleStop New ChartCalendar 2003 ChartObj JANUARY 1 pTransforml SetGraphBorderDiagonal 0 1 0 1 0 45 0 75 Dim backgroundl As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FromArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject backgroundl prTransforml SetScaleStartY 0 Dim xAxisl As New TimeAxis pTransforml xAxisl SetColor Color White chartVu AddChartObject xAxis1 Dim yAxisl As New LinearAxis pTransforml ChartObj Y AXIS yAxisl SetColor Color White chartVu AddChartObject yAxis1 Dim xAxisLabl As New TimeAxisLabels xAxis1 xAxisLabl SetAxisLabelsFormat ChartObj TIMEDATEFORMAT Y2000 xAxisLabl SetColor Color White chartVu AddChartObject xAxisLabl Dim yAxisLabl As New NumericAxisLabels yAxis1 yAxisLabl SetAxisLabelsFormat ChartObj CURRENCYFORMAT yAxisLabl SetColor Color White chartVu AddCh
362. ouble 5 Dim xAxisMajorTickLength As Double 10 Dim xAxisTickDirection As Integer ChartObj AXIS MIN Dim xAxis As LinearAxis New LinearAxis xAxis SetAxisIntercept xAxisIntercept xAxis SetAxisTicks xAxisOrigin xAxisMinorTickSpace xAxisMinorTicksPerMajor xAxisMinorTickLength xAxisMajorTickLength xAxisTickDirection Axes 159 Logarithmic Axes Scientific engineering and financial applications often require the use of logarithmic axe Logarithmic axes are useful for the display of data that either has a wide dynamic range and or data that is exponential in nature Two common examples that use logarithmic scales are hi fi speaker charts db vs log frequency and stock market charts Class LogAxis GraphObj Axis LogAxis The LogAxis class is a concrete subclass of the Axis class Use the LogAxis class to create a logarithmic axis with logarithmic spacing between the major tick marks 1 10 100 and linear spacing 2 3 4 5 between the minor tick marks Logarithmic Axis Minimum and Maximum The minimum and maximum values for a logarithmic axis can have any positive value as long as the maximum is greater than the minimum Create an inverted axis by first defining an inverted physical coordinate system using one of the PhysicalCoordinates derived classes The axis minimum and maximum do not have to fall on decade intervals i e 0 1 to 10 000 and can assume any positive range i e 0 23 to 13 100
363. oupBarData 0 4 58 groupBarData 1 4 40 TimeGroupDataset Datasetl new TimeGroupDataset GroupTimeData xValues groupBarData TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 1 95 0 8 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 0 120 70 Color FrfomArgb 0 40 30 ChartObj Y AXIS chartVu AddChartObject background Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Black 1 DashStyle Solid Color Red attribl SetFillFlag true attribl SetLineFlag false LineGapPlot thePlotl new LineGapPlot pTransforml Datasetl attribl chartVu AddChartObject thePlot1 Visual Basic Dim nNumPnts As Integer 5 Dim nNumGroups As Integer 2 Dim xValues nNumPnts 1 As ChartCalendar Dim groupBarData nNumGroups 1 nNumPnts 1 As Double theFont New Font Microsoft Sans Serif 10 FontStyle Bold xValues 0 New ChartCalendar 1998 ChartObj JANUARY 1 groupBarData 0 0 43 278 Group Plot Objects groupBarData 1 0 71 xValues 1 New ChartCalendar 1999 ChartObj JANUARY 1 groupBarData 0 1 40 groupBarData 1 1 81 xValues 2 New ChartCalendar 2000 ChartObj JANUARY 1 groupBarData 0 2 54 groupBarData 1 2 48 xValues 3 New ChartCalendar 2001 ChartObj JANUARY
364. oupBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rbarwidth As Double _ ByVal rbarbase As Double _ ByVal attribs As ChartAttribute ByVal nbarjust As Integer _ C public GroupBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth double rbarbase ChartAttribute attribs int nbarjust transform The coordinate system for the new GroupPlot object dataset The group bar graph represents the values in this group dataset Individual bars the height of which corresponds to the group values Y 0 Y 1 Y 2 of the dataset rbarwidth The width of the group bars in units of the independent axis All bars within a group are squeezed into the width defined by rbarwidth Each individual bar within the group has a width of rbarwidth dataset GetNumberGroups rbarbase The group bars start at the value rbarbase and extend to the group bar values represented by the dataset attribs An array of ChartAttribute objects sized the same as the number of groups in the dataset specify the attributes outline color and fill color for each group of a group bar graph nbarjust The group bars are justified with respect to the x values in the dataset using the rbarjust justification value JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX The attributes for each group can set or modifi
365. pDataset dataset double rbarwidth double rbarbase ChartAttribute attribs int nbarjust transform The coordinate system for the new StackedBarPlot object dataset The stacked bar graph represents the values in this group dataset rbarwidth The width of the stacked bars in units of the independent axis rbarbase The stacked bars start at the value rbarbase and extend to the group bar values represented by the dataset attribs An array of ChartAttribute objects sized the same as the number of groups in the dataset that specify the attributes outline color and fill color for each group of a stacked bar graph Group Plot Objects 285 nbarjust The stacked bars are justified with respect to the x values in the dataset using the rbarjust justification value JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX Each stacked bar can be labeled with the group value bar using the bar data point methods see the example below The attributes for each group can set or modified using the SetSegment methods where the segment number parameter cooresponds to the group number These methods include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Stacked bar plot example extracted from the example program BigChartDemo class GroupBarPlotChart C TimeCoordinates pTransform2 new TimeCoordinates User same dataset as Group bar plot set stacked mode flag Datasetl SetSta
366. pDataset display open hig C Rectangle2D posrect new Rectangle2D 0 03 0 55 0 9 0 44 DatasetViewer DefaultFont new Font FontFamily GenericSansSerif 7 FontStyle Regular DatasetViewer datasetViewerl new DatasetViewer chartVu pTransforml Datasetl 5 6 0 datasetViewerl EnableEdit true datasetViewerl DatasetTable TableBackgroundMode _ ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl SyncChart true datasetViewerl SetArrayFormat 0 ChartObj TIMEDATEFORMAT MDY datasetViewerl TransformList Add pTransform2 datasetViewerl TransformList Add pTransform3 Visual Basic Dim posrect As New Rectangle2D 0 03 0 55 0 9 0 44 DatasetViewer DefaultFont _ New Font FontFamily GenericSansSerif 7 FontStyle Regular Dim datasetViewerl As New DatasetViewer chartVu pTransforml _ posrect Dataseti 5 6 0 datasetViewerl EnableEdit True datasetViewerl DatasetTable TableBackgroundMode ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl SyncChart True datasetViewerl SetArrayFormat 0 ChartObj TIMEDATEFORMAT MDY h low close data posrect 400 Text Classes datasetViewerl TransformList Add pTransform2 datasetViewerl TransformList Add pTransform3 Vertical Orientation DatasetViewer example extracted from the example program NewDemosRev2 VerticalDatasetViewerChart C Rectangle2D posrect new Rectangle2D 0
367. pie chart It uses segmented rings instead of pie shaped wedges The SimpleVersaPlot plot type can look like any of the simple plot types while the GroupVersaPlot type can look like any of the group plot types Antenna Plot Antenna A Antenna B New 1 Click on the button to re initialize with new data Antenna chart An Antenna chart named Antenna because it is commonly used by engineers plotting the performance characteristics of an antenna design is a circular chart type similar to a polar chart Data is specified using a pair of values radius angle where the angle is in degrees 12 00 is zero degrees and the angle increases clockwise This contrasts to a polar chart where 3 00 is zero radians and the angle increases counter clockwise Also antenna radar chart allows plus minus scaling of the radius for example the radius can be scaled from 40 to 20 as in the picture above The Antenna chart uses a unique 4 Introduction coordinate system AntennaCoordinates axes AntennaAxes axes labels AntennaAxesLabels grid AntennaGrid and plot objects AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot and AntennaAnnotation New Coordinate System Features A TimeCoordinates coordinate system can now have a vertical time date scale The TimeCoordinates class now supports time date scaling for both the x and y axis of a chart Vertical scaling for Time Date 2006 2005 2004 2003 2002 2001 2000 1
368. plate SetNumericFormat ChartObj CURRENCYFORMAT labeltemplate SetDecimalPos 1 labeltemplate SetTextFont theFont hePlotl SetPlotLabelTemplate labeltemplate hePlotl SetLabelInOut 0 hartObj PIELABEL INSLICE hePlotl SetLabelInOut 1 hartObj PIELABEL INSLICE c B hePlotl SetLabelInOut 2 ChartObj PIELABEL INSLICE hePlotl SetLabelInOut 3 ChartObj PIELABEL INSLICE hePlotl SetLabelInOut 4 ChartObj PIELABEL INSLICE chartVu AddChartObject thePlot1 18 Polar and Antenna Plots PolarPlot PolarLinePlot PolarScatterPlot AntennaPlot AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot Polar charts play an important in engineering applications involving electronics and advanced control systems Polar charts give a visual interpretation to mathematical problems involving trigonometric functions and complex numbers Antenna charts are used to display the operating characteristics of antennas The PolarPlot class is an abstract class representing plot types that use data organized as arrays of x and y values where an x value represents the magnitude of a point in polar coordinates and the y value represents the angle of a point in polar coordinates Polar plots types include line plots and scatter plots The polar angle values stored as the y values in the SimpleDataset should be in radians If the raw data is in degrees convert the data to radians using the ChartSupport ToRadians method The AntennaP
369. ple line plot format The lines drawn between adjacent data points use antenna coordinate interpolation This class is a concrete implementation of the AntennaPlot class and displays data in a simple scatter plot format This class is a concrete implementation of the AntennaPlot class and displays data in a simple line markder plot format This class is used to highlight or mark a specific attribute of the chart It can mark a constant radial value using a circle or it can mark a constant angular value using a radial line from the origin to the outer edge of the scale Class Architecture 47 Pie and Ring Chart Classes It uses data organized as arrays of x and y values where an x value represents the numeric value of a pie wedge and a y value specifies the offset or explosion of a pie wedge with respect to the center of the pie Aetius Mutual Fund Asset Allocation Click on any pie wedge to see a detail PieChart This class plots data in a simple pie chart format It uses data organized as arrays of x and y values where an x value represents the numeric value of a pie wedge and a y value specifies the offset or explosion of a pie wedge with respect to the center of the pie 48 Class Architecture Aetius Mutual Fund Asset Allocation Click on any pie wedge to see a detail RingChart The ring chart plots data in a modified pie chart format known as a ring chartt It uses data organized as arrays of x and
370. pleTimeScale new TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed TimeAxis xAxis new TimeAxis simpleTimeScale Create the linear y axis LinearAxis yAxis new LinearAxis simpleTimeScale ChartObj Y AXIS Visual Basic Define a Time coordinate system Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim xMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMin yMin xMax yMax Create the time axis x axis is assumed Dim xAxis As TimeAxis New TimeAxis simpleTimeScale Create the linear y axis Dim yAxis As LinearAxis New LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Custom time axis example C Define a Time coordinate system ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0s double yMax 105 int xAxisTickMarkFormat ChartObj TIMEAXIS MONTHWEEK Axes 173 double xAxisMinorTickLength 5 double xAxisMajorTickLength 10 int xAxisTickDirection ChartObj AXIS MIN TimeCoordinates si
371. r C4 public void SetAxisLabels 204 Axis Labels Font font double rotation int lasboir int decimalpos int timeformat int labelends Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ C4 public void SetAxisLabelsFormat int format font The font object used to display the axis label text rotation The rotation in degrees of label text in the normal viewing plane labdir The justification of the axis label AXIS MIN or AXIS MAX with respect to the tick mark endpoint decimal Sets the number of digits to the right of the decimal point for elapsed time axis labels labelends Ignored for time axis labels labcolor The color of the label text timeformat Sets the numeric format for the axis labels Use one of the time format constants TIMEDATEFORMAT MS TIMEDATEFORMAT 24HMS TIMEDATEFORMAT 24HM Simple ElapsedTimeAxisLabels example extracted from the NewDemosRev2 ElapsedTimeChart example program C TimeSpan xl new TimeSpan numPoints Axis Labels 205 double yl new double numPoints double ly2 new double numPoints ink i for 1 0 i lt numPoints i Initialize Data theFont new Font Microsoft Sans Serif 10 FontStyle Bold ElapsedTimeSimpleDataset Datasetl new ElapsedTimeSimpleDataset First xl yl ElapsedTimeSimpleDataset Datas
372. r calculating the milliseconds for any time base and any number of units The code below sets a minimum zoom range of 45 minutes C double minZoomTimeRange ChartCalendar GetCalendarWidthValue ChartObj MINUTE 45 double minZoomYRange 0 01 Dimension zoomLimits new Dimension minZoomTimeRange minZoomYRange zoomObj SetZzoomRangeLimits zoomLimits Visual Basic Dim minZoomTimeRange As double _ ChartObj GetCalendarWidthValue ChartObj MINUTE 45 Dim minZoomYRange As Double 0 01 Dim zoomLimits As Dimension New Dimension minZoomTimeRange minZoomYRange zoomObj SetZzoomRangeLimits zoomLimits Magnifying a portion of a chart in a separate window Class MagniView MouseListener MagniView The MagniView class needs two chart areas in order to work a source chart area which contains the full scale display of the chart and the target chart area which will contain a magnified view of the chart Zooming 329 The MagniView class starts the magnify operation on the OnMouseDown event positioning the lower left corner of a magnify rectangle on top of the source chart Immediately a magnified view of the chart will appear in the target chart As the mouse moves the magnify rectangle the target chart constantly updates to reflect the current view window Once the mouse button is released the target chart remains at its current values MagniView constructor The constructor below creates a MagniView object f
373. r tick mark spacing and axis labels e Zooming of time coordinates with smooth transitions between major scale changes years gt months gt weeks gt days gt hours gt minutes gt seconds e Zooming of time coordinates that use a 5 day week and a non 24 hour day e Simultaneous zooming of an unlimited number of x and y coordinate systems and axes Super zooming e The user can recover previous zoom levels using a zoom stack e The zoomed coordinate system can be forced to maintain a fixed aspect ratio e User defineable zoom limits prevent numeric under and overflows Magnification is related to zooming because it is also the interactive re scaling of a charts physical coordinate system In this case a fixed sized view window is passed over a source chart analogous to passing a magnifying class over a map The area under the view window is magnified and redisplayed in a separate target chart The source chart does not re scale as in the case of zooming Only the target chart gets rescaled in response to the position of the view window position over the source chart Simple Zooming of a single physical coordinate system Class ChartZoom MouseListener 320 Zooming ChartZoom The ChartZoom class implements Net CF delegates for mouse events It implements and uses the mouse events OnMouseMove OnDoubleClick OnMouseDown OnMouseUp and OnClick The default operation of the ChartZoom class starts the zoom operation on the
374. raphObj objects stored in the list and renders them one by one to the current view There are two ordering methods used to render chart objects The first method renders the objects in order as added to the ChartView object Objects added to the view last are drawn on top of objects added first The second method renders the objects according to their z order Objects with the lowest z order values are rendered first Objects with equal z order values are rendered in the ordered they are added to the ChartView object The second method z order rendering is the default method of object rendering used by the The Chart View 139 ChartView class This default behavior can be changed by call the ChartView SetZOrderSortEnable false method Each GraphObj object has a default z order value summarized below Base Class Default z order value Comments Background 10 Backgrounds are drawn first A plot area background has a z value of 10 and a graph area background has a z value of 9 forcing graph area backgrounds to be drawn first Grid 40 A z value of 40 places grids under most other graph objects If you want grids on top change the z value to 150 GraphObj 50 The default value for graph objects if not explicitly changed in the subclass ChartText 50 The default value for text objects ChartPlot 50 The default value for plot objects which includes SimplePlot GroupPlot ContourPlot and PolarPlot objects Axis 100 Chart axes are drawn af
375. rchitecture 41 Video Game Usage by Age Group 100 40 Age Group The height and width of the bars in a Histogram plot carries information HistogramPlot This class is a concrete implementation of the GroupPlot class and displays histogram plots A histogram plot is a collection of rectangular objects with independent widths and heights specified using the values of the associated group dataset The histogram bars share a common base value 42 Class Architecture Sales vs Cost Gap Sales Profits 2001 The Line Gap chart is useful for emphasizing the difference between two lines LineGapPlot This class is a concrete implementation of the GroupPlot class A line gap chart consists of two lines plots where a contrasting color fills the area between the two lines highlighting the difference Characteristic Curves for Bipolar Transistor 50 mdi es s I b 350uA u 40 Region b 300uA 30 I b 250uA I b 200uA mA 20 i E L VIS BR UR tee l at 1 100uA 10 9 MM H M 3 L I b 50uA 0 0 5 10 15 20 Collector Emitter Voltage The Multi inePlot will plot a multiple y vectors vs a single x vector MultiLinePlot Class Architecture 43 This class is a concrete implementation of the GroupPlot class and displays group data in multi line format A group dataset with four groups will display four separate line plots The y values for
376. rdinateBounds xMin new CartesianCoordinates ChartObj LOG SCALE new CartesianCoordinates ChartObj LINEAR SCALE yMin xMax yMax yMin xMax yMax ChartObj LOG SCALE ChartObj LINEAR SCALE 106 Scaling and Coordinate Systems CartesianCoordinates logXLogYScale new CartesianCoordinates ChartObj LOG SCALE ChartObj LOG SCALE logXLogYScale SetCoordinateBounds xMin yMin xMax yMax Visual Basic Dim xMin As Double 1 Dim xMax As Double 1000 Dim yMin As Double 0 2 Dim yMax As Double 2000 Dim logYScale As CartesianCoordinates _ New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE logYScale SetCoordinateBounds xMin yMin xMax yMax Dim logXScale As CartesianCoordinates _ New CartesianCoordinates ChartObj LOG SCALE ChartObj LINEAR SCALE logXScale SetCoordinateBounds xMin yMin xMax yMax Dim logXLogYScale As CartesianCoordinates _ New CartesianCoordinates ChartObj LOG SCALE ChartObj LOG SCALE logXLogYScale SetCoordinateBounds xMin yMin xMax yMax Note When you explicitly scale the minimum and maximum values for a scale set to logarithmic coordinates make sure you use valid values i e non negative values greater than 0 0 The auto scale routines work for both linear and logarithmic scales If you use the auto scale methods it is important that you call the auto scale methods after you establish if a scale is linear or logarithmic This is because the a
377. rdinateBounds xMin yMax xMax yMin Visual Basic Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale SetCoordinateBounds xMin yMax xMax yMin The auto scale functions always create scales that increase from left to right and bottom to top This does not exclude the use of the auto scale functions when creating inverted axes After an auto scale function creates the initial x and y scales either or both can be inverted by using the CartesianCoordinates or TimeCoordinates InvertScaleX or InvertScaleY methods Example of inverting a scale created using the auto scale methods C double xData 2 3 4 5 60 7 9 9 double yData 22 33 44 55 46 33 25 14 SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates simpleScale AutoScale dataset simpleScale InvertScaleY Visual Basic Dim xData As Double 12 35 4 5 6 7 9 9 Dim yData As Double 22 33 44 55 46 33 25 14 Dim dataset As SimpleDataset New SimpleDataset Sales xData yData Dim simpleScale As CartesianCoordinates New CartesianCoordinates simpleScale AutoScale dataset simpleScale InvertScaleY 5 The Chart View ChartView The starting point of a chart is the ChartView class The ChartView class derives from the System Windows Forms UserControl where the Forms class is the base class for the Net
378. rdinates CartesianCoordinates PolarCoordinates AntennaCoordinates TimeCoordinates ElapsedTimeCoordinates The starting point for all drawing in a window is the Net CF 2D device coordinate system The coordinate system uses a default device resolution of the underlying Net CF window regardless of the output device A Net CF window maintains a viewport for the client area of the window controlling the position and size of the drawing area in the window Graphics output is clipped to the viewport preventing graphics output in one window from over writing graphics in another window The user coordinate system for the window starts at 0 0 in the upper left corner and extends in the positive direction down and to the right Plot area and graph area The plot area of a graph 1s the area where the plot data objects line plots bar plots etc are drawn The graph area is the entire area of the chart window The graph area includes the plot area as a subset Usually the plot area is smaller than the graph area and resides roughly centered in the graph area The border around the plot area is sized large enough to display the axis tick mark labels axis titles legends chart titles footers and any other object in the graph Create a physical coordinate system for a chart and you are setting the minimum and maximum values for the x and y dimensions of the plot area Most chart objects require access to the chart coordinate system for proper p
379. real time routines to the QCChart2D CF for the Net Compact Framework library Yes see the Real Time Graphics Tools for Net CF http www quinn curtis com QCRTGraphCFProdPage htm 22 Are you going to add 3D routines to the QCChart2D CF for the Net Compact Framework library Probably not 3D Graphics are popular in presentation charting applications because management types think that 3D charts in their PowerPoint presentations make the content more believable In most implementations of 3D charting the use of the 3 FAQs 455 dimension adds nothing to and often obscures the information content of the chart It also makes real time updates and interactive zooming slower and less precise Also we are not looking for new ways to make the Net Compact Framework slower than it already is INDEX 3D Points 57 58 59 73 74 75 76 77 AntennaAnnotation 1 4 45 46 364 365 AntennaAxes 1 4 25 31 33 60 151 152 182 183 184 185 190 209 210 211 219 220 353 359 360 AntennaAxesLabels 1 4 31 33 60 189 190 209 210 211 353 359 361 AntennaCoordinates 1 4 22 23 59 93 95 127 128 183 184 185 211 353 358 359 360 361 362 363 365 AntennaGrid 1 4 52 53 60 213 219 220 359 360 AntennaLineMarkerPlot 1 4 45 46 60 353 362 363 364 AntennaLinePlot 1 4 45 46 60 353 358 359 360 361 AntennaPlot 33 45 46 60 353 358 361 362 AntennaScatterPlot 1 4 45
380. reeView VScrollBar aj WebBrowser SB chartview Common Device Controls K Pointer 2b Button CheckBox F ComboBox Tf DateTimePicker i DocumentList A Label A LinkLabel E ListBox com quinncurtis chart2dnetcf ChartView ListView EE MonthCalendar 13 NumericUpDown lal PictureBox ProgressBar RadioButton vh Splitter abl TextBox amp mainMenut v 0 Errors A 0 Warnings i 0 Messages Description d Error List E Output Find Results 1 di C i S 4 Solution Explorer Solution UserChartExa A X Galasi E EB A od Solution UserChartExample1 1 project E ie UserChartExample1 Sa My Project uy References 43 QCChart2DNetCF 3 System 3 System Data System Drawing 23 System Windows Forms 3 System xml j bin obj SEEN 98 Form Designer vb 3 Form1 resx Properties Form1 y b File Properties es e Build Action Compile v Copy to Output Director Do not copy Custom Tool Custom Tool Namespace File Name Formi vb Column Project Build Action How the file relates to the build and deployment processes Ready e When you add a ChartView control to a Form it adds a reference to the DLL that the control is in to the project and places the default instantiation code in the form s Form Designer vb module Starting with VS 2005 Microsoft has decided to physically separate the designer generated code in
381. revious examples use the TimeCoordinates default 7 days week and 24 hours day modes Many of the methods in the software have a weektype parameter The default value of this parameter is the constant ChartObj WEEK 7D If you want the coordinate system to ignore Saturdays and Sundays use the constant ChartObj WEEK 5D constant Use the methods below to establish a 5 days week coordinate system TimeCoordinates constructor Visual Basic Overloads Public Sub New _ ByVal dstart As ChartCalendar ByVal yi As Double _ ByVal dstop As ChartCalendar ByVal y2 As Double _ ByVal nweektype As Integer _ 116 Scaling and Coordinate Systems C4 public TimeCoordinates ChartCalendar dstart double yl ChartCalendar dstop double y2 int nweektype SetTimeCoordinateBounds method Visual Basic Overloads Public Sub SetTimeCoordinateBounds _ ByVal dstart As ChartCalendar ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal y2 As Double _ ByVal nweektype As Integer _ C public void SetTimeCoordinateBounds ChartCalendar dstart double yl ChartCalendar dstop double y2 int nweektype E SetWeekType method Visual Basic Public Sub SetWeekType _ ByVal weektype As Integer Cf public void SetWeekType int weektype If you use the auto scale routines set the week type before you call the TimeCoordinates AutoScale method because the auto scale routine
382. ricFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 Simple Plot Objects 241 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue true chartVu AddChartObject thePlot1 Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag True thePlotl New SimpleVersaPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0R attribl ChartObj JUSTIFY CENTER Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue True chartVu AddChartObject thePlotl 11 Group Plot Objects GroupPlot ArrowPlot BubblePlot CandlestickPlot CellPlot ErrorBarPlot FloatingBarPlot GroupBarPlotChartPlot HistogramPlot LineGapPlot MultiLinePlot OHLCPlot StackedBarPlot Stacked LinePlot The GroupPlot class is an abstract class representing plot types that use data organized as arrays of x and y values where there is one or more y value for each x value Group plot types include multi line plots stacked line plots stacked bar plots group bar plots error bar plots floating bar plots open high low close plots candlestick plots
383. rid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR Change default grid line properties gridY SetColor Color Black Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis 216 Axis Grids chartVu AddChartObject gridX chartVu AddChartObject gridY Visual Basic Define the coordinate system Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double O0 Dim yMax As Double 105 Dim simpleScale As CartesianCoordinates _ New CartesianCoordinates xMin yMin xMax yMax Create the x and y axes Dim xAxis As LinearAxis _ New LinearAxis simpleScale ChartObj X AXIS Dim yAxis As LinearAxis _ New LinearAxis simpleScale ChartObj Y AXIS Create the grids Dim gridX As Grid New Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR Change default grid line properties gridX SetColor Color Gray Dim gridY As Grid New Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR Change default grid line properties gridY SetColoriColor Black Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject gridX chartVu AddChartObject gridY Polar Grids Class
384. rnalZoomStackProcessing property true zoomObj InternalZoomStackProcesssing true Return to a previous zoom level by right clicking the mouse Change the zoom stack button using the ZoomStackButtonMask property Setting it to MouseButtons Left MouseButtons Right or MouseButtons Middle Super zoom example Adapted from the SuperZoom example In this example a new class derives from the ChartZoom class and the MousePressed event overridden The event invokes the PopZoomStack method Otherwise the default operation of the ChartZoom class controls everything else Zooming 325 C public class SuperZoom com quinncurtis chart2dnetcf ChartView private class ZoomWithStack ChartZoom public ZoomWithStack ChartView component CartesianCoordinates transforms bool brescale base component transforms brescale public override void MousePressed MouseEventArgs mouseevent if mouseevent Button amp MouseButtons Right 0 this PopZoomStack else base MousePressed mouseevent SimpleDataset Datasetl new SimpleDataset First x1 yl SimpleDataset Dataset2 new SimpleDataset Second x1 y2 SimpleDataset Dataset3 new SimpleDataset Third x1 y3 SimpleDataset Dataset4 new SimpleDataset Fourth x1 y4 SimpleDataset Dataset5 new SimpleDataset Fifth x1 y5 CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Da
385. roup datasets from a CSV file C CSV csvDataFile new CSV GroupDataset Datasetl new GroupDataset csvDataFile GroupDataset csv 0 0 Write out dataset as a CSV file under a different file name Datasetl WriteGroupDataset csvDataFile GroupDataset2 csv Visual Basic Dim csvDataFile As CSV New CSV Dim Datasetl As GroupDataset _ New GroupDataset csvDataFile GroupDataset csv 0 0 Write out dataset as a CSV file under a different file name Datasetl WriteGroupDataset csvDataFile GroupDataset2 csv Date Time Group Dataset Class TimeGroupDataset ChartObj ChartDataset GroupDataset TimeGroupDataset The TimeGroupDataset uses ChartCalendar dates as the x values and floating point numbers as the y values ChartCalendar values are actually stored internally as their equivalent millisecond values The TimeGroupDataset class adds a large number of methods to the GroupDataset class that make it easy to create and modify datasets that use ChartCalendar values This constructor creates a new group TimeGroupDataset object where the x values are ChartCalendar values and the y values are floating point numbers Chart Datasets 83 TimeGroupDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As ChartCalendar ByVal y As Double _ C public TimeGroupDataset string sname ChartCalendar x double y s
386. roupBarData 3 3 3 2 xValues 4 TimeSpan FromMinutes 5 groupBarData 0 4 3 8 groupBarData 1 4 5 6 groupBarData 2 4 4 3 groupBarData 3 4 3 3 ElapsedTimeGroupDataset Datasetl new ElapsedTimeGroupDataset ElapsedTimeGroupData xValues groupBarData VB Dim nNumPnts As Integer 5 nNumGroups As Integer 4 Dim xValues As TimeSpan New TimeSpan nNumPnts 1 Dim groupBarData As Double New Double nNumGroups 1 nNumPnts 1 xValues 0 TimeSpan FromMinutes 1 groupBarData 0 0 6 3 groupBarData 1 0 3 1 groupBarData 2 0 2 2 groupBarData 3 0 1 8 xValues 1 TimeSpan FromMinutes 2 groupBarData 0 1 5 8 groupBarData 1 1 4 3 groupBarData 2 1 2 8 groupBarData 3 1 1 5 xValues 2 TimeSpan FromMinutes 3 groupBarData 0 2 5 5 groupBarData 1 2 4 5 groupBarData 2 2 2 5 groupBarData 3 2 2 1 xValues 3 TimeSpan FromMinutes 4 groupBarData 0 3 4 1 groupBarData 1 3 5 4 groupBarData 2 3 4 1 groupBarData 3 3 3 2 Chart Datasets 91 xValues 4 TimeSpan FromMinutes 5 groupBarData 0 4 3 8 groupBarData 1 4 5 6 groupBarData 2 4 4 3 groupBarData 3 4 3 3 Dim Datasetl As New ElapsedTimeGroupDataset ElapsedTimeGroupData xValues groupBarData 4 Scaling and Coordinate Systems ChartScale LinearScale LogScale TimeScale ElapsedTimeScale UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoo
387. rst dataset s XString property If that is null X Values is displayed for numeric x values and Time for time based x values Subsequent row header strings for the y values are picked up from the main title string of each associated dataset In the case of group datasets with multiple y values for each x value row header strings are picked up from the datasets GroupStrings property which stores one string for each group in the dataset You can change the default orientation of the DatasetViewer by calling a version of the DatasetViewer constructor that has an orientation property as the last parameter See the NewDemosRev2 VerticalDatasetViewerChart for an example Simple DatasetViewer example extracted from the example program NewDemosRev2 SimpleDatasetViewer ae EC HE RECTE E EI EE Week a 2dine 10 01 06 10 08 06 10 15 06 10 22 06 10 23 06 Esstem Central 397 0 8838 913 6 3074 8811 843 4 T JN A DatasetViewer displaying three TimeSimpleDatasets C 398 Text Classes Rectangle2D posrect new Rectangle2D 0 05 0 63 0 9 0 36 DatasetViewer datasetViewerl new DatasetViewer chartVu pTransforml posrect Datasetl 2 6 0 datasetViewerl EnableEdit true datasetViewerl DatasetTable TableBackgroundMode ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl UseStripedGridBackground true datasetViewerl RowHeaderFont new Font Microsoft Sans Serif 7 F
388. rwidth As Double _ attrib As ChartAttribute Ci public BoxWhiskerPlot PhysicalCoordinates transform double rwidth ChartAttribute attrib transform The coordinate system for the new BoxWhiskerPlot object rwidth The width of the candlestick box in physical coordinates attrib Specifies the attributes line color and fill color of the candlestick lines when the close value is greater than the open value Once the initial BoxWhiskerPlot object is created populations are added to it one population at a time using the AddPopulation method Each population can have a different number of data points Once all of the population groups are added the software will calculate the quartile data for each population in response to the AutoBWChart method call Each population is summarized by a single box in the box and whisker plot Visual Basic Declaration Public Sub AddPopulation _ pop As Double _ xvalue As Double _ 248 Group Plot Objects ci public void AddPopulation double pop double xvalue Parameters pop The source population of y values to add xvalue The x value of the of y values population There are several variants of box and whisker plots Select which one you want using the BWFormat property Use one of the BW format constants BW MINMAX WHISKER BW IRQI5 WHISKER OUTLIERS BW IQRI5 WHISKER ALLPOINTS BW MINMAX WHISKER Plot minimum maximum values as whiskers and the median q25 and q75 v
389. s C examples directory BankAmerica BetaPictoris BigChartDemo Principle c example Boston Climate BushGuardRecords EuroDollar JapanWorkforce LandOfTheFry MedicareDrugCosts NasaSpending NewDemosRev2 New examples for Revision 2 0 features RealGDPGrowth Introduction 13 TechnicalAnalysis UserChartExample1 Simple example UserChartExample2 Simple example UserChartExample3 Simple example ZoomExamples Examples for zooming MagniView and Coordinate Moving VB VB specific code CF Examples VB examples BankAmerica BetaPictoris BigChartDemo Principle VB example BostonClimate BushGuardRecords EuroDollar JapanWorkforce LandOfTheFry MedicareDrugCosts NasaSpending NewDemosRev2 New examples for Revision 2 0 features RealGDPGrowth TechnicalAnalysis UserChartExample1 Simple example UserChartExample2 Simple example UserChartExample3 Simple example 14 Introduction ZoomExamples Examples for zooming MagniView and Coordinate Moving There are two versions of the QCChart2D CF for the Net Compact Framework class library the 30 day trial versions and the developers summarized below 30 Day Trial Version The trial version of QCChart2D CF for the Net Compact Framework is downloaded as a zip file named Trial QCChart2DCFR18x zip The 30 day trial version stops working 30 days after the initial download The trial version may include a version message in the upper left corner of the graph w
390. s Doubl 1 2 3 4 5 5 7 9 9 10 oO ll Dim yData As Double 110 22 33 44 55 46 33 25 14 9 Dim dataset As SimpleDataset New SimpleDataset Sales xData yData Dim simpleScale As CartesianCoordinates new CartesianCoordinates simpleScale AutoScale dataset simpleScale SetScaleStartX 1 0 simpleScale SetScaleStopX 10 0 The auto scale methods that use an array of datasets to determine the proper range are very similar Example of auto scaling a CartesianCoordinates object using the multiple datasets C double xDatal 11 2 3 4 5 6 7 9 9 10 double yoatal 10 22 33 44 55 46 33 25 14 Sh double xData s 10 9 9 7 06 5 4 23 2 1 double yData2 20 12 43 54 15 26 63 25 24 19 double xData3 5 6 7 6 5 41 5 6 7 8 double yoatas 30 52 13 64 25 Tb 13 35 24 19 SimpleDataset datasetl new SimpleDataset Sales1 xDatal yDatal SimpleDataset dataset2 new SimpleDataset Sales2 xData2 yData2 SimpleDataset dataset3 new SimpleDataset Sales3 xData3 yData3 SimpleDataset datasetsArray new SimpleDatasets 3 datasetsArray 0 dataset1l datasetsArray 1 dataset2 datasetsArray 2 dataset3 CartesianCoordinates simpleScale new CartesianCoordinates simpleScale AutoScale datasetsArray Visual Basic Dim xDatal As Double 1 2 3 4 5 6 7 9 9 10 Scaling and Coordinate Systems 105 Dim yDatal As Dou
391. s Double _ ByVal maxval As Double C4 public LogAxis PhysicalCoordinates transform Axes 161 int axtype public LogAxis PhysicalCoordinates transform int axtype double minval double maxval transform Places the axes in the coordinate system defined by transform axtype Specifies if the axis is an x axis X AXIS or a y axis Y AXIS minval Sets the minimum value for the axis maxval Sets the maximum value for the axis The first LogAxis constructor assumes that the axis extents match the extents of the underlying coordinate system transform The second LogAxis constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system Other axis properties axis intercept tick mark lengths tick mark direction and axis tick mark origin are automatically calculated using an auto axis method These properties can be explicitly set if you need to override the automatically calculated values SetAxisIntercept method Visual Basic Public Sub SetAxisIntercept _ ByVal intercept As Double _ C public void SetAxisIntercept double intercept SetAxisTicks method Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal nlogtickformat As Integer _ Visual Basic Overloads Public Sub SetAxisTicks _ ByVal origin As Double _ ByVal nlogtickformat As Integer _ ByVal minorticklength As
392. s Long _ ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal stoptime As Long _ ByVal y2 As Double _ ByVal nweektype As Integer _ C public TimeCoordinates ChartCalendar dstart long starttime double yl ChartCalendar dstop long stoptime double y2 int nweektype TimeCoordinates constructor example for a 5 day week and 9 30 AM to 4 00 PM time of day range C long starttod 9 60 30 60 1000 msecs cooresponding to 9 30 AM long stoptod 16 60 60 1000 msecs cooresponding to 4 00 PM ChartCalendar dstart new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar dstop new ChartCalendar 1997 ChartObj JANUARY 5 double yl 0 0 double y2 55 0 TimeCoordinates stockTimeScale 118 Scaling and Coordinate Systems stockTimeScale new TimeCoordinates dstart starttod yl dstop stoptod y2 ChartObj WEEK 5D VB Dim starttod As Long 9 60 30 60 1000 msecs cooresponding to 9 30 AM Dim stoptod As Long 16 60 60 1000 msecs cooresponding to 4 00 PM Dim dstart As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim dstop As ChartCalendar New ChartCalendar 1997 ChartObj JANUARY 5 Dim yl As Double 0 0 Dim y2 As Double 55 0 Dim stockTimeScale As TimeCoordinates stockTimeScale New TimeCoordinates dstart starttod yl dstop stoptod y2 ChartObj WEEK 5D Another technique uses the defaul
393. s New ChartTitle pTransforml theFooterFont The size radius or area of the bubble adds an additional dimension to the graph footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer Dim attrib2 As New ChartAttribute Color FromArgb 177 33 33 0 DashStyle Solid attribl SetFillColor Color FromArgb 177 33 33 Dim legendFont As New Font Microsoft Sans Serif 10 FontStyle Regular Dim legendAttributes As New ChartAttribute Color Black 1 Legends 377 DashStyle Solid Color White legendAttributes SetFillFlag True legendAttributes SetLineFlag True Dim legend As New BubblePlotLegend thePlotl1 0 82 0 15 0 14 0 25 _ legendAttributes legend AddLegendItem 10 Million 10 attrib2 legendFont legend AddLegendItem 25 Million 25 attrib2 legendFont legend AddLegendItem 40 Million 40 attrib2 legendFont legend AddLegendGeneralText ChartObj LEGEND HEADER Bubble Size Color Black legendFont chartVu AddChartObject legend 20 Text Classes ChartText ChartTitle AxisTitle ChartLabel StringLabel TimeLabel NumericLabel ElapsedTimeLabel The software uses the ChartText classes to position and format text in a chart Examples of classes derived from the ChartText include the ChartLabel AxisLabels ChartTitle and AxisTitle classes The Legend PieChart and ChartPlo
394. s analogous to the way you can change the latitude and longitude of an internet map by clicking and dragging it Moving Chart Objects Class MoveObj MouseListener MoveObj The MoveObj mouse listener traps a mouse pressed event and then searches through all of the GraphObj derived objects in the view A rectangle highlights the first object that meets the filter criteria and intersects the mouse cursor Hold the mouse button down and the rectangle tracks the mouse Release the mouse button and the position of the graph object updates to reflect the new physical coordinates of the bounding rectangle If no objectfilter parameter is specified the default object filter is GraphObj MoveObject constructors Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal buttonmask As MouseButtons _ 310 Moving Chart Objects and Data Points ByVal objectlfilter As String _ Overloads Public Sub New _ ByVal component As ChartView _ ByVal buttonmask As MouseButtons _ C public MoveObj ChartView component MouseButtons buttonmask string objectifilter public MoveObj ChartView component MouseButtons buttonmask component A reference to the ChartView object that the chart is placed in buttonmask Specifies the mouse button that is trapped to invoke a move objectfilter The fully qualified class name of the base class that is used to filter the desired class objects The string Chart
395. s need to take into account the week type For example C TimeSimpleDataset dataset new TimeSimpleDataset Sales xData yData TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale SetWeekType ChartObj WEEK 5D simpleTimeScale AutoScale dataset Visual Basic Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Scaling and Coordinate Systems 117 Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale SetWeekType ChartObj WEEK 5D simpleTimeScale AutoScale dataset In addition to the week type the other major way to customize a TimeCoordinates coordinate system is not to use a 24 hour day There are methods that set the starting and ending time of day For example if you are interested in plotting stock market data trading during the regular trading day of 9 30 AM to 4 00 PM you can setup the coordinate system to only include these hours and to treat any data outside of these hours as invalid and not to be plotted A day can have only one continuous range You are not able to define a day to with a valid range of 9 30 AM to 4 00 PM and 6 00 PM to 9 00 PM Only one of these ranges is valid or a combined range of 9 30 AM to 9 00 PM where the 4 00 PM to 6 00 PM time segment is included in the range TimeCoordinates constructor with time of day parameters Visual Basic Overloads Public Sub New _ ByVal dstart As ChartCalendar ByVal starttime A
396. s the VS 2005 creation of partial classes when using the Add User Control wizard The VS 2005 Add User Control wizard now creates two classes UserControlName cs and UserControlName Designer cs or UserControlName vb and UserControlName Designer vb by default The Designer specific code is now placed in the UserControlName Designer vb file In VS 2003 2002 where a separate UserControlName Designer cs file is NOT created the Designer code was placed in the main UserControlName cs file most of which was hidden using the region Windows Form Designer generated cod compiler directive Many of example programs still use this older style with the single UserControIName file The single file structure is forward compatible with the VS 2005 compiler All of the example programs demonstrating new features in the software use the split UserControIName cs UserControlName Designer cs file structure This split structure is NOT backward compaticle with VS 2003 2002 Differences between this and the previous 1 6 version Starting with Visual Studio 2005 the Net Compact Framework 2 0 supports the UserControl class In the 1 6 version of the software the ChartView control was derived from the Net CF Control class and this has been changed to UserControl in order to make the Net CF version of QCChart2D source compatible with the Net version Since the ChartView control is now derived from UserControl and because of improvements made in the Net CF
397. s the most efficient method If memory is not an issue it is also possible to assign every line segment bar and scatter plot symbol a unique ChartAttribute object Used in this mode a single line plot can have unlimited number of multi colored line segments Another option labels each data point with its numeric y value Example program segments presented in this documentation are not complete programs and contain uninitialized and or undefined objects and variables Do not attempt to copy them into your own program Refer to the referenced example Simple Line Plots Class SimpleLinePlot GraphObj ChartPlot SimplePlot SimpleLinePlot The SimpleLinePlot class is a concrete implementation of the SimplePlot class and and displays simple datasets in line plot format Data points are connected using a straight line or a step line SimpleLinePlot contructor 224 Simple Plot Objects Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDataset ByVal attrib As ChartAttribute C4 public SimpleLinePlot PhysicalCoordinates transform SimpleDataset dataset ChartAttribute attrib transform The coordinate system for the new SimpleLinePlot object dataset The line plot represents the values in this dataset attrib Specifies the attributes line and fill color for the line plot A ChartAttribute object sets the objects global line color
398. s tote d cota retine TT 212 Line Gap PIOUS acest cts oobis tereti a cal eta etae ues toed aah eae de ote si 275 MultizLine Plots ooo icit oe odierna odeditee t eee eae nonas 278 Open High Low Close Plots 1525 m bo tette tpe prre tn ai epa d iater ped uix cap aad 281 stacked Bar Plots ooh e ERROR EREEREER TOOT ees usto tot luci lb Saas 284 Stacked Bine PIOS aoo ee eset o eti arabe aed i desi tate aen tosta e fusi 286 12 Contour PIONS a ote osea e e Re ursa baa edite eos taque sd ba Nepotis 291 Line and Filled Contour Plots teer eer te tte a ect eet ern eee 291 vi 13 Data Markers and Data Cursors nennen nennen sess esee esses sese sees 299 Data MORES doses dasa hays edat haee pad duds e sets tesa iut dent Ua oaa ad LUN dra B 299 Data CUFSOIs eerte piede diicatea teque ia quedes taie d eae etd 302 14 Moving Chart Objects Data Points and Coordinate Systems sss 309 Moving Chart 61 e D ee wale DES NO Be uae teca ut 309 Moving Simple Plot Object Data Points essere 312 Moving the Chart Coordinate SySEGETL 2 sse eee eee ee d osa terit es d eS STR QU FUN EN 314 13 X DDITHID S os ehe toa taces tet canara lane Rae MU D A CL a dt EV du oy Zo 319 Simple Zooming of a single physical coordinate system sess 319 Super Zooming of multiple physical coordinate systems sss 323 Limiting tlie Zoom Range a eee decedit a E UR OO e IRR Honea 327 Magnifying a portion of a
399. sLabels TimeAxisLabels Class Architecture 31 180 This class has two axes one linear y axis and one circular axis The linear axis is scaled for the desired range of radius values This can extend from minus values to plus values The second axis is a circle centered on the origin with a radius equal to the range of the radius scale This circular axis represents 360 degrees of the antenna scale and the tick marks that circle this axis are spaced at equal degree intervals 32 Class Architecture ElapsedTimeAxisLabels Axis labels inform the user of the x and y scales used in the chart The labels center on the major tick marks of the associated axis Axis labels are usually numbers times dates or arbitrary strings Possible date labels for todays date April 04 2005 2005 4 2005 4 04 2005 4 04 2005 ns 4 05 4 04 05 4 04 05 April Apr A Monday Man M AxisLabels NumericAxisLabels StringAxisLabels TimeAxisLabels Axis Labels Possible numeric labels for the value 12340 Possible time labels for the current time 6 15 30 24 Hour Made 12340 0 Decimal 6 15 24 Hour Mode 1 2340E 004 Scientific 15 30 Minute Second 12 340K Business 6 15 30 12 Hour Mode 123400096 Percent 6 15 12 Hour Mode 1 2340x10 Exponent 12 340 Currency Cadillac Steak knives Multi line axis Your fred labels are supported Western Eastern Southern Northern Sales Sales Sales Sales Region Region R
400. sedTimeAutoScale Dataset2 ChartObj X AXIS ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pIransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 7 Dim xAxis As New ElapsedTimeAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis Dim xAxisLab As New ElapsedTimeAxisLabels xAxis xAxisLab SetTextFont theFont xAxisLab AxisLabelsDayFormat ChartObj ELAPSEDTIMEFORMAT NEXTTODAYSTRING chartVu AddChartObject xAxisLab Dim yAxisLab As New NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Axis Labels 207 Polar Axes Labels Class PolarAxesLabels GraphObj ChartText AxisLabels NumericAxisLabels PolarAxesLabels The PolarAxesLabels class extends the NumericAxisLabels class and creates labels for objects of the PolarAxes class The PolarAxesLabels class labels the two parts of the polar axes the x and y axes pair defining the polar magnitude and the polar angle circle bounding the x and y axes The class extends the NumericAxisLabels class and uses that class s methods and properties for managing the label properties The x and y axes have extents of R The only labels needed for these axes are for the positive section of the x axis The easiest way to manage this is to create a local x axis that extends from 0 to R This local axis is not drawn but is use
401. setarray As SimpleDataset Datasetl Dataset2 pAntennaTransform New AntennaCoordinates pAntennaTransform AutoScale datasetarray ChartObj AUTOAXES FAR pAntennaTransform SetGraphBorderDiagonal 0 25 0 15 0 75 0 85 Dim background As New Background pAntennaTransform ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject background Dim pAntennaAxis As AntennaAxes pAntennaTransform GetCompatibleAxes pAntennaAxis LineColor Color Black chartVu AddChartObject pAntennaAxis Dim pAntennaGrid As New AntennaGrid pAntennaAxis AntennaGrid GRID ALL pAntennaGrid ChartObjAttributes New ChartAttribute Color LightBlue 1 DashStyle Solid chartVu AddChartObject pAntennaGrid Polar Charts 361 Dim pAntennaAxisLabels As AntennaAxesLabels DirectCast pAntennaAxis GetCompatibleAxesLabels AntennaAxesLabels chartVu AddChartObject pAntennaAxisLabels Dim transparentRed As Color Color FromArgb 180 255 0 0 Dim transparentBlue As Color Color FromArgb 180 0 0 255 Dim attribl As New ChartAttribute transparentRed 1 DashStyle Solid attribl SymbolSize 7 Dim attrib2 As New ChartAttribute Color Blue 1 DashStyle Solid Color Blue attrib2 SymbolSize 7 Dim thePlotl As New AntennaLinePlot pAntennaTransform thePlotl InitAntennaLinePlot Datasetl attribl chartVu AddChartObject thePlot1l Dim thePlot2 As New AntennaScatterPlot pAntennaTransform thePlot2 InitAntennaScatterPlot Datasetl
402. setl ReadTimeSimpleDataset csvDataFile LineFill Datasetl csv 0 0 70 Chart Datasets Simple ElapsedTime Dataset Class ElapsedTimeSimpleDataset ChartObj ChartDataset SimpleDataset ElapsedTimeSimpleDataset The ElapsedTimeSimpleDataset class uses TimeSpan values as one set of the x or y values and floating point values as the other TimeSpan values are actually stored internally as their equivalent millisecond values It has two main constructors The following constructor creates a time dataset using the x and y values stored in arrays ElapsedTimeSimpleDataset constructors Visual Basic Overloads Public Sub New ByVal sname As String _ ByVal x As TimeSpan _ ByVal y As Double _ Overloads Public Sub New _ ByVal sname As String _ ByVal x As Double ByVal y As TimeSpan _ C public ElapsedTimeSimpleDataset string sname TimeSpan x double y public ElapsedTimeSimpleDataset string sname double x TimeSpan y i sname Specifies the name of the dataset x An array that specifies the x values either doubles or TimeSpan objects of a dataset Chart Datasets 71 y An array that specifies the y values of a dataset either doubles or TimeSpan objects The length of the y array must match the length of the x array Either x or y values should be TimeSpan based The number of data points is the value of x Length property The x a
403. sets include a simple dataset type that can substitute ChartCalendar values or TimeSpan as the x or y values Values Also there is a dataset type that is used to plot contour data Copies of the original data arrays are stored The original source data can be deleted once the dataset is created If you want to make any changes to the data you must change the data in the dataset not the original source data Datasets can be initialized using CSV comma separated value files The CSV file is a common file structure that can share data between spreadsheets databases and word processing programs Datasets can also write CSV files loadable into other programs If you need to plot data stored in a database either save the data as a CSV file or read the data into arrays Once the data is in either format inititialize a dataset using the appropriate class and constructor The ChartDataset class is the abstract base class for all of the dataset classes It contains data common to all dataset classes such as the x value array the number of x values the dataset name and the dataset type Simple Numeric Dataset Class SimpleDataset ChartObj ChartDataset 62 Chart Datasets t SimpleDataset The SimpleDataset class represents simple floating point xy data where for every x value there is one y value The number of xy data points in a simple dataset is referred to as the number of columns or as the property numberDatapoints Thi
404. sforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Add in max width of cells double maxx pTransforml GetScaleStopX 20 Add in max height of cells double maxy pTransforml GetScaleStopY 10 pTransforml SetScaleStopX maxx pTransforml SetScaleStopY maxy Re auto scale to produce rounded axis values pTransforml AutoScale ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR plransforml SetGraphBorderDiagonal 0 15 15 90 0 75 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag true CellPlot thePlotl new CellPlot pTransforml Datasetl attribl for i20 i lt numPoints i thePlotl SetSegmentColor i Color FromArgb int xl i int 1y1 0 1 2 0 int el det y1 2 3 7 chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New GroupDataset First xl yl Datasetl SetAutoScaleNumberGroups 1 picks up on width but because data is random should still work Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Add in max width of cells Dim maxx As Double pTransforml GetScaleStopX 20 Add in max height of cells Dim maxy As Double pTransforml GetScaleStopY 10 Group Plot Objects 259 pTransforml
405. sical coordinate system of the chart Rather the axes provide a visual key to the physical coordinate system Define the physical coordinate system first using one of the classes derived from PhysicalCoordinates Next create the axes that reside in the physical coordinate It is possible to define a physical coordinate system scaled using a xy range of 0 100 0 100 and create an axis residing in that coordinate system that has minimum and maximum values of 0 25 The axis in that case takes up 25 of the chart plot area of the chart Define the same axis with minimum and maximum values of 0 100 and the axes will span 100 of chart plot area A chart axis consists of at least two and usually three parts the axis line the axis tick marks and the axis labels The axis line extends from the minimum value to the maximum value of the axis Major tick marks perpendicular to the axis line divide the axis line into sub ranges suitable for labeling Minor tick marks also perpendicular to the axis line further subdivide the space between the major tick marks into even smaller intervals Axis labels are optional On one side of a chart there may be an axis with labels and on the other side an axis without labels 152 Axes Chart Axes There are four concrete axis types supported by the QCChart2D CF for the Net Compact Framework library Axis Type Class Linear LinearAxis Logarithmic LogAxis Date time TimeAxis ElapsedTime ElapsedTimeA xis Pol
406. ss 138 The Chart View Note how the ChartView PreferredSize property is used to establish the base size for font scaling If the final chart window is larger than the PreferredSize the fonts are scaled larger if the final chart window is smaller than the PreferredSize the fonts are scaled smaller ChartView AddChartObject example extracted from the example program BigChartDemo class LabeledDatapoints C ChartView chartVu chartViewl SimpleDataset Datasetl new SimpleDataset First xl yl CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 15 90 0 8 xAxis new LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Visual Basic Dim chartVu As ChartView ChartViewl Dim Datasetl As New SimpleDataset First xl yl Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE _ ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 7 Dim xAxis As New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Rendering Order of GraphObj Objects Each GraphObj object is added as an element to an ArrayList object inside the ChartView class When the chart view is rendered it runs through the G
407. sses using System EventHandler delegate event driven model The chapter also summarizes the classes in the QCChart2D CF for the Net Compact Framework library There are five primary features of the overall architecture of the QCChart2D CF for the Net Compact Framework classes These features address major shortcomings in existing charting software for use with both Net and other computer languages First QCChart2D CF for the Net Compact Framework uses the standard Net window architecture Charts are placed in a ChartView window that derives from the System Windows Forms UserControl class Position one or more ChartView objects in a Net container windows using the standard container layout managers Mix charts with other components in the same container Charts use the standard Net event processing model for handling mouse and keyboard events Second the library is extensible Hundreds of different vertical markets use computer charting The charts used in each market have a unique look and feel A well designed object oriented charting package allows the programmer to extend the software without modifying the source of the underlying classes Instead the programmer extends the software by deriving a new class from an existing base class The new derived class localizes custom source code and the source of the underlying 18 Class Architecture classes remains unchanged In the QCChart2D CF for the Net Compact Framework classes a user
408. stem of the plot area into a linear world coordinate system applied to the whole viewport For example if the desired chart plot area uses a physical coordinate system of 0 0 0 0 100 0 100 0 and the plot area is centered in the graph area with the plot area 2 the width and height of the graph area then the coordinate system 50 50 150 150 is calculated and used to scale the graph area The WorkingCoordinates class uses the underlying WorldCoordinates class to scale the viewport to the final world coordinates scale Physical Coordinates The PhysicalCoordinates abstract class is responsible for mapping the plot area coordinate system whether it 1s linear logarithmic date time polar antenna continuous or discontinuous into a continuous linear coordinate system It uses the WorkingCoordinates class to map this plot area coordinate system to the entire viewport The PhysicalCoordinates system uses independent scale objects derived from ChartScale to manage coordinate conversions for the x and y dimensions This way the x coordinate can use one coordinate conversion object LinearScale LogScale TimeScale and the y coordinate another There are five concrete implementations of the PhysicalCoordinates class CartesianCoordinates TimeCoordinates ElapsedTimeCoordinates PolarCoordinates and AntennaCoordinates Use the CartesianCoordinates class for any combination of linear and logarithmic scaling for the x and y coordinate Use
409. stem will always map to the exact same pixel as the same point plotted in the graph coordinate system the odd pixel problem still exists We avoid the odd pixel problem by never plotting points using the plot area coordinate system using only the graph area coordinate system instead The calculated physical coordinate system applied to the graph area is referred to as the working coordinate system Coordinate Systems A QCChart2D CF for the Net Compact Framework library uses other coordinate systems mapped onto the default Net CF device coordinate system These other coordinate systems include world coordinates working coordinates and physical coordinates Scaling and Coordinate Systems 95 User Coordinates The UserCoordinates class manages a simple viewport drawing system using the Net CF System Drawing classes World Coordinates The WorldCoordinates class maps a linear double based coordinate system onto the integer based user coordinate system of the UserCoordinates class Where the underlying user coordinate system may have an integer range for example 0 400 0 300 units the world coordinate system is able to map this to a completely arbitrary double based linear range for example 0 0 to 10 0 0 0 to 10 0 The world coordinate system applies to the entire graph window and not just the plot area Working Coordinates The WorkingCoordinates class manages a working coordinate system that maps the physical coordinate sy
410. stockPriceData 2 0 24 low for i21 i lt nNumPnts i xValues i ChartCalendar currentdate Clone stockPriceData 3 i stockPriceData 3 i 1 3 0 52 ChartSupport GetRandomDouble close stockPriceData 0 i stockPriceData 3 i 2 0 5 ChartSupport GetRandomDouble open minval Math Min stockPriceData 3 i stockPriceData 0 i maxval Math Max stockPriceData 3 i stockPriceData 0 i stockPriceData 1 i maxval 1 5 ChartSupport GetRandomDouble high stockPriceData 2 i minval 1 5 ChartSupport GetRandomDouble low currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData Visual Basic Dim nNumPnts As Integer 50 Dim nNumGroups As Integer 4 Dim weekmode As Integer ChartObj WEEK 5D Dim xValues nNumPnts 1 As ChartCalendar Dim stockPriceData nNumGroups 1 nNumPnts 1 As Double 86 Chart Datasets Dim minval As Double 0 0 Dim maxval As Double 0 0 Dim i As Integer Dim currentdate As New ChartCalendar Make sure not to start on a weekend currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode xValues 0 currentdate Clone currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode stockPriceData 3 0 25 close st
411. stogramPlot pTransforml Datasetl 0 0 attribl NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj PERCENTFORMAT bardatavalue SetColor Color Black thePlotl SetBarDatapointLabelPosition ChartObj INSIDE BAR thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue true thePlotl SetSegmentAttributesMode true thePlotl SetSegmentFillColor 0 Color Red thePlotl SetSegmentFillColor 1 Color Magenta thePlotl SetSegmentFillColor 2 Color Blue thePlotl SetSegmentFillColor 3 Color Green t hePlotl SetSegmentFillColor 4 Color Yellow hePlotl SetSegmentFillColor 5 Color Pink chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New GroupDataset Actual Sales xl yl Dim pTransforml As New CartesianCoordinates pTransforml SetScaleStartY 0 prTransforml SetScaleStartX 0 pTransforml SetScaleStopX 80 pIransforml SetScaleStopY 1 0 Group Plot Objects 275 pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 75 Dim graphbackground As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 Color FromArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject graphbackground Define axes axes labels and grids Dim attribl As New ChartAttribute Color Black 0 DashStyle Solid Color Green attribl SetFillFlag True Dim thePlotl
412. sult in a tick interval of 3 5 which is inappropriate for either major or minor tick intervals The programmer can calculate the proper tick mark intervals using custom algorithms or use the automatic methods that are used by default in the axis constructors Linear Axis Intercept An axis resides in a 2 dimensional physical coordinate system The minimum and maximum values for the axis provide coordinate information for only one dimension x coordinates in the case of an x axis and y coordinates in the case of the y axis The missing coordinate needed to position the axis is the axis intercept The axis intercept specifies the y coordinate position for the x axis and the x coordinate position for the y axis Linear Axis Tick Mark Origin The axis major and minor tick mark intervals specify the space between adjacent tick marks A minor tick mark interval of 1 0 and a major tick mark interval of 5 0 may result in major tick marks at 0 0 5 0 10 0 15 0 20 0 etc It can also result in major tick marks at 0 88769 4 11231 9 11231 14 11231 19 11231 etc Obviously the first example is the desired tick mark placement The difference between the two examples is the tick mark starting point or origin In the first example the tick mark origin is 0 0 and in the second case the tick mark origin is 0 88769 The tick mark origin is an important property because often it should not be the minimum value of the axis but rather some interme
413. t PolarLinePlot The PolarLinePlot class is a concrete implementation of the PolarPlot class and displays data in a simple line plot format The lines drawn between adjacent data points use polar coordinate interpolation PolarLinePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PolarCoordinates ByVal dataset As SimpleDataset ByVal attrib As ChartAttribute C public PolarLinePlot PolarCoordinates transform SimpleDataset dataset ChartAttribute attrib transform The coordinate system for the new PolarLinePlot object dataset The polar line plot represents the polar coordinate values in this dataset The x values of the dataset represent the magnitudes of the points and the y values the polar angles in radians attrib Specifies the attributes line color for the line plot Polar Charts 355 The polar line plot class interpolates between adjacent data points in polar coordinates and not using straight lines as in the Cartesian coordinate plotting functions This gives the lines between adjacent data points in a polar plot a curved look Polar line plot and scatter plot chart extracted from the example program BigChartDemo class PolarLinePlotChart C int numpl 100 double magl new double numpl double angl new double numpl int i for i20 i lt numpl i angl i ChartSupport ToRadians double i 360 0 double nump1 magl i M
414. t In order to add a ChartView control at runtime the ChartView control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNetMib folder and select it You will also need to make sure that you com quinncurtis chart2dnetcf and System Drawing Drawing2D in the Imports section of any module that references ChartView ChartView constructor example extracted from the example program UserChartExample2 Form1 In VB there is no default constructor to invoke the chart initialization For that reason the chart creation code is placed in the Form Load event Imports com quinncurtis chart2dnetcf Imports System Drawing Drawing2D Public Class Forml Dim chartViewl As ChartView Nothing Private Sub Forml Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InstantiateChartView If chartViewl IsNot Nothing Then InitializeChart End If End Sub Public Sub InstantiateChartView Allow room for a menu in the form Dim graphRect As Rectangle New Rectangle 1 1 Me ClientRectangle Width 2 Me ClientRectangle Height 2 Instantiate chart control chartViewl New ChartView graphRect Me End Sub Public Sub InitializeChart Dim chartVu As ChartView chartViewl Using QCChart2D for Ne
415. t amarker rNumericLabelCntr 1 0 Add a numeric label the identifies the marker pointLabel new NumericLabel GetChartObjScale textCoordsFont rNumericLabelCntr nearestPoint GetX nearestPoint GetY PHYS POS DECIMALFORMAT 0 Nudge text to the right and up so that it does not write over marker pointLabel SetTextNudge 5 5 chartVu AddChartObject pointLabel chartVu UpdateDraw Data Markers and Data Cursors Visual Basic Public Cla Inherit Private Private ss CustomChartDataCursor s DataCursor pointLabel As NumericLabel textCoordsFont As New Font Microsoft Sans Serif 8 FontStyle Regular Private Private Private Public MyBa cplo epic End Sub Public Dim Dim Dim Dim Dim Dim MyB If rNumericLabelCntr As Double 0 0 cplot1 As SimpleLinePlot cplot2 As SimpleLinePlot Sub New ByVal achartview As ChartView ByVal thetransform As CartesianCoordinates ByVal plotl As SimpleLinePlot ByVal plot2 As SimpleLinePlot ByVal nmarkertype As Integer ByVal rsize As Double se New achartview thetransform nmarkertype rsize tl plotl t2 plot2 New Overrides Sub OnMouseUp ByVal mouseevent As MouseEventArgs nearestPointObjl As New NearestPointData nearestPointObj2 As New NearestPointData nearestPoint As New Point2D 0 0 chartview As ChartView GetChartObjComponent bfoundl As Boolean False bfound2 As Boolean False ase OnMouseUp mouseeve
416. t CF to Create Windows Applications 419 End Sub InitializeChart End Class Adding a UserControl derived from ChartView at runtime You can derive your own chart class from ChartView and use that control instead of the base ChartView class Right click on the project in the Solution Explorer and select Add User Control Choose the UserControl template This will add a basic template for a user defined UserControll to your project Go to the UserControll1 Designer vb file and change the inheritance from UserControl to ChartView You can then customize the UserControll class to produce a specific chart See the UserControll vb code in the UserChartExample3 example program In order to add a ChartView derived control at runtime the ChartView derived control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNet lib folder and select it You will also need to make sure that you reference com quinncurtis chart2dnetcf and System Drawing Drawing2D in the Imports section of any module that references ChartView ChartView constructor example extracted from the example program UserChartExample3 In VB there is no default constructor to invoke the chart initialization For that reason the chart creation code is placed in the Form Load event
417. t Compact Framework includes a basic API for writing applications that make use of GUI s data structures databases files and streams networking and web services The graphics part of the API is a subset of the standard Net graphics API supporting far fewer classes than are found in that API and far fewer methods and properties in the classes that are supported A few of the limitations of the Net Compact Framework API compared to the regular Net API are e Brushes only support simple color i e no gradients or textures e Only simple RGB colors are supported with no alpha blending no transparency e No generalized geometry support for arbitrary shapes because Net Compact Framework lacks a Matrix class and a GraphicsPath class 10 Introduction e No 2D coordinate transformation classes for rotating text and arbitrary geometric shapes Text cannot be rotated not even 90 degrees for vertical text No printer and image output support Images imported into a program cannot be rotated In general none of the advanced features found in the System Drawing Drawing2D library are available to the Net Compact Framework programmer The QCChart2D CF for the Net Compact Framework software derives from our original QCChart2D for Net software The original software makes extensive use of the advanced graphics features found in the workstation version of Net In order to port the QCChart2D software to the Net Compact Framework compromises ha
418. t Compact Framework software directly supports twelve time formats and eightteen date formats It is also possible to create custom date time formats The software makes use of the System DateTime ToString method to format times and dates A table listing predefined date time formats appears below Date Time Format Constant TIMEDATEFORMAT MSDDD TIMEDATEFORMAT MSDD TIMEDATEFORMAT MSD TIMEDATEFORMAT MS TIMEDATEFORMAT 12HMSDD TIMEDATEFORMAT 12HMSD TIMEDATEFORMAT 12HMS TIMEDATEFORMAT 12HM TIMEDATEFORMAT 24HMDDD TIMEDATEFORMAT 24HMDD TIMEDATEFORMAT 24HMS TIMEDATEFORMAT 24HM TIMEDATEFORMAT STANDARD TIMEDATEFORMAT MDY TIMEDATEFORMAT DMY TIMEDATEFORMAT MY TIMEDATEFORMAT Q Format String mm ss fff mm ss ff mm ss f m ss h mm ss ff h mm ss f h mm ss h mm H mm ss ff H mm ss f H mm ss H mm MMMMM dd yyyy M dd yy d MM yy M yy None Example String Result 12 33 999 12 33 99 12 33 9 12 33 11 12 33 99 11 12 33 9 11 12 33 11 12 23 12 33 99 23 12 33 9 23 12 33 23 12 December 7 2000 12 07 00 7 12 00 7 00 Q1 198 Axis Labels TIMEDATEFORMAT MMMM TIMEDATEFORMAT MMM TIMEDATEFORMAT M TIMEDATEFORMAT DDDD TIMEDATEFORMAT DDD TIMEDATEFORMAT D TIMEDATEFORMAT Y TIMEDATEFORMAT MDY2000 TIMEDATEFORMAT DMY2000 TIMEDATEFORMAT MY2000 TIMEDATEFORMAT Y2000 MMMM MMM MMM dddd ddd ddd yy M dd yyyy d MM yyyy M yyyy yyyy January Jan J Tuesday T
419. t classes while not derived from the text classes use them internally Simple Text Classes Class ChartText GraphObj ChartText The ChartText class is the base class for all text output classes The ChartText class formats and places text in a chart Position the ChartText objects using any of the coordinate systems Rotate and justify the text vertically and horizontally Insert a CR carriage return ASCII 13 character at line breaks for multiline text The most common constructors are ChartText constructors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal tstring As String _ ByVal x As Double ByVal y As Double _ ByVal npostype As Integer _ ByVal xjust As Integer _ ByVal yjust As Integer _ ByVal rotation As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal tstring As String _ ByVal x As Double _ ByVal y As Double _ 380 Text Classes ByVal npostype As Integer _ Cf public ChartText PhysicalCoordinates transform Font tfont string tstring double x double y int npostype int xjust int yjust int rotation public ChartText PhysicalCoordinates transform Font tfont string tstring double x double y int npostype transform Places the text in the coordinate sys
420. t constructor and scales the coordinates using the TimeCoordinates SetTimeCoordinateBounds method SetTimeCoordinateBounds Method Visual Basic Overloads Public Sub SetTimeCoordinateBounds _ ByVal dstart As ChartCalendar ByVal starttod As Long _ ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal stoptod As Long ByVal y2 As Double _ ByVal nweektype As Integer _ C public void SetTimeCoordinateBounds ChartCalendar dstart long starttod double yl ChartCalendar dstop long stoptod double y2 int nweektype SetTimeCoordinateBounds example for a 5 day week and 9 30 AM to 4 00 PM time of day range SetWeekType method C long starttod 9 60 30 60 1000 msecs cooresponding to 9 30 AM long stoptod 16 60 60 1000 msecs cooresponding to 4 00 PM Scaling and Coordinate Systems 119 ChartCalendar dstart new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar dstop new ChartCalendar 1997 ChartObj JANUARY 5 double yl 0 0 double y2 55 0 TimeCoordinates stockTimeScale stockTimeScale new TimeCoordinates StockTimeScale SetTimeCoordinateBounds dstart starttod yl dstop stoptod y2 ChartObj WEEK 5D Visual Basic Dim starttod As Long 9 60 30 60 1000 T msecs cooresponding to 9 30 AM Dim stoptod As Long 16 60 60 1000 msecs cooresponding to 4 00 PM Dim dstart As ChartCalendar New ChartCalendar 1996 ChartOb
421. t create chart axes axis labels and axis grids Chapter 10 describes the classes used to display simple xy data one y value for each x value as line plots bar plots scatter plots line marker plots and simple versa plots Chapter 11 describes the classes used to display group data one or more y values for each x value as line plots group bar plots stacked bar plots scatter plots open high low close plots candlestick plots box and whisker plots floating stacked bar plots and group versa plots Chapter 12 describes plotting surface data using line and filled contours Chapter 13 14 15 and 16 describe classes that add interactive elements to a chart Chapter 13 describes data marker and data cursor classes used to mark and highlight data points using the mouse Chapter 14 describes classes that can move chart objects and individual data points Chapter 15 adds a zooming class where mouse events define a new scaling range for a chart redrawing the chart axes and data automatically Chapter 16 describes a generalized data tool tip class that can display the x and or y data values for a data point or custom text associated with the data point Chapter 17 describes classes for the display of pie and ring charts Chapter 18 describes classes for the display of data in a polar and antenna chart format Chapter 19 describes classes for the display chart legends used to create visual aids for the interpretation of different el
422. t objects line plots bar plots scatter plots etc are clipped to the plot area Other chart objects axes axes labels titles etc need to reside outside of the plot area and these objects clip to the graph area The plot area can have a background different from that of the graph background Often a contrast between the graph area background and the plot area background produces a more visually pleasing chart Class Background GraphObj Background The Background class paints the graph area background or the plot area background One instance of the class can only paint one area either the graph area or the plot area If you want unique fill properties for both you need to create two instances of the class The Background class uses one of the following techniques to fill the background e solid color e simple color gradient defined using two RGB colors Background constructors Use this constructor to fill the background with a single color Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal bgtype As Integer _ ByVal bgcolor As Color _ C public Background 148 Background Colors Textures and Gradients PhysicalCoordinates transform int bgtype Color bgcolor Use this constructor to fill the background with the gradient defined using the startcolor and stopcolor arguments Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates
423. t represents the values in this group dataset attribs An array of ChartAttribute objects sized the same as the number of groups in the dataset specify the attributes line color for each group of the stacked line graph The attributes for each group can set or modified using the SetSegment methods where the segment number parameter cooresponds to the group number These methods include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Stacked line plot example extracted from the example program BigChartDemo class StackedLineChart C int numPoints 100 int numGroups 7 double x1 new double numPoints double yl new double numGroups numPoints 288 Group Plot Objects Initialize data theFont new Font Microsoft Sans Serif 10 FontStyle Bold GroupDataset Datasetl new GroupDataset First x1 y1 Datasetl SetStackMode ChartObj AUTOAXES STACKED CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartX 0 prIransforml SetScaleStartY 0 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color EFrom rg5 255 255 255 chartVu AddChartObject background pTransforml SetGraphBorderDiagonal 0 15 15 90 0 75 Define axes axes labels and grids ChartAttribute attr
424. t to start programming the control using the control s designe time property 134 The Chart View table A design time property table is poor way of creating a chart with a custom look and we do not implement properties that allow you to define a chart at design time Instead you define the chart in the body of the form that contains the chart See any of our examples Adding a ChartView control at runtime The ChartView class can also be instantiated at runtime without placing it on a form at design time You can use the default ChartView constructor or one of the special constructors that simplify adding an instance of the control to a form at runtime See the list of ChartView constructors a couple of pages back In general you pass the ChartView constructor a parent object Form Panel or TabbedControl and a positioning rectangle that defines the position and size of the ChartView object In order to add a ChartView control at runtime the ChartView control does NOT need to be added to the Visual Studio Toolbox You will need to add the QCChart2DNetCF DLL to the project by right clicking project name in the Solution Explorer and selecting Add Reference Browse to the QCChart2DNetCF DLL in the Quinn Curtis DotNetMib folder and select it You will also need to make sure that you reference com quinncurtis chart2dnetcf in the using or Imports for VB section of any module that references ChartView ChartView constructor example extracted
425. t two TimeAxis constructors assume that the axis extents match the extents of the underlying coordinate system transform The third TimeAxis constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system TimeAxis constructors Visual Basic Overloads Public Sub New _ ByVal transform As TimeCoordinates Overloads Public Sub New ByVal transform As TimeCoordinates ByVal ntickmarkbase As Integer _ Overloads Public Sub New _ ByVal transform As TimeCoordinates ByVal dstart As ChartCalendar ByVal dstop As ChartCalendar _ Cf public TimeAxis TimeCoordinates transform public TimeAxis TimeCoordinates transform public TimeAxis TimeCoordinates transform int ntickmarkbase ChartCalendar dstart ChartCalendar dstop he transform dstart dstop ntickmarkbase The time coordinate system the axis is placed in If the starting and ending dates of the axis are not explicitly set the axis uses the starting and ending dates of the transform time scale The starting date value for the axis The ending date value for the axis This field defines the major and minor tick mark spacing for a time axis Use one of the Date time axis tick mark mode constants TIMEAXIS YEARMONTH TIMEAXIS DAYHOUR for example Axes 171 Other axis properties axis intercept tick mark lengths tick mark direction are automatically c
426. tGraphBorderDiagonal 0 55 0 1 0 95 0 75 pIransform2 SetScaleStartY 0 Define axes axes labels and grids Dim thePlot2 As New StackedBarPlot pTransform2 Datasetl ChartCalendar GetCalendarWidthValue ChartObj YEAR 0 75 0 0 _ attribArray ChartObj JUSTIFY CENTER Dim bardatavalue As NumericLabel thePlot2 GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 1 bardatavalue SetColor Color Black thePlot2 SetPlotLabelTemplate bardatavalue thePlot2 SetBarDatapointLabelPosition ChartObj CENTERED BAR thePlot2 SetShowDatapointValue True chartVu AddChartObject thePlot2 Stacked Line Plots Class StackedLinePlot GraphObj ChartPlot GroupPlot Group Plot Objects 287 StackedLinePlot The StackedLinePlot class extends the GroupPlot class and displays data in stacked line format In a stacked line plot each group is stacked on top of one another each group line a cumulative sum of the groups before it StackedLinePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal attribs As ChartAttribute Cf public StackedLinePlot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attribs transform The coordinate system for the new StackedLinePlot object dataset The stacked line plo
427. ta PolarCoordinates This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot polar coordinate data AntennaCoordinates This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot antenna coordinate data The antenna coordinate system differs from the more common polar coordinate system in that the radius can have plus minus values the angular values are in degrees and the angular values increase in the clockwise direction Attribute Class ChartAttribute This class consolidates the common line and fill attributes as a single class Most of the graph objects have a property of this class that controls the color fill attributes of the object ChartAttribute This class consolidates the common line and fill attributes associated with a GraphObj object into a single class Auto Scaling Classes 24 Class Architecture AutoScale LinearAutoScale LogAutoScale TimeAutoScale ElapsedTimeAutoScale Usually programmers do not know in advance the scale for a chart Normally the program needs to analyze the current data for minimum and maximum values and create a chart scale based on those values Auto scaling and the creation of appropriate axes with endpoints at even values and well rounded major and minor tick mark spacing is quite complicated The AutoScale classes provide tools that make automatic generation of charts easier AutoScale
428. taFile TimeGroupDatasetl csv Read it back in just as a test Datasetl ReadTimeGroupDataset csvDataFile TimeGroupDatasetl csv 0 0 Elapsed Time Dataset Class ElapsedTimeGroup Dataset ChartObj ChartDataset GroupDataset ElapsedTimeGroup Dataset The ElapsedTimeGroupDataset class represents group data where every x value can have one or more y values The number of x values in a group plot is referred to as the number of columns or as numberDatapoints and the number of y values for each x value is referred to as the number of rows or numberGroups ElapsedTimeGroupDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As TimeSpan _ ByVal y As Double _ Overloads Public Sub New _ ByVal sname As String _ 88 Chart Datasets ByVal x As Double ByVal y As Double _ Ct public ElapsedTimeGroupDataset String sname TimeSpan x double y public ElapsedTimeGroupDataset string sname double x double y sname Specifies the name of the dataset x An atray that specifies the x values of a group dataset The length of the x array sets the number of columns for the group dataset y An array that specifies the y values of a group dataset where y has the dimensions number of rows number of columns The number of rows in the y array sets the number of groups in the group dataset The number of columns in the
429. taset ByVal spiestringls As String _ ByVal attribs As ChartAttribute ByVal labelinoutl As Integer _ ByVal pielabelformat As Integer _ C public RingChart PhysicalCoordinates transform SimpleDataset dataset string spiestringis ChartAttribute attribs int labelinouti int pielabelformat The pie ring chart is placed in the coordinate system defined by The pie ring chart represents the values in this dataset The x values of the simple dataset used for data storage specify the pie ring wedge values The y values of the dataset specify the explode percentage for each pie ring wedge An atray of strings size dataset GetNumberDatapoints used as dataset GetNumberDatapoints that specify the attributes outline color and fill color for each wedge of a pie ring chart transform transform dataset spiestrings labels for the pie ring slices attribs An array of ChartAttribute objects size labelinout An array of integer size dataset GetNumberDatapoints specifying if a specific pie ring slice text label is drawn inside the Pie Charts 349 pie ring slice or outside of the pie ring slice Use one of the constants PIELABEL OUTSLICE or PIELABEL INSLICE pielabelformat All pie ring slice labels share the same format Use one of the pie ring slice label format constants PIELABEL NONE Do not display and pie ring slice text PIELABEL STRING Display only the pie ring text strings no n
430. tasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR CartesianCoordinates pTransform2 new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform2 AutoScale Dataset2 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR CartesianCoordinates pTransform3 new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform3 AutoScale Dataset3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR CartesianCoordinates pTransform4 new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform4 AutoScale Dataset4 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR CartesianCoordinates pTransform5 326 Zooming new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform5 AutoScale Dataset5 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR CartesianCoordinates transformArray pTransforml pTransform2 pTransform3 pTransform4 pTransform5 ZoomWithStack zoomObj new ZoomWithStack chartVu transformArray true zoomObj SetButtonMask MouseButtons Left zoomObj SetZzoomYEnable true zoomObj SetZzoomXEnable true zoomObj SetZzoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetZoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable true zoomObj SetZzoomStackEnable true chartVu SetCurrentMouseListener zoomObj Visual Basic Private Class ZoomWithStack Inherits ChartZoom Public Sub New ByVal component As ChartView ByVal transforms As
431. te Color Red 1 DashStyle Solid Color Red Dim profitAttrib As New ChartAttribute Color Green 1 _ DashStyle Solid Color Green profitAttrib SetFillFlag True lossAttrib SetFillFlag True profitAttrib SetLineFlag False lossAttrib SetLineFlag False Must call the linePlot or similar function before setting segment attributes so that it know size of segment buffer to allocate Dim thePlot3 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset3 profitAttrib Dim yValues As Double Dataset3 GetYData thePlot3 SetSegmentAttributesMode True For i 0 To Dataset3 GetNumberDatapoints 1 If yValues i 0 0 Then thePlot3 SetSegmentAttributes i profitAttrib Else thePlot3 SetSegmentAttributes i lossAttrib End If Next i chartVu AddChartObject thePlot3 Simple Bar Plots Class SimpleBarPlot GraphObj 228 Simple Plot Objects ChartPlot SimplePlot SimpleBarPlot The SimpleBar Plot class is a concrete implementation of the SimplePlot class and displays data in a bar format Individual bars the maximum value of which corresponds to the y values of the dataset display justified with respect to the x values SimpleBarPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDataset ByVal barwidth As Double _ ByVal barbase As Double _ ByVal attrib As ChartAttribute ByVal barjust As Integer _
432. ted from the DataCursorView and CustomChartDataCursor classes C public class CustomChartDataCursor extends DataCursor Create your own custom constructor and call the parent constructor public CustomChartDataCursor ChartView achartview CartesianCoordinates thetransform int nmarkertype double rsize base achartview thetransform nmarkertype rsize The mouse Released event should look like this public void OnMouseUp MouseEvent event base MouseReleased mouseevent Add your own code here 304 Data Markers and Data Cursors CustomChartDataCursor dataCursorObj new CustomChartDataCursor chartVu pTransforml ChartObj MARKER HVLINE 8 0 dataCursorObj SetEnable true chartVu SetCurrentMouseListener dataCursorObj Visual Basic Public Class CustomChartDataCursor Inherits DataCursor Public Sub New ByVal achartview As ChartView _ ByVal thetransform As CartesianCoordinates _ ByVal nmarkertype As Integer ByVal rsize As Double MyBase New achartview thetransform nmarkertype rsize End Sub New Public Overrides Sub OnMouseUp ByVal mouseevent As MouseEventArgs MyBase OnMouseUp mouseevent Add your own code here End Sub OnMouseUp End Class CustomChartDataCursor Dim dataCursorObj As New _ CustomChartDataCursor chartVu pTransforml ChartObj MARKER HVLINE 8 0 dataCursorObj SetEnable True chartVu SetCurrentMouseListener dataCursorObj A marker can be placed at any xy c
433. ted from the example program BigChartDemo class LineFill C SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlot1 SimpleLinePlot thePlot2 new SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 SimpleLinePlot thePlot3 new SimpleLinePlot pTransforml Dataset3 profitAttrib Font legendFont new Font Microsoft Sans Serif 14 FontStyle Bold ChartAttribute legendAttributes new ChartAttribute Color Gray 1 DashStyle Solid Color From Argb 155 155 155 legendAttributes SetFillFlag true legendAttributes SetLineFlag true StandardLegend legend new StandardLegend 0 2 0 15 0 3 0 3 legendAttributes StandardLegend VERT DIR legend AddLegendItem Expenses ChartObj LINE thePlotl legendFont legend AddLegendItem Revenue ChartObj LINE thePlot2 legendFont legend AddLegendItem Profit ChartObj HBAR thePlot3 legendFont legend AddLegendItem Loss ChartObj HBAR lossAttrib legendFont chartVu AddChartObject legend 372 Legends Visual Basic Dim thePlotl As SimpleLinePlot New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Dim thePlot2 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 Dim thePlot3 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset3 profitAttrib chartVu AddC
434. tem defined by transform ffont A reference to a Font object tstring A reference to a string object x Specifies the x value of the text position y Specifies the y value of the text position npostype Specifies the if the position of the text is specified in physical xjust yjust rotation coordinates normalized coordinates or Net CF device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS Specifies the horizontal justification of the text Use one of the text justification constants JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX Specifies the vertical justification of the text Use one of the text justification constants JUSTIFY MIN JUSTIFY CENTER or JUSTIFY MAX The rotation of the text Not supported Place text in is a time coordinate system TimeCoordinates by converting the time x position to milliseconds and using the milliseconds as the x position value Text Classes 381 ChartText example extracted from the example program BigChartDemo class Multiline C Font theLabelFont new Font Microsoft Sans Serif 10 FontStyle Bold ChartText currentLabell new ChartText pTransforml theLabelFont L HS 50uA 15 5 yi1 0 85 41 Chartobj PHYS POS chartVu AddChartObject currentLabell ChartText currentLabel2 new ChartText pTransforml theLabelFont WER 180uA 15 5 yl1 l 95 1 ChartObj PHYS POS chartVu AddChartObject currentLabel2
435. tem unchanged and change the starting point of the axis tick marks using the axis SetAxisTickOrigin method The example below is derived from the Logarithmic example code GroupDataset Datasetl new GroupDataset First x1l yl CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LOG SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartX 20 Force start of scale at 20 AutoScale will always choose a power of 10 decade LogAxis xAxis new LogAxis pTransforml ChartObj X AXIS xAxis SetAxisTickOrigin 20 chartVu AddChartObject xAxis Visual Basic Create the ChartView object to place graph objects in Dim Datasetl As GroupDataset New GroupDataset First xl yl 446 FAQs Dim pTransforml As CartesianCoordinates _ New CartesianCoordinates ChartObj LOG SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prTransforml SetScaleStartX 20 Force start of scale at 20 AutoScale will always choose a power of 10 decade Dim xAxis As LogAxis New LogAxis pTransforml ChartObj X AXIS xAxis SetAxisTickOrigin 20 chartVu AddChartObject xAxis 13 How do I create and use custom multi line string labels as the axis labels for my graph The StringAxisLabels class should be used to create multi line axis labels Insert the n new line character to ad
436. tener DataToolTip The DataToolTip class implements Net CF mouse event delegates It implements and uses the mouse events OnMouseMove OnDoubleClick OnMouseDown OnMouseUp and OnClick The default operation of the DataToolTip class traps the mouse pressed event It calculates which chart object intersects the mouse cursor and which data points for the intersecting object are closest Next it pops up a window and displays the x value and or y value representing the data point When the mouse button is released the OnMouseUp event the tooltip popup window is deleted The tooltip data point search algorithm is complicated by the situation that many chart objects occupy a much larger area than the data point that is represented Bars are a good example A bar can occupy a large area yet the actual data value represented by the bar is only a small point at the top The tooltip algorithm searches for an intersection of the bar and the mouse cursor not an intersection of the data point and the mouse cursor If a hit on the bar is detected the data values represented by the bar are used as the values displayed in the tooltip The tooltip symbol will highlight the actual data point at the top of the bar The tooltip window will always popup at the cursor location not the data point location If you click anywhere on a bar the tooltip window will popup at that location and display the data value represented by the top of the bar 336 Data Tool
437. ter data plots AxisLabels 100 Axes labels are drawn with same priority as axes Legend 150 Legend objects usually sit on top of all other graph objects and are drawn last You can change the default z order value on an object by object basis Call the GraphObj SetZOrder method to change the z order for any given object The example below sets the z order value of the x axis to 30 changing the drawing order so that the x axis draws before and is therefore underneath any Grid and ChartPlot objects in the view C ChartView chartVu chartViewl LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS 140 The Chart View xAxis SetZOrder 30 chartVu AddChartObject xAxis Visual Basic Dim chartVu As ChartView ChartViewl Dim xAxis As LinearAxis New LinearAxis pTransforml ChartObj X AXIS xAxis SetZOrder 30 chartVu AddChartObject xAxis Dynamic or Real Time Updates of Chart Objects If you want to change the properties of one or more GraphObj derived objects displayed in the current graph just go ahead and change them using the appropriate Get and Set methods Once you change all of the properties that you want call the ChartView UpdateDraw method This will force the ChartView object to update redrawing every object in its draw list See the example below C ChartView chartVu chartViewl LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis
438. the angular grid aligns with the major tick marks GRID MAJOR the minor tick marks GRID MINOR or the major and minor tick marks GRID ALL of the reference polar axis The SetColor method is used to customize the drawing properties of the lines used to draw the axes lines and tick marks Polar grid example C double polarmagnitude 5 0 PolarCoordinates polarscale new PolarCoordinates polarmagnitude PolarAxes polarAxes new PolarAxes polarscale PolarGrid polarGrid new PolarGrid polarAxes ChartObj GRID MAJOR Create the ChartView object to place graph objects in ChartView chartVu chartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarGrid Visual Basic Dim polarmagnitude As Double 5 0 Dim polarscale As PolarCoordinates New PolarCoordinates polarmagnitude Dim polarAxes As PolarAxes New PolarAxes polarscale Dim polarGrid As PolarGrid New PolarGrid polarAxes ChartObj GRID MAJOR Create the ChartView object to place graph objects in Dim chartVu As ChartView ChartViewl Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarGrid Axis Grids 219 Antenna Grids Class AntennaGrid GraphObj Grid AntennaGrid The AntennaGrid class defines a grid for antenna axes The antenna grid consists of two parts the circular grid and the radial grid The
439. the first row represents the x values and the second row the y values Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String ByVal rowskip As Integer E ByVal columnskip As Integer _ C public SimpleDataset CSV csv string filename int rowskip int columnskip csv An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation columnskip For each row of data skip this many columns before reading the first value from the row You can retrieve references to the internal arrays used to store the data using the SimpleDataset methods GetXData and GetYData Change the values in the data using these references You can also modify a point at a time using one of the SetDataPoint methods If you need to add new points to a dataset increasing its size use one of the AddDataPoint or InsertDataPoint methods Delete data points using the DeleteDataPoint method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method The indexed accessor property of the SimpleGroupDataset will get or set a datapoint as a Point2D object Example of creating simple datasets from numeric arrays Visual Basic 64 Chart Datasets Dim xl1 As Double 10 20 30 40 50 Dim yl As Double 9 21 20
440. the justification constants JUSTIFY_MIN JUSTIFY CENTER JUSTIFY MAX 262 Group Plot Objects An individual bar in a floating bar plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Scheduling charts often use floating bars where the starting and ending values of the bar represent the duration of some aspect of a project The default use of the floating bar class assumes that the ends of the bars are floating point values not date time values Yet the scheduling chart often uses date time values to specify the bar ends Since only the x axis works with time values the floating bars of a scheduling chart need to used in the horizontal orientation mode set using the FloatingBar SetBarOrient method Used in this mode the x values of the dataset position the bars with respect to the y axis and the y values of the dataset position the ends of the bars with respect to the x axis In order to have a group dataset object that stores x values as doubles and the y group values as ChartCalendar dates you must use a special TimeGroupDataset constructor Visual Basic Visual Basic Overloads Public Sub New ByVal sname As String _ ByVal x As ChartCalendar ByVal y As ChartCalendar Ct public TimeGroupDataset string sname ChartCalendar x ChartCalendar y If you manually scale the T
441. the right The default Device Application targets a Net CF 2 0 device Do NOT target a Net 1 0 device by selecting the Device Application 1 0 since this software is not compatible with Net 1 0 and 1 1 e Assign a name to the application in the name box either the default DeviceApplication1 or your own pick UserChartExamplell in the example below Select a location which for our examples is the folder C Quinn Curtis DotNet QCChart2D Visual Basic CF examples 2005 New Project Project types Templates Visual Ct Windows Smart Device Starter Kits Web Other Languages Visual Basic Windows Smart Device Pocket PC 2003 Smartphone 2003 Windows CE 5 0 Windows Mobile 5 0 Starter Kits Wah vi gt lt isual Studio installed templates 575 Device Application 8 Class Library 232 Control Library ffi Console Application ie Empty Project GElDevice Application 1 0 l Class Library 1 0 ff console Application 1 0 dS Empty Project 1 0 My Templates d Search Online Templates A project for creating a NET Compact Framework 2 0 Forms application for Windows Mobile 5 0 Pocket PC and later Mame UserChartExample1 1 Location C Quinn Curtis DotNet QCChart2D Visual Basic CF examples 2005 8 Comes Solution Create new Solution Solution Name v Create directory For solution UserChartExample1 1 e Click OK and you end up looking at the
442. theLabelFont I b 300uA 15 5 yl 5 85 1 GhartObj PHYS POS chartVu AddChartObject currentLabelo Dim currentLabel7 As New ChartText pTransforml theLabelFont I b 350uA 15 5 yl 6 85 Ly ChartObj PHYS POS chartVu AddChartObject currentLabel 7 Dim regionLabel As New ChartText pTransforml theLabelFont Linear ControlChars Lf Region 4 0 40 ChartObj PHYS POS chartVu AddChartObject regionLabel ChartText time coordinates example extracted from the example program BigChartDemo class LineGapChart C Font theLabelFont new Font Microsoft Sans Serif 14 FontStyle Bold ChartText chartLabell new ChartText pTransforml theLabelFont Sales xValues 1 GetCalendarMsecs groupBarData 1 1 ChartObj PHYS POS chartLabell SetColor Color White chartLabell SetYJust ChartObj AXIS MIN chartVu AddChartObject chartLabell Visual Basic Dim theLabelFont As New Font Microsoft Sans Serif 14 FontStyle Bold Dim chartLabell As New ChartText pTransforml theLabelFont Sales xValues 1 GetCalendarMsecs groupBarData 1 1 ChartObj PHYS POS chartLabell SetColor Color White chartLabell SetYJust ChartObj AXIS MIN chartVu AddChartObject chartLabell Text Classes 383 Chart Title Classes Class ChartTitle ChartText ChartTitle The ChartTitle class creates a header subheader or footer for a chart The most common constructors are ChartTitle constru
443. tom version of the class MoveObj This class extends the MouseListener class and it can select chart objects and move them Moveable chart objects include axes axes labels titles legends arbitrary text 56 Class Architecture FindObj DataCursor MoveData DataToolTip ChartZoom MagniView shapes and images Use the MoveData class to move objects derived from SimplePlot This class extends the MouseListener class providing additional methods that selectively determine what graphical objects intersect the mouse cursor This class combines the MouseListener class and Marker class Press a mouse button and the selected data cursor horizontal and or vertical line cross hairs or a small box appears at the point of the mouse cursor The data cursor tracks the mouse motion as long as the mouse button is pressed Release the button and the data cursor disappears This makes it easier to line up the mouse position with the tick marks of an axis This class selects and moves individual data points of an object derived from the SimplePlot class A data tooltip is a popup box that displays the value of a data point in a chart The data value can consist of the x value the y value x and y values group values and open high low close values for a given point in a chart This class implements mouse controlled zooming for one or more simultaneous axes The user starts zooming by holding down a mouse button with the mouse c
444. tomatically calculated using an auto axis method These properties can be explicitly set if you need to override the automatically calculated values Visual Basic Overloads Public Sub SetPolarAxesTicks _ ByVal axestickspace As Double _ ByVal axesntickspermajor As Integer _ ByVal angletickspace As Double _ ByVal anglentickspermajor As Integer _ Overloads Public Sub SetPolarAxesTicks _ ByVal axestickspace As Double _ ByVal axesntickspermajor As Integer _ ByVal angletickspace As Double _ ByVal anglentickspermajor As Integer _ ByVal minorticklength As Double _ ByVal majorticklength As Double _ ByVal tickdir As Integer _ C public void SetPolarAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor E public void SetPolarAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor double minorticklength double majorticklength int tickdir 180 Axes axestickspace Specifies the spacing between minor tick marks for the x and y axes axesntickspermajor Specifies the number of minor tick marks per major tick mark for the x and y axes angletickspace Specifies the spacing in degrees between minor tick marks for the radial axis anglentickspermajor Specifies the number of minor tick marks per major tick mark for the radial axis minorticlength The length of minor tic
445. tour line flags and the contour label flags in the second constructor ContourPlot constructors Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As ContourDataset ByVal contourlevels As Double _ ByVal attribs As ChartAttribute ByVal numcontourlevels As Integer _ ByVal contourtype As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As ContourDataset ByVal contourlevels As Double _ ByVal attribs As ChartAttribute ByVal blineflags As Boolean _ ByVal blabelflags As Boolean _ ByVal numcontourlevels As Integer _ ByVal contourtype As Integer _ Contour Plotting 292 C public ContourPlot PhysicalCoordinates transform ContourDataset dataset double contourlevels ChartAttribute attribs int numcontourlevels int contourtype public ContourPlot PhysicalCoordinates transform ContourDataset dataset double contourlevels ChartAttribute attribs bool blineflags bool blabelflags int numcontourlevels int contourtype transform The coordinate system for the new ContourPlot object dataset The ContourDataset plot will represent the xyz values in this contour data set contourlevels An array size numcontourlevels of the contour levels used in the contour plot attribs An array of color and fill attributes size numcontourlevels 1
446. transform As PhysicalCoordinates ByVal dataset As GroupDataset ByVal attrib As ChartAttribute C4 public Cell Plot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attrib transform The coordinate system for the new CellPlot object dataset The cell plot represents the values in this group dataset The number of groups must be three The X Y 0 values of the group dataset represent the xy position of the lower left corner of each cell the Y 1 values set the width of the cell and the Y 2 values set the height of the cell attrib Specifies the attributes line and fill color for the cell plot Cells can be filled with an image instead of a solid color Use the CellPlot SetPlotImage method to place a System Drawing Image object in the cells of a cell plot One image applies to all of the cells in the cell plot An individual cell in the cell plot object can have unique attributes Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods in the manner described for SimplePlot objects Cell plot example extracted from the example program BigChartDemo class CellPlotChart 258 Group Plot Objects C GroupDataset Datasetl new GroupDataset First x1 y1 Datasetl SetAutoScaleNumberGroups 1 picks up on width but because data is should still work CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTran
447. trib As New ChartAttribute Color Red 1 DashStyle Solid Color Red segmentAttrib SetSymbolSize 20 thePlotl SetSegmentAttributes 8 segmentAttrib thePlotl SetSegmentAttributes 9 segmentAttrib thePlotl SetSegmentAttributes 10 segmentAttrib thePlotl SetSegmentAttributes 11 segmentAttrib chartVu AddChartObject thePlot1 Simple Line Marker Plots Class SimpleLineMarkerPlot GraphObj ChartPlot SimplePlot SimpleLineMarkerPlot The SimpleLineMarkerPlot class is a concrete implementation of the SimplePlot class and displays simple datasets in a line plot format where scatter plot symbols highlight individual data points SimpleLineMarkerPlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal attribs As ChartAttribute Ct public StackedLinePlot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attribs 236 Simple Plot Objects transform The coordinate system for the new SimpleLineMarkerPlot object dataset The line marker plot represents the values in this dataset symtype The symbol used in the line marker plot Use one of the scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR CIRCLE lineattrib Specifies the attributes line color for the line part of the line marker plot symbolattrib Specifies the at
448. tribute Color Blue 1 DashStyle Solid new ChartAttribute Color Yellow 3 DashStyle Solid new ChartAttribute Color MediumPurple 2 DashStyle Dash AntennaLineMarkerPlot thePlotl new AntennaLineMarkerPlot pAntennaTransform Datasetl attribl chartVu AddChartObject thePlot1 364 Polar Charts AntennaLineMarkerPlot thePlot2 new AntennaLineMarkerPlot pAntennaTransform Dataset2 attrib2 chartVu AddChartObject theP10ot2 AntennaAnnotation thePlot3 new AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION ANGULAR 180 attrib3 chartVu AddChartObject theP1ot3 AntennaAnnotation thePlot4 new AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION RADIUS 12 attrib4 chartVu AddChartObject thePlot4 VB Dim attribl As New ChartAttribute transparentRed 1 DashStyle Solid attribl SymbolSize 7 Dim attrib2 As New ChartAttribute Color Blue 1 DashStyle Solid Color Blue attrib2 SymbolSize 7 Dim thePlotl As New AntennaLineMarkerPlot pAntennaTransform Datasetl attribl chartVu AddChartObject thePlot1 Dim thePlot2 As New AntennaLineMarkerPlot pAntennaTransform Dataset2 attrib2 chartVu AddChartObject thePlot2 Dim attrib3 As New ChartAttribute Color Yellow 3 DashStyle Solid Color Yellow Dim attrib4 As New ChartAttribute Color MediumPurple 2 DashStyle Dash Color MediumPurple Dim thePlot3 As New AntennaAnnotation pAntennaTransform ChartObj A
449. tributes line and fill color for the symbol part of the line marker plot nsymbolstart Specifies the starting index for symbols in the line marker plot nsymbolskip Specifies the skip factor for placing symbols in the line marker plot A ChartAttribute object sets the objects global line attributes Change the ChartAttribute object using the objects SetChartObjAttributes method Use the objects setSymbolAttributes to change the attributes of the marker symbol Should you need additional symbols create your own Any GraphicsPath object can be used as a symbol The coordinates of the symbol should assume that 1 0 is the standard symbol size with a symbol center at the relative coordinates 0 5 0 5 See the example in the discussion of the SimpleScatterPlot class Individual line segments in a line marker plot object can have unique properties Use the objects SetSegmentAttributesMode and SetSegmentAttributes methods If this option is used the line and fill properties of the lines and the marker symbols will be the same Simple line marker plot example extracted from the example program BigChartDemo class LabeledDatapoints C SimpleDataset Datasetl new SimpleDataset First xl yl CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prransforml SetGoraphBorderDiagonal 0 15 15 90 0 7
450. ts int compressXmode ChartObj DATACOMRESS AVERAGE int compressYmode ChartObj DATACOMRESS MINMAX int compressTimeField Calendar MONTH TimeSimpleDataset CompressedDataset RawDataset CompressTimeFileSimpleData compressXmode compressYmode compressTimeField 454 FAQs 0 nNumPnts Compressed Visual Basic nNumPnts 100000 Dim Dim Dim Dim Dim RawDataset As TimeSimpleDataset new _ TimeSimpleDataset Raw xtimedata ydata nNumPnts compressXmode As Integer ChartObj DATACOMRESS AVERAGE compressYmode As As Integer ChartObj DATACOMRESS MINMAX compressTimeField As Integer Calendar MONTH CompressedDataset As TimeSimpleDataset _ RawDataset CompressTimeFileSimpleData compressXmode compressYmode compressTimeField 0 nNumPnts Compressed 20 How do I get data from my database into a chart The real question is How do you get data from your database into a simple Net program storing sequential data values in data array variables This is up to you and is independent of the charting software We recommend that you use the SQL database classes that are part of Net and study the documentation provide by Microsoft and other sources such as the O Reilly programming books Once you can read individual data elements of your data base it is a trivial matter to place the numeric and calendar data into simple Net array variables and from there plot the data 21 Are you going to add additional
451. ttrib stext Specifies the text string for the legend item rsize Specifies the size of the bubble for this item in the same units as the coordinate system the bubble plot is placed in chartobj The color and fill attributes for the legend item are copied from the attributes of this chart object thefont Specifies the text font for the legend item Legends 375 The method returns the current number of legend items Simple legend example extracted from the example program BigChartDemo class BubblePlotChart C ChartAttribute attribl new ChartAttribute Color Black 0 DashStyle Solid attribl BertFaillColor Color Fromireh 177 33 ALL attribl SetFillFlag true BubblePlot thePlotl new BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChartObject thePlot1 Font theTitleFont new Font Microsoft Sans Serif 14 FontStyle Bold ChartTitle mainTitle new ChartTitle pTransforml theTitleFont DOT COM Bankruptcies and CEO Compensation mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH chartVu AddChartObject mainTitle Font theFooterFont new Font Microsoft Sans Serif 10 FontStyle Bold ChartTitle footer new ChartTitle pTransforml theFooterFont The size radius or area of the bubble adds an additional dimension to the graph ChartAttribute attrib2 new ChartAttribute Color FromArgb 177 3
452. u AddChartObject yAxisLab Dim titleFont As New Font Microsoft Sans Serif 12 FontStyle Bold Dim yaxistitle As New AxisTitle yAxis titleFont Score chartVu AddChartObject yaxistitle Dim xaxistitle As New AxisTitle xAxis titleFont Student chartVu AddChartObject xaxistitle Text Classes 387 Numeric Time Elapsed Time and String Label Classes Class ChartLabel ChartText ChartLabel StringLabel TimeLabel ElapsedTimeLabel NumericLabel The ChartLabel class is the abstract base class for all of the formatted label classes The axis label classes use formatted labels to label the axis tick marks They are also useful for chart annotations Position the objects using any of the coordinate systems Justify the text vertically and horizontally ChartLabel contructors Visual Basic Overloads Public Sub New ByVal transform As PhysicalCoordinates ByVal tfont As Font ByVal x As Double ByVal y As Double _ ByVal npostype As Integer _ ByVal nnumformat As Integer _ ByVal ndecimal As Integer _ Overloads Public Sub New ByVal initialvaluel As Double _ ByVal transform As PhysicalCoordinates ByVal tfont As Font ByVal x As Double _ ByVal y As Double _ ByVal npostype As Integer _ ByVal nnumformat As Integer _ ByVal ndecimal As Integer _ ByVal xjust As Integer _ ByVal yjust As Integer _ ByVal rotation As Double _ C p
453. ublic NumericLabel PhysicalCoordinates transform Font tfont double initialvaluel double x double y ByVal initialvaluel As Double _ 388 Text Classes int npostype int nnumformat int ndecimal public NumericLabel PhysicalCoordinates transform Font tfont double initialvaluel double x double y int npostype int nnumformat int ndecimal int xjust NumericLabel PhysicalCoordinates transform transform font initialvalue X Y npostype nnumformat ndecimal xjust Font tfont double initialvalue double x double y int npostype int nnumformat int ndecimal Places the text in the coordinate system defined by transform A reference to a Font object The initial value of the numeric label Specifies the x value of the text position Specifies the y value of the text position Specifies the if the position of the text is specified in physical coordinates normalized coordinates or Net CF device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS Specifies the numeric format of the label Use one of the numeric format constants DECIMALFORMAT SCIENTIFICFORMAT BUSINESSFORMAT ENGINEERINGFORMAT PERCENTFORMAT CURRENCEYFORMAT and EXPONENTFORMAT The number of digits to display to the right of the decimal point Specifies the horizontal justification of the text Use one of t
454. uctor Visual Basic Overloads Public Sub New _ ByVal transform As AntennaCoordinates ByVal dataset As SimpleDataset ByVal attrib As ChartAttribute C public AntennaLinePlot AntennaCoordinates transform SimpleDataset dataset ChartAttribute attrib Polar Charts 359 transform The coordinate system for the new AntennaLinePlot object dataset The antenna line plot represents the antenna coordinate values in this dataset The x values of the dataset represent the radial values and the y values represent the antenna angular values in degrees attrib Specifies the attributes line color and line style for the line plot The antenna line plot class interpolates between adjacent data points in antenna coordinates and not using straight lines as in the Cartesian coordinate plotting functions This gives the lines between adjacent data points in a antenna plot a curved look Antenna line plot and scatter plot chart extracted from the example program BigChartDemo AntennaChart C Datasetl new SimpleDataset First magl angl Dataset2 new SimpleDataset Second mag2 angl SimpleDataset datasetarray Datasetl Dataset2 pAntennaTransform new AntennaCoordinates pAntennaTransform AutoScale datasetarray ChartObj AUTOAXES FAR pAntennaTransform SetGraphBorderDiagonal 0 25 15 75 0 85 Background background new Background pAntennaTransform ChartObj GRAPH BACKGROUND Color W
455. ue T 00 12 07 2000 7 12 2000 7 2000 2000 In some cases the TIMEDATEFORMAT Q format for example the DateTime ToString class does not handle the desired conversion In cases like this the date time Format constant is trapped and undergoes additional processing to create the final label That is why some of the date format strings are the same event though the resulting labels are different TimeAxis Labels constructor There is only one main constructor for TimeAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As TimeAxis _ C public TimeAxisLabels TimeAxis baseaxis baseaxis This is the time axis the axis labels are for Axis Labels 199 Other axis label properties font rotation numeric format axis labels direction and numeric precision are automatically set These properties can be explicitly set if you need to override the automatically calculated values SetAxisLabels method Visual Basic Overloads Public Sub SetAxisLabels _ ByVal font As Font _ ByVal rotation As Double _ ByVal labdir As Integer _ ByVal decimalpos As Integer _ ByVal labelends As Integer _ ByVal labcolor As Color _ C4 public void SetAxisLabels Font font double rotation int labdir int decimalpos int labelends Color ilabcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ Ct public vo
456. umeric values PIELABEL NUMVALUE Display the pie ring numeric value only no pie text strings PIELABEL STRINGNUMVAL Display the pie ring text string and numeric value A pie ring chart uses a default CartesianCoordinates object Center it in the window using the CartesianCoordinates SetGraphBorderDiagonal method Format the text used to label the pie ring chart both the strings and the numeric values using a NumericLabel template set using the PieChart SetPlotLabelTemplate method Change the starting position of the first pie ring wedge from the default value of 0 0 3 00 position using the PieChart SetStartPieSliceAngle method The PieChart CalcNearestPoint method can find the pie ring wedge nearest a specified point usually the result of a mouse click See the LabeledPieChart example program Simple pie chart extracted from the example program BigChartDemo class LabeledPieChart int numPoints 5 String sPieStrings Technology Retail Banking Automotive Aerospace ChartAttribute attribs new ChartAttribute 5 Font theFont Color colorArray Color Red Color Blue Color Cyan Color Yellow Color Green Color DarkGray Color LightGray Color Magenta Color Orange Color Pink ChartText techLabel ChartText retailLabel 350 Pie Charts ChartText bankLabel ChartText aeroLabel ChartText autoLabel theFont new Font Microsoft Sans Serif 10 FontStyle Bold double x1 new double num
457. und colors legends titles and data tooltips SimpleLinePlot Class Architecture 51 This class is a concrete implementation of the SimplePlot class it displays simple datasets in a line plot format Adjacent data points are connected using a straight or a step line QC Line Bar Scatter Pie Dynamic Financial Axes Mouse Polar Contour Theoretical vs Experimental Data 100 80 60 Work 40 20 E Energy Companies 20 30 40 50 3 MBAs 1000 employees Software Companies Predicted Scatter plots usually display some form of sampled data SimpleScatterPlot SimpleVersaPlot Legend Classes LegendItem BubblePlotLegendItem Legend StandardLegend This class is a concrete implementation of the SimplePlot class and it displays simple datasets in a scatter plot format where each data point is represented using a symbol The SimpleVersaPlot is a plot type that can be any of the four simple plot types LINE MARKER PLOT LINE PLOT BAR PLOT SCATTER PLOT It is used when you want to be able to change from one plot type to another without deleting the instance of the old plot object and creating an instance of the new 52 Class Architecture BubblePlotLegend Legends provide a key for interpreting the various plot objects in a graph It organizes a collection of legend items one for each plot objects in the graph and displays them in a rectangular frame Legend LegendItem BubblePlotLegendItem StandardLe
458. ur plot type displays the iso lines or contours of a 3D surface using either lines or regions of solid color The last plot object category is the pie chart were a pie wedge represents each data value The size of the pie wedge is proportional to the fraction data value sum of all data values ChartPlot This class is the abstract base class for chart plot objects It contains a reference to a ChartDataset derived class containing the data associated with the plot Contour Plot of the Heat Distribution of a Plasma Torch Degrees C 1000 0 1200 0 1400 0 1600 0 1800 0 1900 0 2000 0 2100 0 2200 0 2400 0 2600 0 2800 0 3000 0 The contour plot routines work with either an even grid or a random shown grid ContourPlot This class is a concrete implementation of the ChartPlot class and displays a contour plot using either lines or regions filled with color Group Plot Classes GroupPlot ArrowPlot BoxWhiskerPlot Class Architecture 35 BubblePlot CandlestickPlot CellPlot ErrorBarPlot FloatingBarPlot FloatingStackedBarPlot GroupBarPlot GroupVersaPlot HistogramPlot LineGapPlot MultiLinePlot OHLCPlot StackedBarPlot StackedLinePlot GroupVeraPlot Group plots use data organized as arrays of x and y values where there is one or more y for every x Group plot types include multi line plots stacked line plots stacked bar plots group bar plots error bar plots floating bar plots floating sta
459. ursor in the plot area of a graph The mouse is dragged and then released The rectangle established by mouse start and stop points defines the new zoomed scale of the associated axes Zooming has many different modes Some of the combinations are One x or one y axis One x and one y axes One x and multiple y axes One y and multiple x axes Multiple x and y axes This class implements mouse controlled magnification for one or more simultaneous axes This class implements a chart magnify class based on the MouseListener class It uses two charts the source chart and the target chart The source chart displays the chart in its unmagnified state The target chart displays the chart in the magnified state The mouse positions a MagniView rectangle within the source chart and the target chart is re scaled and redrawn to MoveCoordinates MultiMouseListener Class Architecture 57 match the extents of the MagniView rectangle from the source chart This class extends the MouseListener class and it can move the coordinate system of the underlying chart analogous to moving chaging the coordinates of an internet map by grabbing it with the mouse and dragging it This class is used by the ChartView class to support multiple mouse listeners at the same time Miscellaneous Utility Classes ChartCalendar CSV Dimension Point2D GroupPoint2D DoubleArray DoubleArray2D BoolArray Point3D NearestPointData TickMark Polysurface
460. uto scale routines will allow zero and negative values for the minimum and maximum of a linear scale but not a logarithmic scale If you call the auto scale routines first while the scales are set to the default linear scale mode and change one or both of the scales to logarithmic mode you can introduce invalid negative and zero values into the logarithmic coordinate system Example of auto scaling a CartesianCoordinates object that has a logarithmic y scale using a single dataset C double xData 2 3 4 5 6 7 8 9 Scaling and Coordinate Systems 107 double yData 2 33 440 5554 46123 332322 5435641 64567551 SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE simpleScale AutoScale dataset simpleScale SetScaleStopX 10 simpleScale SetScaleStartX 1 0 Visual Basic Dim xData As Double 2 3 4 5 6 7 8 9 Dim yData As Double 2 33 440 5554 406123 3322322 54350641 64567551 Dim dataset As SimpleDataset New SimpleDataset Sales xData yData Dim simpleScale As CartesianCoordinates _ New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE simpleScale AutoScale dataset simpleScale SetScaleStopX 10 simpleScale SetScaleStartX 1 0 Coordinate Systems using times and dates Many charting applications use data where the x coordinate values are in t
461. vate stockpanel As ChartText Private xValues As ChartCalendar Private stockPriceData As Double Private stockVolumeData As Double Private NASDAQData As Double Public Sub New ByVal component As ChartView ByVal xs As ChartCalendar ByVal stockprices As Double ByVal stockvolumes As Double MyBase New component xValues xs StockPriceData stockprices stockVolumeData stockvolumes NASDAQData nasdaqs stockpanel GetTextTemplate End Sub New ByVal nasdaqs As Double Public Overrides Sub OnMouseUp ByVal mouseevent As MouseEventArgs MyBase OnMouseUp mouseevent Redraws the chart Since the stockpanel object has not been added to the chart using addChartObject it will not be redrawn when the chart is redrawn GetChartObjComponent UpdateDraw End Sub OnMouseUp Public Overrides Sub OnMouseDown ByVal mouseevent As MouseEventArgs Dim mousepos As New Point2D 344 Data ToolTips mousepos SetLocation mouseevent X mouseevent Y MyBase OnMouseDown mouseevent Dim selectedPlot As ChartPlot CType GetSelectedPlotObj ChartPlot If Not selectedPlot Is Nothing Then Dim selectedindex As Integer GetNearestPoint NearestPointIndex Dim transform As PhysicalCoordinates GetSelectedCoordinateSystem stockpanel stockpanel stockpanel Looking to SetChartOb SetLocatio SetTextStr the origin jScale transform n mousepos ChartObj DEV POS ing
462. w or column format Each legend item contains a symbol and descriptive string The symbol normally associates the legend item to a particular plot object and the descriptive string describes what the plot object represents The BubblePlotLegend is a concrete implementation of the Legend class and it is the legend class for bubble plots The legend items objects display as offset concentric circles with descriptive text giving the key for the value associated with a bubble of this size Standard Legends Class StandardLegend GraphObj StandardLegend The StandardLegend is the primary legend class for all plot objects except for bubble plots The class manages a list of LegendItems that holds the symbols and descriptive text for the symbols StandardLegend constructors 368 Legends Visual Basic Overloads Public Sub New _ ByVal rx As Double _ ByVal ry As Double _ ByVal attrib As ChartAttribute ByVal nlayoutimode As Integer _ Overloads Public Sub New _ ByVal rx As Double ByVal ry As Double ByVal rwidth As Double ByVal rheight As Double _ ByVal attrib As ChartAttribute ByVal nlayoutimode As Integer _ C4 public StandardLegend double rx double ry ChartAttribute attrib int nlayoutimode public StandardLegend double rx double ry double rwidth double rheight ChartAttribute attrib int nlayoutimode rx The x position in chart normalized coordi
463. xDatal yDatal Dim dataset2 As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Sales2 xData2 yData2 Dim dataset3 As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Sales3 xData3 yData3 Dim datasetsArray 2 As ElapsedTimeSimpleDataset datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 Dim simpleScale As ElapsedTimeCoordinates New ElapsedTimeCoordinates simpleScale AutoScale datasetsArray There is a version of the multiple dataset auto scale routine that also specifies rounding mode parameters simpleScale AutoScale datasetsArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Polar Coordinate Systems Class PolarCoordinates PhysicalCoordinates CartesianCoordinates PolarCoordinates The magnitude and the polar angle of a point define its position in a chart scaled for polar coordinates The magnitude can have any value greater than 0 0 and the polar angle any positive or negative value A polar angle range of 0 to 2 pi radians 0 to 360 degrees sweeps a complete circle in polar coordinates A polar coordinate system uses a Cartesian coordinate system scaled for plus minus the polar magnitude The following equations convert from polar coordinates to Cartesian coordinates magnitude cos angle gt ll 126 Scaling and Coordinate Systems y magnitude sine angle magnitude Polar coordinate magnitude angle Plot coordinate angle
464. xMin yMin xMax yMax Another technique uses the default constructor and scales the coordinates using the CartesianCoordinates SetCoordinateBounds method Example of explicit scaling of a CartesianCoordinates object using the CartesianCoordinates SetCoordinateBounds method C double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale new CartesianCoordinates simpleScale SetCoordinateBounds xMin yMin xMax yMax Visual Basic Dim xMin As Double 5 Dim xMax As Double 15 Dim yMin As Double 0 Dim yMax As Double 105 Dim simpleScale As CartesianCoordinates New CartesianCoordinates simpleScale SetCoordinateBounds xMin yMin xMax yMax It is possible to scale the bounds of the coordinate system based on the data values in a dataset There are constructors and methods that take a single dataset and others that take an array of datasets Example of auto scaling a CartesianCoordinates object using a single dataset C Scaling and Coordinate Systems 103 double xData 11 2 3 42 5 6 7 89 9 10 double yData 10 22 33 44 55 46 33 25 14 9 SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates simpleScale AutoScale dataset Visual Basic Dim xData As Double 115253541 5 0 7 9 9 19 Dim yData As Double 110 22 33 44 55 46 33 25 14 9
465. y array must match the length of the x array The number of columns in the group dataset is the value of x Length property The number of columns in the y array must match the length of the x array and every element must be initialized to a valid value All values in the arrays are plotted If the data is outside of the current chart scale the values will be clipped The next constructor creates a dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format There are two ways to organize the numeric values in the data file If you use the COLUMN MAJOR format the first column represents the x values and subsequent columns represent the y values where each column is a group If you use the ROW MAJOR format the first row represents the x values and subsequent rows represent the y values where each row is a group Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal columnskip As Integer _ Chart Datasets 89 C public ElapsedTimeGroupDataset CSV csv string filename int rowskip int columnskip CSV An instance of a CSV object filename The name of the file rowskip Skip this many rows before starting the read operation columnskip For each row of data skip this many columns before reading the first value
466. y lines or symbols drawn using the XOR drawing mode that are used to help position the mouse cursor over the desired section of a graph Standard data cursors include cross hairs a box and horizontal and or vertical lines Data Markers Class Marker GraphObj Marker Create data markers using the Marker class The constructor below creates a new Marker object using the specified coordinate system marker type marker position and marker size Marker constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal nmarkertype As Integer _ ByVal x As Double ByVal y As Double _ ByVal rsize As Double _ ByVal npostype As Integer _ C public Marker PhysicalCoordinates transform int nmarkertype double x double y double rsize int npostype transform Places the marker in the coordinate system defined by transform 300 Data Markers and Data Cursors nmarkertype Specifies the shape of the current chart marker Use one of the chart marker constants MARKER NULL MARKER VLINE MARKER HLINE MARKER CROSS MARKER BOX or MARKER HVLINE x Specifies the x value of the marker position y Specifies the y value of the marker position rsize Specifies the size of the cross hair marker MARKER CROSS and the box marker MARKER BOX in Net CF device coordinates npostype Specifies the if the position of the marker is specified in physical coordin
467. y values where an x value represents the numeric value of a ring segment and a y value specifies the offset or explosion of a ring segment with respect to the origin of the ring Simple Plot Classes SimplePlot SimpleBarPlot SimpleLineMarkerPlot SimpleLinePlot SimpleScatterPlot SimpleVeraPlot Simple plots use data organized as a simple array of xy points where there is one y for every x Simple plot types include line plots scatter plots bar graphs and line marker plots Class Architecture 49 SimplePlot This class is an abstract base class for all simple plot classes Production of Green Bars is Up M 100 1999 2000 2001 2002 2 2004 2005 Bar plots can have the values of the bars displayed above or inside each bar SimpleBarPlot This class is a concrete implementation of the SimplePlot class and displays data in a bar format Individual bars the maximum value of which corresponds to the y values of the dataset are justified with respect to the x values 50 Class Architecture History Test Results 100 90 Score 80 70 Student Individual data points can be automatically labeled SimpleLineMarkerPlot This class is a concrete implementation of the SimplePlot class and it displays simple datasets in a line plot format where scatter plot symbols highlight individual data points Profits are Expected to Rise 1998 1999 2000 2001 2002 2003 2004 2005 2006 Graphs can have backgro
468. y values where each column is a group If you use the ROW MAJOR format the first row represents the time values and subsequent rows represent the y values where each row is a group Use the CSV SetOrientation method to initialize the csv argument for the proper data orientation A DateTimeFormatInfo object and a date time format string in the CSV class control the interpretation of the ChartCalendar values The format in the file must match the format specified for the CSV class The underlying conversion mechanism calls the DateTime ToString String formatstring DateTimeFormatInfo info method for the conversion The default format for the date time formatstring object is M dd yy Call the SetDateTimeFomatString method to change the default date time format See the documentation for the Net CF DateTime ToString method to figure out the various formatting options for the date time format string If you are into internationalization and difficult to understand Net CF documentation you can also create your own DateTimeFormatInfo object installing it in the CSV object using CSV SetTimeDateFormat method The date time format string and the DateTimeFormatInfo object apply to both CSV files used for input and CSV files used for output If an attempt is made to read date time values that do not match the desired format the data values are set to invalid date time values You can retrieve a copy of the date time data using the TimeGroupDataset
469. yAxis2 SetColor Color White chartVu AddChartObject yAxis2 VB Dim xAxis As New TimeAxis pTransforml xAxis SetColor Color White chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS Default places y axis at miniumum of x coordinate scale yAxis SetColor Color White chartVu AddChartObject yAxis Dim yAxis2 As New LinearAxis pTransforml ChartObj Y AXIS 434 FAQs yAxis2 SetAxisIntercept xAxis GetAxisMax yAxis2 SetAxisTickDir ChartObj AXIS MAX yAxis2 SetColor Color White chartVu AddChartObject yAxis2 The other common reason to have multiple axes in a chart is to delineate the simultaneous use of different coordinate systems in the chart In this case each coordinate system has an x and or y axis to differentiate it from the other coordinate systems When the different coordinate systems are created they usually overlay the same area of the chart The default positioning of the axes for each coordinate system will all overlay one another making the axes unreadable In the y axis case you will want to offset additional axes to the left or to the right of the default axis position using the SetAxisIntecept method When using the SetAxisIntercept method make sure you specify the position using the units of the coordinate system scale at right angles to the axis Specify an intercept value outside of the normal scale range to offset the axes so that they do not overlap Th

Download Pdf Manuals

image

Related Search

Related Contents

Manuale di istruzioni  Termometro Digitale Pediatrico FLEX 10 SEC ES  

Copyright © All rights reserved.
Failed to retrieve file