Home

QCChart2D User Manual - Quinn

image

Contents

1. 379 380 381 DatasetViewer 2 9 10 21 377 378 379 380 381 Data Tool Tip ertet oo eoo e i ER datatooltip 332 333 334 407 413 414 430 434 435 450 DataToolTip15 17 58 59 63 330 331 332 333 334 335 336 407 413 414 430 434 435 450 Developer License si us ee Developer ii Dimension 61 63 322 325 326 327 328 329 386 466 Appendix dimension7 24 26 27 61 68 76 89 92 96 103 104 105 129 159 160 174 189 317 321 338 362 363 Dimension 61 63 322 325 326 327 328 329 386 ElapsedTimeAutoScale 6 29 30 63 225 226 ElapsedTimeAutoScale 6 29 30 63 225 226 ElapsedTimeAxis 2 6 31 35 39 172 183 192 193 195 196 197 209 223 224 225 226 ElapsedTimeAxis2 6 31 35 38 39 64 129 171 172 183 192 193 195 197 208 209 223 224 225 226 ElapsedTimeAxisLabels 2 6 38 39 64 129 183 208 209 223 224 225 226 ElapsedTimeAxisLabels 2 6 38 39 64 129 183 208 209 223 224 225 226 ElapsedTimeGroupDataset 2 25 26 30 63 65 91 95 96 97 98 99 377 ElapsedTimeGroupDataset 2 25 26 30 63 65 91 95 96 97 98 377 ElapsedTimeLabel 56 57 64 364 370 372 373 381 ElapsedTimeLabel 56 57 64 364 370 372 373 381 ElapsedTimesScale sess 6 26 27 ElapsedTimeScale
2. New CartesianCoordinates ChartObj LINEAR SCALE h LINEAR SCAL toScale Dat pTransform5 Au LObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim transformArray As CartesianCoordinates pTransforml Zooming 325 Dim zoomObj As New ChartZoom chartVu transformArray 5 True zoomObj SetButtonMask MouseButtons Left zoomObj SetZoomYEnable True zoomObj SetZoomXEnable True zoomObj SetZoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetZoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable True zoomObj SetZoomStackEnable True zoomObj InternalZoomStackProcesssing 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 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
3. Visual Basic Dim numPoints As Integer 5 Dim 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 SansSerif 10 FontStyle Bold Dim xl numPoints 1 As Double Dim yl numPoints 1 As Double Dim i As Integer For 0 To numPoints 1 attribs i New ChartAttribute Color Black 1 0 attribs i SetFillColor colorArray i Next i x1 0 5 8 140 0 2 xl l1 e 2 2 yl 1 0 0 1 2 3 5 1 2 0 0 1 3 4 2 y143 D 9 1 4 3 7 Pie Charts 341 342 Pie Charts 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 STRI
4. LG Dk d Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug 2003 2004 Day 5 Day Week T T T T T T T T T T T T T T 1 w T F M T w T F M T wo T F M T w 1 06 03 13 03 172008 Day 7 Day Week T T Wed Thu Fri Sat Sun Mon Tue Wed 4 05 03 T I T T T T T Thu F Sat Sun Mon Tue Wed Thu 171203 There are more than 40 different time date axes types appropriate for scales ranging from 1 second to 100 years Date Axes Dayi4 Hour 8 HourHour 1 10103 10203 110303 4403 0 800 1600 0 10103 10203 4 HourHour 1 Minute ooo 400 00 1200 1600 4 00 200 490 10103 10103 Minute 15 Minute Minute mmy EIE 0 00 100 200 0 00 045 0 30 0 45 400 D 10103 5 Minute Minute 000 005 045 020 025 10103 Second 0 00 00 0 01 00 0 02 00 0 03 00 10103 Minute 1 Seconds 00000 00100 00200 00300 00400 10103 5 Second Second 0 00 00 00005 0 00 10 00046 0 00 20 10103 There are more than 40 different time date axes types appropriate for scales ranging from 1 second to 100 years Time Date Axes with Custom Hour Range 8 30 AM to 4 00 PM Dayf2 Hour 4 a
5. 29 30 63 TimeAxis 31 35 39 56 64 171 172 183 184 188 189 191 192 209 217 219 220 221 222 226 229 237 284 398 400 429 442 447 448 451 452 limeaxis uid tee eere tre totis E o eee sameness 126 TimeAxis 2 6 31 35 37 38 39 56 64 129 143 171 172 183 184 188 189 191 192 193 195 197 208 209 217 219 220 221 222 223 224 225 226 229 237 284 398 400 401 429 434 442 447 448 451 452 TIMEAXIS 184 185 186 187 188 190 191 192 TimeAxisLabels 37 39 64 208 209 217 219 220 222 223 226 229 284 398 401 429 TimeAxisLabels2 6 37 38 39 64 129 183 208 209 217 219 220 222 223 224 225 226 229 284 398 401 429 434 TimeCoordinates 3 6 27 28 63 103 105 118 119 120 121 122 123 124 125 126 127 128 129 152 153 157 158 170 183 184 188 189 191 192 221 222 246 247 248 250 269 270 277 279 281 282 283 284 289 293 294 295 296 318 365 375 398 400 428 429 451 452 454 TimeCoordinates 2 3 6 27 28 63 82 103 105 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 152 153 157 158 170 183 184 188 189 191 192 195 221 222 225 226 246 247 248 250 269 270 277 279 281 282 283 284 289 293 294 295 296 318 365 375 398 400 428 429 433 451 452 454 TimeCoordinateS sss 70 91 TimeGroupDataset 1
6. 254 Simple Plot Objects 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 ScatterPlots 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 e hePlotl SetSegmentAttributes 11 segmentAttrib hartVu AddChartObject thePlotl Visual Basic Dim attribl As New ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetLineFlag True attribl SetSymbolSize 10 Dim thePlotl As New SimpleScatterPlot pTransforml _ Datasetl ChartObj SQUARE attribl hePlotl SetSegmentAttributesMode True im segmentAttrib As New ChartAttribute Color Red 1 DashStyle Solid Color Red egmentAttrib SetSymbolSize 20 hePlotl SetSegmentAttributes 8 segmentAttrib hePlotl SetSegmentAttributes 9 segmentAttrib
7. 6 26 27 63 103 ElapsedTimeSimpleDataset 2 25 26 30 63 65 70 73 74 75 76 81 86 99 131 132 225 226 377 ElapsedTimeSimpleDataset 2 25 26 30 63 65 70 73 74 75 76 131 132 225 226 377 EventSimpleDataset ees 86 SimpleDataset 86 Errot bar plots 2 nn emen ErrorBarPlot 41 44 64 261 275 1 41 44 64 261 275 1 EventAutoScale 1 29 30 63 EvVent XIS uere trees ee e eere a EventAxis 1 31 35 38 39 64 85 137 139 140 143 171 172 195 196 197 199 208 209 226 229 230 231 EventAxisLabels eerte EventAxisLabels 1 38 39 64 85 137 139 140 143 208 209 226 229 231 EventCoordinates 1 27 29 63 82 83 88 101 102 103 105 133 134 141 142 145 147 148 199 230 231 EventCoordinateS sss 139 EventGroupDoataset esee EventGroupDataset 1 25 26 30 63 65 82 86 98 99 101 102 133 138 139 Events ales gt a nitore EventScale 1 26 27 63 103 EventSimpleDataset essen EventSimpleDataset 1 25 26 30 63 65 81 82 85 86 88 99 101 102 133 138 139 141 199 230
8. 61 62 63 76 77 78 79 80 AntennaAnnotation 2 5 50 51 64 352 353 AntennaAnnotation 2 5 50 51 64 352 353 354 AntennaAxes 2 5 31 37 39 64 171 172 203 204 206 209 234 235 236 242 243 343 348 349 206 207 235 236 AntennaAxes 2 5 31 37 39 64 171 172 203 204 205 206 208 209 234 235 236 242 243 343 348 349 AntennaAxesLabels 2 5 37 39 64 208 209 234 235 236 343 348 349 235 236 AntennaAxesLabels 2 5 37 39 64 208 209 234 235 236 343 348 349 AntennaCoordinates 2 5 27 28 63 103 105 150 151 158 204 206 235 236 343 347 348 349 350 351 353 AntennaCoordinates 2 5 27 28 63 103 105 106 150 151 158 204 206 235 236 343 347 348 349 350 351 353 AntennaGrid 2 5 56 64 237 242 243 244 348 349 AntennaGrid 2 5 56 64 237 242 243 244 343 348 349 AntennaLineMarkerPlot 2 5 49 50 51 64 343 350 351 352 AntennaLineMarkerPlot 2 5 49 50 51 64 343 350 351 352 AntennaLinePlot 2 5 49 50 64 343 347 348 349 AntennaLinePlot 2 5 49 50 64 343 347 348 349 AntennaPlot39 49 50 51 64 156 343 347 350 351 AntennaPlot 39 49 50 51 64 156 343 347 350 351 AntennaScatterPlot 2 5 49 51 64 343 349 350 351 354
9. CandlestickChart FinLogPict GHLCChart OpeninaScreen FinancialOptions Technical nalysis Candlestick Plots in Technical Analysis 12 00 00 13 00 00 14 00 00 15 00 00 9 30 00 11 00 00 12 00 00 13 00 00 14 00 00 15 00 00 7103 12 The Open Close box is filled if the open price is greater than the close price This is accomplished because of the dual positioning values Position and TimeStamp of the ChartEvent class Each element of a plot object one of the candlestick objects in the plot above is positioned in a simple linear coordinate system starting at 0 and incrementing by 1 for each ChartEvent object In the previous example the first ChartEvent object is has a Position value of 0 0 and the last ChartEvent object has a position of 199 because there are 200 data points in the chart This is what keeps the individual elements of a plot bject evenly spaced because the plot elements are positioned in the chart using the Position value not the TimeStamp value But the associated x axis EventAxis and x axis labels objects EventAxisLabels look to the TimeStamp property for their values not the Position property What you end up with is the clean evenly spaced look of a simple linear chart with the axis tick marks and axis labeling of a dedicated time date axis The graph can be made to scroll or pan left to right or re scale along the y axis smoothly The EventSimpleDataset class is used to supply the s
10. thePlot2 theTitleFont titleLine ChartObj NORM GRAPH POS theFooterFont As New Font Microsoft Sans Serif theFooterFont ueTemplate As New NumericLabel ChartObj DECIMALFORMAT ueTemplate As New NumericLabel ChartObj DECIMALFORMAT CIRCLE thePlot3 legendFont legendFont 14 FontStyle Bold Theoretical vs Experimental Data 9 0 00y 10 FontStyle Bold Scatter plots usually display some 10 FontStyle Regular 0 1 204 ChartObj SQUARE New ChartAttribute Color Green datatooltip SetTextTemplate textTemplate datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP XY ONELINE datatooltip SetToolTipSymbol toolTipSymbol datatooltip SetEnable True chartVu SetCurrentMouseListener datatooltip End Sub InitializeChart Private Sub UserChartControll Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InitializeChart End Sub End Class Display the UserChartControll in Design mode and double click on it This will add a UserChartControl Load method to the UserChartControll class The chart initialization code will be invoked by this event Private Sub UserChartControll Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InitializeChart End Sub 408 Using QCChart2D for Net to Create Windows Applicat
11. 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 ChartPlot 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 Text Classes 365 ByVal npostype As Integer _ Cf publico ChartText PhysicalC
12. T 10103 10203 4 03 03 10403 830 12 00 8 30 12 00 10103 10203 2 16 Minute ae 830 1000 1200 1400 9 30 10 00 8 30900 1000 1100 1200 13 00 1400 10103 10203 10103 Hour Minute 15 Minute Minute mpy a R Ce 30 900 10 00 1100 230 8 45 9 00 9 16 9 30 10103 4 01 03 5 Minute Minute 830 835 840 845 850 845 1 0103 Minute 5 Second 8 30 00 8 31 00 8 32 00 8 33 00 10103 Minute 1 Seconds Po 777777774 8 30 00 83100 83200 823300 63400 10103 5 Second Second 8 30 00 83005 823040 8 30 15 8 30 20 10103 Atime axis can be customized for non 24 hour range TimeAxis Class Architecture 35 This class is the most complex of the axis classes It supports time scales ranging from 1 milliseond to hundreds of years Dates and times are specified using the Net 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 followed 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
13. The y scale range for pTransforml to pTransform5 are The plotting area for each pTransform is indentical to the left for extra axes pTransforml SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform2 SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform3 SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform4 SetGraphBorderDiagonal 0 35 15 9 0 65 pTransform5 SetGraphBorderDiagonal 0 35 15 9 0 65 ChartAttribute ChartAttribute attrib2 new ChartAttribute Color Red ChartAttribute attrib3 ChartAttribute attrib4 oo 9 ChartAttribute xAxis new LinearAxis pTransforml ChartObj X AXIS xAxis SetLineWidth 2 chartVu AddChartObject xAxis yAxisl new LinearAxis pTransforml ChartObj Y AXIS yAxisl SetAxisIntercept 0 0 ttribl new ChartAttribute Color Blue FAQs 443 all the same 0 100 all different leaving a large open 2 DashStyle BSolid 2 DashStyle Solid new ChartAttribute Color Green 2 DashStyle Solid new ChartAttribute Color Orange 2 DashStyle Solid ttrib5 new ChartAttribute Color Magenta 2 DashStyle Solid yAxisl SetChartObjAttributes attribl axis color matches line color chartVu AddChartObject yAxis1 yAxis2 new LinearAxis pTransform2 ChartObj Y AXIS yAxis2 SetAxisIntercept 18 yAxis2 SetChartObjAttributes attrib2 axis color matches line color chartVu AddChartObject yAxis2 yAxis3 new LinearA
14. Cf public TimeSimpleDataset string sname ChartCalendar Ry double y public TimeSimpleDataset string sname double x ChartCalendar Specifies name of the dataset x An array that specifies the x values either doubles or ChartCalendar objects of a dataset y An array that specifies the y values of a dataset either doubles or ChartCalendar objects The length of the y array must match the length of the x array Either x or y values should be ChartCalendar based 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 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 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 Chart Datasets 71 Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Inte
15. Define axes axes labels and grids 284 Simple Plot Objects 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 lattribArray attribl attrib2 attrib3 attrib4 GroupBarPlot thePlotl 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 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 pTransforml SetScaleStartY 0 Dim xAxisl As New TimeAxis pTransforml
16. Must be able to remove arbitrary non periodic days holidays for example from the time date scale Allow for a sub range of a day which crosses 24 00 i e 18 00 to 3 00 Allow for multiple active time ranges within the same 24 hour period i e 9 00 AM to 12 00 and 14 00 to 18 00 e Smooth panning and zooming of data across discontinuous time boundaries Allow for exceptions to the predefined set of rules For example be able to include a weekend day or a specific set of hours normally excluded from the scale 82 Chart Datasets These requirements are common enough that we wanted to address them with new coordinate system dataset and axis classes which can accommodate any set of continuous or discontinuous time date values but not waste display space on gaps where no data exists Rather than extend the existing time date coordinate system TimeCoordinates we chose to create new coordinate system EventCoordinates which uses discrete events rather than a continuous domain as the basis for plotting data The basis of the EventCoordinates system are the event dataset classes EventSimpleDataset and EventGroupDataset and the underlying array of ChartEvent objects Rather than define a plot using arrays of x and y values a ChartEvent represents a specific point in time The point in time has the following major properties as distinguishing elements Description A description of the event ShortDescription
17. open 102 Chart Datasets minval Math Min stockPriceData 3 stockPriceData 0 maxval Math Max stockPriceData 3 stockPriceData 0 StockPriceData 1 maxval 1 5 ChartSupport GetRandomDouble high low StockPriceData 2 minval 1 5 ChartSupport GetRandomDouble End If currentEvent New ChartEvent xValues i position stockPriceData currentEvent AxisLabel XXX amp position ToString currentEvent ToolTip ToolTip amp position ToString eventArray i currentEvent currentdate Add incrementbase increment If currentdate Get ChartObj HOUR OF DAY gt 16 Then currentdate Add ChartObj DAY OF YEAR 1 currentdate SetTOD 9 30 0 End If Next Dim Datasetl As New EventGroupDataset Stock Data eventArray 4 Dim Dataset2 As EventSimpleDataset Datasetl ConvertToEventSimpleDataset 1 Dim pTransforml New EventCoordinates Datasetl 4 Scaling and Coordinate Systems ChartScale LinearScale LogScale TimeScale ElapsedTimeScale EventScale UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates PolarCoordinates AntennaCoordinates EventCoordinates TimeCoordinates ElapsedTimeCoordinates The starting point for all drawing in a window is the Net 2D device coordinate system The coordinate system uses a default device resolution of the underlying Net window regardless of the output device A Net window maintains a viewport
18. public AntennaAnnotation AntennaCoordinates transform int annotationtype double value ChartAttribute attrib 354 Polar and Antenna Charts 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 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 1s 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 lege
19. 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 1 10 22 33 44 55 46 33 25 14 YF 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 hartObj APRIL 5 _ New ChartCalendar 1996 hartObj MAY 5 New ChartCalendar 1996 hartObj JUNE 5 New ChartCalendar 1996 hartODjJ JULY 8 _ New ChartCalendar 1996 hartObj AUGUST 5 _ New ChartCalendar 1996 hartObj SEPTEMBER 5 New ChartCalendar 1996 hartObj OCTOBER 5 _ New ChartCalendar 1996 hartObj NOVEMBER 5 Dim yData As Double 10 22 33 44 55 46 33 25 14 9 CI 04 2 01 09 Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Dim simpleTimeScale As TimeC
20. Define a Time coordinate system ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 double yMax 105 int xAxisTickMarkFormat ChartObj TIMEAXIS MONTHWEEK double xAxisMinorTickLength 5 double xAxisMajorTickLength 10 int xAxisTickDirection ChartObj AXIS MIN TimeCoordinates simpleTimeScale 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 192 Axes new LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in ChartView chartVu new ChartView 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
21. 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 direction and y2 y1 rows in the y direction This forms a regular grid surface Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal rows As Integer _ ByVal columns As Integer _ ByVal x1 As Double _ ByVal yl As Double _ ByVal x2 As Double _ ByVal y2 As Double ByVal sf As SurfaceFunction public ContourDataset string sname int rows int columns 78 Chart Datasets double 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 _ ByVal columnskip As Integer _ Cf public ContourDataset
22. Change Y Max a f Trusted sites Using QCChart2D for Net to Create Web Applications 427 Visual C Create a Windows Control Library and User Control You need to create a ChartView derived user control that defines your chart and includes all of the properties that you need for interacting with your chart This is done almost exactly the same as described in the previous chapter Using QCChart2D for Net to Create Windows Applications The difference is that instead of creating a Net application resulting in an exe file you can run from Windows you are instead creating a Windows Control Library which results in a DLL file What you end up with is a user control not an executable program The user control must be referenced in a specific way in an HTML file before you can display it The basic steps for creating the ChartView derived control are described below Start by creating a Windows Control Library project using the Visual Studio project wizard File New Project Visual C Projects Windows Control Libary On the left select a project type of Visual C Projects Give the project a unique name our version of this example is WindowsControlLibrary1 You will end with the shell of a UserControl class with the name UserControll You will modify UserControll and turn it into an object derived from our ChartView object Right click on Reference in the Solution Explorer window and select Add Reference Browse
23. 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 container object such as a UserControl A Net 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 158 The Chart View PolarCoordinates or AntennaCoordinates 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 FinancialExamples class OHLCChart C pTransforml new TimeCoordinates pTransforml SetGraphBorderDiagonal 0 18 490 0 6 j mn pTransform2 new TimeCoordinates pTransform2 SetGraphBorderDiagonal 0 42 0 879 p Visual Basic pTransforml New TimeCoordinates pTransforml SetGraphBorderDiagonal 0 pTransform2 New TimeCoordinates pTransform2 SetGraphBorderDiagonal 0 L2 9U DIE n 22 490
24. File and Printer Rendering 399 Grid ygridl new Grid xAxisl yAxisl ChartObj Y AXIS ChartObj GRID MAJOR yoridl SerColer Color Black chartVu AddChartObject 1 Grid ygrid2 new Grid xAxisl yAxisl ChartObj Y AXIS ChartObj GRID MINOR ygrid2 S5etColor Color Gray chartVu AddChartObject ygrid2 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 ChartObj DAY OF YEAR 0 8 defaultattrib fillattrib chartVu AddChartObject thePlotl Font theTitleFont new Font Microsoft Sans Serif 18 FontStyle Bold ChartTitle mainTitle new ChartTitle pTransforml theTitleFont Candlestick Plots in Technical Analysis mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color White chartVu AddChartObject mainTitle Font theFooterFont new Font Microsoft Sans Serif 10 FontStyle Bold ChartTitle footer new ChartTitle pTransforml theFooterFont The Open Close box is filled if the open price is greater than the close price footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER
25. The StringAxisLabels class should be used to create multi line axis labels Insert the n new line character to add additional lines to each string used to define the string axis labels The example below is from the AxisLabels example program C String xstringlabels 454 FAQs Western n Sales n Region Eastern n Sales n Region Southern n Sales n Region Northern n Sales n Region StringAxisLabels xAxisLab5 new StringAxisLabels 5 xAxisLab5 SetAxisLabelsStrings xstringlabels 5 xAxisLab5 SetTextFont graph5Font chartVu AddChartObject xAxisLab5 Visual Basic Dim xstringlabels As String Western ControlChars Lf Sales _ ControlChars Lf Region Eastern ControlChars Lf Sales _ ControlChars Lf Region Southern ControlChars Lf Sales GontrolChars Lf Region Northern ControlChars Lf Sales ControlChars Lf Reqion Dim xAxisLab5 As New StringAxisLabels xAxis5 xAxisLab5 SetAxisLabelsStrings xstringlabels xAxisLab5 SetTextFont graph5Font chartVu AddChartObject xAxisLab5 5 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 UserControl A layout manager manages the position and size of each ChartView Another way is to
26. mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color White chartVu AddChartObject mainTitle Font theFooterFont new Font Microsoft Sans Serif 10 FontStyle Bold ChartTitle footer new ChartTitle pTransforml theFooterFont Bar plots can have the values of the bars displayed above or inside each bar footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer chartVu SetResizeMode ChartObj AUTO RESIZE OBJECTS DataToolTip datatooltip new DataToolTip chartVu TimeLabel xValueTemplate new TimeLabel ChartObj TIMEDATEFORMAT MDY NumericLabel yValueTemplate new NumericLabel ChartObj CURRENCYFORMAT 0 datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP XY TWOLINE datatooltip GetToolTipSymbol SetColor Color Red datatooltip SetEnable true chartVu SetCurrentMouseListener datatooltip lt summary gt Set Get the chart title lt summary gt public string ChartTitleText get return mainTitle TextString set mainTitle TextString value this UpdateDraw lt summary gt Set Get the yMax lt summary gt public double YMax get return pTra
27. 130 Scaling and Coordinate Systems 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 0 Dim yMax As Double 105 Dim simpleScale As ElapsedTimeCoordinates simpleScale New ElapsedTimeCoordinates xMin yMin xMax yMax or scale using TimeSpan values Dim xTSMin TimeSpan TimeSpan FromSeconds 0 starting time is 0 Dim xTSMax 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 Example of explicit scaling of a ElapsedTimeCoordinates object using the ElapsedTimeCoordinates SetCoordinateBounds method C double xMin 0 starting elapsed time is 0 double xMax 30 1000 ending elpase time is 30 seconds double yMin 0
28. 15 90 0 7 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 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 10 FontStyle Bold AxisTitle yaxistitle new AxisTitle yAxis titleFont Measurable work output chartVu AddChartObject yaxistitle AxisTitle xaxistitle new AxisTitle xAxis titleFont MBAs 1000 employees chartVu AddChartObject xaxistitle Grid xgrid new Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR chartVu AddChartObject xgrid Grid ygrid new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR chartVu AddChartObject ygrid ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SetFillColor Color Blue attribl SetFillFlag true attribl SetSymbolSize 10 SimpleScatterPlot thePlotl new SimpleScatterPlot pTransforml1 Dataset2 ChartObj CROSS attribl chartVu AddChartObject thePlot1
29. 217 219 220 222 223 224 225 226 229 231 232 233 234 235 236 284 301 302 345 346 348 349 364 369 370 398 401 406 412 417 422 429 434 443 445 453 454 457 AxisTitle 56 57 64 314 364 369 370 429 444 445 axistitle 370 406 412 429 434 444 445 axisTitle uius tecto beet 444 445 AxisTitle 56 57 64 314 364 369 370 406 412 429 434 444 445 Backgrounds cerca edhe ahaa UR background 11 16 18 20 24 31 99 155 168 169 170 199 210 231 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 332 341 342 345 346 348 349 368 378 379 382 385 398 400 406 412 417 422 429 434 444 Background 12 31 64 81 155 162 168 169 170 199 231 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 341 342 345 346 348 349 377 378 380 381 385 398 400 406 412 417 422 429 434 444 BACKGROUND 169 170 199 231 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 341 342 345 346 348 349 380 381 398 400 406 412 417 422 429 434 444 Backgrounds 12 31 64 155 168 169 170 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 341 342 345 346 348 349 377 398 400 417 422 429 444 background 11 16 18 20 24 31 99 155 168 169 170 199 210 231 247
30. C Define the coordinate system TimeSpan xMin TimeSpan FromSeconds 0 TimeSpan xMax TimeSpan FromSeconds 15 double yMin 0 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 LinearAxis yAxis new LinearAxis 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 0 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 LinearAxis New LinearAxis simpleScale ChartObj Y AXIS x Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Event Axes Class EventAxis GraphObj 196 Axes Axis LinearAxis EventAxes The EventAxis is subclassed from the LinearAxis class and has much in common with it The major difference between the two is the way in which major and minor tick marks are calculated in the CalcAutoAxis method The EventAxis places tic
31. 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 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 value 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 17
32. LABEL ORIGIN is LABEL ALL labcolor The color of the label text tickstrings Aarray of strings one for each major tick mark that you want labeled numtickstrings The number of strings in the tickstrings array If you want the first major tick mark usually the intercept of the y axis with the x axis to remain empty just initialize the first element of the tickstrings array to the empty string as in the example below Simple string axis labels example extracted from the BarGraphs LandOfTheFry example program C int NumberOfCountries 13 int NumberOfGroups 2 String CountryNames we Chine Russia Italy Sweden Denmark Mexico Brazil France Australia Spain United States England Positions bax double xl new double NumberOfCountries X axis String labels Each string will label a major tick mark StringAxisLabels yAxisLabl new StringAxisLabels yAxisl yAxisLabl SetAxisLabels theFont 0 Axis Labels 217 ChartObj AXIS MIN ChartObj LABEL ALL Color Black CountryNames 14 yAxisLabl SetColor Color Black chartVu AddChartObject yAxisLabl Visual Basic Dim NumberOfCountries As Integer 13 Dim NumberOfGroups As Integer 2 pim CouhtryNames As String Chiha Japan Russia Italy Sweden Denmark Mexico Brazil France Australia Spain United States England Positions bar Dim x1 Nu
33. S 07 Oy 5 3 4 1 Dim 2 Double 20 12 43 54 15 26 63 25 24 19 Dim xData3 Double 5 6 7 6 5 4 5 6 7 BY Dim yData3 As Double 30 52 13 64 25 76 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 simpleScale AutoScale datasetsArray New CartesianCoordinates 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 Scaling and Coordinate Systems 115 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 new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LOG SCALE logYScale SetCoordinateBounds xMin
34. Student 4 chartVu AddChartObject xaxistitle Visual Basic Dim xAxis As New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject xAxis Dim yAxis New LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis Dim xAxisLab As New NumericAxisLabels xAxis xAxisLab SetTextFont theFont hartVu AddChartObject xAxisLab Q Dim yAxisLab As New NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Dim titleFont As New Font SansSerif 12 FontStyle Bold Dim yaxistitle As New AxisTitle yAxis titleFont Test Score hartVu AddChartObject yaxistitle Cy Dim xaxistitle As New AxisTitle xAxis titleFont Student chartVu AddChartObject xaxistitle 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 Rotate and justify the text vertically and horizontally NumericLabel constructors Visual Basic Overloads Public Sub New ByVal transform As PhysicalCoordinates ByVal tfont As Font _ ByVal initialvaluel As Double _ ByVal x As Double _ By
35. chartVu AddChartObject xgrid Dim ygrid As New Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR chartVu AddChartObject ygrid Dim attribs numcontourlevels As ChartAttribute For 1 0 To numcontourlevels Dim color As Color color FromArgb CInt 255 _ ChartSupport GetRandomDouble _ 2 DashStyle 50114 color pom em False End If If i Mod 3 0 Then labelflags i True Else labelflags i False End If 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 temporary 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 Doub
36. double yAxisMinorTickLength 5 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 yAxis SetAxisTicks yAxisOrigin yAxisLogFormat yAxisMinorTickLength yAxisMajorTickLength 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 someth
37. 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 dataset and others that take an array of datasets Scaling and Coordinate Systems 131 Example of auto scaling a ElapsedTimeCoordinates object using a single dataset double xData 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double 110 22 33 44 55 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 Dim yData As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 LIN EE 22 d4 55 SO 22 43 14 39 Dim dataset As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Sales xData yData Dim simpleScale As ElapsedTimeCoordinates New ElapsedTimeCoordinates simpleSc
38. new Font SansSerif 10 FontStyle Bold ChartText currentLabell new ChartText pTransforml theLabelFont I b B 0uA 15 5 yt 0 85 41 GChartObj PHYS POS chartVu AddChartObject currentLabell ChartText currentLabel2 new ChartText pTransforml theLabelFont L b 100uA 15 5 yl 1 85 l Cha rtObj PHYS POS chartVu AddChartObject currentLabel2 ChartText currentLabel3 new ChartText pTransform1 theLabelFont rib 15050A 15 5 y1 2 85 41 ChartObj PHYS POS chartVu AddChartObject currentLabel3 ChartText currentLabel4 new ChartText pTransforml theLabelFont L b 2000A 15 5 yl1 3 85 4 l p ChartObj PHYS POS 7 chartVu AddChartObject currentLabel4 ChartText currentLabel5 new ChartText pTransforml theLabelFont T b 2500A 15 5 y1 4 85 41 ChatrtObj PHYS FOS chartVu AddChartObject currentLabel5 Visual Basic Dim theLabelFont As New Font SansSerif 10 FontStyle Bold Dim currentLabell New ChartText pTransforml theLabelFont I b 50uA 19 9 85 1 ChartObj PHYS POS chartVu AddChartObject currentLabell Dim currentLabel2 As New ChartText pTransforml 15 5 yl l 95 ly ChartObj PHYS POS chartVu AddChartObject currentLabel2 theLabelFont I b 100uA Dim currentLabel3 As New ChartText pTransforml theLabelFont I b 150uA 15
39. null if printobj null printobj new ChartPrint chartVu printobj DoPrintDialog else printobj PrintChartView chartVu printobj DocPrintPage sender Visual Basic This routine invokes the chart objects PageSetupItem method Public Sub PageSetup ByVal sender As Object ByVal e As System EventArgs File and Printer Rendering 393 Dim chartVu As ChartView Me If Not chartVu Is Nothing Then If printobj Is Nothing Then printobj New ChartPrint chartVu Else printobj PrintChartView chartVu End If printobj PageSetupItem sender e End If End Sub PageSetup This routine invokes the chart objects printer setup dialog method Public Sub PrinterSetup ByVal sender As Object ByVal e As System EventArgs Dim chartVu As ChartView Me If Not chartVu Is Nothing Then If printobj Is Nothing Then printobj New ChartPrint chartVu Else printobj PrintChartView chartVu End If printobj DoPrintDialog End If End Sub PrinterSetup This routine invokes the chart objects PrintPreviewItem method Public Sub PrintPreview ByVal sender As Object ByVal e As System EventArgs Dim chartVu As ChartView Me If Not chartVu Is Nothing Then If printobj Is Nothing Then printobj New ChartPrint chartVu Else printobj PrintChartView chartVu End printobj PrintPreviewItem sender e End If End Sub PrintPreview This routine prints a chart by invoking the chart objects DocPrint
40. yl 1 0 New ChartCalendar 2003 ChartObj JANUARY 1 1 1 5 1 0 1 New ChartCalendar 2002 ChartObj JANUARY 1 1 1 1 New ChartCalendar 2002 ChartObj MAY 1 1 17 1 1 0 17 New 1 2002 ChartObj JULY 1 1 1 17 New ChartCalendar 2002 ChartObj OCTOBER 1 theFont New Font SansSerif 10 FontStyle Bold Dim Datasetl As TimeGroupDataset New TimeGroupDataset Actual Sales xl yl Dim pTransforml As TimeCoordinates New TimeCoordinates 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 280 Simple Plot Objects attribl SetFillFlag True thePlotl InitFloatingBarPlot Datasetl 0 75 attribl ChartObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR chartVu AddChartObject thePlotl Floating Stacked Bar Plots Class FloatingStackedBarPlot GraphObj ChartPlot GroupPlot 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
41. zoomObj SetButtonMask MouseButtons Left zoomObj SetZoomYEnable 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 SetZoomRangeLimitsRatio new Dimension 1 0 1 0 zoomObj InternalZoomStackProcesssing true chartVu SetCurrentMouseListener zoomObj Visual Basic Dim zoomObj As New ChartZoom chartVu pTransforml True zoomObj SetButtonMask MouseButtons Left zoomObj SetZoomYEnable True zoomObj SetZoomXEnable True zoomObj SetZoomXRoundMode ChartObj AUTOAXES FAR zoomObj SetZoomYRoundMode ChartObj AUTOAXES FAR zoomObj SetEnable True zoomObj SetZoomStackEnable True set range limits to 1000 ms 1 degree zoomObj SetZoomRangeLimitsRatio New Dimension 1 0 1 0 zoomObj InternalZoomStackProcesssing True 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 15 used to re scale each coordinate system and the axis objects associated with them Use the constructor below in order to super zoom a chart that has multiple co
42. 0 878 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 1 and DateAxes2 Multiple coordinate systems in a ChartView example C double xMinl 5 double xMaxl 15 double yMinl 0 double yMaxl 105 CartesianCoordinates pTransforml new CartesianCoordinates xMinl yMinl xMaxl 1 pTransforml SetGraphBorderDiagonal 0 1 double xMin2 80 SU 2 6 27 The Chart View 159 double xMax2 150 double yMin2 0 double yMax2 1050 CartesianCoordinates pTransform2 new CartesianCoordinates xMin2 yMin2 xMax2 yMax2 pTransform2 SetGraphBorderDiagonal 0 1 15 90 0 6 Visual Basic Dim xMinl As Double 5 Dim xMax1 As Double 15 Dim yMinl As Double 0 Dim yMaxl As Double 105 Dim pTransforml As CartesianCoordinates _ New CartesianCoordinates xMinl
43. 189 191 192 221 222 250 251 259 260 272 277 278 279 281 282 283 284 288 289 293 294 295 296 325 335 336 372 373 397 398 399 400 401 428 429 451 ChartCalendar 26 30 35 57 61 63 65 69 70 71 72 87 88 91 92 93 94 100 101 116 117 118 119 120 121 122 123 124 125 126 127 128 137 138 147 148 152 184 188 189 191 192 221 222 250 251 259 260 272 277 278 279 281 282 283 284 288 289 293 294 295 296 325 335 336 372 373 397 398 399 400 401 428 429 433 434 451 ChartEv etit iia cte ore t chartevent iens 87 88 199 230 231 ChartEvent 1 15 17 26 29 35 36 63 65 81 82 85 86 87 88 99 100 101 102 133 137 138 139 140 142 143 145 147 148 149 196 C hartlmage x cente OI RES 399 401 417 418 423 chartImage 4 eee 386 ChartImage 57 58 64 170 382 384 385 386 421 Charthabel e 56 57 64 364 370 367 56 57 64 364 370 ChartObj 63 66 69 72 73 76 81 88 91 93 94 95 98 113 114 115 116 119 120 121 122 123 124 125 127 128 129 131 133 150 151 152 155 156 157 162 163 170 177 178 182 183 191 192 195 203 206 213 214 217 221 222 223 225 226 231 233 234 235 236 239 240 24
44. 192 Time axis TimeAxisLabels2 6 37 38 39 64 129 183 208 209 217 219 220 222 223 224 225 226 229 284 398 401 429 434 Tirme coordinates neret TimeCoordinates 2 3 6 27 28 63 82 103 105 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 152 153 157 158 170 183 184 188 189 191 192 195 221 222 225 226 246 247 248 250 269 270 277 279 281 282 283 284 289 293 294 295 296 318 365 375 398 400 428 429 433 451 452 454 2 2 70 91 Time labels essere timelabel errore 336 337 TimeLabel 6 56 57 64 330 332 333 334 336 337 364 370 372 373 381 430 434 Time SOCAL CS tee tret etie eee erento TimeScale 6 26 27 63 103 105 119 120 121 122 123 125 127 128 129 147 148 152 153 191 192 221 222 250 283 284 295 296 429 434 451 Time Date group datsets esee TimeGroupDataset2 10 25 26 30 63 65 91 92 93 94 95 96 97 98 121 269 270 272 277 279 281 283 284 289 293 377 380 398 400 458 Time Date simple datasets esses SimpleDataset eese 86 TimeSimpleDataset 2 9 25 26 30 63 65 69 70 71 72 73 74 75 76 121 122 123 125 128 131 132 225 226 247 248 250 318 377 379 429 433 452 458 459
45. 21 22 23 55 59 103 154 312 355 356 357 358 359 360 361 362 363 368 406 407 413 Legend 55 64 156 355 356 357 358 359 360 361 362 363 364 406 407 413 LEGEND 362 363 Lie pend items xs unie ini a e legenditem 357 358 Legendltem 55 64 355 357 358 359 360 361 362 363 406 407 413 Legendltem 55 64 357 358 legenditem eee eee 357 358 Legendltem 55 64 355 357 358 359 360 361 362 363 406 407 413 License te ERES license eie er hen License File Line gap plots t pete toti LineGapPlot 41 47 64 261 287 288 289 290 Line marker plots sse SimpleLineMarkerPlot 52 53 64 85 245 254 255 256 257 312 a dedita e res SimpleLinePlot 16 19 52 54 64 85 162 163 170 245 246 247 248 253 309 310 312 331 359 368 406 413 418 422 444 445 447 448 Linear auto scaling s LinearAutoScale 29 30 63 Liti at axiSNa oen aate LinearAxis 31 33 38 56 64 143 155 156 157 171 172 173 175 177 178 182 184 191 192 193 195 196 199 200 203 204 208 209 211 213 214 221 222 225 226 230 231 237 239 240 284 301 302 369 370 398 400 406 412 417 422 428 429 433 434 442 443 444 445 447 448 451 452 Eineat scale used ee ce eet ues LinearS
46. 22 33 44 55 46 33 25 14 9 Dim dataset As ElapsedTimeSimpleDataset xData yData Dim simpleScale As ElapsedTimeCoordinates simpleScale AutoScale dataset simpleScale SetScaleStartY 0 simpleScale SetScaleStopY 100 0 New ElapsedTimeSimpleDataset Sales new ElapsedTimeCoordinates 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 double xDatal 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double yD tal 10 22 33 44 55 46 33 25 14 double xData2 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double 1 yDEta2 20 12 43 54 15 26 63 25 24 19 double xData3 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 double yDate3 30 52 13 64 25 76 13 35 24 19 ElapsedTimeSi mpleDataset datasetl new ElapsedTimeSimpleDataset Sal Elapsed Sal les1 xDa les2 xDa tal yDatal TimeSimpleDataset dataset2 ta2 yData2 new ElapsedTimeSimpleDataset ElapsedTimeSimpleDataset dataset3 new ElapsedTimeSimpleDataset Sales3 xData3 yData3 ElapsedTimeSimpleDataset datasetsArray new ElapsedTimeSimpleDataset 3 datasetsArray 0 datasetl datasetsArray 1 dataset2 datasetsArray 2 dataset3 Elapse
47. 239 240 241 242 307 308 309 310 311 313 314 315 316 317 320 322 323 326 328 331 332 333 334 335 336 377 378 383 390 391 392 393 394 395 396 397 399 402 404 405 410 411 415 416 417 418 421 422 423 426 427 428 431 432 433 446 448 449 450 451 452 453 454 455 456 chartview 308 309 310 311 394 395 446 ChartView 7 11 17 19 20 22 25 31 59 60 63 67 72 75 87 90 93 97 100 154 155 156 157 158 159 160 161 168 177 182 191 192 202 203 213 214 222 233 234 239 240 241 242 306 307 308 309 310 311 313 314 315 316 317 320 322 323 326 328 331 332 333 334 335 336 377 378 383 390 391 392 393 394 395 396 397 399 402 404 405 410 411 415 416 417 418 421 422 423 426 427 428 431 432 Appendix 465 433 446 448 449 450 451 452 453 454 455 456 Comma separated csv 67 68 69 70 71 72 73 74 78 79 86 90 91 92 93 95 96 97 99 100 CSV 61 63 65 66 67 68 69 70 71 72 73 74 75 78 79 86 87 89 90 91 92 93 95 96 97 99 100 262 Contour plotting eserin p eerie ete ContourDataset 25 26 63 65 76 77 78 79 80 81 299 300 ContourDataset 25 26 63 65 76 77 78 79 80 81 299 300 CSV 61 63 65 66 67 68 69 70 71 72 73 74 75 78 79 86 87 89 90 91 92 93 95 96 97 99 100 262 csv
48. 241 242 243 244 284 301 302 303 343 345 346 348 349 378 379 380 381 398 399 401 406 412 429 434 444 445 447 448 456 458 GRID 238 239 240 241 242 243 244 284 301 302 345 346 348 349 380 381 398 399 401 406 412 429 434 444 445 456 Group barplots is retener GroupBarPlot 41 45 64 158 261 276 282 284 331 451 454 Group datasets ed ento aed GroupDataset 1 2 10 25 26 30 63 65 67 82 86 88 89 90 91 92 93 94 95 96 97 98 99 101 102 121 133 138 139 262 263 264 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 297 298 377 380 398 400 449 453 458 459 Group plot GroupPlot23 39 41 42 43 44 45 46 47 48 64 156 261 262 264 268 270 272 273 275 276 280 282 283 285 288 290 292 294 296 GroupBarPlot 41 45 64 276 282 284 331 GroupBarPlot 41 45 64 158 261 276 282 284 331 451 454 GroupDataset 25 26 30 63 65 88 89 90 91 95 98 262 263 264 269 270 271 273 274 275 276 278 280 282 283 285 286 287 288 290 291 292 293 294 297 298 377 453 458 GroupDataset 1 2 10 25 26 30 63 65 67 82 86 88 89 90 91 92 93 94 95 96 97 98 99 101 102 121 133 138 139 262 263 264 269 270 271 272 273 274 275 276 277
49. 241 242 343 345 346 Polar axis labels cett eerte polarAxesLabels esee 233 234 PolarAxesLabels 37 39 64 208 209 232 233 234 343 345 346 Polar PolarCoordinates 27 28 63 103 105 106 149 150 158 201 202 203 233 241 242 343 344 345 346 347 454 Polat grids aie polarGrid 241 242 PolarGrid 56 64 237 240 241 242 343 345 346 Polar line plots toe ein eot PolarLinePlot 49 64 343 344 345 346 85 6 PolarPlot 39 49 64 156 343 344 346 Polar scatter plots eene eter PolarScatterPlot 49 64 343 345 346 347 PolarAxes 31 36 39 56 64 171 172 200 201 202 203 209 232 233 234 240 241 242 343 345 346 PolarAxesLabels 37 39 64 208 209 232 233 234 343 345 346 PolarCoordinates 27 28 63 103 105 149 150 158 201 202 203 233 241 242 343 344 345 346 347 454 PolarGrid 56 64 237 240 241 242 345 346 PolarLinePlot 49 64 343 344 345 346 PolarPlot 39 49 64 156 343 344 346 PolarScatterPlot 49 64 343 345 346 347 Polysurface class ees 61 62 63 Polysurface 61 62 63 80 81 301 302 Printing 60 63 390 391 392 393 ChartPr
50. 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 332 341 342 345 Appendix 463 346 348 349 368 378 379 382 385 398 400 406 412 417 422 429 434 444 Background 12 31 64 81 155 162 168 169 170 199 231 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 341 342 345 346 348 349 377 378 380 381 385 398 400 406 412 417 422 429 434 444 BACKGROUND 169 170 199 231 247 248 250 253 263 281 282 283 284 286 287 289 291 292 297 298 301 302 341 342 345 346 348 349 380 381 398 400 406 412 417 422 429 434 444 ei SimpleBarPlot 52 53 64 85 245 248 249 250 251 312 331 429 434 435 BarDatapointValue eee 2 64 WhLu sker aei tenere BoxWhiskerPlot 3 41 43 64 264 265 266 267 268 BoxWhiskerPlot 3 41 43 64 264 265 266 267 268 BoxWhiskerPlot 3 41 43 64 264 265 266 267 268 Bubble plot legend items es BubblePlotLegendltem 55 64 360 Bubble plot legends sese BubblePlotLegend 55 64 355 360 361 362 363 Bubble plots inb tatit petet BubblePlot 41 42 55 64 261 268 269 270 355 360 361 362 363 BubblePlot 41 42 64 261 268 269 270 360 361 362 363
51. 349 364 369 370 398 399 400 401 406 412 417 418 422 428 429 430 433 434 435 441 442 443 444 445 447 448 451 452 453 454 456 457 AXIS 146 147 148 155 156 157 170 175 176 177 178 180 182 183 184 185 186 187 188 189 190 191 192 193 195 197 199 202 203 205 206 210 213 214 216 217 220 221 222 223 224 225 226 230 231 238 239 240 247 248 250 281 282 283 284 286 287 289 301 302 341 342 367 369 370 398 399 400 401 406 412 417 422 429 434 442 443 444 445 451 452 453 456 Axis label classes ete ette AxisLabels 1 2 6 37 38 39 64 85 129 137 139 140 143 145 146 147 148 156 183 208 209 210 211 212 213 214 215 216 217 219 220 222 223 224 225 226 229 231 232 233 234 235 236 284 301 302 345 346 348 349 364 369 370 398 401 406 412 417 422 429 434 443 445 453 454 457 chartDabel eter CREE 367 ChartLabel sss 56 57 64 364 370 Axis titles axistitle 370 406 412 429 434 444 445 AXIS eror te reds 444 445 AxisTitle 56 57 64 314 364 369 370 406 412 429 434 444 445 AxisLabels 37 38 64 156 208 209 210 211 215 217 223 226 232 234 364 453 AxisLabels 1 2 6 37 38 39 64 85 129 137 139 140 143 145 146 147 148 156 183 208 209 210 211 212 213 214 215 216
52. 35 yAxis3 SetChartObjAttributes attrib3 chartVu AddC yAxis4 axis color matches hartObject yAxis3 New LinearAxis pTransform4 ChartObj Y AXIS yAxis4 SetAxisIntercept 52 yAxis4 SetChartObjAttributes attrib4 chartVu AddC yAxis5 New yAxis5 SetAx yAxis5 SetAx yAxis5 Setch chartVu AddC Dim xAxisLab xAxisLab Set chartVu AddC Dim yAxisLabl yAxisLabl Se yAxisLabl Se chartVu AddC Dim yAxisLab yAxisLab2 Se chartVu Addc Dim yAxisLab chartVu AddC Dim yAxisLab yAxisLab4 Se chartVu AddC Dim yAxisLab yAxisLab5 Set chartVu AddC Dim axisTitl Dim xaxistitl chartVu AddC Dim xgrid As chartVu AddC Dim thePlotl chartVu AddC Dim thePlot2 char t ct ct ct hePlot4 Vu AddC et gt Dim thePlot5 chartVu AddC 3 Can I add new axes text objects plot objects and images to a chart after it is yAxisLab3 Set axis color matches hartObject yAxis4 LinearAxis pTransform5 ChartObj Y AXIS isIntercept xAxis GetAxisMax isTickDir ChartObj AXIS MAX artObjAttributes attrib5 hartObject yAxis5 axis color matches As New NumericAxisLabels xAxis TextFont theFont hartObject xAxisLab As New NumericAxisLabels yAxis1 tTextFont theFont tAxisLabelsFormat ChartObj BUSINESSFORMAT hartObject yAxisLabl 2 As New NumericAxisLabels yAxis2 tTextFont theFont hartObject yAxisLab2 3 As New NumericAxisLab
53. 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 34 Class Architecture Date Axes Year YeavQuarter LL TEAR Le 4985 4920 1995 2000 4998 2000 2001 2002 2003 YeawMonth QuartevMonth 4998 1999 2000 2001 2002 2008 4 002 72002 1002002 102003 Month Week Month Day 7 Day Week 98402 100102 110002 420402 40103 140102 120102 40103 Month Day 5 Day Week WeekiDay 7 Day Week rmm 10103 20303 30303 40103 1 203 1 0 42503 Week Day Day Week Day 8 Hour i Hrot i3 4 06 03 4413 03 1 20 03 12703 10103 1 02 03 1 03 03 1 0403 There are more than 40 different time date axes types appropriate for scales ranging from 1 second to 100 years Date Axes Quarte Month 01 02 04 Q1 o2 01 2001 2002 2003 Month
54. 63 312 314 315 316 344 375 Pee t eie MoveObj 58 59 63 312 313 314 450 Moving chart data 58 59 63 312 314 315 316 344 MoveData 58 59 63 312 314 315 316 344 375 Moving graph objects 58 59 63 312 313 314 450 MoveObj 58 59 63 312 313 314 450 Multi line plots tenait eterne MultiLinePlot 16 18 41 47 64 162 261 290 291 292 297 331 366 383 387 MultiLinePlot 41 47 64 162 261 290 291 292 331 MultiLinePlot 16 18 41 47 64 162 261 290 291 292 297 331 366 383 387 2 2 18 7 58 60 63 Nearest point 55 NearestPointData 61 62 63 310 311 NearestPointData 61 62 63 310 311 Numeric axis NumericAxisLabels 37 38 64 208 209 210 211 212 213 214 222 225 226 232 234 284 301 302 369 370 398 401 406 412 417 422 429 434 443 445 Numeric data point 64 64 Numeric labels eese eterne NumericLabel 56 57 64 251 257 259 260 286 287 296 302 303 309 310 311 330 332 333 334 340 341 342 364 370 371 375 376 407 413 429 430 434 446 NumericA
55. 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 the stockPrice array is initialized with stock price data Dim Datasetl As TimeSimpleDataset _ New TimeSimpleDataset First tradingDay stockPrice Scaling and Coordinate Systems 129 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
56. ByVal labelends As Integer _ ByVal labcolor As Color _ public void SetAxisLabels Font font double rotation int int decimalpos int timeformat int labelends Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ Ct public void SetAxisLabelsFormat int format Hs 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 Axis Labels 225 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 double yl new double numPoints double y2 new double numPoints ihe Lf for i20 i lt numPoints f f Initialize Data theFont new Font Microsoft Sans Serif 10 FontStyle Bold ElapsedTimeSimpleDataset Datasetl new ElapsedTimeSimpleDataset First yl ElapsedTimeSimple
57. 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 As String _ ByVal nsymbol As Integer _ ByVal chartobj As ChartPlot ByVal ngroup As Integer ByVal thefont As Font _ As Integer public int AddLegendItem string stext int nsymbol ChartAttribute attrib Font thefont public int AddLegendItem string stext GraphicsPath symbolshape ChartAttribute attrib Font thefont public int AddLegendItem 358 Legends 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 chartobj int ngroup Font thefont Stext nsymbol chartobj symbolshape attrib thefont Specifies the text string for the legend item Specifies the symbol for the legend item Use one of the chart symbol
58. ChartCalendar xl new ChartCalendar nnumpnts Using QCChart2D for Net to Create Web Applications 429 double yl new double nnumpnts ChartCalendar currentdate new ChartCalendar 1998 ChartObj JANUARY 1 ine db y1 0 100 1 0 ChartCalendar currentdate Clone currentdate Add ChartObj MONTH 12 for i 1 i lt nnumpnts itt xl i ChartCalendar currentdate Clone yl i yl i 1 25 i 0 75 ChartSupport GetRandomDouble currentdate Add ChartObj MONTH 12 theFont new Font Microsoft Sans Serif 10 FontStyle Bold TimeSimpleDataset Datasetl new TimeSimpleDataset Actual Sales 1 yl pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartY 0 pTransforml SetTimeScaleStart new ChartCalendar 1997 Chartobj JgULT 122 pTransforml SetGraphBorderDiagonal 0 15 15 9 0 8 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FEromArgb 30 70 70 Color FromArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject background TimeAxis xAxis new TimeAxis pTransforml xAxis SetColor Color White chartVu AddChartObject xAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS yAxis SetColor Color White chartVu AddChartObject yAxis TimeAxisLabels xAxisLab new TimeAxisLabels xAxis xAxisLab SetAxisLabelsFormat Char
59. ChartObj HBAR thePlot3 legendFont legend AddLegendItem Loss ChartObj HBAR lossAttrib legendFont chartVu AddChartObject legend Visual Basic Dim thePlotl As SimpleLinePlot New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Dim thePlot2 SimpleLinePlot New SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 Dim thePlot3 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset3 profitAttrib chartVu AddChartObject thePlot3 Dim legendFont As New Font SansSerif 14 FontStyle Bold Dim legendAttributes As New ChartAttribute Color Gray 1 DashStyle Solid Color FromArgb 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 360 Legends Bubble Plot Legends Class BubblePlotLegend GraphObj t BubblePlot Legend The BubblePlotLegend is the primary legend class for bubble plots The class manages a list of B
60. Manually scale the coordinate system and axes by calling the appropriate constructors For example 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 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 new ChartView 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 New ChartView Add the x and y axes to the chartVu object chartVu A
61. Multiline Event Based Charting for Time Stamped Applications 3 000 Millions 13 00 00 14 00 00 15 00 00 9 30 00 11 00 00 12 00 00 7 11 12 7 12 12 All plot types will cross time discontinuities without gaps Note how the plot still captures the crossover between 16 00 7 12 12 and 9 30 7 13 12 without a gap The same would be true if there was a weekend or holiday or even a lunch break between adjacent data points Below is an example of how multiple datasets are attached to an EventCoordinates system C EventSimpleDataset Datasetl new EventSimpleDataset Actual Sales 1 EventSimpleDataset Dataset2 new EventSimpleDataset Forecast Sales cev2 EventSimpleDataset Dataset3 new EventSimpleDataset Actual Sales cev3 EventSimpleDataset Dataset4 new EventSimpleDataset Forecast Sales cev4 EventSimpleDataset DatasetArray Datasetl Dataset2 Dataset3 Dataset4 EventCoordinates pTransforml new EventCoordinates DatasetArray VB Dim Datasetl As new EventSimpleDataset Actual Sales Dim Dataset2 new EventSimpleDataset Forecast Sales cev2 Dim Dataset3 new EventSimpleDataset Actual Sales cev3 Dim Dataset4 new EventSimpleDataset Forecast Sales cev4 Dim DatasetArray As EventSimpleDataset Datasetl Dataset2 Dataset3 Dataset4 Dim EventCoordinates pTransforml new EventCoordinates DatasetArray 142 Scaling and Coordinate
62. 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 1000000 3 0 1000000 i i 0 00 00 0 15 00 0 30 00 0 45 00 1 00 00 Time Elapsed Time support Introduction 7 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 magnifying 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 and drag on the top graph using left mouse button o 2 gt 2000 Time The area bound
63. 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 96 Chart Datasets 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 ByVal x As _Double _ ByVal y As Double _ public ElapsedTimeGroupDataset string sname TimeSpan double y public ElapsedTimeGroupDataset string sname double Xy double y sname Specifies the 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 constructo
64. TimeAxis object The class supports many time 23 59 59 and date 5 17 2001 formats It is also possible to define custom date time formats 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 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 This class labels the major tick marks of the associated 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 This class labels the major tick marks of the associated EventAxis object The class supports many time 23 59 59 and date 5 17 2001 formats It is also possible to define custom date time formats 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 org
65. 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 becomes 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
66. double tickspace int nminortickspermajor double minorticklength double majorticklength int tickdir intercept Sets the intercept of this axis with the perpendicular axis in physical coordinates tickorigin The tick marks start at this value tickspace Not used in event axis Axes 199 ntickspermajor Specifies the number of minor tick marks per major tick mark minorticklength The length of minor tick marks in Net device coordinates majorticklength 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 axis line and tick marks Simple event axis example C EventSimpleDataset Datasetl new EventSimpleDataset Actual Sales chartevents EventCoordinates pTransforml new EventCoordinates Datasetl pTransforml SetScaleStartY 0 pTransforml 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 Y AXIS chartVu AddChartObject background EventAxis xAxis new EventAxis pTransforml EventAxis TICK RULE MAJOREVENT ChartO0bj X AXIS xAxis SetColor Color White chartVu AddChartObject xAxis LinearAxis yAxis new LinearA
67. indicating the scale of the axis Axis labels are a separate class from the axis classes An axis class 1 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 seven axis labels classes the AxisLabels abstract base class and concrete subclasses NumericAxisLabels TimeAxisLabels ElapsedTimeAxisLabels EventAxisLabels StringAxisLabels PolarAxesLabels and AntennaAxesLabels 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 NumericA xisLabels 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 Business currency format The business format combined with the currency format 123K OOOO StringAxisLabels Axis Labels 209 The LinearAxis and LogAxis axis types use this class Arbitrary strings JEFF Sales are used to label the major tick marks of the axis
68. 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 stockTimeScale new TimeCoordinates StockTimeScale SetTimeCoordinateBounds dstart starttod yl stoptod ChartObj WEEK 5D Visual Basic 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 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
69. 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 The example below was extracted from the OHLCFinPlot class C pTransforml new TimeCoordinates pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 pTransform2 new TimeCoordinates pTransform2 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 do I use your software to generate GIF files FAQs 455 Unlike the JPEG image file format the GIF file format uses a proprietary data compression algorithm known as LZW The patent on the LZW compression algorithm is owned by the large computer data processing company Unisys Programmers who write commercial applications that use this file format may be subject to paying Unisys royalties For this reason we do
70. 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 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 is 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 UserControlName file The single file structure is forward compatible with the VS 2005 compiler of the example programs demonstrating new features in the software use Introduction 11 the split UserControlName cs UserContr
71. script gt lt head gt lt body gt lt p gt lt b gt lt font face Arial size 4 gt Hello this page includes a windows user control tfont b p P lt OBJECT id MyTestUserControll height 496 width 646 classid http quinn curtis com UserControlTestRev2 QCCHT2D WindowsControlLibraryl dll WindowsControlLi braryl UserControll VIEWASTEXT gt lt OBJECT gt lt P gt lt P gt lt input type text id textl gt amp nbsp amp nbsp amp nbsp lt input type button value Change Title onclick ChangeTitle ID Buttonl NAME Buttonl P lt gt lt gt lt gt lt input type text id text2 NAME text2 gt amp nbsp input type button value Change Y Max onclick ChangeYMax ID Button2 NAME Button2 gt lt P gt lt body gt html 26 Frequently Asked Questions FAQs 10 11 12 13 14 Is the QCChart2D for Net software backward compatible with the Charting Tools for Windows and the Graphics Class Libraries for MFC 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 the additional objects How do you zoom charts that use multiple coordinate systems How do you select a chart object and create a dialog panel that permits editing of that objects propert
72. 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 An 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 256 Simple Plot Objects 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 LabeledDatapoints class LabeledDatapoints C SimpleDataset Datasetl new SimpleDataset First xl yl CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoSca
73. the second error bar lines rbarwidth The width of the error bars 276 Simple Plot Objects attrib Specifies the attributes line color and line style 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 t ChartPlot GroupPlot FloatingBarPlot The FloatingBarPlot class extends the GroupBarPlot 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 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 _ public FloatingBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth ChartAttribute attrib int nbarjust transform The coordinate system for the new Floa
74. 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 _ Ct public void SetAxisIntercept double intercept SetAxisTicks method Visual Basic Overloads Public Sub SetAxisTicks _ ByVal tickorigin As Double _ ByVal Visual B Overloads ByVal ByVal ByVal ByVal ByVal Ct Axes 181 nlogtickformat As Integer _ asi Public Sob SetAxisTicks _ origin As Double _ nlogtickformat As Integer _ minorticklength As Double _ majorticklength As Double _ tickdir As Integer public void SetAxisTicks double int pi tickorigin ogtickformat 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 ch
75. 0 2 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable true superMagniViewChartl SetCurrentMouseListener magnifyObj VB 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 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 support
76. 07 00 TIMEDATEFORMAT DMY H mm nd M yy 23 12 33 12 07 00 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 Axis Labels 229 EventAxis Labels constructor There is only one main constructor for EventAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As EventAxis _ public TimeAxisLabels EventAxis baseaxis baseaxis This is the event 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 _ Ct public void SetAxisLabels Font font double rotation int int decimalpos int labelends Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ Ct public void
77. 112 113 114 115 116 118 129 133 149 150 152 153 154 155 157 158 159 177 182 213 214 239 253 256 263 274 278 286 287 291 292 297 298 301 302 306 308 309 310 314 316 324 329 340 341 342 417 422 442 444 453 454 CartesianCoordinates 3 27 28 29 63 103 105 110 111 112 113 114 115 116 118 129 133 149 150 152 153 154 155 157 158 159 177 182 213 214 239 253 256 263 274 278 286 287 291 292 297 298 301 302 306 308 309 310 314 316 324 329 340 341 342 405 412 417 422 442 444 453 454 Cell plots eii CellPlot 41 44 64 261 270 272 273 274 CellPlot 41 44 64 261 270 272 273 274 Chart object attributes seseses 24 29 attribute 13 14 24 29 51 162 166 210 246 247 248 249 252 255 259 263 265 269 271 273 276 277 283 286 288 290 293 295 297 300 339 344 347 348 350 351 354 358 361 379 449 Attribute 11 24 29 30 31 63 162 163 167 190 191 192 243 244 245 246 247 248 249 250 251 252 253 254 255 256 258 259 260 262 263 264 265 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 297 298 299 300 301 302 303 334 338 339 340 341 344 345 346 347 348 349 350 351 352 353 356 357 358 359 360 36
78. 231 Finding graph FindOb 58 59 63 161 447 448 450 FindOb 58 59 63 161 447 448 450 FindOb 58 59 63 161 447 448 450 floatingBarPlot sess 278 FloatingBarPlot 41 44 64 261 276 278 279 280 FloatingBarPlot 41 44 64 261 276 278 279 floatingBarPlot sese 278 FloatingBarPlot 41 44 64 261 276 278 279 280 Graph object class 22 447 448 GraphObj 29 30 31 50 64 106 154 155 156 157 159 160 161 162 168 172 173 178 184 192 195 200 203 209 210 215 217 223 226 232 234 237 238 240 242 245 248 251 254 257 262 264 268 270 272 275 276 280 282 285 287 290 292 294 296 299 304 306 312 313 314 338 344 346 347 349 350 352 355 357 358 360 364 382 384 447 448 449 455 GraphObj 29 30 31 50 64 106 154 155 156 157 159 160 161 162 168 172 173 178 184 192 195 200 203 209 210 215 217 223 226 232 234 237 238 240 242 245 248 251 254 257 262 264 268 270 272 275 276 280 282 285 287 290 292 294 296 299 304 306 312 313 314 338 344 346 347 349 350 352 355 357 358 360 364 382 384 447 448 449 455 graphobj ee Oe emp 447 448 GraphObj 29 30 31 50 64 106 154 155 156 15
79. 273 275 276 280 282 285 288 290 292 293 294 297 299 300 304 307 315 317 320 322 323 326 328 335 337 338 339 364 365 367 371 372 373 374 378 382 383 385 PhysicalCoordinates 27 28 30 31 63 103 105 106 111 119 129 133 149 150 166 168 169 171 173 175 178 180 193 197 246 249 252 255 258 262 264 269 271 273 2775 276 280 282 285 288 290 292 293 294 297 299 300 304 307 315 317 320 322 323 326 328 335 337 338 339 364 365 367 371 372 373 374 378 382 383 385 Piecharts PieChart 16 18 39 51 64 157 158 311 338 340 341 342 364 449 451 454 39 51 64 338 340 341 342 364 Plot object classes 39 40 64 65 156 161 245 249 251 254 257 262 264 268 270 272 275 276 280 282 285 287 290 292 294 296 299 335 337 338 344 346 347 349 350 357 358 364 449 456 459 ChartPlot 39 40 64 65 156 161 245 249 251 254 257 261 262 264 268 270 272 275 276 280 282 285 287 290 292 294 296 299 335 337 338 344 346 347 349 350 357 358 364 449 456 459 61 62 63 76 77 78 79 80 Polat dxe use E polarAxes 202 203 233 234 241 242 PolarAxes 31 36 37 39 56 64 171 172 200 201 202 203 208 209 232 233 234 237 240
80. 3 ChartObj DashStyle Solid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashDot chartVu AddChartObject thePlot1 Visual Basic Dim pTransforml As TimeCoordinates New TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Simple Plot Objects 247 Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Dim thePlotl As SimpleLinePlot _ New SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashStyle DashDot chartVu AddChartObject thePlotl Simple line plot example using segment colors extracted from the example program SimpleLinePlots class LineFill C TimeSimpleDataset DatasetArray Datasetl Dataset2 Dataset3 pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetoraphBorderDiagonal 0 15 1 92 0 75 1 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 thePlo
81. 9 yl 2 85 1 ChartObj PHYS POS chartVu AddChartObject currentLabel3 Dim currentLabel4 As New ChartText pTransforml1 theLabelFont I b 200uA 19 9 YLIS 85 1 ChartObj PHYS POS chartVu AddChartObject currentLabel4 Dim currentLabel5 As New ChartText pTransforml1 theLabelFont I b 250uA 15 5 yl 4 85 Obj PHYS POS chartVu AddChartObject cur Dim currentLabel6 As New ChartText pTransforml1 theLabelFont I b 300uA 5 5 yl 5 B5 1 ChartObj PHYS POS chartVu AddChartObject currentLabel6 Dim currentLabel7 As New ChartText pTransforml1 theLabelFont I b 350uA 5 9 85 Ly ChartODj PHYS POS chartVu AddChartObject currentLabel7 Dim regionLabel As New ChartText pTransforml theLabelFont _ Linear ControlChars Lf Region 4 0 40 ChartObj PHYS POS chartVu AddChartObject regionLabel Text Classes 367 ChartText time coordinates example extracted from the example program MiscCharts class LineGap C Font theLabelFont new Font SansSerif 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 theLabelF
82. An abbreviated description of the event e AxisLabel A string which be uses as an axis label for the event ToolTip A custom tool tip which can be displayed if the event is clicked on e Position The position of the event with respect to the underlying linear coordinate system TimeStamp The time stamp of the event Indirectly related to the Position of the event in the coordinate system NumericTimeStamp The numeric value of the time stamp in milliseconds an Offset numericTimeStampOffset e NumericValues One or more numeric y values a simple plot uses a single y value while a group plot uses an array of y values The ChartEvent class incorporates two x value positioning properties the Position and the TimeStamp and one or more numeric y values for each event A single event therefore defines both the x and y values of the event in the underlying coordinate system A collection or array of ChartEvent objects define the data for a plot the same way as arrays of x and y values define a plot when using a simple dataset class with a Cartesian coordinate system The critical element of the ChartEvent which permit it to be used for the plotting of discontinuous data is that the Position of the event in a chart is related but independent of the TimeStamp of the event Event data can be positioned contiguously and evenly spaced in a chart even if the time stamps of the events are not contiguous or evenly
83. 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 public int AddLegendItem string stext double rsize ChartAttribute attrib Font thefont public BubblePlotLegend BubblePlot plot double rx double ry double rwidth double rheight ChartAttribute attrib 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 362 Legends The method returns the current number of legend items Simple legend example extracted from the example program ScatterPlots class BubbleChart C ChartAttribute attribl new ChartAttribute Color Black 0 DashStyle Solid attribl SetFillColor Color FromArgb 177 33 33 attribl SetFillFlag true BubblePlot thePlotl new BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChartObject thePlot1 Font theTitleFont new Font SansSerif 14 FontStyle Bold ChartTitle mainTitle new ChartTitle pTransforml theTitleFont DOT COM Bankruptcies and CEO Compensation m
84. Color barcolors Color Red Color Orange Color Yellow Color White double barbreakpoints 0 0 0 33 0 66 1 0 int gradmode ChartGradient GRADIENT MAPTO OBJECT ChartGradient cg new ChartGradient pTransforml gradmode barcolors barbreakpoints 90 attribl Gradient cg Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green Dim barcolors As Color Color Red Color Orange Color Yellow Color White Dim barbreakpoints As Double 0 0 0 33 0 66 1 0 Dim gradmode As Integer ChartGradient GRADIENT MAPTO OBJECT Dim cg As ChartGradient New ChartGradient pTransforml grad mode barcolors _ barbreakpoints 90 attribl Gradient cg 168 Background Colors Textures and Gradients Class 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 SetGraphBorderDiagonal SetGraphBorderFrame or SetGraphBorderlInsets Typically the chart plot objects line plots bar plots scatter plots etc are clipped to the plot area Other chart objects axes axes labels titles etc need to r
85. 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 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 if 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 C
86. Customize the line and tick mark drawing properties of the axis using the SetLineWidth SetLineStyle and SetColor methods Simple 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 0 double yMax 105 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 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 New ChartView Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Custom time axis example C
87. FAR _ ChartObj AUTOAXES FAR Dim mouselistener As MoveObj New MoveObj chartVu mouselistener SetEnable True mouselistener SetMoveObjectFilter GraphObj chartVu SetCurrentMouseListener mouselistener Moving Simple Plot Object Data Points Class MoveData MouseListener MoveData Moving Objects Data Points 315 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 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 _ public MoveData ChartView component PhysicalCoordinates transform MouseButtons button
88. FontStyle Bold double xl double 1 int 1 new double numPoints new double numPoints for i20 i lt numPoints itt attribs i new ChartAttribute Color Black 1 0 attribs i SetFillColor colorArray i xlI 0 5 8 yl 0 0 2 1 1 2 2 1 1 0 0 x1 2 3 5 yl1 2 0 0 x1 3 4 2 y1 3 0 0 1 4 3 7 y1 4 0 0 SimpleDataset Datasetl new SimpleDataset First xl yl 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 P P thePlotl SetLabelInOut 3 ChartObj PIELABEL INSLICE thePlotl SetLabelInOut 4 ChartObj PIELABEL INSLICE chartVu AddChartObject thePlot1
89. GRAPH footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer Save the chart as an image file BufferedImage chartimage new BufferedImage chartVu ImageFormat Jpeg chartimage SaveImage CandlestickPlot jpg VB Imports com quinncurtis chart2dnet Imports System Drawing Imports System Drawing Imaging Imports System Drawing Drawing2D Module Modulel Sub Main InitializeChart End Sub Private Sub InitializeChart Dim chartVu As New ChartView chartVu Size New Size 600 300 400 File and Printer Rendering Dim Dim Dim Dim nNumPnts As Integer 50 nNumGroups As Integer 4 weekmode As Integer ChartObj WEEK 5D xValues As ChartCalendar New ChartCalendar nNumPnts 1 StockPriceData As Double New Double nNumGroups 1 nNumPnts 13 i Dim Dim Dim Dim Char theFont As Font minval As Double 0 0R maxval As Double 0 0R i As Integer currentdate As New ChartCalendar tCalendar SetTOD currentdate 0 0 1 theFont New Font Microsoft Sans Serif 10 FontStyle Bold Curr Ma xVal Curr Stoo Sto stoc PE stoc r 1o For entdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode ke sure not to start on a weekend ues 0 DirectCast currentdate Clone ChartCalendar entdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode kPriceData 3 0 25 ose kPriceData 0 0 25 en kPriceD
90. Green Bars is Up Millions 1999 2000 2001 2002 2003 2004 2005 Bar plots have the values of the bars displayed above or inside each bar Note how in this example each bar displays the full range of colors red orange yellow and white regardless of the bar height GRADIENT_MAPTO_PLOT_PHYSICAL COORDINATES In this mapping mode the breakpoints are expected to be in the range of the physical coordinate system of the plot area of the chart If the y scale of the coordinate system has been scaled for 0 50 000 then the breakpoints are expected to be in the range of 0 50 000 This allows for the most interesting gradient effects If you define your gradient breakpoints as extending from 0 50 000 and you plot a bar that is only 10 000 high only the lower 20 of the gradient will be visible This way you can have bars change color as they increase in value The best analogy would be if you were plotting temperature in a bar graph As the temperature increases and the height of the bar the bar would display as a color gradient The color gradient would transition from a dull red color through orange yellow and finally white representing the highest color breakpoint GRADIENT PLOT PHYSICAL COORDINATES applied to a simple bar graph Background Colors Textures and Gradients 165 ini xl Production of Green Bars is Millions 1998 1999 2000 2001 2002 2003 2004 Bar plots can have the values of
91. HTMLPaget htm Pir File Edit Favorites Tools Help Google 8 vi Search M O 8 Bookmarksy Find check SE AutoFill amp Sign In We BH Untitled Page ES dh WebApplication 1 Local intranet Another method is to use two WebForms in the ASP application One form is setup much like the previous example The aspx page contains nothing and the aspx cs behind code page does all the work defining a chart and streaming the result back as a JPEG image The other WebForm page is used to host a collection of Web controls place on the aspx page One of these Web controls would be an Image web control The behind code page for this WebForm would connect the URL of the Image control to the first WebForm page which does nothing be serve up charts Our example Chart2DASPWebApp uses this approach The reason you might want to take this approach is that it is much easier to wire up the controls on a WebForm page using the aspx cs behind code as opposed to doing it on an HTML page The drawback is that the entire page is redrawn when anything is posted causing a momentary flash when the chart is redraw Using the HTML approach the chart is redrawn without the flash making it a better method for real time applications Visual Basic for Net Using QCChart2D for Net to Create Web Applications 421 If you do not already have an application program project creat
92. LinePlotSalesVolume C public void SaveAsFile object sender System EventArgs e ChartView chartview this String filename this Name SaveFileDialog imagefilechooser new SaveFileDialog imagefilechooser Filter Image Files BMP JP6G GIP TIPE PNG JBMPI IJPOSUIGIEP TIEF PNG AII files imagefilechooser FileName filename if imagefilechooser ShowDialog DialogResult OK filename imagefilechooser FileName FileInfo fileinformation new FileInfo filename String fileext fileinformation Extension File and Printer Rendering 395 fileext fileext ToUpper ImageFormat fileimageformat if fileext BMP fileimageformat ImageFormat Bmp else if fileext JPG fileext JPEG fileimageformat ImageFormat Jpeg else if fileext GIF fileimageformat ImageFormat Gif else if fileext TIF fileext TIFF fileimageformat ImageFormat Tiff else if fileext PNG fileimageformat ImageFormat Png else fileimageformat ImageFormat Bmp BufferedImage savegraph new BufferedImage chartview fileimageformat savegraph Render savegraph Savelmage filename Visual Basic Public Sub SaveAsFile ByVal sender As Object ByVal e As System EventArgs Dim chartview As ChartView Me Dim filename As String Me Name Dim imagefilechooser As New SaveFileDialog imagefilechooser Filter Image
93. Nothing ChartObj SQUARE _ New ChartAttribute Color Black toolTipSymb datatooltip datatooltip datatooltip datatooltip datatooltip datatooltip ol SetSymbolSize 5 0 SetTextTemplate textTemplate SetXValueTemplate xValueTemplate SetYValueTemplate yValueTemplate SetDataToolTipFormat ChartObj DATA TOOLTIP OHLC SetToolTipSymbol toolTipSymbol 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 amp Subclass the DataToolTip class with one of your own Enable the custom mode by calling DataToolTip SetDataToolTipFormat method 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 selec
94. 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 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 360 to 360 degrees of the text in the normal viewing plane The TimeLabel ElapsedTimeLabel and StringLabel classes are similar unique properties for each are listed below TimeLabel constructors 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 public TimeLabel 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 _ PhysicalCoordinates transform ChartCalendar date int timeformat public TimeLabel PhysicalCoordinates transform Font tfont ChartCalendar date double x
95. Projects Give the project a unique name our version of this example is UserChartExample1 You will end with a basic Form based application For purposes of this example the chart will placed in the initial default form S Add a User Control class to the project Project Add User Control Enter a class name of UserChartControll Select the template Inherited User Control Add New Item UserChartExample2 Templates Using QCChart2D for Net to Create Windows Applications ES windows Form E Splash Screen avg Interface gujDataSet E User Control Custom Control 8 Settings File lt 8 XML File amp Text File Cursor File Parent Form 2 Transactional Component Visual Studio installed templates Dialog E About Box ye Class dd Component Class j SQL Database Form A Web Custom Control Code File 2 XML Schema HTML Page aui Icon File dj Installer Class Explorer Form ES Login Form Module avg COM Class si Report amp giResources File 22 Class Diagram XSLT File 1 Bitmap File a Application Configuration File di Windows Service new control based on an existing Windows Forms control Name UserChartControll vb When you click Add you will see the Inheritance Picker Select Browse browse to the Quinn Curtis DotNet lib folder and select the QCChart2DNet DLL file and select Op
96. 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 230 Axis Labels 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 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 DMY2000 TIMEDATEFORMAT MY2000 TIMEDATEFORMAT Y2000 TIMEDATEFORMAT MDY HMS TIMEDATEFORMAT DMY HMS TIMEDATEFORMAT MDY HM TIMEDATEFORMAT DMY HMS Simple time axis labels example theFont new Font Microsoft Sans Serif 10 FontStyle Bold EventSimpleDataset Datasetl new EventSimpleDataset Actual Sales chartevents EventCoordinate
97. Systems This method relies on the ability to detect when the time stamps of an event are equal In the case of pure time equality depends on the granularity you want in the display Events can be equal at the year month week day hour minute second and millisecond level So if you want events across multiple plots to line up by the minute not caring for differences in seconds or milliseconds you can do that Set the EventCoordinates property TimeStampResolution to ChartObj MINUTE The default value is ChartObj SECOND and if you want you can set the resolution to MILLISECOND SECOND MINUTE HOUR DAY OF YEAR WEEK OF YEAR MONTH or YEAR Make sure you set the resolution to a value below that what you want to see in your data If your data is sampled at 6 second intervals and you want to see each value at a unique position on the x axis set the TimeStampResolution to SECOND If you set it to MINUTE all of the samples within a minute interval will be grouped together at a single Position value Below is an example of a chart with multiple overlapping datasets sampled at different resolutions Candlestick Chart OHLC a 9 z 1 t T T i T T i 7 13 12 7 18 12 7 23 12 7 28 12 All plot types will cross time discontinuities without gaps When the merged datasets have the Position values of their ChartEvent objects modified to reflect the true position of the ChartEvent in the graph the auto positioning s
98. Time Axis Tick Mark Constants Description TIMEAXIS 50YEARIOYEAR 50 year major tick mark spacing 10 year minor tick mark spacing TIMEAXIS 20YEARSYEAR 20 year major tick mark spacing 5 year minor tick mark spacing TIMEAXIS IlOYEARYEAR TIMEAXIS SYEARYEAR TIMEAXIS YEAR TIMEAXIS YEARQUARTER TIMEAXIS YEARMONTH TIMEAXIS QUARTER TIMEAXIS QUARTERMONTH TIMEAXIS MONTH TIMEAXIS MONTHWEEK TIMEAXIS MONTHDAY TIMEAXIS WEEK TIMEAXIS WEEKDAY TIMEAXIS DAY TIMEAXIS DAYI2HOUR TIMEAXIS DAYSHOUR TIMEAXIS DAY4HOUR TIMEAXIS DAY2HOUR Axes 185 10 year major tick mark spacing 1 year minor tick mark spacing 5 year major tick mark spacing 1 year minor tick mark spacing 1 year major tick mark spacing 1 year major tick mark spacing 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 1 month major tick mark spacing 1 week minor tick mark spacing 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 spaci
99. TimeAxisLabels The TimeAxis axis types use this class Time formats hh mm ss hh mm mm ss etc Date formats mm dd yy dd mm yy mm yy etc Time Date formats mmm ddd yyy hh mm ss 3 ElapsedTimeAxisLabels The ElapsedTimeAxisLabels are used in combination with the ElapsedTimeAxis type Elapsed time formats hh mm ss hh mm mm ss mm ss fff etc EventAxisLabels The EventeAxisLabels are used in combination with the EventAxis type Time formats hh mm ss hh mm mm ss etc Date formats mm dd yy dd mm yy mm yy etc Time Date formats mmm ddd yyy hh mm ss 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 210 Axis Labels 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 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
100. Visual Basic Overloads Public Sub New _ ByVal rgbcolor As Color _ ByVal rlinewidth As Double _ ByVal nlinestyle As DashStyle _ ByVal rgbfillcolor As Color _ C public ChartAttribute Color rgbcolor double rlinewidth DashStyle nlinestyle Color rgbfillcoolor rgbcolor The primary line and text color Background Colors Textures and Gradients 163 rlinewidth The line width for all lines nlinestyle The line style for all lines rgbfillcolor fill color for solid objects C ChartAttribute attribl new ChartAttribute Color Blue 3 ChartObj DashStyle Solid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashDot chartVu AddChartObject thePlotl1 Visual Basic Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Dim thePlotl As SimpleLinePlot _ New SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashStyle DashDot chartVu AddChartObject thePlotl of the ChartAttribute constructors assume you are using a solid area fill color If you want to use a gradient you need to attach a ChartGradient object to the ChartAttribute The ChartGradient object will specify the defining range of colors for the gradient the breakpoints for the gradient colors and the mapping mode for mapping the breakpoints to the current chart Class ChartGradient ChartObj ChartGradient ChartAttribute o
101. Windows user interface Name UserChartExample1 Location CiQuinn CurtisiDotNetlOCChart2Dlisual CSharp examples v Solution Create new Solution v Create directory for solution Solution Name UserChartExample1 Using QCChart2D for Net to Create Windows Applications 409 Add a User Control class to the project Project Add User Control Enter a class name of UserChartControll Add New Item UserChartExample1 Templates Visual Studio installed templates cs Class ES windows Form cgInherited Form 84 Component Class e XML File HTML Bitmap File if Icon File JScript File c8 Assembly Information File 2 Settings File csi Debugger Visualizer scp Interface sj Inherited User Control j SQL Database amp XML Schema Aj Style Sheet Cursor File dd Windows Service VBScript File H Application Configuration File EMDI Parent 2 Class Diagram Code File Custom Control A Web Custom Control s5 DataSet ia XSLT File amp Text File i Report d Installer Class i Windows Script Host cgiResources File About 4 reusable Windows Forms control Name UserChartControll cs S Right click on Reference in the Solution Explorer window and select Add Reference Browse to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL 410 Using QCChart2D for Net to Create Window
102. a UserControl object can be used utilizing standard or specialized Net layout managers The Chart View 161 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 Visual Basic Overloads Public Function FindObj _ ByVal testpoint As Point2D _ ByVal classname As String _ As GraphObj Cf public GraphObj FindObj Point2D testpoint String classname Parameters If the graph has multiple overlapping objects of 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 testpoint The current position of the mouse in Net 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
103. 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 Cumulative Plot of Noise vs Time from 7 Sources 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 Class Architecture 49 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 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 Polar Line and Scatter Plots The polar line charts use true polar not linear int
104. are automatically 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 _ public void SetPolarAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor public void SetPolarAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor double minorticklength double majorticklength int tickdir axestickspace Specifies the spacing between minor tick marks for the x and y axes 202 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 tick marks in Ne
105. attribl hartVu AddChartObject thePlot1l im thePlot2 As New AntennaScatterPlot pAntennaTransform hePlot2 InitAntennaScatterPlot Datasetl ChartObj SQUARE attrib2 hartVu AddChartObject thePlot2 Class AntennaScatterPlot GraphObj ChartPlot 350 Polar and Antenna Charts 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 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 AttennaScatterPlot Class A
106. axes associated with the grid 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 SetLineStyle 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 244 Axis Grids chartVu AddChartObject pAntennaAxis Dim pAntennaGrid As New AntennaGrid pAntennaAxis AntennaGrid GRID ALL pAntennaGrid ChartOb
107. axis object to the ChartView draw list ChartView AddChartObject example extracted from the example program LabeledDatapoints class LabeledDatapoints ChartView chartVu new ChartView SimpleDataset Datasetl new SimpleDataset First xl yl CartesianCoordinates pTransforml The Chart View 155 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 New ChartView 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 GraphObj 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 Obj
108. chartVu AddChartObject mainTitle Dim theFooterFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim footer As New ChartTitle pTransforml theFooterFont Bar plots can have the values of the bars displayed above or inside each bar footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer chartVu SetResizeMode ChartObj AUTO RESIZE OBJECTS Dim datatooltip As New DataToolTip chartVu Dim xValueTemplate As New TimeLabel ChartObj TIMEDATEFORMAT MDY Dim yValueTemplate As New NumericLabel ChartObj CURRENCYFORMAT datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate Using QCChart2D for Net to Create Web Applications 435 datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP XY TWOLINE datatooltip GetToolTipSymbol SetColor Color Red datatooltip SetEnable True chartVu SetCurrentMouseListener datatooltip End Sub InitializeChart Private Sub SimpleBarPlot Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load InitializeChart End Sub lt summary gt Set Get the chart title lt summary gt Public Property ChartTitleText As String Get Return mainTitle TextString End Get Set ByVal Value As String mainTitle TextString Value Me UpdateDraw End Set End Property lt
109. chartVu AddChartObject mainTitle Return chartVu End Function End Class Modify the Page Load method that was included by default when the behind code page was created In the example below parameters that were appended to the ASP page request are retrieved using the Request Params Get method The values define the size of the image This is just one way to pass data from the HTML page to the ASP page In some of our other examples we use a key string that Using QCChart2D for Net to Create Web Applications 423 specifies which stocks we want to plot Using the behind code page you can query some database and get the data values from there without passing the data through the HTML page In our Chart2DHTMLAspApp and Chart2DAspWebApp examples we query the Yahoo database of historical stock values and get the data from them Once the chart is create and available as a ChartView object use the BufferedImage class to render the chart as a JPEG file and stream the image back in the response stream of the requesting HTML page protected void Page Load object sender EventArgs e Get Input from HTML ASP page request String widthstring Request Params Get 0 String heightstring Request Params Get 1 int imagewidth int Parse widthstring int imageheight int Parse heightstring ChartView chartVu GetInitializeChart imagewidth imageheight Stream chart back as a JPeg image BufferedImage chartimage new Buffer
110. 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 ChartPlot SimplePlot 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 PieChart Constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates _ ByVal dataset As SimpleDataset ByVal spiestringls As String _ ByVal attribs As ChartAttribute _ ByVal labelinoutl As Integer _ ByVal pielabelformat As Integer _ public PieChart Pie Charts 339 PhysicalCoordinates transform SimpleDataset dataset string spiestringls ChartAttribute attribs int labelinoutl int pielabelformat RingChart Constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As SimpleDataset B
111. class used to define geometric transforms and the GraphicsPath class System Drawing Imaging Namespace 14 Introduction The System Drawing Imaging namespace provides advanced GDI 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 ARGB Alpha Red Green Blue components System Drawing Font Class Defines a particular format for text including font face size and style attributes System Drawing Drawing2D GraphicsPath Class This class is used to define a series of connected lines and curves System Drawing Printing Namespace This namespace provides classes and interfaces for a general printing API System Globalization Namespace The System Globalization namespace contains classes that define culture related information including the language the country region the calendars in use the format patterns for dates currency and numbers and the sort order for strings System Drawing Text Namespace The System Drawing Text namespace provides advanced GDI typography functionality Basic graphics functionality is provided by the System Drawing namespace 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 cl
112. 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 installed and being used 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 ii 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 ide
113. 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 value 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 450 FAQs 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 UserControl display buffer The UserControl 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 5 Trapping a mouse event and determining the mouse cursor position in device and physical coordinates Identifying the chart object that intersects the mouse event 5 Displaying appropriate information about the chart object There are many classes that aid in one or more of these functi
114. 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 File and printer rendering 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 line style line thickness 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 classes 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 These classes render the chart image to a printer to a variety of file formats including JPEG and BMP or to a Net Image object Other classes use
115. drawn between adjacent data points use antenna coordinate interpolation AntennaLinePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As AntennaCoordinates 348 Polar and Antenna Charts ByVal dataset As SimpleDataset ByVal attrib As ChartAttribute Ct public AntennaLinePlot AntennaCoordinates transform SimpleDataset dataset ChartAttribute attrib 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 AntennaCharts AntennaLineMarkerChart 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 SetGraphBor
116. evenly spaced and contains large gaps corresponding to weekends and inactive hours of the day The July 4 holiday is included in the range and there is no data for that time interval either 134 Scaling and Coordinate Systems EuroDollar FinLogPlot OHLCChart OpeningScreen FinancialOptions Technicalnalysis Candlestick Plots Technical Analysis 7 08 12 7 15 12 7 22 12 The Open Close box is filled if the open price is greater than the close price Contrast this to the similar data using the same time range plotted using the EventCoordinates class Note how every event is evenly spaced with its neighbor Gaps do not exist since weekends holidays and unused hours are bridged over as if they do not exist he same would be true for gaps due to holidays and a varying number of work hours in a day Scaling and Coordinate Systems 135 7 09 12 The Open Close box is filled if the open price is greater than the close price Zooming in further you can see the smooth transition across the July 4 holiday and the following weekend EuroDollar CandlestickChart FinLogPiot OHLCChart OpeningScreen FinancialOptions Technical nalysis Candlestick Plots in Technical Analysis 7103 12 7 05 12 7 06 12 7 09 12 The Open Close box is filled if the open price is greater than the close price 136 Scaling and Coordinate Systems Zoom in again and you can see the smooth transition from one day to the next e
117. example one y value for each x value In the EventGroupDataset each ChartEvent object can have multiple y values for each x value as seen in the programming example below EventGroupDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal ev As ChartEvent public EventGroupDataset string sname ChartEvent ev sname Specifies the name of the dataset ev An array of ChartEvent objects Create an array of ChartEvent objects specifying the time stamp and y values for each ChartEvent object and use that to initialize a EventSimpleDataset The next constructor creates EventGroupDataset using the x and y values stored in a file that uses the CSV Comma Separated Value format Only the COLUMN MAJOR format is supported where each row presents a ChartEvent object and the columns are organized as description short description x axis string label tool tip string position time stamp numeric time stamp y value index index for the y value to use when the ChartEvent contains multiple y values and the y values Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal columnskip As Integer _ Ct public EventGroupDataset CSV csv String filename int rowskip int columnskip 100 Chart Datasets CSV An instance of a CSV object filename The name of the file rowskip Skip this many rows befor
118. 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 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 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 t NumericAxisLabels Axis Labels 211 The NumericAxisLabels class extends the AxisLab
119. hePlotl SetSegmentAttributes 10 segmentAttrib hePlotl SetSegmentAttributes 11 segmentAttrib hartVu AddChartObject thePlotl G erect ct ob 1 ct Simple Line Marker Plots Class SimpleLineMarkerPlot GraphObj ChartPlot SimplePlot SimpleLineMarkerPlot Simple Plot Objects 255 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 SimpleDataset ByVal symtype As Integer _ ByVal lineattrib As ChartAttribute _ ByVal symbolattrib As ChartAttribute ByVal nsymbolstart As Integer _ ByVal nsymbolskip As Integer _ Ct public SimpleLineMarkerPlot PhysicalCoordinates transform SimpleDataset dataset int symtype ChartAttribute lineattrib ChartAttribute symbolattrib int nsymbolstart int nsymbolskip 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 and line style for the line part of
120. 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 It may be that you want to specify date times for the starting and ending values of the x axis instead of a simple index In that case you use the EventCoordinates TimeScaleStart and EventCoordinates TimeScaleStop properties Those methods use a binary search algorithm to search for the ChartEvent closest to the desired date time It then uses the ChartEvent at that index to establish the x axis scale The code below is extracted from the ChartEventExamples OHLCEventChart example program public void UpdateScaleAndAxesUsingDates int startindex ChartCalendar startdate ChartCalendar datastartdate Clone ChartCalendar stopdate new ChartCalendar Startdate Add ChartCalendar DAY OF YEAR startindex Stopdate ChartCalendar startdate Clone stopdate Add ChartObj MONTH 1 pTransforml TimeScaleStart startdate pTransforml TimeScaleStop stopdate pTransform2 TimeScaleStart startdate pTransform2 TimeScaleStop stopdate pTransform3 TimeScaleStart startdate pTransform3 TimeScaleStop stopdate xAxisl CalcAutoAxis yAxisl CalcAutoAxis xAxisLabl CalcAutoAxisLabels yAxisLabl CalcAutoAxisLabels xAxis2 CalcAutoAxis xAxis2 SetAxisIntercept pTransform2 GetStopY xAxis2 SetAxisTickDir ChartObj AXIS MAX 148 Scaling and Coordinate Systems yAxis2 CalcAu
121. in the same manner The example below inverts the y scale Scaling and Coordinate Systems 153 C TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale SetCoordinateBounds 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 9 7 8 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 Dim yData As Double 2 3 4 5 6 7 8 9 2 33 44 55 45 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 st
122. major tick mark spacing 1 minute minor tick mark spacing 2 minute major tick mark spacing 1 minute minor tick mark spacing TIMEAXIS MINUTE TIMEAXIS MINUTE30SECOND TIMEAXIS MINUTEISSECOND TIMEAXIS MINUTEIOSECOND TIMEAXIS MINUTESSECOND TIMEAXIS MINUTE2SECOND TIMEAXIS MINUTESECOND TIMEAXIS 30SECONDSECOND TIMEAXIS _ISSECONDSECOND TIMEAXIS I0SECONDSECOND TIMEAXIS SSECONDSECOND TIMEAXIS 2SECONDSECOND TIMEAXIS SECOND Axes 187 1 minute major tick mark spacing 1 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 1 minute major tick mark spacing 5 second minor tick mark spacing 1 minute major tick mark spacing 2 second minor tick mark spacing 1 minute major tick mark spacing 1 second minor tick mark spacing 30 second major tick mark spacing 1 second minor tick mark spacing 15 second major tick mark spacing 1 second minor tick mark spacing 10 second major tick mark spacing 1 second minor tick mark spacing 5 second major tick mark spacing 1 second minor tick mark spacing 2 second major tick mark spacing 1 second minor tick mark spacing 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 m
123. months or years ElapsedTimeA xis 7 0312 EventAxis 7 05 12 U L I E TL 31 1 31 1 1 1 1 1 T T 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 7 06 12 7 09 12 7 10 12 7 11 12 The event axis 15 a hybrid of the a time axis and the linear axis It places major and minor tick marks on the axis based on the event data attached to the coordinate system Every ChartEvent object in the coordinate system does not necessarily have a tick mark because where the data values are bunched together this would create too many tick marks and they would overlap Every tick mark though will have at least one ChartEvent object associated with it In the case where multiple plots have ChartEvent objects 36 Class Architecture PolarAxes with the same time stamp a tick mark can have multiple ChartEvent objects associated with it Polar Axes 4 polar axis consists of the x and y axis for magnitude and the outer circle for the angle 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 c
124. not intent to write any code that explicitly supports the GIF file format If you after having considered all of the alternatives still require GIF files then create a System Drawing Imaging ImageFormat instance that uses a GIF image format and use that to initialize the chart2dnet BufferedImage class The same holds true for all image formats 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 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 ChartVi
125. numeric value i e 1 23 14K 44M 32B 3 0T ENGINEERINGFORMAT Ifthe 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 is appended on 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 212 Axis Labels CURRENCEYFORMAT A character is appended to the front of the label NumericAxisLabels constructor There is only one main constructor for NumericAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As Axis _ public NumericAxisLabels Axis baseaxis baseaxis This 18 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 _ public
126. of spreadsheet file that looks like Chart Datasets 89 x values x 0 x 1 x 2 x 3 x 4 x 5 y values group 0 y 0 0 0 1 y 0 2 y 0 3 y 0 4 10 5 y values group 1 y 1 0 y L1 1 2 1 3 1 4 5 y values group 2 2 0 2 1 yI22 2 3 2 4 yI2 5 number of x values numberDatapoints numberColumns 6 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 _ Ct public GroupDataset string sname double 46 double y sname Specifies the 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 values in the arrays are plotted If the data is outside of the current chart sca
127. program MultiLinePlots class MultiLine C int numPoints 100 int numGroups 7 double xl new double numPoints double yl new double numGroups numPoints int i js for i0 i lt numPoints i xijil i double i 0 2 for j 0 7 lt numGroups yl j i 7 i 0 01 double 741 5 0 1 0 M th Exp x1 il 0 7 GroupDataset Datasetl new GroupDataset First xl yl CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartX 0 pTransforml SetScaleStartyY 0 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color 255 255 255 4 chartVu AddChartObject background pTransforml SetGraphBorderDiagonal 0 15 15 90 0 70 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Blue 3 DashStyle Solid ChartAttribute JattribArray new ChartAttribute numGroups for ie0 1 lt mumGroups 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 x1 numPoints 1 As Double Dim yl numGroups 1 numPoints 1 As Double Dim i j As In
128. 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 There are three main constructors for TimeAxis objects The first 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 Chart
129. 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 xAxis SetLineWidth 2 chartVu AddChartObject xAxis yAxisl New LinearAxis pTransform1 ChartObj Y AXIS yAxisl SetAxisIntercept 0 0 yAxisl SetChartObjAttributes attribl axis color matches line color chartVu AddChartObject yAxis1 yAxis2 New LinearAxis pTransform2 ChartObj Y AXIS yAxis2 SetAxisIntercept 18 yAxis2 SetChartObjAttributes attrib2 chartVu AddC yAxis3 axis color matches hartObject yAxis2 New LinearAxis pTransform3 ChartObj Y AXIS yAxis3 SetAxisIntercept
130. scatter plot symbol constants NOSYMBOL SQUARE TRIANGLE Simple Plot Objects 259 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 Color barcolors Color Red Color Orange Color Yellow Color White double barbreakpoints 0 0 80 160 240 int gradmode ChartGradient GRADIENT MAPTO PLOT PHYSICAL COORDINATES ChartGradient cg new ChartGradient pTransforml gradmode barcolors barbreakpoints 90 attribl Gr
131. sets the minimum zoom range for the time axis to 1 second and for the y axis to 0 01 The utility method ChartCalendar GetCalendarWidthValue is useful for 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 minZzoomTimeRange minZoomYRange zoomObj SetZoomRangeLimits 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 SetZoomRangeLimits zoomLimits 326 Zooming Magnifying a portion of a chart in a separate window Class MagniView MouseListener t 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 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 th
132. spaced Here is a simple example of a standard financial candlestick plot chart using our TimeCoordinates class as the coordinate system where the time date data is not evenly spaced and contains large gaps corresponding to weekends and inactive hours of the day The July 4 holiday is included in the range and there is no data for that time interval either Chart Datasets 83 DER FinLogPlot OHLCChart OpeningScreen FinancialOptions TechnicalAnalysis Candlestick Plots in Technical Analysis 7 08 12 7 15 12 7 2212 The Open Close box is filled if the open price is greater than the close price Contrast this to the similar data using the same time range plotted using the EventCoordinates class Note how every event is evenly spaced with its neighbor Gaps do not exist since weekends holidays and unused hours are bridged over as if they do not exist he same would be true for gaps due to holidays and a varying number of work hours in a day 4 Chart Datasets Zooming in further you can see the smooth transition across the July 4 holiday and the following weekend EuroDolar CandlestickChart FinLogPlot DHLCChart OpeningScreen FinancialOptions TechnicalAnalysis Candlestick Plots in Technical Analysis Chart Datasets 85 Zoom in again and you can see the smooth transition from one day to the next even though the working hours are only a 9 30 to 16 00 subset of the 24 hours of a day
133. text to the right and up so that it does not write over marker pointLabel SetTextNudge 5 5 chartview AddChartObject pointLabel chartview UpdateDraw 4 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 5 How do you select a chart object and create a dialog panel that permits editing of that objects properties The QCChart2D for Net library does not include predefined dialogs for editing chart object properties The look feel and details of such dialogs are application FAQs 447 specific and it is up to the application programmer to provide these The property editor tables common to many packages are designed to be used by developers not end users You can add your own dialogs that edit the characteristics important to your end users If you want to select the chart object by pressing a mouse button while the cursor is on the object use the FindObj class Override the OnMouseDown method and invoke the appropriate dialog panel there The following example is extracted from the EditChartExample example program C public class LinePlot EditChartExample UserChartControll private System ComponentModel IContainer components null public TimeAxis xAxis null public
134. the ChartView AddChartObject method GraphObj Background Axis Classes Axis LinearAxis PolarAxes AntennaAxes 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 line style and gradient 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 This class fills the background of the entire chart or the plot area of the chart using a solid color a color gradient or a texture ElapsedTimeAxis LogAxis TimeAxis EventAxis 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 the axes do not need to have the same limits In general the limits of the coordinate system should be greater than or 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 32 Class Architecture Widget Tolerances by Worker Click on one of the buttons below to change th
135. 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 X or the y dimension vovE v using the MoveMode property Set MoveMode to 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 from the ZoomExamples MoveCoordinates example C 318 Moving Chart Objects and Data Points 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 Dim movecoords As New MoveCoordinates chartVu pTransforml movecoords SetEnable True c
136. the axis extents match the extents of the underlying coordinate system transform The second ElapsedTimeAxis constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system ElapsedTimeAxis 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 TimeSpan _ ByVal maxval As TimeSpan _ Ct public ElapsedTimeAxis PhysicalCoordinates transform int axtype 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 y axis Y AXIS minval Sets the minimum value for the axis maxval Sets the maximum value for the axis 194 Axes 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 _ Ct public void SetAxisIntercept do
137. the range x1 y1 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 columns 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 1 j count 0 doubl x y zj double startx 6 0 starty 6 0 double stepx 12 0 nrows 1 stepy 12 0 ncols 1 Point3D pointarray pointarray new Point3D nrows ncols x Startx starty for i 0 i nrows i x startx for je0 J lt nools j pointarray count new Point3D z 2000 950 Math Sin Math Sqrt x x y y polintarray count SetLocation x y z x stepx count 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 80 Chart Datasets Dim nrows As Integer LE 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 poi
138. 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 Class Architecture 57 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 ChartTitle AxisTitle ChartLabel NumericLabel TimeLabel ElapsedTimeLabel StringLabel This class draws a string in the current chart window It is the base class for the ChartTitle AxisTitle and ChartLabel classes The ChartText class also creates independent te
139. these for data storage file I O and data processing Class Architecture 25 A summary of each category appears in the following section 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 System Windows Forms UserControl class where the UserControl class is the base class for the Net 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 UserControl class it acts as a container for other Net components too Data Classes ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset EventSimpleDataset GroupDataset TimeGroupDataset ElapsedTimeGroupDataset EventGroupDataset 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 more 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
140. 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 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 Use an auto scale method to calculates appropriate minimum and maximum x and y values based on the x and y values in one or more datasets 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 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
141. to plot linear logarithmic and semi logarithmic graphs This class is a concrete implementation of the PhysicalCoordinates class and implements a coordinate system used to plot GregorianCalenar time based data This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot elapsed time data This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot polar coordinate data 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 Class Architecture 29 degrees and the angular values increase in the clockwise direction EventCoordinates This class is a subclass of the CartesianCoordinates class and implements a coordinate system used to plot ChartEvent based data Attribute Class ChartAttribute ChartGradient 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 line thickness and fill attributes of the object The ChartGradient class expands the number of color options available in the ChartAttribute class ChartAttribute This class consolidates the common line and fill attributes associated with a Graph
142. tooltips and x axis strings The most common use for event based plotting will be for displaying time based data which is discontinuous financial markets data for example In financial markets the number trading hours in a day may change and the actual trading days Weekends holidays and unused portions of the day can be excluded from the plot scale producing continuous plots of discontinuous data The following classes have been added to the software in support of event based charting e ChartEvent ChartEvent object stores the position value the time stamp y values and custom strings associated with the event EventArray A utility array class used to store ChartEvent objects EventAutoScale An auto scale class used by the EventCoordinates class EventAxis Displays an axis based on an EventCoordinates scale EventAxisLabels Displays the string labels labeling the tick marks of an EventAxis EventCoordinates Event coordinates define a coordinate system based on the the attached Event datasets EventGroupDataset A group dataset which uses ChartEvent objects as the source of the data It is used to feed data into the group plotting routines EventScale An event scale class used to convert between event coordinates and device coordinates EventSimpleDataset A simple dataset which uses ChartEvent objects as the source of the data It is used to feed data into the simple plotting routines 2
143. type as legend items BubblePlotLegendItem 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 StandardLegend 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 BubblePlotLegend 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 56 Class Architecture Grid Classes Grid PolarGrid AntennaGrid 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 ChartText ChartTitle AxisTitle ChartLabel 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
144. users defined background texture 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 SimpleLinePlots class LineFill C pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prIransforml SetGraphBorderDiagonal 0 15 1 92 0 75 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromA rgb 100 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 Axis LinearAxis ElapsedTimeAxis PolarAxes AntennaAxes EventAxis LogAxis TimeAxis Chart axes describe for the viewer the physical coordinate system used to sc
145. 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 398 File and Printer Rendering stockPriceData 0 stockPriceData 1 stockPriceData 2 for ChartSupport Ge ChartSupport Ge i 1 xValues i i nNumPnts 0 25 open 0 26 high 0 24 low itt ChartCalendar currentdate Clone ChartSupport Ge ChartSupport Ge stockPriceData 3 i stockPriceData 3 i 1 3 0 52 tRandomDouble close stockPriceData 0 i stockPriceData 3 i 2 0 5 tRandomDouble 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 tRandomDouble high stockPriceData 2 i minval 1 5 tRandomDouble low currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode xValues ChartObj ChartObj ChartObj ChartObj ChartObj ChartObj TimeGroupDataset Datasetl stockPriceData int compressarray new int 4 compressarray 0 ChartObj DATACOMPRESS AVERAGE compressarray ChartObj DATACOMPRESS MAX compressarray ChartObj DATACOMPRESS MIN compressarray ChartObj DATACOMPRESS AVERAGE 1 2 TimeCoordinates pTransforml pTransforml
146. 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 public TimeGroupDataset string sname ChartCalendar x ChartCalendar y If you manually scale the TimeCoordinates 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 278 Simple Plot Objects 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 prog
147. 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 Scaling and Coordinate Systems 113 C double xData 1 2 3 4 5 6 7 8 9 10 double l0 22 33 44 55 46 33 25 14 SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates simpleScale AutoScale dataset Visual Basic Dim xData As Double 1 2 3 4 5 5 7 8 9 10 Dim yData As Double 10 22 33 44 55 46 33 25 14 9 Dim dataset As SimpleDa
148. yMin xMax yMax CartesianCoordinates logXScale new CartesianCoordinates ChartObj LOG SCALE ChartObj LINEAR SCALE logXScale SetCoordinateBounds xMin yMin xMax yMax 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 _ 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 auto scale routines will allow zero and negative values for the minimum an
149. yMinl xMaxl 1 pTransforml SetGraphBorderDiagonal 0 1 15 90 0 6 Dim xMin2 As Double 50 Dim xMax2 As Double 150 Dim yMin2 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 or line thickness 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 and the line thickness 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 NO RESIZE OBJECTS The resizeMultiplier stays fixed at 1 0 Resizing the graph window does not affect the size and
150. 0 25 26 30 63 65 91 92 93 94 95 121 269 270 272 277 279 281 283 284 289 293 380 398 400 458 TimeGroupDataset2 10 25 26 30 63 65 91 92 93 94 95 96 97 98 121 269 270 272 277 279 281 283 284 289 293 377 380 398 400 458 TimeLabel 56 57 64 330 332 333 334 336 337 364 370 372 373 430 tim label 5 Aere esc e E 336 337 TimeLabel 6 56 57 64 330 332 333 334 336 337 364 370 372 373 381 430 434 Timescale nirso te 26 27 63 103 105 TimeScale 6 26 27 63 103 105 119 120 121 122 123 125 127 128 129 147 148 152 153 191 192 221 222 250 283 284 295 296 429 434 451 TimeSimpleDataset 9 25 26 30 63 65 69 70 71 72 73 121 122 123 125 128 247 248 250 318 377 429 452 458 459 SumpleDataset uia 86 TimeSimpleDataset 2 9 25 26 30 63 65 69 70 71 72 73 74 75 76 121 122 123 125 128 131 132 225 226 247 248 250 318 377 379 429 433 452 458 459 ToolTips 58 59 63 330 331 332 333 334 335 336 430 450 datatooltip 332 333 334 407 413 414 430 434 435 450 DataToolTip15 17 58 59 63 330 331 332 333 334 335 336 407 413 414 430 434 435 450 Trial Ei ensez 2255659565 ibd RENS Trial L1Cense ass ii Us rp coordinates ecce mete npe eere RU UserCoordinates 277 28
151. 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 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 Moving Objects and Data Points 317 Release the mouse button and 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 _ C 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 Create the MoveCoordinates object and then install it using the ChartView SetCurrentMouseListener method This adds the MoveCoordinates object as a MouseListener to
152. 0 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 Class Architecture 41 Group Plot Classes GroupPlot ArrowPlot BoxWhiskerPlot 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 stacked 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 42 Class Architecture Flow Analysis Stealth Project TEEN RT EET 1 j 1 e 2 ee Hcc 5 1 ane il t nm ee ERI jc i f axe o eae 0 2 4 6 8 10 The size position and direction of every arrow in an arrow plot is und
153. 07 00 In some cases the TMEDATEFORMAT 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 _ 220 Axis Labels public TimeAxisLabels TimeAxis baseaxis baseaxis This is the time 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 _ Ct public void SetAxisLabels Font font double rotation int labdir int decimalpos int labelends Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ Ct public void SetAxisLabelsFormat int format font The font ob
154. 1 Visual Basic Dim Datasetl As New GroupDataset First 1 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 pTransforml 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 0 To numPoints 1 thePlotl SetSegmentColor i Color FromArgb CInt x1 i GrnE y1 0 2 2 0 _ 4 1 vilis 797 Next i chartVu AddChartObject thePlotl 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 produ
155. 1 242 246 247 248 250 251 253 254 256 257 259 260 263 267 268 269 270 272 274 278 279 280 281 282 283 284 286 287 288 289 291 292 293 294 295 296 297 298 301 302 303 306 308 309 310 311 313 314 316 318 322 324 325 332 333 334 335 336 337 341 342 345 346 348 349 352 359 362 363 366 367 368 369 370 375 376 381 384 386 387 388 390 393 397 398 399 400 401 417 418 422 429 430 442 443 444 445 449 451 452 453 455 456 459 ch rtobj tete ads 357 358 361 ChartObj 31 63 66 69 72 73 76 81 87 88 91 93 94 95 98 100 101 102 113 114 115 116 119 120 121 122 123 124 125 127 128 129 131 133 137 138 139 142 143 146 147 148 150 151 152 154 155 156 157 162 163 170 177 178 182 183 191 192 195 196 199 202 203 206 207 213 214 217 221 222 223 225 226 230 231 233 234 235 236 239 240 241 242 243 244 246 247 248 250 251 252 253 254 255 256 257 259 260 263 264 267 268 269 270 272 274 278 279 280 281 282 283 284 286 287 288 289 290 291 292 293 294 295 296 297 298 301 302 303 306 308 309 310 311 313 314 316 318 321 322 324 325 332 333 334 335 336 337 341 342 345 346 348 349 352 359 362 363 366 367 368 369 370 375 376 381 384 386 387 388 390 393 397 398 399 400 401 405 406 407 412 413 414
156. 1 282 283 284 289 291 292 293 294 295 296 297 298 306 314 316 318 324 345 346 348 349 398 400 405 412 417 422 429 434 452 453 Axis 31 32 37 38 57 64 156 171 172 173 174 175 178 179 184 188 192 193 196 197 200 203 204 208 210 212 214 215 217 223 226 237 314 369 axis 1 2 6 20 24 30 31 32 33 35 36 37 38 39 56 57 59 62 82 85 86 99 103 104 118 119 121 126 129 137 139 140 142 143 145 147 148 154 156 171 172 173 174 175 176 177 178 179 180 181 182 183 184 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 208 209 210 211 212 213 214 215 216 217 219 220 221 222 223 224 225 227 229 230 231 232 233 234 235 237 238 240 241 242 243 274 277 278 280 283 293 295 312 314 319 320 322 325 343 369 370 406 412 429 434 436 440 441 442 443 444 445 446 451 452 453 455 456 458 Axis 1 2 6 31 32 33 35 37 38 39 56 57 64 82 85 87 88 101 102 129 137 138 139 140 143 145 146 147 148 155 156 157 171 172 173 174 175 176 177 178 179 180 181 182 183 184 188 189 190 191 192 193 194 195 196 197 198 199 200 203 204 208 209 210 211 212 213 214 215 216 217 219 220 221 222 223 224 225 226 229 230 231 232 233 234 235 236 237 239 240 243 244 284 301 302 314 345 346 348
157. 1 362 363 379 384 387 388 399 401 406 407 412 413 418 422 429 434 443 444 445 Chart titles erc EORR OG TEE ete PET ChartTitle 56 57 64 314 362 363 364 367 368 369 399 401 407 413 418 422 428 430 433 434 435 436 437 ChartAttribute 11 29 30 31 63 162 163 167 243 244 245 246 247 248 249 250 251 252 253 254 255 256 258 259 260 262 263 264 265 267 268 269 270 271 272 273 274 275 276 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 297 298 299 300 301 302 303 334 338 339 340 341 344 345 346 347 348 349 350 351 352 353 356 357 358 359 360 361 362 363 384 387 388 399 401 418 422 429 443 444 ChartAttribute 11 29 30 31 63 162 163 167 243 244 245 246 247 248 249 250 251 252 253 254 255 256 258 259 260 262 263 264 265 267 268 269 270 271 272 273 274 275 276 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 297 298 299 300 301 302 303 334 338 339 340 341 344 345 346 347 348 349 350 351 352 353 356 357 358 359 360 361 362 363 384 387 388 399 401 406 407 412 413 418 422 429 434 443 444 ChartCalendar 26 30 35 57 61 63 65 69 70 71 72 87 91 92 93 94 100 116 118 119 120 121 122 123 124 125 126 127 128 152 184 188
158. 2 0 features PieCharts Simple pie charts and pie charts combined with line and bar plots PolarCharts Polar line line file and scatter plots Also includes an Antenna plot example ResizeExamples Fixed size frame resizeable frame with fixed sized objects resizeable frame with resizeable objects scrollable panel as a view into a much larger fixed size frame ScatterPlots Simple scatter line and line marker plots scatter plots with variable size and color symbols cell plots arrow plots Also labeling the data point values or a line marker plot Introduction 19 SimpleLinePlots Simple line plots with linear and time date coordinate systems Also filled and step lines UserChartExample1 Simple example displays line and scatter plots ZoomExamples Zooming simple linear axes super zooming of multiple axes zooming of time data based data WindowsControlLibrary1 Create a QCChart2D ChartView derived window that can be embedded in Windows Internet Explorer ASP Net Holds ASP Net examples specific directory VBChart2DAspWebApp ASP Net Web application VBChart2DDynWebApp Dynamic ASP Net Web app VBChart2DHTMLAspApp ASP Net App in HTML page Critical Note Running the Example Programs The example programs for QCChart2D charting software are supplied in complete source In order to save space they have not been pre compiled which means that many of the intermediate object files neede
159. 2 SetPlotLabelTemplate bardatavalue thePlot2 SetBarDatapointLabelPosition ChartObj CENTERED BAR thePlot2 SetShowDatapointValue true chartVu AddChartObject thePlot2 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 SetGraphBorderDiagonal 0 55 0 1 0 95 0 75 pTransform2 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 StackedLinePlot The StackedLinePlot class extends the Group
160. 22 32 44 55 46 32 25 14 9 114 Scaling and Coordinate Systems Dim dataset As SimpleDataset New SimpleDataset Sales Dim simpleScale As CartesianCoordinates simpleScale AutoScale dataset simpleScale SetScaleStartX 1 0 simpleScale SetScaleStopX 10 0 xData yData new CartesianCoordinates 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 1 2 3 4 5 6 7 8 9 10 double yD tal 10 22 33 44 55 46 33 25 14 9 double xDataz 10 9 8 7 06 5 4 3 2 1 1 double 1 yData2 20 12 43 54 15 26 63 25 24 19 double 5 8 7 5 5 4 5 8 7 8 5 double yData3 30 52 13 64 25 76 13 35 24 181 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 datasetl 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 8 9 10 Dim yDatal As Double 10 22 33 44 55 46 33 25 14 9 Dim xData2 As Double
161. 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 297 298 377 380 398 400 449 453 458 459 GroupPlot 23 39 41 42 43 44 45 46 47 48 64 156 261 262 264 268 270 272 273 275 276 280 282 283 285 288 290 292 294 296 GroupPlot23 39 41 42 43 44 45 46 47 48 64 156 261 262 264 268 270 272 273 275 276 280 282 283 285 288 290 292 294 296 0 2 3 5 41 46 64 10 2 3 5 41 46 64 Histogr m plots iicet tese HistogramPlot 41 46 64 261 285 286 287 HistogramPlot 41 46 64 261 285 286 287 HistogramPlot 41 46 64 261 285 286 287 Image objects 57 58 64 170 382 384 385 386 421 399 401 417 418 423 FUTT 386 ChartImage 57 58 64 170 382 384 385 386 421 Image Rendering e BufferedImage 60 63 390 393 394 395 396 399 401 415 417 418 421 423 455 460 legend 21 22 23 55 59 103 154 312 355 356 357 358 350 360 361 362 363 368 406 407 413 Legend 55 64 156 355 356 357 358 359 360 361 362 363 364 406 407 413 Appendix 467 LEGEND eren en 362 363 Legend classes 55 64 156 355 364 legend
162. 2D using System Drawing Imaging using com quinncurtis chart2dnet namespace WebApplicationl public partial class Default System Web UI Page protected void Page Load object sender EventArgs e Get Input from HTML ASP page request String widthstring Request Params Get 0 String heightstring Request Params Get 1 int imagewidth int Parse widthstring int imageheight int Parse heightstring ChartView chartVu GetInitializeChart imagewidth imageheight Stream chart back as a JPeg image BufferedImage chartimage new BufferedImage chartVu ImageFormat Jpeg get your binary image data here Response ContentType image jpeg chartimage Savelmage Response OutputStream private ChartView GetInitializeChart int imagewidth int imageheight double xvalues double yvalues pi N Co 0 4 5 3 10 TE N ChartView chartVu new ChartView imagewidth imageheight Set size of view to match the size of target image for best rendering Font theFont new Font SansSerif 10 FontStyle Bold SimpleDataset Datasetl new SimpleDataset First xvalues yvalues CartesianCoordinates pTransforml new CartesianCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 15 15 90 0 90 Background graphbackgroundl new Background pTransforml Cha
163. 3 44 5 61 4 _ DX Vast 7253 Gosar 49992 _ 41 33 51 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 thePlotl New BoxWhiskerPlot pTransforml 0 25 fillattrib hePlotl AddPopulation NYCity 1 hePlot1l AddPopulation Houston 2 hePlotl AddPopulation SanFrancisco 3 hePlotl AddPopulation Boston 4 hePlotl AddPopulation Pittsburgh 5 et et cr ice ot ct hePlotl BWFormat ChartObj BW IQR15 WHISKER OUTLIERS hePlotl BarDatapointLabelPosition ChartObj CENTERED BAR hePlotl PlotLabelTemplate TextFont _ New Font Microsoft Sans Serif 8 FontStyle Regular et ct hePlotl PlotLabelTemplate DecimalPos 1 hePlotl ShowDatapointValue True label outliers hePlotl ScatterPlot ShowDatapointValue True hePlotl AutoBWChart et et ph 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 Simple Plot Objects 269 BubblePlot constructor Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordi
164. 31 359 368 406 413 418 422 444 445 447 448 SimplePlot 23 39 52 53 54 58 59 64 156 245 249 251 252 254 255 257 263 269 271 273 216 277 286 288 293 338 SimplePlot 23 39 52 53 54 58 59 64 156 245 249 251 252 254 255 257 263 269 271 273 276 277 286 288 293 338 SimpleScatterPlot 52 54 64 245 251 252 253 254 256 312 SimpleScatterPlot 52 54 64 85 245 251 252 253 254 256 312 406 412 413 SimpleVersaPlot 2 3 5 54 64 257 258 259 260 SimpleVersaPlot 2 3 5 54 64 245 257 258 259 260 Stacked bar plots secet StackedBarPlot 2 3 4 41 45 46 64 261 280 281 282 294 295 296 331 Stacked line plots sse StackedLinePlot41 48 64 261 296 297 298 331 StackedBarPlot 41 46 64 261 280 294 295 296 331 StackedBarPlot 2 3 4 41 45 46 64 261 280 281 282 294 295 296 331 StackedLinePlot 41 48 64 261 296 297 298 331 StackedLinePlot41 48 64 261 296 297 298 331 Standard legends eene StandardLegend 55 64 355 356 359 406 413 StandardLegend 55 64 355 356 359 StandardLegend 55 64 355 356 359 406 413 String axis labels ice tees StringAxisLabels 37 38 64 208 214 215 216 217 453 454 Sung labels tere De eo eg stringlabel eee 453 454 StringLabel 56 57 64 364 370 372 374 3
165. 338 339 340 342 343 344 345 346 347 348 349 350 351 377 379 405 412 417 422 429 433 452 458 459 Simple plot bjects uento St oto SimplePlot 23 39 52 53 54 58 59 64 156 245 249 251 252 254 255 257 263 269 271 273 276 277 286 288 293 338 SimpleBarPlot 52 53 64 245 248 249 250 251 312 331 429 SimpleBarPlot 52 53 64 85 245 248 249 250 251 312 331 429 434 435 SimpleDataset 25 26 30 63 65 66 67 68 69 73 76 81 113 114 116 150 151 153 154 155 246 249 252 255 256 258 323 324 338 339 340 342 343 344 345 346 347 348 349 350 351 377 417 422 458 SimpleDataset 1 2 9 25 26 30 63 65 66 67 68 69 70 71 72 73 74 75 76 81 82 85 86 88 99 101 102 113 114 116 121 122 123 125 128 131 132 133 138 139 141 150 151 153 154 155 199 225 226 230 231 246 247 248 249 250 252 255 256 258 318 323 324 338 339 340 342 343 344 345 346 347 348 349 350 351 377 379 405 412 417 422 429 433 452 458 459 SimpleLineMarkerPlot 52 53 64 245 254 255 256 257 312 SimpleLineMarkerPlot 52 53 64 85 245 254 255 256 257 312 SimpleLinePlot 52 54 64 162 163 245 246 247 248 253 309 310 312 331 359 418 422 444 445 447 448 470 Appendix SimpleLinePlot 16 19 52 54 64 85 162 163 170 245 246 247 248 253 309 310 312 3
166. 417 418 422 429 430 433 434 435 442 443 444 445 446 447 448 449 451 452 453 454 455 456 459 REI GRE ChartPlot 39 40 64 65 156 161 245 249 251 254 257 261 262 264 268 270 272 275 276 280 282 285 287 290 292 294 296 299 335 337 338 344 346 347 349 350 357 358 364 449 456 459 GhartPrint s eei centes aeia ChartPrint 60 63 390 391 392 393 printing 14 16 18 21 60 390 391 396 Printitg 2 sten awe es 14 60 390 391 ChartScale ecrit ER etes 26 27 28 63 103 105 Chart Shape e eo ata ChartShape 57 58 64 382 383 384 386 387 388 407 413 ChartSymbol ee teet a ChartSymbol ChartLext uc cct ep ere RR ChartText 56 57 64 155 209 210 215 217 223 226 232 234 301 302 311 313 314 332 333 334 335 336 340 341 364 365 366 367 369 370 406 407 413 447 448 450 ChartTitle 56 57 64 314 362 363 364 367 368 369 399 401 418 422 428 430 ChartTitle 56 57 64 314 362 363 364 367 368 369 399 401 407 413 418 422 428 430 433 434 435 436 437 ChartView 7 11 17 19 20 22 25 31 59 60 63 67 72 75 87 90 93 97 100 154 155 156 157 158 159 160 161 168 177 182 191 192 202 203 213 214 222 233 234
167. 5 yAxisLab5 SetTextFont theFont 444 FAQs chartVu AddChartObject yAxisLab5 Font axisTitleFont AxisTitle xaxistitl chartVu AddChartObj new Font SansSerif 10 FontStyle Bold new AxisTitle xAxis axisTitleFont Event Partition ct xaxistitle oot Grid xgrid new Grid xAxis yAxisl ChartObj X AXIS ChartObj GRID MAJOR chartVu AddChartObject xgrid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl chartVu AddChartObject thePlotl tribl et SimpleLinePlot thePlot2 new SimpleLinePlot pTransform2 Dataset2 attrib2 chartVu AddChartObject thePlot2 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 a chartVu AddChartObject thePlot5 VB trib5 ct Dim pTransforml As CartesianCoordinates Dim pTransform2 As CartesianCoordinates Dim pTransform3 As CartesianCoordinates Dim pTransform4 As CartesianCoordinates Dim pTransform5 As CartesianCoordinates Dim xAxis As LinearAxis 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
168. 5 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 _ 180 Axes ByVal transform As PhysicalCoordinates ByVal axtype As Integer _ Overloads Public Sub New _ ByVal transform As PhysicalCoordinates _ ByVal axtype As Integer ByVal minval As Double _ ByVal maxval As Double _ public LogAxis PhysicalCoordinates transform 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 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
169. 6 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 110 22 33 44 55 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 hartObj 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 Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale AutoScale dataset simpleTimeScale SetTimeScaleStart new ChartCalendar 1996 ChartOb
170. 63 103 105 UserControl 11 22 24 25 63 154 157 160 378 402 415 425 426 427 431 450 454 456 UserControl 10 11 22 24 25 63 154 157 160 327 329 378 402 410 415 425 426 427 428 431 432 433 435 436 437 450 454 456 UserCoordinates 277 28 63 103 105 UserCoordinates 277 28 63 103 105 Visual Basic 17 21 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 86 88 89 90 91 92 94 95 96 97 99 108 109 110 112 113 114 115 Appendix 471 116 119 120 121 122 123 124 125 126 127 128 130 131 132 138 150 151 152 153 154 155 156 157 158 159 161 162 163 166 167 168 169 170 172 173 175 176 177 178 179 180 181 182 183 188 190 191 192 193 194 195 197 198 199 201 202 203 204 206 212 213 214 215 217 219 220 222 223 224 226 229 231 232 233 234 235 236 237 238 239 240 242 243 246 248 249 250 251 252 253 254 255 256 257 258 260 262 263 264 265 267 269 270 271 272 273 274 275 276 277 278 279 280 281 282 284 285 287 288 289 290 291 292 293 294 296 297 298 299 302 304 306 307 308 310 313 314 315 316 317 318 320 322 325 326 327 328 331 333 334 336 338 339 341 344 345 346 347 349 350 351 353 356 357 359 360 361 362 364 366 367 368 369 370 371 372 373 374 375 378 380 381 382 384 385 386 387 3
171. 67 68 69 70 71 72 73 74 78 79 86 90 91 92 93 95 96 97 99 100 CSV 61 63 65 66 67 68 69 70 71 72 73 74 75 78 79 86 87 89 90 91 92 93 95 96 97 99 100 262 Data compression 458 458 5 458 CompressTimeFieldGroupDataset 458 459 CompressTimeFieldSimpleDataset 458 458 CompressTimeSimpleDataset Data CUfSOIS i i iet e eret bdo 22 2 308 309 DataCursor 15 17 58 59 63 304 306 307 308 309 310 311 316 446 Data logging eicere ete terret exin data logging 5 Data Tooltips sss data tooltips Data tooltips usi 330 DataCursor 58 59 63 304 306 307 308 309 310 316 dataC rsor o A AS Wes 308 309 DataCursor 15 17 58 59 63 304 306 307 308 309 310 311 316 446 IDataselx acento ES DURO ides ChartDataset 25 39 40 63 65 66 69 73 76 80 81 88 91 95 98 107 378 Dataset classes 25 39 40 63 65 66 69 73 76 80 81 88 91 95 98 107 378 ChartDataset 25 39 40 63 65 66 69 73 76 80 81 88 91 95 98 107 378 DatasetViewer 2 9 10 21 377 378 379 380 381
172. 7 159 160 161 162 168 172 173 178 184 192 195 200 203 209 210 215 217 223 226 232 234 237 238 240 242 245 248 251 254 257 262 264 268 270 272 215 2716 280 282 285 287 290 292 294 296 299 304 306 312 313 314 338 344 346 347 349 350 352 355 357 358 360 364 382 384 447 448 449 455 grid 2 5 9 20 22 23 24 56 76 77 78 79 80 155 237 238 239 240 241 242 243 247 248 250 253 256 263 269 270 272 274 278 279 283 284 286 287 289 290 291 292 293 294 295 296 298 301 302 343 377 378 379 398 399 401 406 412 429 434 441 444 445 455 456 Grid 2 5 56 64 80 81 155 156 237 239 240 241 242 243 244 284 301 302 303 343 345 346 348 349 378 379 380 381 398 399 401 406 412 429 434 444 445 447 448 456 458 GRID 238 239 240 241 242 243 244 284 301 302 345 346 348 349 380 381 398 399 401 406 412 429 434 444 445 456 Grids 56 64 155 156 237 239 240 242 284 301 302 398 399 401 429 444 445 447 448 456 grid 2 5 9 20 22 23 24 56 76 77 78 79 80 155 237 238 239 240 241 242 243 247 248 250 253 256 263 269 270 272 274 278 279 283 284 286 287 289 290 291 292 293 294 295 296 298 301 302 343 377 378 379 398 399 401 406 412 429 434 441 444 445 455 456 Grid 2 5 56 64 80 81 155 156 237 239 240
173. 75 StringAxisLabels 37 38 64 208 214 215 216 217 453 454 StringAxisLabels 37 38 64 208 214 215 216 217 453 454 StringLabel 56 57 64 364 370 372 374 375 stiitiglabel tenet 453 454 StringLabel 56 57 64 364 370 372 374 375 Symbols esee 57 58 64 332 334 ChartSymbol 57 58 64 332 334 407 413 Templates re Ce pte p ete Templates cote orsi dr d 332 Text classes 56 57 64 155 209 210 215 217 223 226 232 234 301 302 311 313 314 332 333 334 335 336 340 341 364 365 366 367 369 370 447 448 450 ChartText 56 57 64 155 209 210 215 217 223 226 232 234 301 302 311 313 314 332 333 334 335 336 340 341 364 365 366 367 369 370 406 407 413 447 448 450 Tick mark class tickmark 188 189 190 TickMark sss 61 62 64 191 192 TickMark e eerte 61 62 64 188 189 190 TickMark ere Time auto scaling TimeAutoScale 6 29 30 63 225 226 Time axis tt ROTE SEGA ee toD rots UMEARI S sed ento NS 126 TimeAxis 2 6 31 35 37 38 39 56 64 129 143 171 172 183 184 188 189 191 192 193 195 197 208 209 217 219 220 221 222 223 224 225 226 229 237 284 398 400 401 429 434 442 447 448 451 452 TIMEAXIS 184 185 186 187 188 190 191
174. 90 392 394 395 402 415 420 421 431 448 450 451 452 453 454 456 457 459 Visual Basic 17 21 69 72 73 75 79 80 88 91 94 95 110 112 113 114 115 116 119 120 121 122 123 125 128 130 131 132 150 151 152 153 155 156 157 158 159 163 167 170 177 178 182 183 191 192 195 199 202 203 206 213 214 215 217 222 226 231 233 236 239 242 243 246 248 250 251 253 254 256 257 260 263 264 265 267 270 272 274 277 278 279 281 284 287 289 291 293 296 298 302 306 308 310 314 316 317 318 322 325 326 327 328 333 334 336 341 345 349 359 362 366 367 368 370 373 375 378 380 381 384 386 387 392 395 402 415 420 421 431 448 450 451 452 453 454 456 457 459 Visual CH 21 408 416 427 Visual C 21 408 416 427 Visual Studio 2005 sss 10 Web Applications essen web applications Web Windows Applications see Windows applications sees 21 Windows Applications 11 402 427 431 Working coordinates esses WorkingCoordinates 27 28 63 103 105 107 WorkingCoordinates 27 28 63 103 105 107 WorkingCoordinates 27 28 63 103 105 107 World coordinates WorldCoordinates 27 28 63 103 105 WorldCoordi
175. ABEL 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 PieCharts class SimplePieChart A simlar example for a RingChart is found in the example program NewDemosRev2 SimpleRingChart C 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 ChartText bankLabel ChartText aeroLabel ChartText autoLabel theFont new Font SansSerif 10
176. AM EST and the ending time is 4 00 PM EST Any data outside of this range 15 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 3 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 for Net library uses milliseconds as the underlying time base for all date time coordinate system When a scale is created using two ChartCalendar dates as end points the
177. AntennaCoordinates minvalue maxvalue 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 In degrees double radiusData 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 radiusData As Double 1 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 152 Scaling and Coordinate Systems Invert the x and or y scales by swapping the scale starting and ending vaues in the call to the CartesianCoordinates or the TimeCoordinate
178. AntennaScatterPlot 2 5 49 51 64 343 349 350 351 354 o iet ArrowPlot 41 42 64 261 262 263 264 2770 382 386 ArrowPlot 41 42 64 261 262 263 264 270 382 386 63 262 263 264 382 386 387 388 arrow 16 18 21 41 42 117 261 262 263 264 382 386 387 388 Arrow41 42 63 64 261 262 263 264 270 382 386 387 388 t ete rtt E 21 ASP Net za seien 17 19 415 416 421 460 redes rrt tu ee 21 Auto scaling classes 29 30 63 113 114 116 121 122 123 125 128 129 131 132 133 150 151 153 155 170 246 247 248 250 253 256 263 269 270 274 279 281 282 283 284 289 291 292 293 294 295 296 297 298 306 314 316 318 324 345 346 348 349 398 400 417 422 429 452 453 a tosc le 5 o eme Sen 157 AutoScalel 6 29 30 63 113 114 116 121 122 123 125 128 129 131 132 133 139 150 151 153 155 170 225 226 246 247 248 250 253 256 263 264 260 270 273 274 279 281 282 283 284 289 291 292 293 294 295 296 297 298 306 314 316 318 324 345 346 348 349 398 400 405 412 417 422 429 434 452 453 autoscale AutoScalel 6 29 30 63 113 114 116 121 122 123 125 128 129 131 132 133 139 150 151 153 155 170 225 226 246 247 248 250 253 256 263 264 269 270 273 274 279 28
179. Axis xAxis SetColor Color Red chartVu UpdateDraw 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 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
180. Axis already has member variables that define properties and draw the tick marks for the circular axis The PolarAxes class also includes uses two additional LinearAxis 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 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 201 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
181. Axis2 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 The 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
182. BubblePlotLegend 55 64 355 360 361 362 363 BubblePlotLegendltem n 55 64 360 Buffered images aee repr Reiten BufferedImage 60 63 390 393 394 395 396 399 401 415 417 418 421 423 455 460 BufferedImage 60 63 390 393 394 395 396 399 401 415 417 418 421 423 455 460 BufferedImage 60 63 390 393 394 395 396 399 401 415 417 418 421 423 455 460 Calendar utilities rete eer ChartCalendar 26 30 35 57 61 63 65 69 70 71 72 87 88 91 92 93 94 100 101 116 117 118 119 120 121 122 123 124 125 126 127 128 137 138 147 148 152 184 188 189 191 192 221 222 250 251 259 260 272 277 278 279 281 282 283 284 288 289 293 294 295 296 325 335 336 372 373 397 398 399 400 401 428 429 433 434 451 Candlestick plots see CandlestickPlot 41 43 64 261 270 271 272 281 331 399 401 CandlestickPlot 41 43 64 261 270 271 272 331 399 401 Cartesian coordinates essen CartesianCoordinates 3 27 28 29 63 103 105 110 111 112 113 114 115 116 118 129 133 149 150 152 153 154 155 157 158 159 177 182 213 214 239 253 256 263 464 Appendix 274 278 286 287 291 292 297 298 301 302 306 308 309 310 314 316 324 329 340 341 342 405 412 417 422 442 444 453 454 CartesianCoordinates 3 27 28 29 63 103 105 110 111
183. ByVal transform As PhysicalCoordinates _ ByVal ByVal ByVal ByVal ByVal ByVal Ct Lines Shapes Images and Arrows 383 ashape As GraphicsPath shapecoordstype As Integer _ X As Double _ y As Double npositiontype As Integer _ rotation As Integer _ 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 System Drawing Drawing2D GraphicsPath object shapecoordstype Specifies if the coordinate system defining the shape is specified in X y npostype rotation physical coordinates normalized coordinates or Net device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS Specifies the x value of the shape position Specifies the y value of the shape position Specifies the if the position of the shape is specified in physical coordinates normalized coordinates or Net device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT POS 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 rotated out of the current viewing plane ChartShape example extracted
184. 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 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 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 Chart Datasets 79 y An array size npoints of double that specifies the y values of the dataset Z 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
185. Calendar Overloads Public Sub New _ ByVal transform As TimeCoordinates ByVal axtype As Integer Overloads Public Sub New _ ByVal transform As TimeCoordinates Axes 189 ByVal As Integer _ ByVal ntickmarkbase As Integer _ Overloads Public Sub New _ ByVal transform As TimeCoordinates _ ByVal axtype As Integer ByVal dstart As ChartCalendar ByVal dstop As ChartCalendar public TimeAxis TimeCoordinates transform public TimeAxis TimeCoordinates transform int ntickmarkbase ye public TimeAxis TimeCoordinates transform ChartCalendar dstart ChartCalendar dstop public TimeAxis TimeCoordinates transform int axtype public TimeAxis TimeCoordinates transform int axtype int ntickmarkbase public TimeAxis TimeCoordinates transform int axtype ChartCalendar dstart ChartCalendar dstop If the constuctor does not explicitly specify whether the axis is for the x or y axis then the software checks the underlying TimeCoordinates system transform and creates an axis for the dimension of the coordinate system that is time based transform 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 axtype The axis types Use one of the axis type constants X_AXIS or Y AXIS d
186. ChartAttribute attrib2 new ChartAttribute Color Green 3 DashStyle Solid attrib3 ChartObj PHYS POS Using QCChart2D for Net to Create Windows Applications 413 SimpleLinePlot thePlot2 new SimpleLinePlot pTransforml Datasetl attrib2 chartVu AddChartObject thePlot2 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 chartVu AddChartObject thePlot3 ChartText EnronLabel new ChartText pTransforml theFont Eronix x1 94 y2 94 EnronLabel SetXJust ChartObj JUSTIFY MAX EnronLabel SetYJust ChartObj JUSTIFY MAX EnronLabel SetTextNudge 4 4 chartVu AddChartObject EnronLabel ChartText IGG new ChartText pTransforml theFont Quinn Curtis x1 0 y3 0 ChartObj PHYS POS IGG SetXJust ChartObj JUSTIFY MIN IGG SetYJust ChartObj JUSTIFY MAX IGG SetTextNudge 4 4 chartVu AddChartObject IGG Font legendFont new Font Microsoft Sans Serif 8 FontStyle Regular ChartAttribute legendAttributes new ChartAttribute Color Gray 1 DashStyle Solid legendAttributes SetFillFlag false legendAttributes SetLineFlag false StandardLegend legend new StandardLegend 0 01 0 875 0 98 0 075 legendAttributes StandardLegend HORIZ DIR Experimental Data legend AddLe
187. ChartView object that the chart is placed in buttonmask Specifies the mouse button that is trapped to invoke a move Create the DataToolTip object and then install it using the ChartView SetCurrentMouseListener method This adds the DataToolTip object as a 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 332 Data ToolTips 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 SetXValueTemplate 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 met
188. ContourPlots Line and filled contour plots CustomDataToolTips Creating custom data tooltips for an OHLC plot multiple stacked graphs and a pie chart DataCursorsAndMarkers Using data cursors and markers DynamicCharts Scrolling lines bars scatter plots data logging instrument simulation chart animation EditChartExample Dialog box for chart example 16 Introduction FinancialExamples OHLC plots candlestick plots financial log plots option chart technical analysis chart FormControlExamples Adding check boxes scrollbars and tables to charts ImageCharts Using images as chart data elements chart backgrounds and annotations LabeldDatapoints Label the data points of a simple line chart LinePlotSalesVolume Simple line plot example with printing and save image menu LogPlots Logarithmic plots for financial charts and engineering charts MiscCharts A line gap chart MouseListeners Data tooltips data cursors moving data points moving chart objects MultiLinePlots Group multi line plots stacked line plots multiple single line graphs MultipleAxes Multiple axes graphs NewDemosRev2 New examples for Revision 2 0 features PieCharts Simple pie charts and pie charts combined with line and bar plots PolarCharts Polar line line file and scatter plots Also includes an Antenna plot example ResizeExamples Fixed size frame resizeable frame with fixed s
189. DDD 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 TIMEDATEFORMAT MMMM TIMEDATEFORMAT MMM TIMEDATEFORMAT M 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 MMMM MMM MMM 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 QI January Jan TIMEDATEFORMAT DDDD TIMEDATEFORMAT DDD TIMEDATEFORMAT D TIMEDATEFORMAT Y TIMEDATEFORMAT MDY2000 TIMEDATEFORMAT DMY2000 TIMEDATEFORMAT MY2000 TIMEDATEFORMAT Y2000 TIMEDATEFORMAT MDY HMS TIMEDATEFORMAT DMY HMS TIMEDATEFORMAT MDY HM TIMEDATEFORMAT DMY HM dddd ddd ddd yy M dd yyyy d MM yyyy M yyyy H mm ss nM dd yy H mmi ss nd M yy H mm nM dd yy H mm nd M yy Axis Labels 219 Tuesday Tue T 00 12 07 2000 7 12 2000 7 2000 2000 12 23 33 12 07 00 23 12 33 12 07 00 12 23 33 12 07 00 23 12 33 12
190. Data TimeCoordinates simpleTimeScale new TimeCoordinates simpleTimeScale SetWeekType ChartObj WEEK 5D simpleTimeScale AutoScale dataset Visual Basic Dim dataset As TimeSimpleDataset New TimeSimpleDataset Sales xData yData Dim simpleTimeScale As TimeCoordinates New TimeCoordinates simpleTimeScale SetWeekType ChartObj WEEK 5D simpleTimeScale AutoScale dataset 126 Scaling and Coordinate Systems 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 As Long _ ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal stoptime Long _ ByVal y2 As Double _ ByVal nweekty
191. Dataset Actual Sales x1 yl orml As New CartesianCoordinates SetScaleStartY 0 SetScaleStartx 0 SetScaleStopX 80 SetScaleStopY 1 0 SetGraphBorderDi gonal 0 15 0 15 0 9 0 75 Ckground As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 Color FromArgb 90 20 155 ChartObj Y AXIS chartVu Add Define Dim attribl attribl Set Dim thePlot ChartObject graphbackground axes axes labels and grids As New ChartAttribute Color Black 0 DashStyle Solid Color Green FillFlag True 1 As New HistogramPlot pTransforml Datasetl 0 0 attribl Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalu bardatavalu bardatavalu thePloti Se thePloti Se thePloti Se thePloti Se thePlotl Se thePloti Se thePlotl Se thePloti Se thePloti Se thePloti Se chartVu Add e SetTextFont theFont e SetNumericFormat ChartObj PERCENTFORMAT e SetColor Color Black tBarDatapointLabelPosition ChartObj INSIDE BAR tPlotLabelTemplate bardatavalue tShowDatapointValue True tSegmentAttributesMode True tSegmentFillColor 0 Color Red tSegmentFillColor 1 Color Magenta tSegmentFillColor 2 Color Blue tSegmentFillColor 3 Color Green tSegmentFillColor 4 Color Yellow tSegmentFillColor 5 Color Pink ChartObject thePlotl Line Gap Plots Class LineGapPlot GraphObj ChartPlot 288 Simple Plot Objects
192. Dataset Dataset2 new ElapsedTimeSimpleDataset Second 1 y2 ElapsedTimeCoordinates pTransforml new ElapsedTimeCoordinates ChartObj ELAPSEDTIME SCALE ChartObj LINEAR SCALE pTransforml ElapsedTimeAutoScale Dataset2 ChartObj X AXIS ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR 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 226 Axis Labels yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Visual Basic Dim 1 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 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 1 y2 Dim pTransforml As New ElapsedTimeCoordinates ChartObj ELAPSEDTIME SCALE _ ChartObj LINEAR SCALE pTransforml
193. Datasetl attribl chartVu AddChartObject thePlotl Multi Line Plots Class MultiLinePlot GraphObj ChartPlot GroupPlot 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 GroupDataset _ ByVal attribs As ChartAttribute Ct 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 and line style 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 Simple Plot Objects 291 include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Multi line plot example extracted from the example
194. Dim chartVu As ChartView new ChartView 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 my chart Since the ChartView class is derived from UserControl you can place the scroll bar in the ChartView object or 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 UserControl 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 C public void UpdateXScaleAndAxes int index int startindex index pTransforml SetScaleStartxX d
195. ENTER 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 Bargraphs class GroupBargraphs C TimeCoordinates pTransform2 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 5etGraphBorderDiagonal 0 55 1 95 0 75 pTransform2 SetScaleStartY 0 Define axes axes labels and grids StackedBarPlot thePlot2 new StackedBarPlot pTransform2 Datasetl 296 Simple Plot Objects 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 thePlot
196. ElapsedTimeAutoScale Dataset2 ChartObj X AXIS _ ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 7R Dim xAxis As New ElapsedTimeAxis pTransforml ChartObj X AXIS hartVu AddChartObject xAxis Q 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 AxisLab SetTextFont theFont hartVu AddChartObject yAxisLab OS Event Axis Labels Class EventAxisLabels GraphObj ChartText AxisLabels EventAxisLabels The EventAxisLabels class extends the AxisLabels class adding extensive time and date formatting capability Use it to label axes created using the EventAxis class Label formats Axis Labels 227 A time axis label can take many forms Variations on these forms include Time formats hh mm ss hh mm mm ss etc 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 for Net software directly supports twelve time formats and twenty two 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
197. FY MIN JUSTIFY CENTER JUSTIFY MAX 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 TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData pTransforml new TimeCoordinates pTransforml SetWeekType weekmode pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 1 15 90 0 75 SetInitialDates pTransform1 Background graphbackgroundl new Background pTransforml ChartObj GRAPH BACKGROUND Color White Color LightGray ChartObj Y AXIS hartVu AddChartObject graphbackgroundl ackground plotbackgroundl new Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject plotbackgroundl wa y hartAttribute attribl new ChartAttribute Color Red 1 DashStyle Solid Color Red hartAttribute attrib2 new ChartAttribute Color Yellow 1 DashStyle Solid Color Yellow hartAttribute attrib3 new ChartAttribute Color Blue 1 DashStyle Solid Color Blue hartAttribute attrib4 new ChartAttribute Color Green 1 DashStyle Solid Color Green hartAttribute attribArray attribl attrib2 attrib3 attrib4 attribl SetFillFlag true thePlotl new Flo
198. Files BMP JPG GIF TIFF PNG BMP JPG GIF TIFF PNG AIL files imagefilechooser FileName filename If imagefilechooser ShowDialog DialogResult OK Then filename imagefilechooser FileName Dim fileinformation As New FileInfo filename Dim fileext As String fileinformation Extension fileext fileext ToUpper Dim fileimageformat As ImageFormat If fileext BMP Then fileimageformat ImageFormat Bmp Else If fileext JPG Or fileext JPEG Then fileimageformat ImageFormat Jpeg Else If fileext GIF Then fileimageformat ImageFormat Gif Else If fileext TIF Or fileext TIFF Then fileimageformat ImageFormat Tiff Else If fileext PNG Then fileimageformat ImageFormat Png Else fileimageformat ImageFormat Bmp End If End If End If End If End If Dim savegraph As New BufferedImage chartview fileimageformat savegraph Render savegraph SaveImage filename End If End Sub SaveAsFile 396 File and Printer Rendering Headless Rendering of Charts Often is it necessary to render a chart as an image file or stream without actually displaying it This is the case if you are producing the images on a server and serving up the images to web pages Or you may just be printing charts or storing them as images without actually viewing them on a Windows form One term for this is headless rendering since the computer may not have a monitor or graphics terminal connec
199. 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 _ public StackedBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth double rbarbase ChartAttribute attribs Simple Plot Objects 295 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 nbarjust The stacked bars are justified with respect to the x values in the dataset using the rbarjust justification value JUSTIFY MIN JUSTIFY C
200. Integer ByVal gradcolors As Color ByVal gradbreak As Double _ ByVal graddir As Integer _ Overloads Public Sub New _ ByVal gradmode As Integer ByVal gradcolors As Color ByVal gradbreak As Double _ ByVal graddir As Integer _ C public ChartGradient PhysicalCoordinates transform int gradmode Color gradcolors double gradbreak int graddir ye public ChartGradient int gradmode Color gradcolors double gradbreak int graddir gradcolors gradbreak graddir gradmode transform An array of colors used to define the gradient An array of gradient breakpoints one for each color The range of values depends on the mapping mode For the GRADIENT MAPTO OBJECT GRADIENT MAPTO PLOT NORMALIZED COORDINATES and GRADIENT MAPTO GRAPH NORMALIZED COORDINATES modes the first value of the array should always be 0 0 and the last value should always be 1 0 The direction of the gradient in degrees At 0 degrees the direction is 3 00 Positive degrees rotate clockwise When used with the GRADIENT MAPTO PLOT PHYSICAL COORDINATES mapping mode always make degrees even divisible by 90 The mapping mode of the breakpoints to the gradient area Use one of the gradient mode constants GRADIENT MAPTO OBJECT GRADIENT MAPTO PLOT PHYSICAL COORDINATES GRADIENT MAPTO PLOT NORMALIZED COORDINATES or GRADIENT MAPTO GRAPH NORMALIZED COORDINATES The physical coordinate system of the graph object The coo
201. Introduction EuroDollar CandlestickChart FinLogPlot OHLCChart OpeningScreen FinancialOptions Technical nalysis Candlestick Plots in Technical Analysis 7103 12 7105 12 7 06 12 7 09 12 7 10 12 7 11 12 Open Close box is filled if the open price is greater than the close price Event coordinates transition smoothly across holidays weekends and unused hours of the day New Features found in the 2 0 version of QCChart2D Many new features have been added to Revision 2 0 of QCChart2D for Net Existing classes have been extended and new classes added Features new to Revision 2 0 include Five new plot types for the Cartesian time and elapsed Time coordinate systems BoxWiskerPlot FloatingStackedBarPlot RingChart SimpleVersaPlot and GroupVersaPlot Antenna Charts includes coordinate system AntennaCoordinates axes AntennaAxes axes labels AntennaAxesLabels grid AntennaGrid and plot objects AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot and __ AntennaAnnotation 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 ElapsedTimeA xisLabels Vertical axis scaling for time date and elapsed time A DatasetViewer class for the grid like display of dataset information in
202. LUDING 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 YOU 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 plea
203. LinearAxis yAxis null class CustomFindObj FindObj LinePlot currentObj null public CustomFindObj LinePlot component base component currentObj component public void InvokeLineDialog GraphObj graphobj EditLineDialog linedialog null linedialog new EditLineDialog graphobj if liedialog ShowDialog this GetChartObjComponent DialogResult OK selectedObj SetColor linedialog GetLineColor SelectedObj SetLineStyle linedialog GetLineStyle selectedObj SetLineWidth linedialog GetLineWidth public void InvokeTextDialog ChartText textobj EditTextDialog textdialog null textdialog new EditTextDialog textobj if textdialog ShowDialog this GetChartObjComponent DialogResult OK textobj SetTextString textdialog GetString textobj SetTextFont textdialog GetFont public override void OnMouseDown MouseEventArgs mouseevent base OnMouseDown mouseevent GraphObj selectedObj GetSelectedObject if selectedObj null Check for a specific object if selectedObj currentObj xAxis selectedObj currentObj yAxis or check for for all classes inheriting from a specific type ChartSupport IsKindOf selectedObj SimpleLinePlot or Check for a specific object type ChartSupport IsType selectedObj com quinncurtis chart2dnet Grid 448 FAQs InvokeLineDialog selectedObj else if ChartSupport IsKindOf selectedObj C
204. 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 Dim yAxis As LinearAxis New LinearAxis simpleTimeScale ChartObj Y AXIS Create the ChartView object to place graph objects in Dim chartVu As ChartView New ChartView Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis Elapsed Time Axes Class ElapsedTimeAxis GraphObj Axis LinearAxis t ElapsedTimeA xis 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 Linear Axis Minimum and Maximum Axes 193 Linear Minor and Major Tick Mark Intervals Linear Axis Intercept Linear Axis Tick Mark Origin under the discussion of LinearAxis Creating a Elapsed Time Axis There are two main constructors for ElapsedTimeA xis objects The first ElapsedTimeAxis constructor assumes that
205. NGNUMVAL thePlotl SetStartPieSliceAngle 45 Dim labeltemplate As 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 thePlotl 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
206. NumPnts theFont new Font SansSerif 10 FontStyle Bold xValues 0 new ChartCalendar 1998 ChartObj JANUARY 1 Simple Plot Objects 289 groupBarData 0 0 43 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 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 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 FromArgb 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 nNumPn
207. ONTOUR LINE algorithm 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 ContourPlots class ContourLinePlot C double contourlevels 1000 1200 1400 1600 1800 1900 2000 2100 2200 2400 2600 2800 3000 chartVu this int ij theFont new Font SansSerif 10 FontStyle Bold chartVu this CartesianCoordinates pTransforml new CartesianCoordinates 7 7 7 7 CreateRegularGridPolysurface pTransforml 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 hartVu AddChartObject checkBoxCaption el inearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS hartVu AddChartObject xAxis inearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS hartVu AddChartObject yAxis umericAxisLabels xAxisLab new NumericAxisLabels xAxis hartVu AddChartObject xAxisLab umericAxisLabels yAxisLab new NumericAxisLabels yAxis hartVu AddChartObject yAxisLab rid xgrid
208. Obj object into a single class ChartGradient A ChartGradient can be added to a ChartAttribute object defining a multicolor gradient that is applied wherever the color fill attribute is normally used Auto Scaling Classes AutoScale LinearAutoScale LogAutoScale TimeAutoScale ElapsedTimeAutoScale EventAutoScale 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 30 Class Architecture AutoScale LinearAutoScale LogAutoScale TimeAutoScale ElapsedTimeAutoScale EventAutoScale This class is the abstract base class for the auto scale classes 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 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 This class is a concrete implementation of the AutoSc
209. Object thePlotl Dim theTitleFont As New Font SansSerif 14 FontStyle Bold Dim main le 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 SansSerif 10 FontStyle Bold Dim footer As New Char le 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 SansSerif 10 FontStyle Regular Dim legendAttributes As New ChartAttribute Color Black 1 DashStyle Solid Color White legendAttributes SetFillFlag True legendAttributes SetLineFlag True Dim legend As New BubblePlotLegend thePlotl 0 82 0 15 0 14 0 25 legendAttributes legend AddLegendItem 10 Million 10 attrib2 legendFont l 111 25 attrib Lee dFont legend AddLegendItem 40 Million 40 attrib2 legendFont legend AddLegendGeneralText ChartObj LEGEND HEADER Bubble Size Color Black legendFont i chartVu AddChartObject legend
210. 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 _ Cf 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 coordinates 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 outline line style 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 357 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
211. Page method Public Sub PrintPage ByVal sender As Object ByVal e As System EventArgs Dim chartVu As ChartView Me If Not chartVu Is Nothing Then If printobj Is Nothing Then printobj New ChartPrint chartVu printobj DoPrintDialog Else printobj PrintChartView chartVu End If printobj DocPrintPage sender e End If End Sub PrintPage Capturing the Chart as a Buffered Image Class BufferedImage ChartObj t BufferedImage 394 File and Printer Rendering The BufferedImage class creates a Bitmap object that is used to render a ChartView object into an image buffer The rendering takes place when the BufferedImage Render method or BufferedImage Savelmage method is called BufferedImage constructor Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal imgformat As ImageFormat _ Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ Ct public BufferedImage ChartView component ImageFormat imgformat public BufferedImage ChartView component component The ChartView object that is the source for the chart image imageformat An image format object specifying the format of the rendered image The BufferedImage GetBufferedImage method converts the chart to the Net Bitmap object specified by the imageformat object and returns a reference the resulting bitmap BufferedImage example extracted from the example program LinePlotSalesVolume class
212. Plot 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 Simple Plot Objects 297 Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset ByVal attribs As ChartAttribute _ public StackedLinePlot PhysicalCoordinates transform GroupDataset dataset ChartAttribute attribs transform The coordinate system for the new StackedLinePlot object dataset The stacked 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 specify the attributes line color and line style 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 MultiLinePlots class StackedL ines int numPoints 100 int numGroups 7 double x1 new double numPoints double yl new double numGroups numPoints f f Initialize data theFont new Font SansSerif 10 FontStyle Bold GroupDataset Datasetl new G
213. 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 contour 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 _ public ContourPlot PhysicalCoordinates transform
214. QCChart2D Charting Tools for Net Price Volume NASDAQ 40 4 7 LE tee H 1840 NE E EE EAE OEE 2 2 422 Fet X 4820 5 18 03 5 26 03 6 02 03 6 09 03 6 16 03 8 23 03 6 30 03 7 07 03 7 14 03 On inspecting any one of these Charts attentively a sufficiently distinct impression will be made to remain unimparied for a considerable time and the idea which does remain will be simple and complete at once including the duration and the amount William Playfair the father of statistical graphics in 1 786 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 12 18 2013 Rev 2 3 QCChart2D for Net Documentation and Software Copyright Quinn Curtis Inc 2014 Quinn Curtis Inc Tools for Net 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 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 ins
215. R SCALE AUTOAXES FAR Aut CartesianCoordinat new Ca pTransform5 AutoScale Datas INEAR SCALE UTOAXES FAR Ch j LINEAR SCALE FAR CartesianCoordinates transformArray pTransforml pTransform2 pTransform3 pTransform4 pTransform5 ChartZoom zoomO new ChartZoom transformArray true rable true tZoomXRoundM de ChartObj AUTOAXES FAR de ChartObj AUTOAXES FAR ble true ng true SetCurrentMouseListener zoomObj Dim Datasetl As New Dim Dataset2 As New Simp Dim Dataset3 As New Si Dim Dataset4 As New Simp Dim Dataset5 As New Si pirat x1 yi I ad 1 2 Ei wu t Fourth 1 y4 SEI PLETE 5 Dim pTr isforml As New CartesianCoordinates ChartObj LINEAR SCALE Obj LINEAR SCALE pTransformi AutoScale Dataset1 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim pTransform2 As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransform2 AutoScale jet2 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR Dim p As sianCoordinates Chart t SCALE t3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR 4 As New CartesianCoordinates ChartObj LINEAR SCALE LINEAR SCALE pTransform4 AutoScale Dataset4 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR
216. RIZ DIR legend AddLegendItem Energy Companies ChartObj CROSS thePlotl legendFont Using QCChart2D for Net to Create Windows Applications 407 legend AddLegendItem Software Companies ChartObj legend AddLegendItem Predicted ChartObj LINE legend SetLegendItemUniformTextColor Color Black chartVu AddChartObject legend Dim theTitleFont Dim mainTitle As As New Font Microsoft Sans Serif New ChartTitle pTransforml mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH chartVu AddChartObject mainTitle Dim titleLine As New Grap titleLine AddLine 0 1F 0 Dim titleLineShape As New ChartObj NORM GRAPH POS 0 titleLineShape SetLineWid chartVu AddChartObject ti hicsPath LE D LE ChartShape pTransforml th 3 tleLineShape Dim Dim footer As New ChartTi sampled data footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 chartVu AddChartObject footer chartVu SetResizeMode ChartObj AUTO RESIZE OBJECTS tle pTransforml form of toolTipFont As New Font Microsoft Sans Serif datatooltip As New DataToolTip chartVu xVal yVal Dim textTemplate As New ChartText toolTipFont textTemplate SetTextBgColor Color FromArgb 255 textTemplate SetTextBgMode True 299 Dim toolTipSymbol As New ChartSymbol Nothing toolTipSymbol SetSymbolSize 10 0
217. RM GRAPH POS 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 Lines Shapes Images and Arrows 387 Arrow constructor Visual Basic Overloads Public Sub New _ ByVal arrowshafthalfwidth As Double ByVal arrayshaftlength As Double _ ByVal arrowheadhalfwidth As Double _ ByVal arrowheadlength As Double _ public Arrow double arrowshafthalfwidth double arrayshaftlength double arrowheadhalfwidth double arrowheadlength 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 sca
218. SS The marker is a cross hair centered on the marker position Set the size of the cross hair using Net 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 device coordinates in the object constructor or later using the setMarkerSize method 306 Data Markers and Data Cursors 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 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 10 0 Marker amarker new Marker pTransforml1 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 pTransform1 ChartObj MARKER BOX _ xpos ypos 10 ChartObj PHYS POS theChartView AddChartObject amarker Data Cursors Class DataCursor GraphObj DataCursor Data cursors are an extension of the marker cla
219. SetWeekType ChartObj WEEK 5D new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 13 15 Background graphbackgroundl GRAPH BACKGROUND Color FromArgb 127 Y AXIS chartVu AddChartObject graphbackgroundl Background plotbackgroundl PLOT BACKGROUND Color White tVu AddChartObj 127 127 char ect plotbackgroundl TimeAxis xAxisl new TimeAxis pTransforml xAxisl SetColor Color White chartVu AddChartObject xAxis1 LinearAxis yAxisl SetColor Color White chartVu AddChartObject yAxis1 TimeAxisLabels xAxisLabl xAxisLabl SetColor Color White chartVu AddChartObject xAxisLabl NumericAxisLabels yAxisLabl yAxisLabl SetAxisLabelsFormat yAxisLabl SetColor Color White chartVu AddChartObject yAxisLabl Grid xgridl GRID MAJOR xgridl SetColor Color Black chartVu AddChartObject xgridl new Grid xAxisl F Grid xgrid2 GRID MINOR xgrid2 SetColor Color Gray chartVu AddChartObject xgrid2 new Grid xAxisl 90 Color FromArgb 55 0 8 new Background pTransforml SS new Background pTransforml new TimeAxisLabels xAxis1 yAxisl ChartObj X AXIS yAxisl ChartObj X AXIS new TimeGroupDataset Stock Data 55 new NumericAxisLabels 1 ChartObj CURRENCYFORMAT new LinearAxis pTransforml ChartObj Y AXIS
220. The goal of the Microsoft Net framework is to create an integrated platform for the creation distribution and execution of application programs The applications can be standalone programs suitable for a single computer and a single user networked client server applications or Internet applications involving local and remote servers Fast powerful and flexible charting graphics is common requirement for application programs in all market segments A long term goal of Microsoft Net is platform independence This implies that application programs written in C of VB will run not only on Windows platforms but UNIX and Linux based machines Since Microsoft Net is optimized for Windows making use of large portions of the Win32 operating system porting it to UNIX based machines is a lot of work Microsoft s goal of platform independence may be achieved not by supporting UNIX but by eliminating the competition until all computers run some form of Windows The major competitor to Microsoft Net is Java the language invented by Sun Computer In some respects Java already is what Microsoft Net wants to be You can write application programs using Java that are very platform independent This is because Java interpreters have been written for most modern operating systems The disadvantage of Java is that it creates application programs much slower than C C C and VB Microsoft was once a Java supporter and a member of the Java language consorti
221. 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 axis line and tick marks 177 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 new ChartView 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 Double 5 Dim xMax As Double 15 Dim yMin As Double 0 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 Dim chartVu As ChartView New Char
222. 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 Dim attribl As New ChartAttribute Color Blue 3 DashStyle Solid Datasetl SortByX True Dim thePlotl As SimpleLinePlot _ New SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashStyle DashDot chartVu AddChartObject thePlotl Dim attrib2 As New ChartAttribute Color Yellow 3 DashStyle Solid Dataset2 SortByX True Dim thePlot2 As SimpleLinePlot New SimpleLinePlot pTransforml Dataset2 attrib2 thePlot2 SetLineStyle DashStyle Dash chartVu AddChartObject thePlot2 Dim transparentRed As Color Color FromArgb 200 255 0 0 Dim transparentGreen As Color Color FromArgb 200 0 255 0 Dim lossAttrib As New ChartAttribute transparentRed 1 DashStyle Solid transparentRed Dim profitAttrib As New ChartAttribute transparentGreen 1 DashStyle Solid transparentGreen profitAttrib SetFillFlag True lossAttrib SetFillFlag True pr
223. Val y As Double _ ByVal npostype As Integer _ ByVal nnumformat As Integer ByVal ndecimal As Integer _ Overloads Public Sub New ByVal transform As PhysicalCoordinates ByVal tfont Font _ ByVal initialvaluel As Double 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 _ public NumericLabel PhysicalCoordinates transform Font tfont double initialvaluel double x double y int npostype int nnumformat int ndecimal public NumericLabel transform transform tfont A reference to a Font object initialvalue The initial value of the numeric label a Specifies the x value of the text position y Specifies the y value of the text position npostype PhysicalCoordinates transform Font tfont double initialvaluel double x double y int npostype int nnumformat int ndecimal int just nnt vj3ust double rotation Text Classes 371 Places the text in the coordinate system defined by Specifies the if the position of the text 1s specified in physical coordinates normalized coordinates 372 Text Classes nnumformat ndecimal xjust yjust rotation or Net device coordinates Use one of the position constants DEV POS PHYS POS NORM GRAPH POS NORM PLOT
224. Viewer example extracted from the example program NewDemosRev2 VerticalDatasetViewerChart Rectangle2D posrect new Rectangle2D 0 725 0 1 0 25 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 9 FontStyle Regular ChartObj TIMEDATEFORMAT 24HMS datasetViewerl SetFormatTemplate 1 etimetemplate Visual Basic Dim posrect As New Rectangle2D 0 725 0 1 0 25 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 22 Adding Lines Shapes Images and Arrows to a Chart ChartShape Arrow ChartImage It is not possible to take into account every possible graphical o
225. XY40 XY41 XY42 XY43 XY44 Bar plots can have the values of the bars displayed above or inside each bar If you plan to implement scrolling panning along the x axis using a scroll bar or some other method you need to know how to re scale the x scale EventCoordinate system First understand that the underlying coordinate system is a Cartesian coordinate system with the x axis scaled from 0 to the number of ChartEvent objects with unique time stamps Because a simple linear scale is used for the x axis you can scale the x axis using simple linear values 0 to number of ChartEvent objects In that case you use the EventCoordinates ScaleStartX and EventCoordinates ScaleStopX properties The code below is extracted from the ChartEventExamples OHLCEventChart example program C public void UpdateScaleAndAxesUsingEventIndex int startindex pTransforml ScaleStartX startindex pTransforml ScaleStopX startindex numberEventsInView 1 pTransform2 ScaleStartX startindex pTransform2 ScaleStopX startindex numberEventsInView 1 pTransform3 ScaleStartX startindex pTransform3 ScaleStopX startindex numberEventsInView 1 xAxisl CalcAutoAxis yAxisl CalcAutoAxis 1 51 1 51 Labl CalcAutoAxisl Labl CalcAutoAxisl Labels Labels 146 Scaling and Coordinate Systems InView 1 InView 1 InView 1 xAxis2 CalcAutoAxis xAxis2 SetAx
226. a NASDAQData stocktooltip SetDataToolTipFormat ChartObj DATA TOOLTIP CUSTOM Stocktooltip SetEnable true chartVu SetCurrentMouseListener stocktooltip Visual Basic Class CustomToolTip Inherits DataToolTip Private 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 stockprices As Double ByVal xs As ChartCalendar ByVal nasdaqs As Double ByVal stockvolumes As Double MyBase New component xValues xs StockPriceData stockprices StockVolumeData stockvolumes NASDAQData nasdaqs stockpanel GetTextTemplate End Sub New Public Overrides Sub OnMouseUp ByVal mouseevent As MouseEventArgs Data ToolTips 337 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 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 GetNearestPointIndex Dim transform As P
227. a points are connected using a straight line or a step line SimpleLinePlot constructor 246 Simple Plot Objects Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates _ ByVal dataset As SimpleDataset ByVal attrib As ChartAttribute public SimpleLinePlot PhysicalCoordinates transform SimpleDataset dataset ChartAttribute attrib E transform The coordinate system for the new SimpleLinePlot object dataset The line plot represents the values in this dataset attrib Specifies the attributes line color thickness and style fill color and fill mode for the line plot A ChartAttribute object sets the objects global line color line thickness line style fill color and fill mode Change the ChartAttribute object using the objects SetChartObjAttributes method There is also a group of methods that set individual simple plot properties SetColor SetLineWidth and SetLineStyle 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 SimpleLinePlots class LineFill C TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale DatasetArray ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR ChartAttribute attribl new ChartAttribute Color Blue
228. a table The MagniView class represents a new way to zoom data Introduction 3 A CoordinateMove class is used to pan the coordinate system left right up down 5 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 Box and Whisker Plots are used in Descriptive Statistics 150 New York Houston San Francisco Boston Pittsburgh 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 4 Introduction Daily Stock Price Price NASDAQ 1 05 09 1 12 09 1 19 09 1 26 09 2 02 09 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 A Ring chart Introduction 5 The ring chart is a similar to a pie chart It uses segmented rings instead of pie shaped wedges The SimpleVersaPlot plot type can look like a
229. ab SetColor Color White chartVu AddChartObject xAxisLab Dim yAxisLab As New NumericAxisLabels yAxis yAxisLab SetColor Color White yAxisLab SetAxisLabelsFormat ChartObj CURRENCYFORMAT chartVu AddChartObject yAxisLab Dim yaxistitle As New AxisTitle yAxis theFont yaxistitle SetColor Color White chartVu AddChartObject yaxistitle Millions Dim ygrid As New Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR ygrid SetColor Color White ygrid SetLineWidth 1 chartVu AddChartObject ygrid Dim attribl As New ChartAttribute Color Green attribl SetFillFlag True Dim thePlotl As New SimpleBarPlot pTransforml ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 DashStyle Solid Color Green Datasetl Dog weir ied ChartObj JUSTIFY CENTER Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalue Set TextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue True chartVu AddChartObject thePlotl Dim theTitleFont As New Font Microsoft Sans Serif 14 FontStyle Bold mainTitle New ChartTitle pTransforml theTitleFont Production of Green Bars is Up mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color White
230. able 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 n earestPoint GetX nearestPoint Gery 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 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 textCoordsFont rNumericLabelCntr nearestPoint GetX nearestPoint GetY PHYS POS DECIMALFORMAT 0 Nudge
231. ackground pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 Color FromArgbo 90 20 155 ChattObj 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 SetFillFlag true HistogramPlot thePlotl new HistogramPlot pTransforml Datasetl 0 0 attribl NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj PERCENTFORMAT bardatavalu thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se thePloti Se chartVu Add Simple Plot Objects 287 e SetColor Color Black tBarDatapointLabelPosition ChartObj INSIDE BAR tPlotLabelTemplate bardatavalue tShowDatapointValue true tSegmentAttributesMode true tSegmentFillColor 0 Color Red tSegmentFillColor 1 Color Magenta tSegmentFillColor 2 Color Blue tSegmentFillColor 3 Color Green tSegmentFillColor 4 Color Yellow tSegmentFillColor 5 Color Pink ChartObject thePlotl1 Visual Basic Dim Dataset Dim pTransf pTransforml pTransforml pTransforml pTransforml pTransforml Dim graphba 1 As New Group
232. 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 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 _ Cf public Grid Axis xaxis Axis yaxis int gridaxistype 238 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 a
233. adient cg attribl SetFillFlag true thePlotl new SimpleVersaPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0 attrib ChartObj JUSTIFY CENTER NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartOb j CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue true chartVu AddChartObject thePlotl1 260 Simple Plot Objects Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green Dim barcolors As Color Color Red Color Orange Color Yellow Color White Dim barbreakpoints As Double 0 0R 80 160 240 Dim gradmode As Integer ChartGradient GRADIENT MAPTO PLOT PHYSICAL COORDINATES Dim cg As New ChartGradient pTransforml gradmode barcolors barbreakpoints 90 attribl Gradient cg 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 SetShowDatapo
234. age needs to be invoked from an HTML page that references Default aspx page as an image file reference A sample HTML file HTMLPagel htm has been included as part of the project The HTML page connects the Default aspx program to an image tag that can be displayed in a browser lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtmll DTD xhtmll transitional dtd lt html xmlns http www w3 0rg 1999 xhtml gt lt head gt lt title gt Untitled Page lt title gt lt head gt lt body gt lt FORM id Forml name simplegraph gt lt P gt lt P gt lt IMG height 448 src Default aspx WIDTH 666 amp HEIGHT 448 width 666 name thegraph gt lt P gt lt P gt lt p gt lt input type button value Update Image name B1 onclick updategraph ID Buttonl amp nbsp lt P gt lt input type text name T1 size 152 ID Text1 gt lt P gt lt P gt amp nbsp lt P gt lt P gt HTML Page Containing Graph Image lt P gt lt FORM gt lt body gt lt html gt The HTMLPagel htm has been made the Start page of the project If you run the project it will display the HTML Pagel htm file in a browser and that in turn will invoke the Default aspx page which creates the chart and transfers it to the image tag of the HTMLPage htm page 420 Using QCChart2D for Net to Create Web Applications Untitled Page Windows Internet Explorer http localhost 2322
235. ainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH chartVu AddChartObject mainTitle Font theFooterFont new Font SansSerif 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 33 33 O DashStyle Solid attribi SetPFillColor Coler FromArgb 177 33 33 Font legendFont new Font SansSerif 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 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 SetFillColor Color FromArgbo 177 33 33 attribl SetFillFlag True Legends 363 Dim thePlotl As New BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribl chartVu AddChart
236. aintains a one to one coordespondence in the printing engine The aspect ratio of the view is maintained PRT RECT Print the view to the specified rectangle specified using the SetPrintRect method and normalized coordinates Regardless of the print rectangle the aspect ratio of the chart is maintained Call the ChartPrint DoPrintDialog method after creating the ChartPrint object Then call the ChartPrint DoPrintPage method rendering the chart to the printer If the DoPrintDialog method is not called prior to DoPrintPage the DoPrintPage method automatically invokes the DoPrintDialog method Subsequent calls to DoPrintPage will not invoke the DoPrintDialog method Using All of the Paper When Printing The PRT MAX mode prints the chart as large as possible while maintaining the same aspect ratio as the original ChartView If the width 1s the limiting factor the bottom of the printed page will always be blank The same is true of the PRT RECT mode While the PRT RECT mode can control the size and position of the chart on the printed page it cannot change the aspect ratio of the chart The only way to fill the printed page in portrait or landscape mode is establish the screen ChartView size with the same aspect ratio as the 8 1 2 x 11 printed page printable area about 6 5 x 9 assuming the 1 inch default margins Assuming portrait mode a ChartView sized to 650W x 900H will fill the page as will other ChartView sizes with the same proportion
237. ajor 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 188 Axes 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 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
238. al to the range of the radial scale centered on the origin Class AntennaAxes GraphObj Axis LinearAxis 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 204 Axes 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 Creating antenna axes There is only one constructor for AntennaAxes objects AntennaAxes AntennaCoordinates transform transform The transform coordinate system defines the a
239. ale 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 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 This class is a concrete implementation of the AutoScaleclass It calculates scaling values based on the numeric values in EventSimpleDatasetand EventGroupDatasetobjects The evnet classes use it for auto scale calculations 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 chart objects have certain information in common This includes instances of ChartAttribute and PhysicalCoordinates classes The ChartAttribute class contains basic color line style and gradient 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 Class Architecture 31 derived objects axes plots labels title etc to a graph using
240. ale 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 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 132 Scaling and Coordinate Systems Visual Basic Dim xData As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 Dim yData As Double 10
241. ale the plot area of a chart A well defined visually appealing chart will display one or more axes with the following characteristics Minimum and maximum values for axes endpoints that are appropriate for the displayed data SJ Appropriately spaced axis tick marks that permit the user to easily interpolate by simple inspection data values located between labeled tick marks Axis tick mark labels that fall on logical even intervals Flexible axis placement inside or outside the plot area Axes for linear date time elapsed time event 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 physical 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 10096 of chart plot ar
242. alue 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 68 Chart Datasets Visual Basic Dim x1 As Double 10 20 30 40 50 Dim yl As Double 9 21 20 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 2 0 5 2 1 7 x2 n2 1 100 yz o 15 y2 1 25 y2 n2 1 100 Dim Dataset2 As SimpleDataset New SimpleDataset Second x2 y2 C double xl 10 20 30 40 50 double yl 9 21 20 40 30 SimpleDataset Datasetl new SimpleDataset First x1 yl int n2 9 double x2 new double n2 dimension is size not upper limit double y2 new doub
243. alues You can also modify a point at a time using SetEvent If you need to add new points to the dataset increasing its size use one of the AddEvent or InsertEvent methods Delete data points using the DeleteEvent method In order to see the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a simple event datasets extracted from the ChartEventExamples SimpleEventChart example program C int nnumpnts 10 ChartCalendar xl new ChartCalendar nnumpnts double yl new double nnumpnts ChartCalendar currentdate new ChartCalendar 1998 ChartObj JANUARY 1 ChartEvent chartevents new ChartEvent nnumpnts int 22 double startx 1 for i 0 i lt nnumpnts itt if i 0 1 0 100 1 0 ChartCalendar currentdate Clone chartevents 0 new ChartEvent x1 0 startx 1 0 chartevents 0 AxisLabel XY 0 currentdate Add ChartObj MONTH 12 1 1 1 ChartCalendar currentdate Clone ylli ylli 1 25 0 55 ChartBupport GetRandomDouble t chartevents i new ChartEvent xl i i startx 1 1 chartevents i AxisLabel XY i ToString currentdate Add ChartObj MONTH 12 88 Chart Datasets theFont new Font Microsoft Sans Serif 10 FontStyle Bold EventSimpleDataset Datasetl new EventSimpleDataset Actual Sales chartevents EventCoordinates pTransforml new EventCoordinates D
244. and displayed in a chart ChartShape This class encapsulates a System Drawing Drawing2D 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 System Drawing Drawing2D 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 MoveObj FindObj DataCursor MoveData DataToolTip ChartZoom Class Architecture 59 This class implements Net 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 custom version of the class This class extends the MouseListener class and it can select char
245. ange So if your events are spaced approximately 5 seconds apart you will get a minor tick mark for approximately every three events If you choose a MajorTickCrossoverEvent of ChartObj MINUTE and an AxisMajorNthTick of 1 this will cause a major tick mark to be displayed every minute if an event falls within that range Tick marks only show up on an event so if there are no events within the time Axes 197 interval no tick mark will appear Creating a Event Axis There are two main constructors for EventAxis objects The first EventAxis constructor assumes that the axis extents match the extents of the underlying coordinate system transform The second EventAxis constructor sets the axis extents to the specified minimum and maximum values regardless of the underlying coordinate system EventAxis constructors Visual Basic Overloads Public Sub New ByVal ByVal ByVal transform As PhysicalCoordinates _ tickrule As TICK RULE _ axtype Integer Overloads Public Sub New ByVal ByVal ByVal ByVal ByVal transform PhysicalCoordinates tickrule As TICK RULE _ axtype As Integer minval As TimeSpan _ maxval As TimeSpan _ public ElapsedTimeAxis PhysicalCoordinates transform TICK RULE tickr ls int axtype public ElapsedTimeAxis PhysicalCoordinates transform TICK RULE tickrule int axtype double minval double maxval transform Places the axes in the
246. anized 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 40 Class Architecture 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 values The most common example of antenna charts is the display of antenna performance and specification graphs The contour 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 240
247. aph objects in Dim chartVu As ChartView New ChartView Add the 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 Font labelfont new Font Helvetica 10 FontStyle BOLD 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 Axis Labels 223 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 ElapsedTimeA xisLabels GraphObj ChartText AxisLabels ElapsedTimeAxisLabels The ElapsedTimeAxisLabels class extends the AxisLabels class and
248. aphObj 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 Another interesting technique is to place a fixed size ChartView object in a Windows Form that has the AutoScroll property set to true The size of the ChartView window can much larger than the Form window size Place the chart in a form that has the AutoScroll property set to true The auto scroll feature of the Form displays scroll bars when the chart object is larger than the containing form The scroll bars permit the user to pan left right up and down to view the portion of the ChartView window that is outside of the clipping limits of the Form window See the FixedSizeScrollable tab of the ResizeExamples program for an example There are many more variations Just remember that the ChartView class is a UserControl derived class and it can be used anywhere
249. 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 _ Ct 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 Chart Datasets 093 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 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 cla
250. artCalendar numgroups nnumpnts Simple Plot Objects 279 1 0 0 new ChartCalendar 2002 ChartObj JANUARY 1 yl 1 0 new ChartCalendar 2003 ChartObj JANUARY 1 1 1 5 1 0 1 new ChartCalendar 2002 ChartObj JANUARY 1 yl 1 1 new ChartCalendar 2002 ChartObj MAY 1 1 1 0 17 new ChartCalendar 2002 ChartObj JULY 1 yl 1 17 new ChartCalendar 2002 ChartObj OCTOBER 1 theFont new Font SansSerif 10 FontStyle Bold TimeGroupDataset Datasetl new TimeGroupDataset Actual Sales x1 y1 TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES NEAR pTransforml SwapScaleOrientation pTransforml SetScaleStartY 0 pTransforml SetGraphBorderDiagonal 0 22 15 95 0 8 Define axes axes labels and grids LE loatingBarPlot thePlotl new FloatingBarPlot pTransforml hartAttribute attribl new ChartAttribute Color Black 1 DashStyle Solid Color Green attribl SetFillFlag true thePlotl InitFloatingBarPlot Datasetil 0 75 attribl ChartObj JUSTIFY CENTER t Q hePlotl SetBarOrient ChartObj HORIZ DIR hartVu AddChartObject thePlotl1 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 y1 0 0 New ChartCalendar 2002 ChartObj JANUARY 1
251. artObject 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 pTransforml subheadFont class2Average 0 9 0 55 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddChartObject class2AverageLabel Visual Basic classlAverage Datasetl GetAverageY class2Average Dataset2 GetAverageY Dim classlLabel As New StringLabel pTransforml subheadFont _ Class 1 Control Chars 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 376 Text Classes class2AverageLabel New NumericLabel pTransforml1 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 us
252. artView derived UserControl is added to a Form annoying We found it was very easy to initialize properties in a ChartView subclass only to have them over ridden in hidden InitializeComponent code So we added the DesignerSerializationVisibility DesignerSerializationVisibility Hidden compiler flag in front of all ChartView properties to force the VS IDE to ignore them Tutorials Tutorials that describe how to get started with the QCChart2D for Net charting software are found in Chapter 24 Using OCChart2D for Net to Create Windows Applications and Chapter 25 Using OCChart2D for Net to Create Web Applications 12 Introduction QCChart2D for Net Background Charting is the display of quantitative information using a combination of lines points bars colors curves text and images Charts are a relatively new invention first organized categorized and extensively used by William Playfair 1759 1823 in the late 18th century The purpose of charts has remained unchanged since that time A chart replaces a tabular numeric display of information with a graphical image that visually shortcuts to the underlying pattern in the data A chart does not have to be an output only display medium A chart can be interactive where a user interacts with a chart using the mouse and keyboard changing colors changing axes limits highlighting data values are just a few of the interactive options programmers want in the charts they create
253. arting 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 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 component that can be placed and positioned in UserControl windows using a Net layout managers UserControl ChartView The ChartView class has only one constructor with no arguments ChartView constructor Visual Basic Public Class ChartView Inherits UserControl public class ChartView UserControl 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
254. ase tViewer chartVu pTransforml posrect Datasetl 2 10 0 datasetViewerl EnableEdit true datasetViewerl DatasetTable TableBackgroundMode ChartGeneralizedTableDisplay TABLE SINGLE COLOR BACKGROUND GRIDCELL datasetViewerl UseStripedGridBackground true datasetViewerl RowHeaderFont new Font Microsoft Sans Serif 11 FontStyle Regular datasetViewerl ColumnHeaderFont new Font Microsoft Sans Serif 10 FontStyle Regular datasetViewerl GridCellFont new Font Microsoft Sans Serif 9 FontStyle Regular datasetViewerl SyncChart true Visual Basic Dim posrect As New Rectangle2D 0 05 0 67 0 9 0 26 Dim rows As I startindex As Integer nteger 4 columns As Integer 10 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 10 FontStyle Regular datasetViewerl ColumnHeaderFont _ New Font Microsoft Sans Serif 10 FontStyle Regular datasetViewerl GridCellFont _ New Font Microsoft Sans Serif 9 FontStyle Regular datasetViewerl SyncChart True Group DatasetViewer example extra
255. aset TimeGroupDataset CompressTimeFieldSimpleDataset TimeGroupDataset CompressTimeFieldGroupDataset that operate on the FAQs 459 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 nNumPnts 1000000 TimeSimpleDataset RawDataset new TimeSimpleDataset Raw xtimedata ydata nNumPnts int compressXmode ChartObj DATACOMRESS AVERAGE int compressYmode ChartObj DATACOMRESS MINMAX int compressTimeField Calendar MONTH TimeSimpleDataset CompressedDataset RawDataset CompressTimeFileSimpleData compressXmode compressYmode compressTimeField 0 nNumPnts Compressed Visual Basic nNumPnts 1000000 Dim RawDataset As TimeSimpleDataset new TimeSimpleDataset Raw xtimedata ydata nNumPnts Dim compressXmode As Integer ChartObj DATACOMRESS AVERAGE Dim compressYmode As As Integer ChartObj DATACOMRESS MINMAX Dim compressTimeField As Integer Calendar MONTH Dim CompressedDataset As TimeSimpleDataset _ RawDatas
256. asic 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 Control 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 Scaling and Coordinate Systems 151 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
257. ask 0 Find nearest point for each line plot object Point2D location GetLocation bfoundl thePlotl 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 nearestPointObj2 GetNearestPointMinDistance nearestPoint nearestPointObjl 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 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 pointLabel SetTextNudge 5 5 chartVu AddChartObject pointLabel chartVu UpdateDraw Visual Basic Public Class CustomChartDataCursor Inherits DataCursor Private Private Private Private Private pointLabel As NumericLabel textCoordsFont As New Font SansSerif 8 FontStyle Regular rNumericLabelCntr As Double 0 0 cplotl As SimpleLinePlot cplot2 As SimpleLinePlo
258. asses that define various collections of objects such as lists queues bit arrays hashtables and dictionaries Directory Structure of QCChart2D for Net The QCChart2D for Net class library uses the following directory structure Drive Quinn Curtis Root directory Introduction 15 DotNet Quinn Curtis Net based products directory Docs Quinn Curtis Net related documentation directory Lib Quinn Curtis Net related compiled libraries and components directory QCChart2D Language specific code directory Visual CSharp C specific directory QCChart2DClassLib contains the source code to the QCChart2DNet dll library installed only if the source code has been purchased Examples CZ examples directory Effective 7 25 05 the examples have been reorganized into categories to make it easier to find the code behind a specific chart AntennaCharts A simple antenna chart example Bargraphs Horizontal vertical stacked group histogram floating CalendarData Line plots bar plots and log plots that use time date data Also reading time date data from a file ChartAxes Linear logarithmic time date custom hours time date and polar axes Also axes labels ChartEventExamples A variety of examples using ChartEvent objects as the source data ConsoleApplicationl a headless console app that renders chart images directly to an image file without displaying the chart on a Windows form
259. ata 1 0 26 gh kPriceData 2 0 24 WwW i 1 To nNumPnts 1 xValues i DirectCast currentdate Clone ChartCalendar StockPriceData 3 i stockPriceData 3 i 1 3 0 52 ChartSupport GetRandomDouble close stockPriceData 0 1 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 minval 1 5 ChartSupport GetRandomDouble low currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode Next Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData Dim compressarray As Integer New Integer 3 compressarray 0 ChartObj DATACOMPRESS AVERAGE compressarray 1 ChartObj DATACOMPRESS MAX compressarray 2 ChartObj DATACOMPRESS MIN compressarray 3 ChartObj DATACOMPRESS AVERAGE Dim pTransforml As New TimeCoordinates pTransforml SetWeekType ChartObj WEEK 5D pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 13 0 15 0 9 0 8 Dim graphbackgroundl As New Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 127 127 127 Color FromArgb 55 55 55 Ch rtObg Y AXIS chartVu AddChartObject graphbackgroundl Dim p
260. atasetl Visual Basic Dim nnumpnts As Integer 20 Dim 1 As ChartCalendar New ChartCalendar nnumpnts 1 Dim yl As Double New Double nnumpnts 1 Dim currentdate As New ChartCalendar 1998 ChartObj JANUARY 1 Dim chartevents As ChartEvent New ChartEvent nnumpnts 1 Dim i As Integer Dim startx As Double 1 For 0 To nnumpnts 1 If i 0 Then y1 0 100 x1 0 DirectCast currentdate Clone ChartCalendar chartevents 0 New ChartEvent x1 0 startx 1 0 chartevents 0 AxisLabel XY amp 0 currentdate Add ChartObj MONTH 12 Else xl i DirectCast currentdate Clone ChartCalendar yl i yl i 1 25 0 55 ChartSupport GetRandomDouble chartevents i New ChartEvent xl i i startx yl i chartevents i AxisLabel XY amp i ToString currentdate Add ChartObj MONTH 12 End If Next theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New EventSimpleDataset Actual Sales chartevents Dim pTransforml As New EventCoordinates Datasetl 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
261. atasetsArray 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 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 yDatal As Double 10 22 33 44 55 46 33 25 14 9 Dim yD ta2 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 11 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 TimeCoor
262. ate 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 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 Chart Scaling and the Net Drawing2D Matrix The System Drawing Drawing2D Matrix class can handle a large number of scaling operations including linear operations that look at first glance capable of transforming chart physical coordinates to Net device coordinates Why not use the Drawing2D Matrix class There are at least four reasons First the Drawing2D Matrix class not only scales the endpoints of li
263. ates xMin yMin xMax yMax TimeCoordinates constructor with explicit scaling of a numeric based x scale and a time based y scale C double xMin 0 double xMax 1054 ChartCalendar yMin ChartCalendar yMax new ChartCalendar 1996 ChartObj FEBRUARY 5 new ChartCalendar 2002 ChartObj JANUARY 5 TimeCoordinates simpleTimeScale simpleTimeScale new TimeCoordinates xMin yMin xMax yMax 120 Scaling and Coordinate Systems Visual Basic Dim xMin As Double 0 Dim xMax As Double 105 Dim yMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim yMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim simpleTimeScale As TimeCoordinates simpleTimeScale new TimeCoordinates yMin xMax yMax Another technique uses the default constructor and scales the coordinates using the TimeCoordinates SetTimeCoordinateBounds method Example of explicit scaling of a TimeCoordinates object time x scale and numeric y scale 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 Visual Basic Dim xMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim
264. atingStackedBarPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF YEAR 0 75 attribArray ChartObj JUSTIFY CENTER hePlot1 SetFastClipMode ChartObj FASTCLIP X hartVu AddChartObject thePlotl1 0 Q Cy et Visual Basic Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData 282 Simple Plot Objects pTransforml New TimeCoordinates pTransforml SetWeekType weekmode pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 1 0 15 0 9 0 75 SetInitialDates pTransforml Dim graphbackgroundl As New Background pTransforml ChartObj GRAPH BACKGROUND Color White Color LightGray ChartObj Y AXIS chartVu AddChartObject graphbackgroundl Dim plotbackgroundl 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 C
265. aultattrib 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 defaultattrib fillattrib chartVu AddChartObject thePlotl Dim theTitleFont As New Font Microsoft Sans Serif 18 FontStyle Bold Dim mainTitle As New ChartTitle pTransforml theTitleFont Candlestick Plots in Technical Analysis 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 Dim footer As New ChartTitle pTransforml theFooterFont The Open Close box is filled if the open price is greater than the close price footer SetTitleType ChartObj footer SetTitlePosition Char footer SetTitleOffset 8 footer SetColor Color White chartVu AddChartObject footer CHART FOOTER Save the chart as an image file Dim chartimage As New BufferedImage chartVu chartimage SaveImage CandlestickPlot jpg End Sub End Module tObj CENTER GRAPH ImageFormat Jpeg 24 Using QCChart2D for Net to Create Windows Applications Critical Note Running the Example Programs The example programs for QCChart2D charting software are supplied in complete source I
266. b3 new ChartAttribute Color Red l DashStyle Solid ttrib3 SertFillColor Color Red ttrib3 SetFillFlag ttrib3 SetSymbolSize 6 impleScatterPlot thePlot3 new SimpleScatterPlot pTransforml Dataset3 ChartObj CIRCLE attrib3 chartVu AddChartObject thePlot3 Ud me o 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 ChartObj CROSS attribl chartVu AddChartObject thePlotl Dim attrib2 As New ChartAttribute Color Green 3 DashStyle Solid Dim thePlot2 As New SimpleLinePlot pTransforml Datasetl attrib2 chartVu AddChartObject thePlot2 im attrib3 As New ChartAttribute Color Red 1 DashStyle Solid ttrib3 SetFillColor Color Red ttrib3 SetFillFlag True ttrib3 SetSymbolSize 6 im thePlot3 As New SimpleScatterPlot pTransforml Dataset3 ChartObj CIRCLE attrib3 chartVu AddChartObject thePlot3
267. bars as a function of time in this case a width of 8 months Simple Plot Objects 251 Simple bar plot example that displays numeric data values extracted from the example program Bargraphs class SimpleBars 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 attribpl 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 thePlotl1 Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag True Dim thePlotl As New SimpleBarPlot pTransforml Datasetl _ ChartCalendar GetCalendarWidthValue ChartObj MONTH 8 D 0 attribl ChartObj JUSTIFY CENTER Dim bardatavalue As NumericLabel thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartOb j CURRENCYFORMAT bardatavalue SetDecimalPos 0 bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue True chartVu A
268. bars start at the value rbarbase and extend to the histogram bar values represented by the dataset 286 Simple Plot Objects attrib Specifies the attributes line color and line style 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 example extracted from the example program Bargraphs class HistogramBars C int nnumpnts 6 int numgroups 2 double xl new double nnumpnts double yl new double numgroups nnumpnts height width 0 1 0 01 12 yil 1 0 13 xl l e 13 yL 0 1 e 977 vill 1 e 7 xl 2 20 y1 0 2 80 y1 1 2 10 xl 3 e 30 yl 0 3 447 yl 1 3 10 1 4 40 y1 0 4 28 1 1 4 20 x1 5 60 y1 0 5 4 yl1 1 5 20 theFont new Font SansSerif 10 FontStyle Bold GroupDataset Datasetl new GroupDataset Actual 5 1 5 1 1 CartesianCoordinates pTransforml new CartesianCoordinates pTransforml SetS3caleStartY 0 pTransforml SetScaleStartX 0 pTransforml SetScaleStopX 80 pTransforml SetScaleStopY 1 00 pTransforml SetGraphBorderDiagonal 0 15 15 9 0 75 Background graphbackground new B
269. bject 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 the Arc2D Rectangle2D 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 System Drawing Drawing2D 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 t 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 the rotation origin of shape ChartShape constructor Visual Basic Overloads Public Sub New _
270. bjects include a reference to a ChartGradient object Normally this reference is null signifying that line and area fills work exactly the same as before If the ChartGradient reference is not null the color definitions in the ChartGradient take precedence over the fill color of the ChartAttribute Any area fill object can have a gradient of two or more colors mapped to it The colors are mapped to the area fill object using an array of breakpoints one for each color that define the transition points for one color to the next The values of the breakpoints are interpreted according to one of four different mapping modes 164 Background Colors Textures and Gradients GRADIENT MAPTO OBJECT In this mapping mode the breakpoints are expected to be in the range of 0 0 to 1 0 The break points are applied as percentages to the area fill object The value 0 0 corresponds to the start of the area fill object and the value 1 0 corresponds to the end of the area fill object It does not matter how large or small the area fill object is all of the gradient colors will map to that object This mapping mode would normally used with just two colors though it will work with an unlimited number of colors GRADIENT MAPTO OBJECT applied to a simple bar graph lol xl SimpleBars DoubleBarPlot GroupBargraphs HistogramBars FloatingBars FloatingBars2 BostonClimate JapariWorkforce LandOfTheFry NasaSpending MedicareDrugCosts Production of
271. c Dim Datasetl As TimeSimpleDataset New TimeSimpleDataset Sales xl yl Dim simpleTimeCoordinates As TimeCoordinates New TimeCoordinates simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR _ ChartObj AUTOAXES FAR Dim chartVu As ChartView New ChartView 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 The following code would be in the code handling the rescale event Rescale chart based on a modified Datasetl datset simpleTimeCoordinates AutoScale Datasetl1 ChartObj AUTOAXES FAR _ ChartObj AUTOAXES FAR xAxis CalcAutoAxis yAxis CalcAutoAxis Redraw the chart using the rescaled coordinate system and axes chartVu UpdateDraw FAQs 453 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 const
272. cale 26 27 63 103 105 2 29 30 63 LinearAxis31 33 38 56 64 155 156 157 171 172 173 175 177 178 182 184 191 192 193 196 200 203 204 208 209 211 213 214 221 222 225 226 237 239 240 284 301 302 369 370 398 400 417 422 428 429 442 443 444 445 447 448 451 452 LinearAxis 31 33 38 56 64 143 155 156 157 171 172 173 175 177 178 182 184 191 192 193 195 196 199 200 203 204 208 209 211 213 214 221 222 225 226 230 231 237 239 240 284 301 302 369 370 398 400 406 412 417 422 428 429 433 434 442 443 444 445 447 448 451 452 EinearScale eee 26 27 63 103 105 TinearScale rers 26 277 63 103 105 LineGapPlot 41 47 64 261 287 288 289 290 LineGapPlot 41 47 64 261 287 288 289 290 LogScale eese tes 26 27 63 103 105 Logarithmic auto scaling sese 468 Appendix LogAutoScale eese 29 30 63 Logaritlir ic axis 2n rre ete teet a t edente LogAxis 31 33 38 56 64 171 172 178 179 180 182 208 209 211 237 453 2 29 30 63 LogAxis 31 33 38 56 64 171 172 178 179 180 182 208 209 211 237 453 LogAxis 31 33 38 56 64 171 172 178 179 180 182 208 209 211 237 453 LogsSc
273. ceData 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 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 stockPriceData 0 0 25 open StockPriceData 1 0 26 high stockPriceData 2 0 24 low For 1 To nNumPnts 1 xValues i currentdate Clone stockPriceData 3 1 stockPriceData 3 i 1 3 0 52 ChartSupport GetRandomDouble close stockPriceData 0 1 stockPriceData 3 i _ 2 0 5 ChartSupport GetRandomDouble open minval Math Min sto
274. 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 cells can be edited and the associated chart immediately updated using the synchronize feature Display and edit dataset values in a simple grid E a 2 714 725 721 1 2007 EN 11 01 06 12 01 06 1 01 07 2 01 07 3 01 07 4 01 07 ss 6 01 07 7 01 07 sovr sue 7138 e803 nas 7246 7907 686 SD O The grid can be synchronized to the chart DatasetViewer displaying the contents of a TimeSimpleDataset 10 Introduction Daily Stock Price Price Volume Rass NASDAQ 1840 1820 20 P 1800 FIF VI TI ERU UR ULIS RUE LEE ISI fT py 12 23 08 12 24 08 12 25 08 12 26 08 12 29 08 12 30 08 12 31 08 1 01 09 1 02 09 1 05 09 1 06 09 Lic oaa coca Eod occa d oca 3 0M 20M d EE NM DU DOM 7722 727 72 7 10 M NL m I oo til 260 273 23 253 5 28 22 365 252 26 250 252 24 9 254 258 26 2 249 241 23 3 DatasetViewer display the contents of a TimeGroupDataset Visual Studio 2005 Projects of the example program projects have been converted to the Visual Studio 2005
275. chartVu AddChartObject thePlotl Simple Plot Objects 285 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 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 rbarbase The histogram
276. cialExamples class CandlestickChart C TimeGroupDataset Datasetl new TimeGroupDataset Stock Data xValues stockPriceData 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 ChartObj DAY OF 0 8 defaultattrib 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 default ttrib filla ttrib chartVu AddChartObject thePlotl Note how the ChartCalendar GetCalendarWidth Value 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 CellPlot Simple Plot Objects 273 The CellPlot class extends the Gr
277. cing a coordinate system that takes into account the widths and heights of the cells Simple Plot Objects 275 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 of the 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
278. ck 1 DashStyle Solid Color Red defaultattrib SetFillFlag true ChartAttribute fillattrib new ChartAttribute Color Black 3 DashStyle Solid Color Red fillattrib SetFillFlag true BoxWhiskerPlot thePlotl new BoxWhiskerPlot pTransforml 0 25 fillattrib thePlotl AddPopulation NYCity 1 thePlotl AddPopulation Houston 2 thePlotl AddPopulation SanFrancisco 3 thePlotl AddPopulation Boston 4 thePlotl AddPopulation Pittsburgh 5 thePlotl BWFormat 1 thePlot1 BarDatapointLabelPosition ChartObj CENTERED BAR thePlotl PlotLabelTemplate TextFont new Font Microsoft Sans Serif 8 FontStyle Regular thePlotl PlotLabelTemplate DecimalPos 1 thePlotl ShowDatapointValue true label outliers thePlotl ScatterPlot ShowDatapointValue true thePlotl AutoBWChart chartVu AddChartObject thePlotl1 Visual Basic New York City nim NYCity As Doubile 31 5 33 6 42 4 52 5 62 7 71 6 130 79 8 75 5 BB ey 57 5 47 6 36 61 Houston Dim Houston As Double 50 4 53 9 60 6 68 3 74 5 80 4 _ B 100 82 5 82 3 78 2 89 6 61 53 5 San Francisco 268 Simple Plot Objects Dim SanFrancisco As Double 48 7 52 2 53 3 55 6 58 1 _ pleny Geely Gorily 95 24 Ble Pr 49 4 Boston Dim Boston As Double 32 4 53 9 44 6 58 3 64 5 70 4 _ 73 SU 72 6 7853 49 9 2 21 33 5 Pittsburgh Dim Pittsburgh As Double 41 4 54 24 6 38
279. ckPriceData 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 Chart Datasets 95 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 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 CVS file Datasetl WriteTimeGroupDataset csvDataFile TimeGroupDatasetl csv Read it back in just as a test Datasetl ReadTimeGroupDataset csvDataFile TimeGroupDatasetl csv 0 0 Elapsed Time Dataset Class ElapsedTimeGroupDataset ChartObj ChartDataset GroupDataset ElapsedTimeGroupDataset The ElapsedTimeGroupDataset class represents group data where every x value can have one or more y values
280. class OHLCChart C 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 1 ChartObj DashStyle Solid Color Red attribl SetFillFlag true OHLCPlot thePlotl new OHLCPlot pTransforml Datasetl ChartCalendar GetCalendarWidthValue ChartObj DAY OF 0 75 abtribl chartVu AddChartObject thePlotl Visual Basic Dim Datasetl As New TimeGroupDataset Stock Data xValues stockPriceData 294 Simple Plot Objects 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 GetCalendarWidth Value method calculates the width of the bars as a function of time in this case a width of 0 75 days Stacked Bar Plots Class StackedBarPlot
281. columnskip As Integer _ Ct public EventSimpleDataset 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 Chart Datasets 87 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 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 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 v
282. com quinncurtis chart2dnet ChartView only needs to be performed once Any instance of the control that you add to any form in the project will derive from UserChartControll Build the Solution Build Build Solution This will compile the UserChartControll class and make it accessible as a component on the Toolbox and to derive from If the project fails to compile you need to go back and check the previous steps You can create as many custom chart controls as your application requires Each custom chart control will inherit from the com quinncurtis chart2dnet ChartView control Or Optional You can create inherited controls from the UserChartControll class that you already created Create an inherited control by selecting Project Add Inherited Control Give the inherited control a unique name 1 UserChartInheritedControll When you select Open choose UserChartControll in the Inheritance Picker The result is new control added to the project Build the solution and the UserChartInheritedControll control will be added to the Toolbox in addition to the UserChartControll Right click on the UserChartControll form and view the underlying C code We placed all of the chart customization code in the InitializeChart method Until this method is called the UserChartControll appears as an empty shell Sometimes it is best to call this method from somewhere outside of the class the Load event of your main form for example to avoid problem
283. constants NOSYMBOL SQUARE TRIANGLE DIAMOND CROSS PLUS STAR LINE HBAR VBAR or CIRCLE The color and fill attributes for the legend item are copied from the attributes of this ChartPlot object Specifies a user defined shape to use as the legend item symbol Specifies the ChartAttribute object to get the color and fill attributes of the legend item Specifies the text font for the legend item The AddLegendltem returns the current number of legend items Simple legend example extracted from the example program PolarCharts class PolarLineFillAndScatterChart C Legends 359 SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl SimpleLinePlot thePlot2 new SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 SimpleLinePlot thePlot3 new SimpleLinePlot pTransforml Dataset3 profitAttrib Font legendFont new Font SansSerif 14 FontStyle Bold ChartAttribute legendAttributes new ChartAttribute Color Gray 1 DashStyle Solid Color FromArgb 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
284. coordinate system defined by transform tickrule Specifies the tick rule used to calculated the tick marks NO TICKS MINOREVENT MAJOREVENT MAJOREVENT MINORCROSSOVEREVENT MAJORCROSSOVEREVENT MAJORCROSSOVEREVENT axtype Specifies if the axis is an x axis AXIS or a y axis Y AXIS minval Sets the minimum value for the axis maxval Sets the maximum value for the axis 198 Axes 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 _ Ct 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 _ public void SetAxisTicks double tickorigin double tickspace int ntickspermajor public void SetAxisTicks double tickorigin
285. cted from the example program NewDemosRev2 GroupDatasetViewer Daily Stock Price 26 3 27 0 24 6 A DatasetViewer displaying a TimeGroupDataset display open high low close data C Text Classes 381 Rectangle2D posrect new Rectangle2D 0 03 0 67 0 9 0 24 DatasetViewer DefaultFont new Font FontFamily GenericSansSerif 9 FontStyle Regular DatasetViewer datasetViewerl new DatasetViewer chartVu pTransforml posrect Datasetl 5 12 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 67 0 9 0 24 DatasetViewer DefaultFont _ New Font FontFamily GenericSansSerif 9 FontStyle Regular Dim datasetViewerl As New DatasetViewer chartVu pTransforml posrect Dataserl 5 12 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 Vertical Orientation Dataset
286. d PolarAxes polaraxis int gridtype public PolarGrlid 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 major and minor tick marks GRID ALL of the reference polar axis gridangletype Specifies 1f 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 SetLineWidth SetLineStyle and SetColor methods are used to customize the drawing properties of the lines used to draw the axes lines and tick marks Polar grid example 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 new ChartView Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarGrid 242 Axis Grids Visual Basic Dim polarmagnitude As D
287. d 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 S 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 it is not useful and in many cases misleading to scale a graph us
288. d initializes the size and position of the plot area inside the graph area 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 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 110 Scaling and Coordinate Systems Visual Basic Public Sub SetGraphBorderInsets _ ByVal rLeft As Double _ ByVal rTop As Double _ ByVal rRight As Double _ ByVal rBottom As Double _ 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
289. d 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 116 Scaling and Coordinate Systems Example of auto scaling a CartesianCoordinates object that has a logarithmic y scale using a single dataset C double Data 2 3 4 5 9 7 8 9 double 1 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 Dim yData As Double 2 3 4 5 6 7 8 9 2 33 440 5554 46123 332322 5435641 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 or y coordinate values are in the form of time and date records The creation of a powerful yet flexible tim
290. d numeric ranges Linear Minor and Major Tick Mark Intervals 174 Axes 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 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 result 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
291. d to view the main form are not present This means that ChartView derived control will not be visible on the main Form if you attempt to view the main form before the project has been compiled The default state for all of the example projects should be the Start Page Before you do view any other file or form do a build of the project This will cause the intermediate files to be built If you attempt to view the main Form before building the project Visual Studio decides that the ChartView control placed on the main form does not exist and delete it from the project There are two versions of the QCChart2D for Net class library the 30 day trial versions and the developer version Each version has different characteristics that are summarized below 30 Day Trial Version The trial version of QCChart2D for Net is downloaded as a zip file named Trial QCChart2DR20x zip The 30 day trial version stops working 30 days after the initial download The trial version includes a version message in the upper left corner of the graph window that cannot be removed 20 Introduction Developer Version The developer version of QCChart2D for Net is downloaded as a zip file name something similar to NETCHTDEV IR2x5x353x1 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 d
292. dTimeCoordinates 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 20 12 43 54 15 26 63 25 24 19 Dim xData3 As Double 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000 Dim yData3 Double 130 52 13 64 25 76 13 35 24 19 Dim datasetl As ElapsedTimeSimpleDataset New ElapsedTimeSimpleDataset Salesl 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 Scaling and Coordinate Systems 133 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 Class EventCoordinates PhysicalCoordinates CartesianCoordinates EventCoordinates The E
293. data theFont New Font SansSerif 10 Dim Datasetl As New GroupDataset First x FontStyl Color Blue 1 DashStyle Solid new ChartAttribute numGroups ttribl Clone asetl attribArray le Bold yl at Dataset1 SetStackMode ChartObj AUTOAXES STACKED Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE pTransforml AutoScale Datasetl pTransforml SetScaleStartX 0 pTransforml SetScaleStartY 0 ChartObj AU Dim background As New Background pTransform Color FromArgo 255 255 255 chartVu AddChartObject background 0 pTransforml SetGraphBorderDiagonal 0 15 Define axes axes labels and grids Dim attribl attribl SetFillFlag True attribl SetLineFlag False As New ChartAttribute Color Blue ChartObj LINEAR SCALE 5 FAR ChartObj AUTOAXES FAR ChartObj PLOT BACKGROUND Sp 0 9 0 25 1 DashStyle Solid 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
294. datapoint Simple Date Time Dataset Class TimeSimpleDataset ChartObj ChartDataset SimpleDataset TimeSimpleDataset The TimeSimpleDataset uses ChartCalendar dates as one set of the x or y values and floating point values as the other Starting with Revision 2 0 of the software you can have ChartCalendar dates as either the x or y values in a TimeSimpleDatset 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 Note Do not use the TimeSimpleDataset if you want to display data using the elapsed time The TimeSimpleDataset uses a full GregorianCalendar date time and it is not suitable for the display of elapsed time since time intervals do not have an explicit date 70 Chart Datasets i e 10 11 2008 Use the ElapsedTimeSimpleDataset class in combination with an ElapsedTimeCoordinateSystem if you plan to create an elapsed time chart 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 _ Overloads Public Sub New _ ByVal sname As String _ ByVal x As Double _ ByVal y As ChartCalendar
295. 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 QI 228 Axis Labels TIMEDATEFORMAT MMMM MMMM January TIMEDATEFORMAT MMM MMM Jan TIMEDATEFORMAT M TIMEDATEFORMAT DDDD dddd Tuesday TIMEDATEFORMAT DDD ddd Tue TIMEDATEFORMAT D ddd T TIMEDATEFORMAT Y 00 TIMEDATEFORMAT MDY2000 4 12 07 2000 TIMEDATEFORMAT DMY2000 d MM yyyy 7 12 2000 TIMEDATEFORMAT MY2000 M yyyy 7 2000 TIMEDATEFORMAT Y2000 2000 TIMEDATEFORMAT MDY HMS H mm ssnM dd yy 12 23 33 12 07 00 TIMEDATEFORMAT DMY HMS H mm ssnd M yy 23 12 33 12 07 00 TIMEDATEFORMAT MDY HM H mmWM dd yy 12 23 33 12
296. ddChartObject thePlotl Simple Scatter Plots Class SimpleScatterPlot GraphObj ChartPlot SimplePlot SimpleScatterPlot 252 Simple Plot Objects 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 _ Cf public SimpleScatterPlot PhysicalCoordinates transform SimpleDataset dataset int symtype ChartAttribute attrib 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 SetChartObjAttributes 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 symb
297. ddChartObject xAxis chartVu AddChartObject yAxis 452 FAQs The documentation for the various coordinate system and axis classes includes examples of manual scaling 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 x1l yl TimeCoordinates simpleTimeCoordinates new TimeCoordinates simpleTimeCoordinates AutoScale Datasetl ChartObj AUTOAXES FAR f ChartObj AUTOAXES FAR ChartView chartVu new ChartView 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 Basi
298. dding 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 first 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 45 146 147 148 149 150 151 152 153 154 101407 10 2107 10 28 07 11 04 07 11 11 07 1118 07 11 25 07 12 02 07 12 0907 12 16 07 Cental 13747 16021 19239 15844 16560 15447 16169 165 15367 17099 isi A DatasetViewer displaying three TimeSimpleDatasets C Rectangle2D posrect new Rectangle2D 0 05 0 7 0 9 0 2 DatasetViewer datasetViewerl 380 Text Classes new Dat
299. derDiagonal 0 25 15 75 0 85 Background background new Background pAntennaTransform ChartObj GRAPH BACKGROUND Color White 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 ntennaAxesLabels pAntennaAxisLabels AntennaAxesLabels pAntennaAxis GetCompatibleAxesLabels hartVu AddChartObject pAntennaAxisLabels aana Color transparentRed Color FromArgb 180 255 0 0 Color transparentBlue Color FromArgb 180 0 0 255 ChartAttribute attribl new ChartAttribute transparentRed 1 DashStyle Solid attribl SymbolSize 7 ChartAttribute attrib2 new ChartAttribute Color Blue 1 DashStyle Solid Color Blue attrib2 SymbolSize 7 Polar and Antenna Charts 349 ChartAttribute attrib3 new ChartAttribute Color Yellow 3 DashStyle Solid Color Yellow ChartAttribute attrib4 new ChartAttribute Color MediumPurple 2 DashStyle Dot Color MediumPurple AntennaLinePlot thePlotl new AntennaLinePlot pAntennaTransform thePlotl InitAntennaLinePlot Datasetl attribl chartVu AddChartObject thePlotl AntennaScatterPlot thePlot2 new 2 thePlot2 In
300. dinates 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 AUTOAXES FAR 124 Scaling and Coordinate Systems The previous 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 ChartCalendar ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal y2 As Double _ ByVal nweektype As Integer _ Overloads Public Sub New _ ByVal dstart As ChartCalendar _ ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal y2 As Double _ Overloads Public Sub New _ ByVal x1 As Double _ ByVal dstart As ChartCalendar ByVal x2 As Double _ ByVal dstop As ChartCalendar public TimeCoordinates ChartCalendar dstart double yl ChartCalendar dstop double y2 int nweektype public TimeCoordinates double xi ChartCalendar dstart double 2 ChartCalendar dstop public TimeCoordina
301. double y int npostype int timeformat int xjust int just double rotation Text Classes 373 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 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 _ CH public ElapsedTimeLabel PhysicalCoordinates transform ChartCalendar date int timeformat public ElapsedTimeLabel PhysicalCoordinates transform Font tfont TimeSpan timespan double x 374 Text Classes double y int npostype int timeformat just int yjust double rotation timespan The time span value used to initialize the label timeformat 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 transform As PhysicalCoordinates ByVal tf
302. e Request Params Get method The values define the size of the image This is just one way to pass data from the HTML page to the ASP page In some of our other examples we use a key string that specifies which stocks we want to plot Using the behind code page you can query some database and get the data values from there without passing the data through the HTML page In our Chart2DHTMLAspApp and Chart2DAspWebApp examples we query the Yahoo database of historical stock values and get the data from them Once the chart is create and available as a ChartView object use the BufferedImage class to render the chart as a JPEG file and stream the image back in the response stream of the requesting HTML page protected void Page Load object sender EventArgs e Get Input from HTML ASP page request String widthstring Request Params Get 0 String heightstring Request Params Get 1 int imagewidth int Parse widthstring int imageheight int Parse heightstring ChartView chartVu GetInitializeChart imagewidth imageheight Stream chart back as a JPeg image BufferedImage chartimage new BufferedImage chartVu ImageFormat Jpeg get your binary image data here Response ContentType image jpeg chartimage SaveImage Response OutputStream Using QCChart2D for Net to Create Web Applications 419 5 Build the Solution Build Build Solution and resolve any errors that might have crept in The Default aspx p
303. e 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 datasets 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 1 146 147 148 149 150 151 152 153 154 Central 15747 16021 19239 15844 1656 15447 116 165 15367 17099 a E gt A DatasetViewer displaying three TimeSimpleDatasets Class DatasetViewer ChartView DatasetViewer 378 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 cons
304. e and date physical coordinate system for scaling charts is a major challenge Important design goals include The programmer scales the graph using objects of the ChartCalendar class The scale should support a continuous range of date time scaling from milliseconds to hundreds of years The scale should have a 5 7 day week option 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 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 Scaling and Coordinate Systems 117 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 sampled every 15 seconds starting on June 12 2001 11 43 00 PM an
305. e 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 Point3D 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 _ ByVal columns As Integer _ C4 public ContourDataset string sname Point3D grid rows int columns Chart Datasets 77 This constructor creates a new ContourDataset object that represents a surface not necessarily a regular grid 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 _ public ContourDataset string sname Point3D grid hs 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 double double
306. e in the Solution Explorer window and select Add Reference Browse to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL Critical Step Make sure you add the following lines to the top of the UserChartControll vb code to resolve the QCChart2D and other graphics classes used in the example Imports com quinnourtis chartzdnet Imports System Drawing Imports System Drawing Drawing2D The step of creating and defining a User Control that inherits from com quinncurtis chart2dnet ChartView only needs to be performed once Any instance of the control that you add to any form in the project will derive from UserChartControll Using QCChart2D for Net to Create Windows Applications 405 Build the Solution Build Build Solution This will compile the UserChartControll class and make it accessible as a component on the Toolbox and to derive from If the project fails to compile you need to go back and check the previous steps You can create as many custom chart controls as your application requires Each custom chart control will inherit from the com quinncurtis chart2dnet ChartView control Or Optional You can create inherited controls from the UserChartControll class that you already created Create an inherited control by selecting Project Add Inherited Control Give the inherited control a unique name i e UserChartInheritedControll When you select Open choose UserChartControll in the In
307. e 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 Simple Plot Objects 293 public OHLCPlot PhysicalCoordinates transform GroupDataset dataset double rflagwidth ChartAttribute 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 and line style 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 FinancialExamples
308. e mouse button is released the target chart remains at its current values MagniView constructor The constructor below creates a MagniView object for a single chart coordinate system Visual Basic Declaration Public Sub New source As ChartView _ target As ChartView _ transform As PhysicalCoordinates magnirect As Dimension _ C 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 Zooming 327 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 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 cons
309. e 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 line thickness line style fill color and fill mode Change the ChartAttribute object using the objects 250 Simple Plot Objects SetChartObjAttributes method The simple bar plot SetColor method can be used to change the bar color 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 Bargraphs class SimpleBars C TimeSimpleDataset Datasetl new TimeSimpleDataset Actual Sales x1 y1 TimeCoordinates pTransforml new TimeCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartY 0 pTransforml SetTimeScaleStart new ChartCalendar 1997 ChartObj JULY 1 pTransforml SetGraphBorderDiagonal 0 15 15 9 0 8 Background background new Background pTransforml ChartObj GRAPH BACKGROUND Color FromArgb 30 70 70 CQo
310. e 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 442 FAQs 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 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 yAxis2 SetAxisIntercept xAxis GetAxisMax yAxis2 SetAxisTickDir ChartObj AXIS MAX y
311. e 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 Chart Datasets 67 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 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 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 _ ByVal columnskip As Integer _ 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 v
312. e one using the Visual Studio project wizard File New Project Visual Basic Projects ASP Net Web Application On the left select a project type of Visual Basic Projects Give the project a unique name our version of this example is WebApplicationl You will end with a basic WebForm based application with one System Web UI Page derived form Default aspx by default For purposes of this example the chart will placed in the initial default form Assume that you want to make an ASP Net application that streams an image file to an image component in a web page You do not need to add anything to the Default aspx page Right click on the page and select View Code This brings up the code behind file Default aspx vb for the Default aspx page Add the following references in the using section at the top of the Default aspx cs file Imports com quinncurtis chart2dnet Imports System Drawing Imports System Drawing Drawing2D Imports System Drawing Imaging 8 Right click on Reference in the Solution Explorer window and select Add Reference Browse to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL Also add System Windows Forms dll from the Net list box Add a method that makes the chart and returns a ChartView object of the chart In the example below this is the function GetInitializeChart It has String arguments that contain the x and y data values and integers that specify the desired height and width for
313. e project it will display the HTMLPagel htm file in a browser and that in turn will invoke the Default aspx page which creates the chart and transfers it to the image tag of the HTMLPage htm page 2 Untitled Page Windows Internet Explorer httpuflocalhost 4913 HTMLPagel htm Pir File Edit View Favorites Tools Help Search gt M S Bookmarks Sign In Google 8 We Be untitled Page _ ta H Page iG Tools WebApplication 1 Local intranet S Another method is to use two WebForms in the ASP application One form is setup much like the previous example The aspx page contains nothing and the aspx cs behind code page does all the work defining a chart and streaming the result back as a JPEG image The other WebForm page is used to host a collection of Web controls place on the aspx page One of these Web controls would be an Image web control The behind code page for this WebForm would connect the URL of the Image control to the first WebForm page which does nothing be serve up charts Our example Chart2DASPWebApp uses this approach The reason you might want to take this approach is that it is much easier to wire up the controls on a WebForm page using the aspx cs behind code as opposed to doing it on an HTML page The drawback is that the entire page is redrawn when Using QCChart2D for Net to Create Web Applications 425 anything i
314. e 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 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 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 also modify a point at a time using SetEvent If you need to add new points to the dataset increasing its size use one of the AddEvent or InsertEvent methods Delete data points using the DeleteEvent method In order to see
315. e values You can retrieve a copy of the date time data using the TimeSimpleDataset GetTimeXData or GetTimeYData 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 TimeSimpleDataset GetXData and GetYData methods return references to the underlying numeric data You can also modify a point at a time using one of the SetTimeDataPoint SetTimeXDataValue or SetTimeYDataValue and SetYDataValue or SetXDataValue methods If you need to add new points to the 72 Chart Datasets 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 1 new double nnumpnts double y2 new double nnumpnts y1 0 100 30 1 0 ChartCalendar currentdate Clone currentdate Add ChartObj MONTH 3 for 1 lt nnumpnts i 1 1 ChartCalendar currentdate Clone ylli 1 1 1 5 i 0 75 ChartSupport GetRandomDouble 2 y2 i 1 15 i 0 95 ChartSupport GetRandomDouble t currentdate Add Cha
316. e x and y values are displayed on one line side by side C Font toolTipFont new Font SansSerif 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 334 Data ChartSymbol new toolTipSymb datatooltip datatooltip datatooltip datatooltip datatooltip datatooltip ToolTips toolTipSymbol ChartSymbol null ChartObj SQUARE new ChartAttribute Color Black ol SetSymbolSize 5 0 SetTextTemplate textTemplate SetXValueTemplate xValueTemplate SetYValueTemplate yValueTemplate SetDataToolTipFormat ChartObj DATA TOOLTIP OHLC SetToolTipSymbol toolTipSymbol SetEnable true chartVu SetCurrentMouseListener datatooltip Visual Basic Dim toolTip Dim datatoo Dim Dim Dim Font As New Font SansSerif 10 FontStyle Regular ltip As New DataToolTip chartVu xValueTemplate As New TimeLabel ChartObj TIMEDATEFORMAT MDY yValueTemplate As New NumericLabel ChartObj CURRENCYFORMAT textTemplate As New ChartText toolTipFont textTemplate SetTextBgColor Color FromArgb 255 2 nn 255 204 textTemplate SetTextBgMode True Dim toolTip Symbol As New ChartSymbol
317. e x axis range 600 1500 13 0K 60 400 1000 12 0K 40 200 500 11 0K 20 0 0 10 0 i T 0 0 20 40 60 80 100 Event Partition Graphs can have an UNLIMITED number of x and y axes Axis This class is the abstract base class for the other axis classes It contains data and drawing routines common to all axis classes Linear Axes 100 0 00004 50 0 00002 0 0 00000 sog 91 0 02 0 03 0 04 0 05 0 00002 0 00004 2000 0 2000 4x10 100 0 4 0 2 0 0 0 2 0 4 0 10000 20000 30000 40000 10 80 80 2800 45 20 40 40 2400 25 0 0 2000 0 20 40 60 80 100 0 5 10 45 The positioning of axes is very flexible Axes can have an inverted scale Class Architecture 33 LinearAxis This class implements a linear axis with major and minor tick marks placed at equally spaced intervals Logarithmic Axes 1000 50000 100 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 02 2 20 200 1 10 100 1000 40 Log X 20 Linear Y 0 0 2 0 4 0 6 1 2 4 6 10 20 40 60 100 499 400600 1000 100 Time X 10 Log Y 1 8 01 02 9 01 02 10 01 02 Logarithmic axes can be combined with linear logarithmic and time axes 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
318. e yMax 105 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 222 Axis Labels TimeAxisLabels xAxisLabels new TimeAxisLabels xAxis NumericAxisLabels yAxisLabels new NumericAxisLabels yAxis Create the ChartView object to place graph objects in ChartView chartVu new ChartView 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 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 Dim xAxisLabels As TimeAxisLabels New TimeAxisLabels xAxis Dim yAxisLabels As NumericAxisLabels New NumericAxisLabels yAxis Create the ChartView object to place gr
319. ea 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 172 Axes 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 Chart Axes There are seven concrete axis types supported by the QCChart2D for Net library Axis Type Class Linear LinearAxis Logarithmic LogAxis Date time TimeAxis ElapsedTime ElapsedTimeAxis Event EventAxis Polar PolarAxes Antenna AntennaAxes The seven 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 Bas
320. econds 2 y2 i yl i 15 90 2 xl i TotalSeconds 0 5 ChartSupport GetRandomDouble ElapsedTimeSimpleDataset Datasetl ElapsedTimeSimpleDataset Dataset2 new ElapsedTimeSimpleDataset First 1 yl new ElapsedTimeSimpleDataset Second 1 y2 Visual Basic Dim numPoints As Integer 100 Dim x1 As TimeSpan New TimeSpan numPoints 1 Dim yl As Double New Double numPoints 1 Dim y2 As Double Dim i As Integer New Double numPoints 1 For 0 To numPoints 1 xl i TimeSpan FromMilliseconds i 30 1000 76 Chart Datasets 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 gt 0 Then yl i 20 0R 50 0R 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeoconds 5 Else yl i 20 0R 5 0R 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalSeconds 2 End If 2 1 yL 1 5 0 2 xLl i TotalSeconds 0 5 ChartSupport GetRandomDouble Next Dim Datasetl As New ElapsedTimeSimpleDataset First xl yl Dim Dataset2 As New ElapsedTimeSimpleDataset Second 1 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 simpl
321. ectedObj SimpleLinePlot Or _ ChartSupport IsType selectedObj com quinncurtis chart2dnet Grid Then InvokeLineDialog selectedObj ElseIf ChartSupport IsKindOf selectedObj ChartText Then InvokeTextDialog selectedObj End If Me GetChartObjComponent UpdateDraw End Sub End Class FAQs 449 The LineDialog and TextDialog classes are derived from System Windows Forms Form and need to be written by the programmer Sample classes are found in the EditChartExample example The sample LineDialog class uses the System Windows Forms ColorDialog to select the color of line objects The TextDialog class uses the System Windows Forms FontDialog to select the text attributes associated with a font 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
322. ects 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 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 156 The Chart View ChartPlot 50 The default value for plot objects which includes SimplePlot GroupPlot ContourPlot PolarPlot and AntennaPlot objects Axis 100 Chart axes are drawn after 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 val
323. ed bar plots and group bar plots Drug Sales The Group bar graph and the Stacked bar graph represent two different ways of displaying the same data GroupBarPlot 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 46 Class Architecture StackedBarPlot 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 GroupVeraPlot 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 Video Game Usage by Age Group 100 E E a 5 5 o gt t o 5 a 20 40 60 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 dis
324. ed by the NumericLabel and TimeLabel classes Simple Data Tooltips Class DataToolTip MouseListener t DataToolTip The DataToolTip class implements Net 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 15 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 popu
325. ed by the mouse magnify icon is displayed full scale in the bottom graph 450 o 3 400 350 300 Time Subject 1 Subject 2 In use the MagniView class is similar to passing a magnifying glass over your data 8 Introduction Click and drag on the top graph using left mouse button 100 20000 0 100K 0 15000 100 10000 20000 50K 200 5000 40000 300 0 0 Event Partition The area bounded by the mouse magnify icon is displayed full scale in the bottom graph 70K 82 11000 17000 102 10000 60K 22000 122 9000 50K 8000 46 48 50 52 54 56 Event Partition 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 in the plot area and move in any direction 90 edt 80 Test Score 60 50 100 120 140 160 180 Student Introduction 9 Additional Chart Objects Integrated data grids for viewing chart data The new DatasetViewer class displays
326. edImage chartVu ImageFormat Jpeg get your binary image data here Response ContentType image jpeg chartimage Savelmage Response OutputStream Build the Solution Build Build Solution and resolve any errors that might have crept in The Default aspx page needs to be invoked from an HTML page that references Default aspx page as an image file reference A sample HTML file HTMLPagel htm has been included as part of the project The HTML page connects the Default aspx program to an image tag that can be displayed in a browser lt DOCTYPE html PUBLIC W3C DTD XHTML 1 0 Transitional EN http www w3 org TR xhtml11 DTD xhtmll transitional dtd lt html xmlns http www w3 org 1999 xhtml gt lt head gt lt title gt Untitled Page lt title gt lt head gt lt body gt lt FORM id Forml name simplegraph gt lt P gt lt P gt lt IMG height 448 src Default aspx WIDTH 666 amp HEIGHT 448 width 666 name thegraph gt lt P gt lt P gt lt p gt lt input type button value Update Image name B1 onclick updategraph ID Buttonl amp nbsp lt P gt lt input type text name T1 size 152 ID Textl P lt P gt amp nbsp lt P gt lt P gt HTML Page Containing Graph Image lt P gt lt FORM gt lt body gt lt html gt 424 Using QCChart2D for Net to Create Web Applications The HTMLPagel htm has been made the Start page of the project If you run th
327. eferenced in a specific way in an HTML file before you can display it The basic steps for creating the ChartView derived control are described below Start by creating a Windows Control Library project using the Visual Studio project wizard File New Project Visual Basic Projects Windows Control Libary On the left select a project type of Visual Basic Projects Give the project a unique name our version of this example is WindowsControlLibrary1 You will end with the shell of a UserControl class with the name UserControll You will modify UserControll and turn it into an object derived from our ChartView object 432 Using QCChart2D for Net to Create Web Applications New Project Project types Templates Windows E Smart Device el Windows Application Class Library Starter Kits EA Console Application ais Windows Control Library DocProject Device Application a ASP NET Web Application Remote Tools Framework ASP NET Web Service Application yal DoeProject Web DocSite Web Application Other Languages Visual Basic My Templates visual J e Visual C gu Search Online Templates Other Project Types Platform Builder For CE 6 0 Visual C isual Studio installed templates 4 project For creating controls to use in Windows applications Mame WindowsControlLibrary1 Location Cii Quinn CurtisiDotNetlQCChart2DlVisual Basiclexamples Solution Name WindowsC
328. els 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 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 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 15 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
329. els yAxis3 tTextFont theFont hartObject yAxisLab3 4 New NumericAxisLabels yAxis4 tTextFont theFont hartObject yAxisLab4 5 As Hr New NumericAxisLabels yAxis5 rextFont theFont hartObject yAxisLab5 eFont As New Font SansSerif e As New AxisTitle xAxis hartObject xaxistitle 16 axisTitleFont New Grid xAxis hartObject xgrid yAxisl ChartObj X As New SimpleLinePlot pTransforml Datasetl hartObject thePlot1l As New SimpleLinePlot pTransform2 Dataset2 hartObject thePlot2 As New SimpleLinePlot pTransform3 Dataset3 hartObject thePlot3 As New SimpleLinePlot pTransform4 Dataset4 hartObject thePlot4 As New SimpleLinePlot pTransform5 Dataset5 hartObject thePlot5 line line line 1 color color color ine color FontStyle Bold Event Partition S ChartObj GRID MAJOR tribi tribz Lttrlb3 trib4 trib5 FAQs 445 already displayed or must I create a new chart from scratch taking into account the additional objects 446 FAQs 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 objects when you want them to show up Use the chart objects SetChartObjEnable method to en
330. en Select a file that contains a component to inherit from My Documents My Network 2 QcsPCChartNet dl 8 QCRTGraphNet dll 8 QcMatviewNet dll 8 ocMatPackNet dl QCChart2DNet dll File name QCChart2D Files of type DII files 41 Cancel 404 Using QCChart2D for Net to Create Windows Applications S Select the ChartView component name because that is the class you want to inherit from Inheritance Picker Specify the component to inherit from Component Name Namespace Location AutoChart com quinncuttis chart2dnet C Quinn Curtis D otN ePlibNQ CChart2D Net dll ChartView com quinncurtis chart2dnet C Quinn Curtis D otNet lib G CChart2D Net dll DatasetViewer com quinncurtis chart2dnet C Quinn CurtissDotNerlibNQ CChart2D Net dll LserControll UserChartExample2 C Quinn Curtis D ot et GCChart2D Visual Basic exar 1 6 gt New component name UserChartControl1 Select OK This will create a class named UserChartControll derived from ChartView and add it to the project It also adds the QCChart2DNet DLL to the References section of the project S Under some circumstances you may have to add the QCChart2DNet DLL to the projects References Show the References node in the Solution Explorer by selecting the Show Files icon Explorer second button from the left at the top of the Solution Explorer Right click on Referenc
331. ender As System Object ByVal e As System Windows Forms ScrollEventArgs If Not Me IsDesignMode Then UpdateXScaleAndAxes HScrollBarl Value End If End Sub Private Sub VScrollBar2 Scroll ByVal sender As System Object System Windows Forms ScrollEventArgs e System Windows Forms ScrollEventArgs e FAQs 457 458 FAQs ByVal e As System Windows Forms ScrollEventArgs If Not Me IsDesignMode Then UpdateYScaleAndAxes VScrollBarl Value End If End Sub There are many other examples of Form components interacting with charts The ContourLinePlot example program uses a CheckBox object to specify which contours are to be displayed The CandlestickWithTable example continuously updates a DataGrid the base class for the MyDataGrid class table with open high low close data and simultaneously updates a chart with the same data The scrolling action of the DataGrid is synchronized with the chart 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 trying to plot 100 000 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 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 best way to display your data A fundamental issue that many p
332. enter 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 NumericA xis Labels StringAxisLabels PolarAxesLabels AntennaAxesLabels TimeAxisLabels Class Architecture 37 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 38 Class Architecture ElapsedTimeAxisLabels EventAxisLabels 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 Axis Labels Possible date labels Possible time labels Possible numeric labels for todays date for the current time for the value 12340 July 18 2002 15 15 11 24 Hour Mode 12340 0 Decimal 2002 15 15 24 Hour Mode 1 2340E4 Scientific 7 2002 15 11 Minute Second 12 340K Busine
333. er SetTitleType ChartOb CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH Text Classes 369 footer SetTitleOffset 8 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 x axis titles and vertical for y axis titles The most common constructor is AxisTitle Constructor Visual Basic Overloads Public Sub New _ ByVal axis As Axis _ ByVal thefont As Font _ ByVal s As String _ Ct public AxisTitle Axis axis Font thefont string sS The base axis this title is associated with thefont The font object used to display the axis title 5 Sets the title string ChartTitle example extracted from the example program LabeledDatapoints class LabeledDatapoints C LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS chartVu AddChartObject yAxis NumericAxisLabels xAxisLab new NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLab new NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab 370 Text Classes Font titleFont new Font SansSerif 12 FontStyle Bold AxisTitle yaxistitle new AxisTitle yAxis titleFont Test Score chartVu AddChartObject yaxistitle AxisTitle xaxistitle new AxisTitle xAxis titleFont
334. er program control 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 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 Class Architecture 43 Box and Whisker Plots are used in Descriptive Statistics 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 smallest observation lower quartile Q1 median Q2 upper quartile Q3 and largest observation Technical Analysis Uses Candlestick Plots 8 01 02 The Open Close box is filled if the open price is 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 44 Class Architecture CellPlot ErrorBarPlot FloatingBarPlot 2 2 5 gt Distance from Closest Walmart Miles e e Cell Plot of Population Density DSP Journal PC Mag C
335. erpolation 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 50 Class Architecture 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 270 180 AntennaLineMarkerPlot AntennaLinePlot This 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 AntennaScatterPlot AntennaLineMarkerPlot AntennaAnnotation Class Architecture 51 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 d
336. erred to as the working coordinate system Scaling and Coordinate Systems 105 Coordinate Systems A QCChart2D for Net library uses other coordinate systems mapped onto the default Net device coordinate system These other coordinate systems include world coordinates working coordinates and physical coordinates User Coordinates The UserCoordinates class manages a simple viewport drawing system using the Net 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 system 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 the width and height of the graph area then the coordinate system 50 50 150 150 15 calculated and used to scale the g
337. es ByVal bgtype As Integer ByVal startcolor As Color _ ByVal stopcolor As Color ByVal dir As Integer _ public Background PhysicalCoordinates transform int bgtype Color startcolor Color stppoolor int dir Use this constructor to fill the background with a user defined gradient Visual Basic Overloads Public Sub New ByVal transform As PhysicalCoordinates _ ByVal bgtype As Integer ByVal gradient As LinearGradientBrush public Background PhysicalCoordinates transform int bgtype LinearGradientBrush gradient Use this constructor to fill the background with a user defined texture Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal bgtype As Integer ByVal texture As TextureBrush _ public Background PhysicalCoordinates transform int bgtype TextureBrush texture 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 170 Background Colors Textures and Gradients gradient The user defined background gradient texture The
338. es As PhysicalCoordinates ByVal SimpleDataset As SimpleDataset ByVal Double As Double ByVal Double As Double _ ByVal ChartAttribute As ChartAttribute ByVal Int32 As Integer _ Overloads Public Sub New _ ByVal PhysicalCoordinates As EhysicalCoordinates ByVal SimpleDataset As SimpleDataset ByVal Int32 As Integer _ ByVal ChartAttribute As ChartAttribute Overloads Public Sub New _ ByVal PhysicalCoordinates As PhysicalCoordinates ByVal SimpleDataset As SimpleDataset ByVal Int32 As Integer _ ByVal ChartAttribute As ChartAttribute ByVal ChartAttribute As ChartAttribute ByVal Double As Double _ Cf public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset ChartAttribute lineattrib public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset Double barwidth Double barbase ChartAttribute attrib Int32 barjust public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset Int32 symtype ChartAttribute symbolattrib public SimpleVersaPlot PhysicalCoordinates transform SimpleDataset dataset Int32 symtype ChartAttribute lineattrib ChartAttribute symbolattrib Double barwidth transform The coordinate system for the new SimpleVersaPlot object dataset The versa plot represents the values in this dataset symtype The symbol used in the line marker plot Use one of the
339. esianCoordinates 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 SetLineWidth 2 0 gridX SetLineStyle DashStyle Dot gridX SetColor Color Gray Grid gridY new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR Change default grid line properties gridY SetLineWidth 1 0 gridY SetLineStyle DashStyle Solid gridY SetColor Color Black Create the ChartView object to place graph objects in ChartView chartVu new ChartView Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis 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 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 240 Axis Grids 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 C
340. eside 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 GraphObj t 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 S solid color 5 simple color gradient defined using two RGB colors user defined gradient supplied as a Net LinearGradientBrush object 5 user defined texture supplied as a Net TextureBrush object 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 public Background PhysicalCoordinates transform int bgtype Color bgcolor Background Colors Textures and Gradients 169 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 PhysicalCoordinat
341. et 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 SOL 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 How do I use this charting software to generate chart images on the fly from a server 460 FAQs The BufferedImage class creates chart images independent of any physical display context The BufferedImage class uses a System Drawing Imaging ImageFormat object to control the format of the resulting image bitmap You can use this image as an image object in an HTML page See the previous chapter on ASP Net programming for examples 22 Can QCChart2D for Net be used to create programs and controls that run like Java applets in web browsers Yes there are several options See th discussion of using the QCChart2DNet with ASP Net is found in the previous chapter Index 3D Potnts e c ee e ee Point3D
342. et 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 Datasetl ReadTimeSimpleDataset csvDataFile LineFill Datasetl csv 0 0 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 public ElapsedTimeSimpleDataset string sname TimeSpan X 74 Chart Datasets double y public ElapsedTimeSimpleDataset string sname double x TimeSpan yr Ve sname Specifies the name of the dataset x An array that specifies the x values either doubles or TimeSpan objects of a dataset y An array that s
343. ew _ ByVal transform As PhysicalCoordinates ByVal brescale As Boolean _ Ct 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 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 SetZoomXEnable 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 Zooming 321 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 InternalZoomStackProcesssi
344. ew 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 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 See the section in the manual titled Rendering Order of GraphObj Objects for information about the default z values for all chart objects 456 FAQs 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 new ChartView 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 grid1l 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
345. f 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 IQRI5 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 Simple Plot Objects 267 C New York City double NYCIty 31 5 32 6 42 4 52 5 62 7 71 0 130 76 8 78 5 Sy oy 87 5 55 5 Fe Houston double Houston 30 4 53 9 60 6 68 3 74 5 80 4 5 100 82 0 82 69 6 61 53 9 17 San Francisco double 48 7 52 2 53 3 55 9 58 1 76 1 5 62 7 64 5 61 54 8 49 4 7 Bouston double Boston 32 4 53 9 44 6 58 3 564 5 70 4 73 90 72 6 72 49 6 41 33 5 Pittsburgh double Pittsburgh 41 4 54 24 6 38 3 44 5 61 4 63 105 72 6 68 2 49 5 41 33 5 FF double minval 0 0 maxval 0 0 ine Ls 72 2 78 2 7 68 2 3 int numpnts NYCity Length Houston Length SanFrancisco Length Boston Length Pittsburgh Length ChartAttribute defaultattrib new ChartAttribute Color Bla
346. 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 66 Chart Datasets Simple Numeric Dataset Class SimpleDataset ChartObj ChartDataset 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 Think of a spreadsheet file that looks like x values x 0 x 1 x 3 x 4 x 5 y values 01 21 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 public SimpleDataset string sname double X double y sname Specifies the nam
347. 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 PhysicalCoordinates _ ByVal dataset As GroupDataset ByVal rbarwidth As Double _ ByVal attrib As ChartAttribute _ ByVal nbarjust As Integer _ Ct public FloatingStackedBarPlot PhysicalCoordinates transform GroupDataset dataset double rbarwidth ChartArttribute 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 2 rbarwidth The width of the floating bars in units of the independent axis Simple Plot Objects 261 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 JUSTI
348. 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 public class CustomChartDataCursor DataCursor NumericLabel pointLabel Font textCoordsFont new Font SansSerif 8 FontStyle Regular double rNumericLabelCntr 0 0 SimpleLinePlot thePlotl SimpleLinePlot thePlot2 public CustomChartDataCursor ChartView achartview CartesianCoordinates thetransform SimpleLinePlot plotl SimpleLinePlot plot2 int nmarkertype double rsize base achartview thetransform nmarkertype rsize thePlotl thePlot2 plotl plot2 public override void MouseReleased MouseEventArgs mouseevent 310 Data Markers and Data Cursors NearestPointData nearestPointObjl new NearestPointData NearestPointData nearestPointObj2 new NearestPointData Point2D nearestPoint new Point2D 0 0 ChartView chartVu GetChartObjComponent bool bfoundl false bool bfound2 false base MouseReleased mouseevent A mouseevent Button amp GetButtonM
349. 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 is 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 positioning 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 104 Scaling and Coordinate Systems labels are usually outside of the plot area The tick marks and tick mark labels must align perfectly with the coordinate system in
350. from the example program MultiLinePlots class MultiLines C ChartView chartVu new ChartView 384 Lines Shapes Images and Arrows Color alphatcolor Color FromArgo 127 170 100 50 ChartAttribute attrib2 new ChartAttribute alphaColor 1 DashStyle Solid alphaColor attrib2 S58tFillFlag tr s 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 127 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 ChartOb PHYS POS 0 linearRegionShape SetChartObjAttributes attrib2 chartVu AddChartObject linearRegionShape ChartShape example extracted from the example program LabeledDatapoints class LabeledDatapoints C GraphicsPath titleLine new GraphicsPath titleLine AddLine 0 1f 0 1f 0 9f 0 1f ChartS
351. g Drawing2D using System Drawing Imaging using com quinncurtis chart2dnet You create a ChartView object and draw the chart to it You then render the chart as an image file using our BufferedImage class The example program below extracted from the ConsolApplication Program file produces the same chart as in our FinancialExamples CandlestickChart example program File and Printer Rendering 397 Candlestick Plots in Technical Analysis 3 02 09 4 01 09 5 01 09 The Open Close box is filled if the open price is greater than the close price C using System using System Collections Generic using System Text using System Drawing using System Data using System Drawing Drawing2D using System Drawing Imaging using com quinnourrtis chart2dnet namespace ConsoleApplicationl class Program static void Main string args i InitializeChart static void InitializeChart ChartView chartVu new ChartView chartVu Size new Size 600 300 int nNumPnts 50 nNumGroups 4 int weekmode ChartObj WEEK 5D ChartCalendar xValues new ChartCalendar nNumPnts double stockPriceData new double nNumGroups nNumPnts Font theFont double minval 0 0 maxval 0 0 int 1 ChartCalendar currentdate new ChartCalendar ChartCalendar SetTOD currentdate 0 0 1 theFont new Font Microsoft Sans Serif 10 FontStyle Bold currentdate ChartCalendar CalendarDaysAdd currentdate 1
352. ge in 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 ChartImage example extracted from the example program ImageCharts class ImageBackground C String filename Images ChartClouds jpg Bitmap almage null try almage new Bitmap filename catch System ArgumentException 386 Lines Shapes Images and Arrows filename Images NNChartClouds jpg almage null if aImage null try almage new Bitmap filename catch System ArgumentException aImage null 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 Dim filename As String Images ChartClouds jpg Dim almage As Bitmap Try aImage New Bitmap filename Catch err As System ArgumentException filename Images ChartClouds jpg aImage Nothing End Try If aImage Is Nothing Then Try almage New Bitmap filename Catch err As System ArgumentException almage Nothing End Try End If If Not aImage Is Nothing Then Dim chartImage As New ChartImage pTransforml alImage 0 0 ChartObj NO
353. gendItem Energy Companies ChartObj CROSS thePlotl legendFont legend AddLegendItem Software Companies ChartObj CIRCLE thePlot3 legendFont legend AddLegendItem Predicted ChartObj LINE thePlot2 legendFont legend SetLegendItemUniformTextColor Color Black chartVu AddChartObject legend Font theTitleFont new Font Microsoft Sans Serif 14 FontStyle Bold ChartTitle mainTitle new ChartTitle pTransforml theTitleFont Theoretical vs mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH chartVu AddChartObject mainTitle GraphicsPath titleLine new GraphicsPath titleLine AddLine 0 1f 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 titleLineShape SetLineWidth 3 chartVu AddChartObject titleLineShape Font theFooterFont new Font Microsoft Sans Serif 10 FontStyle Bold ChartTitle footer new ChartTitle pTransforml theFooterFont Scatter plots usually display some form of sampled data footer SetTitleType ChartObj CHART FOOTER footer SetTitlePosition ChartObj CENTER GRAPH footer SetTitleOffset 8 chartVu AddChartObject footer chartVu SetResizeMode ChartObj AUTO RESIZE OBJECTS Font toolTipFont new Font Microsoft Sans Serif 10 FontStyle Regular DataToolTip datatooltip new DataToolTip chartVu NumericLabel
354. ger ByVal columnskip As Integer _ public TimeSimpleDataset 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 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 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 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 tim
355. ger 8 Dim xl nnumpnts 1 As ChartCalendar Dim yl nnumpnts 1 As Double Dim currentdate As New ChartCalendar 1998 ChartObj JANUARY 1 Dim i As Integer 1 0 100 1 0 CType currentdate Clone ChartCalendar currentdate Add ChartObj MONTH 12 For i 1 To nnumpnts 1 xl i CType currentdate Clone ChartCalendar yl i yl i 1 25 i 0 75 ChartSupport GetRandomDouble currentdate Add ChartObj MONTH 12 Next i theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New TimeSimpleDataset Actual Sales 1 yl pTransforml New TimeCoordinates 434 Using QCChart2D for Net to Create Web Applications pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml 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 FromA gb 90 20 155 ChartObj Y AXIS chartVu AddChartObject background Dim xAxis As New TimeAxis pTransforml xAxis SetCol lor Color White chartVu AddChartObject xAxis yAxis New yAxis SetCol LinearAxis pTransform1 ChartObj Y AXIS lor Color White chartVu AddChartObject yAxis Dim xAxisLab As New TimeAxisLabels xAxis xAxisLab SetAxisLabelsFormat ChartObj TIMEDATEFORMAT Y2000 xAxisL
356. han Microsoft Internet Explorer In order to guarantee the necessary security clearance to run in the browser you must install our QCChart2DNet DLL library in the GAC of the client computer more on that later Included with the software is the complete source to the three web applications we have running on our web site at http quinn curtis com Chart2DAspWebA pp htm http quinn curtis com Chart2DDynWebA pp htm http quinn curtis com Chart2DHTMLAspApp htm The source is found in our DotNet QCChart2D Visual CSharp Examples and our DotNet QCChart2D Visual Basic Examples folders 416 Using QCChart2D for Net to Create Web Applications ASP Net Programs can run on the built in VS 2005 Server Starting with VS 2005 our ASP Net example programs can run and be debugged locally under the built in web server that ships as part of VS 2005 development system Nothing special needs to be done Just load the project and run On Demand Creation of QCChart2D Images from a Server Visual C for Net If you do not already have an application program project create one using the Visual Studio project wizard File New Project Visual C Projects ASP Net Web Application On the left select a project type of Visual C Projects Give the project a unique name our version of this example is WebApplicationl You will end with a basic WebForm based application with one System Web UI Page derived form Default aspx by default For purposes of t
357. hange default grid line properties gridX SetLineWidth 2 0 gridX SetLineStyle DashStyle Dot gridX SetColor Color Gray Dim gridY As Grid New Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR Change default grid line properties gridY SetLineWidth 1 0 gridY SetLineStyle DashStyle Solid gridY SetColor Color Black Create the ChartView object to place graph objects in Dim chartVu As ChartView New ChartView 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 PolarGrid GraphObj t 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 _ Axis Grids 241 Overloads Public Sub New ByVal polaraxis As PolarAxes _ ByVal gridmagtype As Integer ByVal gridangletype As Integer _ public PolarGri
358. hape titleLineShape new ChartShape pTransforml titleLine ChartObj NORM GRAPH POS 0 0 0 0 ChartObj NORM GRAPH POS 0 titleLineShape SetLineWidth 3 chartVu AddChartObject titleLineShape Visual Basic Dim titleLine As New GraphicsPath titleLine AddLine 0 lF 0 1 0 9 0 18 Dim titleLineShape As New ChartShape pTransforml titleLine ChartObj NORM GRAPH POS 0 0 0 0 ChartObj NORM GRAPH POS 0 titleLineShape SetLineWidth 3 chartVu AddChartObject titleLineShape Chart Image Class Class ChartImage GraphObj t ChartImage Lines Shapes Images and Arrows 385 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 _ 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 ima
359. hartObj JUSTIFY CENTER thePlotl SetFastClipMode ChartObj FASTCLIP X chartVu AddChartObject thePlotl Group Bar Plots Class GroupBarPlot GraphObj t ChartPlot GroupPlot GroupBarPlot 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 GroupBarPlot 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 _ public GroupBarPlot PhysicalCoordinates transform Simple Plot Objects 283 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 bars within a group are squeezed into the width defined by rbarwidth Each individual bar within the group has a width of rbarwidth dataset GetNumbe
360. hartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15 15 80 0 75 Define axes axes labels and grids 270 Simple Plot Objects ChartAttribute attribl new ChartAttribute Color Black 0 DashStyle Solid attribi SetPFillCOolor Coler FromArgb 1 7 33 33 attribl SetFillFlag true BubblePlot thePlotl new BubblePlot pTransforml Datasetl ChartObj SIZE BUBBLE RADIUS attribil chartVu AddChartObject thePlot1 Visual Basic Dim Datasetl As New TimeGroupDataset First xl yl 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 Define axes axes labels and grids Dim attribl As New ChartAttribute Color Black 0 DashStyle Solid attribi SetFillColor Color FromArgb 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
361. hartText InvokeTextDialog ChartText selectedObj this GetChartObjComponent UpdateDraw Visual Basic Public Class LinePlot Inherits EditChartExample UserChartControll Public xAxis As TimeAxis Public yAxis As LinearAxis Class CustomFindObj Inherits FindObj Dim currentObj As LINEPLOT Public Sub New ByVal component As ChartView MyBase New component currentObj component End Sub New Sub InvokeLineDialog ByVal graphobj As GraphObj Dim linedialog As EditLineDialog linedialog New EditLineDialog graphobj If linedialog ShowDialog Me GetChartObjComponent _ DialogResult OK Then selectedObj SetColor linedialog GetLineColor selectedObj SetLineStyle linedialog GetLineStyle SelectedObj SetLineWidth linedialog GetLineWidth End If End Sub Public Sub InvokeTextDialog ByVal textobj As ChartText Dim textdialog As EditTextDialog textdialog New EditTextDialog textobj If textdialog ShowDialog Me GetChartObjComponent DialogResult OK Then textobj SetTextString textdialog GetString textobj SetTextFont textdialog GetFont End If End Sub Public Overrides Sub OnMouseDown ByVal mouseevent As MouseEventArgs MyBase OnMouseDown mouseevent Dim selectedObj As GraphObj GetSelectedObject If selectedObj Is Nothing Then Return Check for a specific object If selectedObj Is currentObj xAxis Or _ selectedObj Is currentObj yAxis Or _ ChartSupport IsKindOf sel
362. hartVu SetCurrentMouseListener movecoords 15 Zooming and Magnification ChartZoom MagniView 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 S Automatic recalculation of axis properties for tick mark spacing and axis labels SJ Zooming of time coordinates with smooth transitions between major scale changes years gt months gt weeks gt days gt hours gt minutes gt seconds Zooming of time coordinates that use a 5 day week and a non 24 hour day SJ Simultaneous zooming of an unlimited number of x and y coordinate systems and axes Super zooming The user can recover previous zoom levels using a zoom stack SJ The zoomed coordinate system can be forced to maintain a fixed aspect ratio 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 i
363. he buffered image to an image file Class Architecture 61 Miscellaneous Utility Classes ChartCalendar CSV Dimension Point2D GroupPoint2D DoubleArray DoubleArray2D BoolArray Point3D NearestPointData TickMark Polysurface Rectangle2D ChartCalendar CSV Dimension Point2D GroupPoint2D DoubleArray DoubleArray2D BoolArray 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 Point and PointF classes 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 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 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 Array class adding routines for resizing of the array and the insertion and deletion of bool based data elements 62 C
364. he xAxisLabels object is created Custom numeric axis labels example C Font labelfont new Font Helvetica 10 FontStyle BOLD double xAxisLabelsRotation 0 0 int xAxisLabelsDir ChartObj AXIS MIN int xAxisLabelsDecimal 1 int xAxisLabelsEnds 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 String Axis Labels Class StringAxisLabels Axis Labels 215 GraphObj ChartText AxisLabels StringAxisLabels Use the StringAxisLabels class to label major tick marks of a linear or logarithmic axis with arbitrary strings StringAxisLabels constructor There is only one main const
365. heritance Picker The result is new control added to the project Build the solution and the UserChartInheritedControll control will be added to the Toolbox in addition to the UserChartControll Look at the UserChartControll class The chart is created in the InitializeChart method Until this method is called the UserChartControll appears as an empty shell Call this method from somewhere outside of the class the Load event of the main Form is one we use in many example programs to avoid problems associated debugging errors in user controls at design time Imports System Drawing Drawing2D Imports System Drawing Imports com quinncurtis chart2dnet Public Class UserChartControll Public Sub InitializeChart Dim chartVu As ChartView Me Dim theFont As Font Dim numPoints As Integer 95 Dim xl numPoints 1 As Double Dim yl numPoints 1 As Double Dim y2 numPoints 1 As Double Dim y3 numPoints 1 As Double Dim i As Integer For 0 To numPoints 1 xl i CDbl ri 1 yl i 20 0 50 0 1 Math Exp x1 i1 20 0 y2 i yl i 20 0 2 1 1 0 6 Chart3upport GetRandomDouble y3 i yl i 20 0 4 x1 i 0 4 ChartS3upport GetRandomDouble Next i y2 94 10 93 theFont New Font Microsoft Sans Serif 10 FontStyle Bold Dim Datasetl As New SimpleDataset First xl yl Dim Dataset2 As New SimpleDataset Second xl y2 Dim Dataset3 As New SimpleDataset Third
366. his example the chart will placed in the initial default form Assume that you want to make an ASP Net application that streams an image file to an image component in a web page You do not need to add anything to the Default aspx page Right click on the page and select View Code This brings up the code behind file Default aspx cs for the Default aspx page Add the following references in the using section at the top of the Default aspx cs file using System Drawing using System Drawing Drawing2D using System Drawing Imaging using com quinncurtis chart2dnet Right click on Reference in the Solution Explorer window and select Add Reference Browse to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL Also add System Windows Forms dll from the Net list box Add a method that makes the chart and returns a ChartView object of the chart In the example below this is the function GetInitializeChart It has String arguments that contain the x and y data values and integers that specify the desired height and width for the chart using System using System Data Using QCChart2D for Net to Create Web Applications 417 using System Configuration using System Collections using System Web using System Web Security using System Web UI using System Web UI WebControls using System Web UI WebControls WebParts using System Web UI HtmlControls using System Drawing using System Drawing Drawing
367. hod Our example has copied the initialization code from the SimpleScatter class in the ScatterPlots example You should now be able to compile run and view the entire project Any changes you make in the UserChartControll form will be reflected in the application 25 Using QCChart2D for Net to Create Web Applications There are two ways you can integrate the QCChart2D library in your web pages the first is to serve up an image file created using QCChart2D from the server and the second is to actually embed a QCChart2D UserControl derived from our ChartView class in the HTML web page In the first method you use a Image component in either a HTML web page or in an ASP Net page The source URL for the image component can either be an image file or a URL address to an ASP page that serves up the image file as a stream The QCChart2D library includes a BufferedImage class that renders a ChartView chart as a memory bitmap and will output that image to a file or a stream The image file or stream can be in any image format supported by the Net System Drawing Imaging ImageFormat class The second method embedding a QCChart2D ChartView derived object in an HTML page is made possible because we eliminated the license file from the software There was no way to check the license file from a control embedded in an HTML page without generating exceptions that would invalidate the control We aren t sure what browsers support this other t
368. hod specifying one of the data tooltip format constants DATA TOOLTIP CUSTOM DATA TOOLTIP X DATA TOOLTIP Y DATA TOOLTIP XY ONELINE DATA 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 ChartView chartVu DataToolTip datatooltip new DataToolTip chartVu chartVu SetCurrentMouseListener datatooltip Data ToolTips 333 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 displa
369. hysicalCoordinates 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 Dim open As Double stockPriceData 0 selectedindex Dim high As Double stockPriceData 1 selectedindex Dim low As Double stockPriceData 2 selectedindex Dim close As Double stockPriceData 3 selectedindex Dim nasdaq As Double NASDAQData selectedindex Dim volume As Double stockVolumeData selectedindex Dim openObj As String ChartSupport NumToString open ChartObj DECIMALFORMAT 2 Dim highObj As String ChartSupport NumToString high ChartObj DECIMALFORMAT 2 Dim lowObj As String ChartSupport NumToString low ChartObj DECIMALFORMAT 2 Dim closeObj As String ChartSupport NumToString close ChartObj DECIMALFORMAT 2 Dim volumeObj As String ChartSupport NumToString volume ChartObj DECIMALFORMAT 0 Dim nasdaqObj As String ChartSupport NumToString nasdaq ChartObj DECIMALFORMAT 2 Dim timelabel As New TimeLabel transform xValues selectedindex ChartObj TIMEDATEFORMAT STANDARD tockpanel AddNewLineTextString timelabel GetTextString tockpanel AddNewLineTextString Open openObj toc
370. ic Overridable Public Sub SetLineWidth _ ByVal linewidth As Double _ Axes 173 Cf public virtual void SetLineWidth double linewidth SetLineStyle method Visual Basic Overridable Public Sub SetLineStyle _ ByVal linestyle As DashStyle _ Ct 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 Use one of the Net Drawing2D DashStyle enumerated constants Dash DashDot DashDotDot Dot or Solid 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 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 polar and antenna axes which have specific vali
371. iclength 10 int tickdir ChartObj AXIS CENTER polarAxes SetPolarAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor minorticlength majorticlength tickdir Create the ChartView object to place graph objects in ChartView chartVu new ChartView 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 _ minorticlength majorticlength _ tickdir Create the ChartView object to place graph objects in Dim chartVu As ChartView New ChartView 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 equ
372. idered 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 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 Dataset 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 Dim magnifyObj As New MagniView MagniViewChartl MagniViewChart2 _ MagniViewChartl pTran
373. ies 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 FAQs 441 15 How do I use your software to generate GIF 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 control horizontal scrolling of the data in my chart 19 L am trying to plot 100 000 000 data points and it takes t
374. ifferent modes Some of the combinations are One x or one y axis One x and one y axes 60 Class Architecture MagniView MoveCoordinates MultiMouseListener 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 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 File and Printer Rendering Classes ChartPrint BufferedImage ChartPrint BufferedImage This class implements printing using the Net System Drawing Printing print related services It can select setup and output a chart to a printer This class will convert a ChartView object to a Net Image object Optionally the class saves t
375. im thePlotl As New AntennaLineMarkerPlot pAntennaTransform Datasetl attribl chartVu AddChartObject thePlotl 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 Dot Color MediumPurple Dim thePlot3 As New AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION ANGULAR 180 attribp3 chartVu AddChartObject thePlot3 Dim thePlot4 As New AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION RADIUS 12 attrib4 chartVu AddChartObject thePlot4 Class AntennaAnnotation GraphObj AntennaAnnotation Polar and Antenna Charts 353 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 _
376. imeSpan nNumPnts 1 Dim groupBarData As Double New Double nNumGroups 1 nNumPnts 1 xValues 0 TimeSpan FromMinutes 1 groupBarData 0 0 6 2 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 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 Event Group Dataset Class EventGroupDataset ChartObj ChartDataset GroupDataset EventGroupDataset Chart Datasets 99 The EventGroupDataset class is the group dataset version of EventSimpleDataset See the background information under the EventSimpleDataset It is used to supply data to the group plotting classes OHLC Candlestick GroupBar Stacked Bar etc A ChartEvent can have one or more y values In the case of an EventSimpleDataset usually it will have a single value as seen in the EventSimpleDataset programming
377. imple plot classes SimpleLinePlot SimpleBarPlot SimpleScatterPlot and SimpleLineMarkerPlot with data A ChartEvent can have one ore more y values In the case of an EventSimpleDataset usually it will have a single value as seen in the programming example below one y 86 Chart Datasets value for each x value In the EventGroupDataset each ChartEvent object can have multiple y values for each x value EventSimpleDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal ev As ChartEvent public EventSimpleDataset string sname ChartEvent ev sname Specifies the name of the dataset ev An array of ChartEvent objects Create an array of ChartEvent objects specifying the time stamp and y value for each ChartEvent object and use that to initialize a EventSimpleDataset The next constructor creates an ChartEvent dataset using the x and y values stored in a file that uses the CSV Comma Separated Value format Only the COLUMN MAJOR format is supported where each row presents a ChartEvent object and the columns are organized as description short description x axis string label tool tip string position time stamp numeric time stamp y value index index for the y value to use when the ChartEvent contains multiple y values and the y values Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer _ ByVal
378. in degrees convert the data to radians using the ChartSupport ToRadians method The AntennaPlot 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 344 Polar and Antenna 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
379. ing 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 for Net 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 is inactive It is possible to treat the unused portion of the day in a manner analogous to 118 Scaling and Coordinate Systems weekends It is possible to eliminate unused hours and minutes of a day from the chart coordinate system The QCChart2D for Net coordinate system allows the programmer to specify a starting and ending time for a days worth of data In the NYSE stock market example the starting time is 9 30
380. ing 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 184 Axes Class TimeAxis GraphObj 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 using 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 1 1 1972 00 00 00 1 1 1999 00 00 00 27 years 11 04 1997 8 30 00 11 04 1997 16 00 00 7 hours 30 minutes 11 28 2000 8 31 22 1 14 2001 15 14 33 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
381. int 60 63 390 391 392 393 Gola DN DEL ouibus pince qe QCChart2DNet dll eet 15 QCChart2DNet DLL 403 404 409 415 416 421 425 427 431 432 435 Rectangle2D 61 62 63 108 110 111 336 337 378 379 380 381 382 384 Appendix 469 Rectangle2D 61 62 63 108 110 111 336 337 378 379 380 381 382 384 Redistributable Redistributable ii 11 RingChart ua acts RingChart Scale classes ChartScale Scatter Plots d eter te SimpleScatterPlot 52 54 64 85 245 251 252 253 254 256 312 406 412 413 Scatter 1 scatter plots 15 16 17 18 19 20 24 39 49 50 52 168 245 343 355 Scatter plots Scatter Plots 1 2 2 02 nennen Scrollbar cem s Scrollbar ScrollBat 456 457 458 Shapes 57 58 64 382 383 384 386 387 388 ChartShape 57 58 64 382 383 384 386 387 388 407 413 Simple datasets essent SimpleDataset 1 2 9 25 26 30 63 65 66 67 68 69 70 71 72 73 74 75 76 81 82 85 86 88 99 101 102 113 114 116 121 122 123 125 128 131 132 133 138 139 141 150 151 153 154 155 199 225 226 230 231 246 247 248 249 250 252 255 256 258 318 323 324
382. intValue True chartVu AddChartObject thePlotl 11 Group Plot Objects GroupPlot ArrowPlot BubblePlot CandlestickPlot CellPlot ErrorBarPlot FloatingBarPlot GroupBarPlotChartPlot HistogramPlot LineGapPlot MultiLinePlot OHLCPlot StackedBarPlot StackedLinePlot 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 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 0 11 y 0 2 y 03 0 4 v 0 5 y values group 1 y 1 0 y L1 1 2 1 3 1 4 y L5 y values group 2 2 0 2 1 2 2 2 3 2 4 2 5 number of x values numberDatapoints numberColumns 6 number of y values for each x value numberGroups numberRows 3 262 Simple 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 no
383. ions Go to the main form Form1 Go to the toolbox and select the UserChartControll from the Windows Forms list Drop it onto the main form and size it Define the chart by customizing the UserChartControll InitializeChart method Our example has copied the initialization code from the SimpleScatter class in the ScatterPlots example S You should now be able to compile run and view the entire project Any changes you make in the UserChartControll form will be reflected in the application Visual CZ for Net If you do not already have an application program project create one using the Visual Studio project wizard File New Project Visual C Projects Windows Application On the left select a project type of Visual C Projects Give the project a unique name our version of this example is UserChartExample1 You will end with a basic Form based application For purposes of this example the chart will placed in the initial default form New Project Project types Templates Visual C Visual Studio installed templates Windows Smart Device Windows Application E Class Library Starter Kits gl windows Control Library 3 Web Control Library DocProject e Console Application E Empty Project Remote Tools Framework Web MyTemplates Other Languages E Other Project Types Platform Builder For CE 6 0 gu Search Online Templates 4 project For creating an application with a
384. irection using the SetMagniXEnable and SetMagniY Enable methods Set the rounding mode associated with rescale 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 Zooming 329 Super magnify example Adapted from the ZoomExamples SuperMagniView UserControll 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 tiz 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
385. is labels example Font labelfont new Font Helvetica 10 FontStyle BOLD 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 232 Axis Labels 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 NumericAxi
386. is 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 new ChartView 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 Create the ChartView object to place graph objects in Dim chartVu As ChartView New ChartView 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 Axes 183 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
387. isIntercept pTransform2 GetStopY xAxis2 SetAxisTickDir ChartObj AXIS MAX yAxis2 CalcAutoAxis yAxisLab2 CalcAutoAxisLabels yAxis3 CalcAutoAxis yAxisLab3 CalcAutoAxisLabels yAxis3 SetAxisIntercept pTransform3 GetStopX yAxis3 SetAxisTickDir ChartObj AXIS MAX this UpdateDraw VB Public Sub UpdateScaleAndAxesUsingEventIndex ByVal startindex As Integer pTransforml ScaleStartX startindex pTransforml ScaleStopX startindex numberEvents pTransform2 ScaleStartX startindex pTransform2 ScaleStopX startindex numberEvents pTransform3 ScaleStartX startindex pTransform3 ScaleStopX startindex numberEvents xAxisl CalcAutoAxis yAxisl CalcAutoAxis xAxisLabl CalcAutoAxisLabels yAxisLabl CalcAutoAxisLabels xAxis2 CalcAutoAxis xAxis2 SetAxisInter xAxis2 SetAxisTickD yAxis2 CalcAutoAxis yAxisLab2 CalcAu yAxis3 CalcAutoAxis yAxisLab3 CalcAu yAxis3 SetAxisIn yAxis3 Se Me UpdateDraw End Sub toAxisLabel toAxisLabel tercep tAxisTickDir Char cept pTransform2 GetStopY ir ChartObj AXIS MAX 5 L amp t pTransform3 GetStopX tObj AXIS MAX Scaling and Coordinate Systems 147 Form1 DER Candlestick Chart Custom Axis Labels Elapsed Time Vertical Event Axis Numeric Multiline Daily Stock Price Price Volume NASDAQ 9 03 12 9 10 12 9 17 12 9 24 12 The classic stock price chart combines a open
388. isplays 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 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 Click on any pie wedge to see a detail Click again on the pie wedge to remove detail PieChart The pie chart 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 52 Class Architecture 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 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 i
389. itAnt catte chartVu AddChartObject thePlot2 Visual Basic Datasetl New SimpleDataset First magl angl Dataset2 New SimpleDataset Second mag2 angl Dim datasetarray 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 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 im thePlotl As New AntennaLinePlot pAntennaTransform hePlotl InitAntennaLinePlot Datasetl
390. ized objects resizeable frame with resizeable objects scrollable panel as a view into a much larger fixed size frame ScatterPlots Simple scatter line and line marker plots scatter plots with variable size and color symbols cell plots arrow plots Also labeling the data point values or a line marker plot SimpleLinePlots Simple line plots with linear and time date coordinate systems Also filled and step lines Introduction 17 UserChartExample1 Simple example displays line and scatter plots ZoomExamples Zooming simple linear axes super zooming of multiple axes zooming of time data based data WindowsControlLibraryl Create QCRTGraph ChartView derived window that can be embedded in Windows Internet Explorer ASP Net Holds ASP Net examples specific directory Chart2DAspWebApp ASP Net Web application Chart2DDynWebApp Dynamic ASP Net Web Chart2DHTMLAspApp ASP Net App in HTML page Visual Basic VB specific code Examples VB examples Effective 7 25 05 the examples have been reorganized into categories to make it easier to find the code behind a specific chart AntennaCharts A simple antenna chart example Bargraphs Horizontal vertical stacked group histogram floating CalendarData Line plots bar plots and log plots that use time date data Also reading time date data from a file ChartAxes Linear logarithmic time date custom hours time date and polar axes Also a
391. j JANUARY 5 simpleTimeScale SetTimeScaleStop new ChartCalendar 1997 ChartObj JANUARY 5 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 using the multiple datasets Scaling and Coordinate Systems 123 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 10 22 33 44 55 46 33 25 14 9 double 11 yDataz 120 12 43 54 15 26 63 25 24 19 double 30 52 13 64 25 76 13 33 24 187 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 Sales1 xData yDatal TimeSimpleDataset dataset2 new TimeSimpleDataset Sales2 xData yData2 TimeSimpleDataset dataset3 new TimeSimpleDataset Sales3 xData yData3 TimeSimpleDataset datasetsArray new TimeSimpleDataset 3 datasetsArray 0 datasetl d
392. jAttributes New ChartAttribute Color LightBlue 1 DashStyle Solid 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 gradient styles In terms of memory usage this is 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 examples Simple Line Plots Class SimpleLinePlot GraphObj t ChartPlot SimplePlot SimpleLinePlot The SimpleLinePlot class is a concrete implementation of the SimplePlot class and and displays simple datasets in line plot format Dat
393. ject 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 Axis Labels 221 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 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 DMY2000 TIMEDATEFORMAT MY2000 TIMEDATEFORMAT Y2000 TIMEDATEFORMAT MDY HMS TIMEDATEFORMAT DMY HMS TIMEDATEFORMAT MDY HM TIMEDATEFORMAT DMY HM 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 doubl
394. job of providing a core set of classes that allow most Java applications to be ported to Net Features found in the Microsoft Net API and used in the QCChart2D for Net library include the following Arbitrary line thickness and line styles for all lines Gradients fill patterns and color transparency for solid objects Generalized geometry support used to create arbitrary shapes Printer and image output support Improved font support for a large number of fonts using a variety of font styles size and rotation attributes Imaging support for a large number of image formats Advanced matrix support for handling 2D transformations OOOO QCChart2D for Net Dependencies The QCChart2D for Net class library is self contained It uses only standard classes that ship with the Microsoft Net 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 GDI basic graphics functionality More advanced functionality is provided in the System Drawing Drawing2D System Drawing Imaging and System Drawing Text namespaces System Drawing Drawing2D Namespace The System Drawing Drawing2D namespace provide advanced 2 dimmensional and vector graphics functionality This namespace includes the gradient brushes the Matrix
395. jor 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 206 Axes Simple antenna axes example double minvalue 40 maxvalue 20 AntennaCoordinates antennascale new AntennaCoordinates minvalue 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 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 AntennaAxes antennaAxes new AntennaAxes an
396. k marks at the x positions of the ChartEvent objects attached to the common EventCoordinate system It places major tick marks at the ChartEvent objects which correspond to where an axis label is expected to go and minor tick marks at events which fall between the major tick marks If the tick marks start to overlap tick marks are skipped in order to maintain the look of the chart Tick Rules The TickRule property controls the tick mark logic of the axis Use one of the TICK RULE enumeration constants NO TICKS do not display any tick marks No tick marks means no axis labels MINOREVENT MAJOREVENT display a minor tick mark every AxisMinorNthTick event and a major tick mark every AxisMinorTicksPerMajor MAJOREVENT display a major tick mark every AxisMajorNthTick event MINORCROSSOVEREVENT MAJORCROSSOVEREVENT display a minor tick mark every AxisMinorNthTick minor crossover event and a major tick mark every AxisMajorNthTick major crossover event The minor and major crossover events are controlled by the MajorTickCrossoverEvent and MinorTickCrossoverEvent properties of the EventAxis The default is ChartObj TICK RULE MINORCROSSOVEREVENT MAJORCROSSOVEREVENT The term crossover event means that an element of date time timestamp changes If you specify a MinorTickCrossoverEvent of ChartObj SECOND and an AxisMinorNthTick of 15 this will cause a minor tick mark to be displayed every 15 second if an event falls within that r
397. kpanel AddNewLineTextString High highObj tockpanel AddNewLineTextString Low lowObj tockpanel AddNewLineTextString Close closeObj tockpanel AddNewLineTextString Volume volumeObj tockpanel AddNewLineTextString NASDAQ nasdaqObj tockpanel SetChartObjEnable ChartObj OBJECT ENABLE im g2 As Graphics GetToolTipGraphics Precalculates the text bounding box so that the size is known before it is drawn Stockpanel PreCalcTextBoundingBox 92 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 O 0 OO UU o 0 0 17 Pie and Ring Charts PieChart RingChart Everyone is familiar with the ubiquitous pie chart Pie charts 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 software The best use of pie
398. l Basic Dim numpl As Integer 100 Dim magl numpl 1 As Double Dim angl numpl 1 As Double Dim i As Integer For 0 To numpl 1 angl i ChartSupport ToRadians CDbl i 360 0 CDblinumpl magl i Math Abs 30 Math Sin 2 angl i Math Cos 2 ang1 i 346 Polar and Antenna Charts Next i theFont New Font SansSerif 10 FontStyle Bold chartVu Me 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 chartVu AddChartObject pPolarAxisLabels Dim attribl As New ChartAttribute Color Blue 2 0 Dim thePlotl As New PolarLinePlot pPolarTransform Datasetl attribl hartVu AddChartObject thePlotl Dim attrib2 As ChartAttribute Color Red 1 0 Color Red attrib2 SetFillFlag True Dim thePlot2 As New PolarScatterPlot pPolarTransform Datasetl ChartObj CIBCLE sttrib2 chartVu AddChar
399. l SetShowDatapointValue true NumericLabel modellabel new NumericLabel modellabel SetXJust ChartObj JUSTIFY CENTER modellabel SetYJust ChartObj JUSTIFY MIN Font modellabelfont new Font SansSerif 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 SansSerif 10 FontStyle Regular modellabel SetTextFont modellabelfont modellabel SetTextNudge 0 5 thePlotl SetPlotLabelTemplate modellabel chartVu AddChartObject thePlotl 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 258 Simple Plot Objects Visual Basic Overloads Public Sub New _ ByVal PhysicalCoordinates As EhysicalCoordinates ByVal SimpleDataset As SimpleDataset ByVal ChartAttribute As ChartAttribute Overloads Public Sub New _ ByVal PhysicalCoordinat
400. l UserControll VIEWASTEXT lt OBJECT gt Notice the classid in the lt object gt tag The classid has two parts to it First we have the URL to the DLL file make sure the DLL is not in the web sites bin directory In this example the WindowsControlLibraryl DLL file has been explicity copied to the http quinn curtis com web site and placed in the folder UserControlTestRev2 Hence the URL to the library is http quinn curtis com UserControlTestRev2 QCCHT2D WindowsControlLibraryl dll It is then followed by a sign and ends with the fully qualified name of the control namespace control name In this case that is WindowsControlLibraryl UserControll The full classid becomes classid http quinn curtis com UserControlTestRev2 QCCHT2D WindowsControlLibraryl dll WindowsControlLi braryl UserControll This is sufficient to display the QCChart2D derived user control in a web page using Internet Explorer If you want to modify elements of the chart you will need to communicate to the control from JavaScript embedded in the HTML page In our IEQCChart2D htm example we added a couple of text fields one that changes the chart title text1 and another that changes the y axis range of the chart text2 A couple of buttons force the changes to go into affect Note how the buttons are hooked into the JavaScript event handlers ChangeTitle and ChangeY Max and how they in turn interact with the properties ChartTitleText and YMa
401. lass AntennaAxesLabels GraphObj ChartText AxisLabels t NumericAxis Labels 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 the 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 Visual Basic Overloads Public Sub New _ ByVal baseaxis As AntennaAxes _ Cf public AntennaAxesLabels AntennaAxes baseaxis baseaxis This 18 the axis the axis labels are for Axis Labels 235 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 _ Ct public void SetAxisLabelsFormat int format font The font object used to displa
402. lass Architecture Point3D NearestPointData TickMark Polysurface Rectangle2D 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 from nearest point calculations The axis classes use this class to 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 63 A diagram depicts the class hierarchy of the QCChart2D for Net library ChartObj Arrow ChartCalendar ChartEvent CSV Dimension Point3D NearestPointData Polysurface ChartScale LinearScale LogScale TimeScale ElapsedTimeScale EventScale UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates PolarCoordinates AntennaCoordinates EventCoordinates TimeCoordinates ElapsedTimeCoordinates ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset EventSimpleDataset GroupDataset TimeGroupDataset ElapsedTimeGroupDataset EventGroupDataset AutoScale LinearAutoScale LogAutoScale TimeAutoScale ElapsedTimeAutoScale EventAutoScale MouseListener MoveObj FindObj DataToolTip ChartZoom MagniView MoveCoordinates MultiMouseListener DataCursor MoveData Cha
403. lass 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 308 Data Markers and Data Cursors 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 Adapted from the DataCursorView and CustomChartDataCursor classes 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 CustomChartDataCursor dataCursorObj new CustomChartDataCursor chartVu pTransforml ChartObj MARKER HVLINE 8 0 dataCurs
404. le tee 26 27 63 103 105 LogSeale os ote dedos 26 27 63 103 105 MagniView 2 7 8 58 60 63 319 326 327 328 329 344 TagniVIeW secret sioni Ns eves dew eines ence euet 327 MagniView 2 7 8 58 60 63 319 326 327 328 329 344 Markers 57 58 59 64 254 304 306 307 309 310 311 446 marker 1 15 16 17 18 20 22 23 39 50 52 58 106 245 255 256 257 258 259 293 304 305 306 307 308 309 310 311 343 351 446 Marker 2 5 15 17 49 50 51 52 53 57 58 59 64 85 245 254 255 256 257 304 305 306 307 309 310 311 312 316 343 348 350 351 352 446 MARKER 54 257 259 305 306 307 308 309 310 311 316 446 MouseListener 5 B noi REIR et vaste mouselistener 314 316 MouseListener 7 16 18 58 59 60 63 307 308 309 312 313 314 315 316 317 318 319 322 324 325 326 327 329 330 331 332 333 334 336 375 407 414 430 435 450 MouseListeners 58 59 60 63 307 312 313 314 315 316 317 319 326 330 331 450 2 2 314 316 MouseListener 7 16 18 58 59 60 63 307 308 309 312 313 314 315 316 317 318 319 322 324 325 326 327 329 330 331 332 333 334 336 375 407 414 430 435 450 MoveCoordinates 8 58 60 63 312 316 317 318 344 MoveCoordinates8 58 60 63 312 316 317 318 344 MovYveboat a eee ute eee et MoveData 58 59
405. le _ ByVal rsize As Double _ ByVal npostype As Integer _ 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 Data Markers and Data Cursors 305 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 device coordinates npostype Specifies the if the position of the marker is specified in physical coordinates normalized coordinates or Net 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 CRO
406. le Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR prIransforml SetGraphBorderDiagonal 0 15 15 90 0 7 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 1l DashStyle Solid attrib2 SetFillColor Color Blue attrib2 SsetFIllFlag attrib2 SetSymbolSize 10 SimpleLineMarkerPlot thePlotl new SimpleLineMarkerPlot pTransforml Datasetl Chartob SQUARE attribl attrib2 9 11 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 pTransforml 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 Blus attrib2 SetFillFlag True attrib2 SetSymbolSize 10 Dim thePlotl As New SimpleLineMarkerPlot pTransforml Datasetl _ ChartO0bj SOUARE attribl attribz 0 1 chartVu AddChartObject thePlotl Simple Plot Objects 257 Add the following lines to the program segment above to add data point labeling to the line marker plot thePlot
407. le n2 dimension is size not upper limit xz 0 5 x2 1 7 dues ren x2 n2 1 100 y2 0 15 y2 1 25 ffs 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 Chart Datasets 69 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 modifying simple dataset elements using the indexed accessor property C Define a simple dataset SimpleDataset Datasetl new SimpleDataset First x1l 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 Datasetl1 0 datapoint Change the datapoint Visual Basic Dim Datasetl As SimpleDataset New SimpleDataset First xl yl Dim datapoint As Point2D Datasetl1 0 Get the xy point at index 0 in the dataset If datapoint X 0 Then datapoint X Math Abs datapoint X arbitrary Dataset1 0 datapoint Change the
408. le the 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 MultiLinePlots class MultiLines 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 ChartObjDEV POS 1 5 40 0 ChartOb PHYS POS 195 arrowShape SetChartObjAttributes arrowAttrib chartVu AddChartObject arrowShape Visual Basic 388 Lines Shapes Images and Arrows 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 ChartObj DEV POS 1 5 40 0 ChartOD PHYS POS 195 arrowShape SetChartObjAttributes arrowAttrib chartVu AddChartObject arrowShape 23 File and Printer Rendering Classes ChartPrint BufferedImage High quality B amp W and color printing is an important feature of the charting library The resulting graph renders on the printer using the resolution of the output device for both text and graphical elements of the chart and does not transfer a grainy image from the computer to the printer The QCChart2D for Net software uses the Micro
409. le 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 90 Chart Datasets 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 15 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 _ Cf 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 si
410. lisecond 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 l 1 4 3 groupBarData 2 1 2 8 groupBarData 3 1 1 5 xValues 2 TimeSpan FromMinutes 3 groupBarData D 2 5 5 groupBarData l1 2 4 5 groupBarData 2 2 2 5 groupBarData 3 2 2 1 98 Chart Datasets 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 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 T
411. lor FromArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject background Define and add axes axes labels and grids to chart j a hartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green ttribl 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 pTransforml 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 Polor FromArgb 30 70 FO _ Color FromArgb 90 20 155 ChartObj Y AXIS chartVu AddChartObject background 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 GetCalendarWidthValue ChartObj MONTH 8 _ DIO attrib ChartObj JUSTIFY CENTER chartVu AddChartObject thePlotl Note how the ChartCalendar GetCalendarWidth Value method calculates the width of the
412. lot class it displays simple datasets in a line plot format Adjacent data points are connected using a straight or a step line Theoretical vs Experimental Data Measurable work output 0 20 40 60 80 100 MBAs 1000 employees Energy Companies Software Companies Predicted Scatter plots usually display some form of sampled data SimpleScatterPlot 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 SimpleVersaPlot 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 Class Architecture 55 another without deleting the instance of the old plot object and creating an instance of the new Legend Classes LegendItem BubblePlotLegendItem Legend StandardLegend 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 This class is the abstract base class for chart legends LegendItem 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
413. lotbackgroundl As New Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject plotbackgroundl 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 TimeAxi xAxisLabl SetColor Color Whi chartVu AddChartObject xAxis Dim yAxisLabl As New Numeric yAxisLabl SetAxisLabelsForma File and Printer Rendering 401 sLabels xAxis1 te Labl AxisLabels yAxisl t ChartObj CURRENCYFORMAT yAxisLabl SetColor Color Whi chartVu AddChartObj te ect yAxisLabl Dim xgridl As New Grid xAxisl ChartObj GRID MAJOR xgridl Betcolor Col chartVu AddChartObj yAxisl or Black ect xgridl Dim xgrid2 As New Grid xAxisl ChartObj GRID MINOR yAxisl ChartObj ChartObj Eq ncm 2 AXIS xgrid2 S8etColor Col chartVu AddChartObj Dim ygridl As New Grid xAxis1 ChartObj GRID MAJOR ygridl SetColor Col chartVu AddChartObj Dim ygrid2 As New Grid xAxisl ChartObj GRID MINOR ygrid2 SetColor Col or Gray ect xgrid2 yAxisl ChartObj Y AXIS or Black ect 1 yAxisl ChartObj Y AXIS or Gray chartVu AddChartObj ect ygrid2 Dim defaultattrib As New ChartAttribute Color Black 1 DashStyle Solid Color White def
414. ls 1 xAxisLabl SetColor Color White chartVu AddChartObject xAxisLabl Everything else is the same as in our other charts Things are more complicated once you start plotting multiple overlapping datasets in the same coordinate system Each ChartEvent object in the previous example had a unique Position and TimeStamp value The software only needed to auto scale the coordinate system for the range of ChartEvent Position values and plot the data If you want to plot a second dataset in the same chart it is more complicated If every ChartEvent object of the the second dataset uses exactly the same Position and TimeStamp values as the first and only has different y values you could plot it as is You should be able to plot the second dataset directly on top of the first and the TimeStamps of the ChartEvents objects would line up chronologically exactly as you would expect The complication arises if the second dataset overlaps the first with respect to the TimeStamp values but does NOT use exactly the same TimeStamps as the first set of data For example the first set of data is contains ChartEvent objects sampled at 10 minute intervals starting at 8 30 The second dataset contains ChartEvents objects starting at 8 15 and sampled every 15 minutes In this case some of the TimeStamp values would match at every gt hour but in every case the Position values would be out of sync If these two datasets were plotted as is the Ti
415. mask 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 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 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 MoveData SetHitTestThreshold method 316 Moving Chart Objects and Data Points Moving datapoints example See the class MoveDatapoint for a more complicated example C ChartView chartVu new ChartView 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 New ChartView Dim pTransforml As CartesianCoordinates _ New CartesianCoordinates 0 0
416. mberOfCountries As Double Overweight data for magnitude of of stacked bars Make sure arrays are sized for 0 N 1 Dim Men NumberOfGroups 1 NumberOfCountries 1 As Double Dim Women NumberOfGroups 1 NumberOfCountries 1 As Double Y axis string labels Each string will label a major tick mark Dim yAxisLabl As New StringAxisLabels 1 yAxisLabl SetAxisLabels theFont 0 ChartObj AXIS MIN ChartObj LABEL ALL Color Black CountryNames 14 yAxisLabl SetColor Color Black chartVu AddChartObject yAxisLabl Time and Date Axis Labels Class TimeAxisLabels GraphObj ChartText AxisLabels t 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 A time axis label can take many forms Variations on these forms include S Time formats hh mm ss hh mm mm ss etc S Date formats mm dd yy dd mm yy mm yy etc 218 Axis Labels There are more ways to format time and date information than numeric data The QCChart2D for Net software directly supports twelve time formats and eighteen 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 MS
417. meStamp values for the two datasets would not align with respect to the x axis 140 Scaling and Coordinate Systems When multiple datasets are attached to the same EventCoordinate system the coordinate system needs to merge and sort the ChartEvent objects of every dataset The ChartEvents are sorted by the TimeStamp value It may be that many TimeStamps are duplicates since different datasets may have used the same TimeStamps in their event data Other TimeStamps may be singular having occurred in only one dataset It really doesn t matter Next the software runs through the ChartEvents of the sorted list assigning a new Position value to every object in the list If adjacent ChartEvent objects in the sorted list have the same TimeStamp they are assigned the same Position value If the next object in the sorted list has a different TimeStamp value it is assigned a Position value one greater than the previous ChartEvent The net effect is that the ChartEvents with the same TimeStamp value will align properly at the same x position in the graph regardless of how the initial Position values were set The EventAxis and EventAxisLabels objects when applied to the EventCoordinate system will see every unique TimeStamp in the merged datasets without double counting duplicate TimeStamp values across dataset Scaling and Coordinate Systems 141 Form1 DER Candlestick Chart OHLC Custom Axis Labels Elapsed Time Vertical Event Axis Numeric
418. 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 using the new values Objects can be added or modified based on some external event or in response to a timer event created using System Timers 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
419. n of the plot area in the graph view port is at x 0 2 0 2 width 0 6 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 _ 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 _ public void SetGraphBorderFrame double rLeft double rTop double width double height rLeft The left x position of the plot area inside the graph area specified using graph normalized coordinates Scaling and Coordinate Systems 109 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 metho
420. n order to save space they have not been pre compiled which means that many of the intermediate object files needed to view the main form are not present This means that ChartView derived control will not be visible on the main Form if you attempt to view the main form before the project has been compiled The default state for all of the example projects should be the Start Page Before you do view any other file or form do a build of the project This will cause the intermediate files to be built If you attempt to view the main Form before building the project Visual Studio decides that the ChartView control placed on the main form does not exist and delete it from the project The primary view class of the QCChart2D 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 UserControl class Follow the following steps in order to incorporate the QCChart2D classes into your program This is 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 Visual Basic for Net If you do not already have an application program project create one using the Visual Studio project wizard File New Project Visual Basic Projects Windows Application On the left select a project type of Visual Basic
421. nCoordinates New CartesianCoordinates pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR pTransforml SetGraphBorderDiagonal 0 15 0 15 0 9 0 9 Dim graphbackgroundl As Background New Background pTransforml ChartObj GRAPH BACKGROUND Color White chartVu AddChartObject graphbackgroundl Dim xAxisl As LinearAxis New LinearAxis pTransforml ChartObj X AXIS xAxisl SetColor Color Black chartVu AddChartObject xAxis1 Dim yAxisl As LinearAxis New LinearAxis pTransforml ChartObj Y AXIS yAxisl SetColor Color Red chartVu AddChartObject yAxis1 Dim xAxisLabl As NumericAxisLabels New NumericAxisLabels 1 xAxisLabl SetColor Color Black chartVu AddChartObject xAxisLab1 Dim yAxisLabl NumericAxisLabels New NumericAxisLabels 1 yAxisLabl SetColor Color Red chartVu AddChartObject yAxisLabl Dim attribl As ChartAttribute New ChartAttribute Color Red 3 DashStyle Solid Dim thePlotl As SimpleLinePlot New SimpleLinePlot pTransforml Datasetl attribl chartVu AddChartObject thePlotl Dim theTitleFont As Font New Font SansSerif 18 FontStyle Bold Dim GraphTitle As String WebApplicationl Dim mainTitle As ChartTitle New ChartTitle pTransforml theTitleFont GraphTitle mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color Black
422. nCoordinates PhysicalCoordinates t 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 Scale the minimum and maximum x and y values explicitly 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 SJ 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 112 Scaling and Coordinate Systems 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 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
423. nalZoomStackProcesssing 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 C public class SuperZoom com quinncurtis chart2dnet ChartView SimpleDataset Datasetl SimpleDataset Dataset2 SimpleDataset Dataset3 new SimpleDataset First 1 1 new SimpleDataset Second x1 y2 new SimpleDataset Third x1 y3 324 Zooming SimpleDataset Dataset4 new SimpleDataset Fourth x1 y4 SimpleDataset Dataset5 new SimpleDataset Fifth 1 5 CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE C pTransforml AutoScale Date AUTOAXES FAR Ch INEAR SCALE TOAXES FAR CartesianCoordin new Cart pTransform2 Auti CartesianCoordin LINEAR SCALE ChartOb LOU TU ChartObj LINEAR SCALE ITOAXES FAR sianc 3 tObj LINEAR SCALE ChartObj p n3 Aut cale S ChartObj AUTOAXES FAR Chart Cart 5 INEAR SCALE TOAXES FAR ChartObj LINEAR SCALE Chartol ChartObj AUTOAXES FAR ChartObj INEA
424. name and the dataset type 26 Class Architecture SimpleDataset TimeSimpleDataset Represents simple xy data where for every x value there is one y value A subclass of SimpleDataset it is initialized using ChartCalendar dates a wrapper around the System DateTime value class in place of the x or y values ElapsedTimeSimpleDataset A subclass of SimpleDataset it is initialized with EventSimpleDataset ContourDataset GroupDataset TimeGroupDataset TimeSpan objects or milliseconds in place of the x or y values A subclass of SimpleDataset it is initialized with ChartEvent objects where the data is to be plotted using one of the simple plot types A subclass of SimpleDataset it adds a third dimension z values to the x and y values of the simple dataset Represents group data where every x value can have one or more y values 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 EventGroupDataset Scale Classes ChartScale LinearScale LogScale TimeScale ElapsedTimeScale EventScale milliseconds as the x values and floating point numbers as the y values A subclass of GroupDataset it uses ChartEvent objects where the data is to be plotted using one of the group plot types Class Architect
425. nates 277 28 63 103 105 WorldCoordinates 27 28 63 103 105 Zooming 7 58 59 63 64 319 320 321 322 323 325 344 446 ChartZoom3 7 58 59 63 64 319 320 321 322 323 324 325 344 446 zoom 2 3 7 17 19 20 23 58 59 81 117 143 319 320 321 322 323 324 325 440 446 472 Zoom 3 7 17 19 58 59 63 64 84 85 135 136 317 319 320 321 322 323 324 325 327 329 344 446 88 90 91 93 94 95 98 100 101 102 114 121 122 128 132 137 138 139 141 150 151 154 155 161 199 214 216 217 218 219 222 225 226 227 228 230 231 250 256 257 263 267 268 269 270 272 273 274 278 279 281 283 284 286 287 288 289 291 292 293 297 298 301 302 303 309 310 313 314 318 323 324 327 329 333 334 335 336 337 338 339 340 341 342 345 346 348 349 359 362 363 366 367 368 370 375 380 381 385 386 394 395 397 398 399 400 401 405 406 407 412 413 417 418 419 421 422 423 429 430 433 434 436 437 444 445 447 448 452 453 454 459
426. nates _ ByVal dataset As GroupDataset ByVal bubblesizetype As Integer _ ByVal attrib As ChartAttribute _ 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 AREA or the radiusSIZE BUBBLE RADIUS 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 ScatterPlots class BubbleChart C TimeGroupDataset Datasetl new TimeGroupDataset First xl yl Dataset1 SetStackMode ChartObj AUTOAXES STACKED TimeCoordinates pTransforml new TimeCoordinates ChartObj TIME SCALE C
427. nd 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 row 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 t 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 356 Legends StandardLegend constructors Visual Basic Overloads Public Sub New _ ByVal rx As Double ByVal ry As Double _ ByVal attrib As ChartAttribute ByVal nlayoutimode As Integer _
428. nes which is what we want it also has the unwanted side effect of scaling the thickness of lines It is important that the thickness of lines remain unchanged regardless of the desired physical coordinate system Second the Drawing2D Matrix transform does not handle logarithmic scaling needed for physical coordinate systems that use logarithmic or semi logarithmic scaling Third the Drawing2D Matrix class does not support discontinuous scales as needed date time scale and coordinate classes Fourth and last a point transformed using a Drawing2D Matrixundergoes a time consuming relatively complicated matrix math calculation involving a 3x3 matrix For these reasons the coordinate conversion routines do not use the Drawing2D Matrix class Other chart classes use the Drawing2D Matrix class for scaling and rotation of graph objects such as shapes images and text A copy of a concrete instance of the PhysicalCoordinates class is stored in every GraphObj derived object This includes all axes plot objects text objects and data markers When a chart object draws itself it uses the viewport and the physical coordinate system stored in its instance of a PhysicalCoordinates class A chart can have one or more instances of the PhysicalCoordinates since a single chart can plot data against one or more physical coordinate systems Scaling and Coordinate Systems 107 Important numeric considerations Value limiting A chart should be scaleable to an
429. new Grid xAxis yAxis ChartObj X AXIS ChartObj GRID MAJOR hartVu AddChartObject xgrid zx E O E 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 1 SetFillFlag true atiribe 0 SetColor Color Black attribs 1 SetColor Color attribs 2 SetColor Color DarkGray attribs 3 SetColor Color Green attribs 4 SetColor Color Red aciribe 5 SetColor Color Cyan atiribs 6 SetColor Color Magenta atiribs 7 SetColor Color Orange attribs 8 SetColor Color Yellow for i 0 i lt numcontourlevels 144 a 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 thePlotl SetPolygonGridOn true thePlotl SetContourLineAlgorithm ChartObj CONTOUR LINEWALK NumericLabel contourlabel thePlotl GetPlotLabelTemplate Font contourLabelFont new F
430. new LinearAxis simpleScale ChartObj X AXIS LinearAxis yAxis new LinearAxis simpleScale ChartObj Y AXIS NumericAxisLabels xAxisLabels new NumericAxisLabels xAxis NumericAxisLabels yAxisLabels new NumericAxisLabels yAxis Create the ChartView object to place graph objects in ChartView chartVu new ChartView Add the x and y axes to the chartVu object chartVu AddChartObject xAxis chartVu AddChartObject yAxis chartVu AddChartObject xAxisLabels chartVu AddChartObject yAxisLabels Visual Basic 214 Axis Labels 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 New ChartView 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 t
431. ng 1 day major tick mark spacing 2 hour minor tick mark spacing 186 Axes TIMEAXIS DAYHOUR TIMEAXIS 12HOURHOUR TIMEAXIS SHOURHOUR TIMEAXIS 4HOURHOUR TIMEAXIS 2HOURHOUR TIMEAXIS HOUR TIMEAXIS HOUR30MINUTE TIMEAXIS HOURISMINUTE TIMEAXIS HOURIOMINUTE TIMEAXIS HOURSMINUTE TIMEAXIS HOUR2MINUTE TIMEAXIS HOURMINUTE TIMEAXIS 30MINUTEMINUTE TIMEAXIS 15MINUTEMINUTE TIMEAXIS 10MINUTEMINUTE TIMEAXIS S5MINUTEMINUTE TIMEAXIS 2MINUTEMINUTE 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 1 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 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
432. ng 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 dimension 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 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 322 Zooming ChartZoom zoomObj new ChartZoom chartVu pTransforml true
433. ng 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 ChartCalendar xValues new ChartCalendar nNumPnts double stockPriceData new double nNumGroups nNumPnts 94 Chart Datasets double minval 0 0 maxval 0 0 int ij 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 25 open stockPriceData 1 0 26 high stockPriceData 2 0 24 low for i 1 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 stockPri
434. nsforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleX 0 10 pTransforml 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 264 Simple Plot Objects 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 thePlotl 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 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 i
435. nsforml GetScaleStopY pTransforml SetScaleStopY value yAxis CalcAutoAxis this UpdateDraw Using QCChart2D for Net to Create Web Applications 431 Once you can compile the project copy the resulting WindowsControlLibrary1 DLL file to the desired folder on your web site In our example we copied the DLL to the http quinn curtis com UserControlTestRev2 OCCH2D folder The DLL file size should be quite small since the underlying QCChart2DNet DLL file is not included as part of the WindowsControlLihraryl DLL When Internet Explorer views a web page that properly references the WindowsControlLihraryl DLL and its internal UserControll user control it will download just that DLL Internet Explorer will not attempt to download the QCChart2DNet DLL and will look to the system GAC for it instead Visual Basic Create a Windows Control Library and User Control You need to create a ChartView derived user control that defines your chart and includes all of the properties that you need for interacting with your chart This is done almost exactly the same as described in the previous chapter Using QCChart2D for Net to Create Windows Applications The difference is that instead of creating a Net application resulting in an exe file you can run from Windows you are instead creating a Windows Control Library which results in a DLL file What you end up with is a user control not an executable program The user control must be r
436. ntCoordinateSystem referencing the EventSimpleDataset as a parameter The coordinate system is defined by the content of the EventSimpleDataset It will auto scale the coordinate system to the number of ChartEvents found in the source dataset C pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR VB pTransforml AutoScale Datasetl ChartObj AUTOAXES NEAR ChartObj AUTOAXES NEAR Scaling and Coordinate Systems 139 Define the x axis as an EventAxis The tick marks of the axis are defined using the TickRule property in this case the TickRule is TICK RULE MINORCROSSOVEREVENT MAJORCROSSOVEREVENT This means a minor tick mark is placed every time the time rolls over a minor event and a major tick mark is placed every time the time rolls over a major event More on this later C EventAxis xAxisl new EventAxis pTransforml xAxisl SetColor Color White xAxisl TickRule ChartObj TICK RULE MINORCROSSOVEREVENT MAJORCROSSOVEREVENT chartVu AddChartObject xAxis1 VB Dim xAxisl As New EventAxis pTransforml xAxisl SetColor Color White xAxisl TickRule ChartObj TICK RULE MINORCROSSOVEREVENT MAJORCROSSOVEREVENT chartVu AddChartObject xAxis1 Last define the x axis labels using the EventAxisLabels class C EventAxisLabels xAxisLabl new EventAxisLabels xAxis1 xAxisLabl SetColor Color White chartVu AddChartObject xAxisLabl VB Dim xAxisLabl New EventAxisLabe
437. ntarray nrows ncols 1 As Point3D x startx y starty For i 0 To nrows 1 x startx For j D To neols 1 pointarray count New Point3D 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 1 75 ChartSupport GetRandomDouble 0 5 1 75 ChartSupport GetRandomDouble 0 5 z 1500 1500 0 Math Sin Math Sqrt x x y y 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 Public Overrides Function CalcZValue ByVal x As Double ByVal y As Double As Double Dim z As Double x
438. ntennaLineMarkerPlot GraphObj ChartPlot AntennaPlot Polar and Antenna Charts 351 AntennaLineMarkerPlot The AntennaLineMarkerPlot class is a concrete implementation of the AntennaPlot 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 _ ByVal symbolattrib As ChartAttribute _ Ct public AntennaLineMarkerPlot AntennaCoordinates transform SimpleDataset dataset int symtype ChartAttribute lineattrib ChartAttribute symbolattrib transform The coordinate system for the new AntennaLineMarkerPlot 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 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 Antenna line marker plot extracted from the example program Antenna AntennaLineMarkerChart C Color transparentRed Color FromArgb 180 255 0 0 352 Polar and Antenna Charts Color transparentBlue Color Fr
439. ntifies 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 law 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 INC
440. numerie eonsidjerst tis daresi 107 Positioning the Plot Area in Graph Arca a en ti ta iia ai id Gs e 107 Linear and Logarithmic Coordinate Scaling e c eser rabidi 111 Coordinate Systems using times and dates called edad Lcid bl adds cac till 116 Polar Coordinate Systems oco iki aren 149 Antenna Coordinate ecce eae se ase ta e n ee e Sean seo sese R e rn rix n Nki 150 3 2005 Serv from a 16 Explorer The QCChart2D for Net Charting Library 1 Introduction New Features found in the 2 3 version of QCChart2D Event Based Charting A new set of classes have been added in support of new event based plotting system In event based plotting the coordinate system is scaled to the number of event objects Each event object represents an x value and one or more y values The x value can be time based or numeric based while the y values are numeric based Since an event object can represent one or more y values for a single x value it can be used as the source for simple plot types simple line plot simple bar plot simple scatter plot simple line marker plot and group plot types open high low close plots candlestick plots group bars stacked bars etc Event objects can also store custom data
441. ny of the simple plot types while the GroupVersaPlot type can look like any of the group plot types Antenna Plot Aspect Ratio 1 00 Antenna Antenna 270 180 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 coordinate system AntennaCoordinates axes AntennaAxes axes labels AntennaAxesLabels grid AntennaGrid and plot objects AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot and AntennaAnnotation 6 Introduction 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 2006 2005 ETIT 2004 2003 2002 2001 2000 1999 1998 100 200 300 Millions A bar chart with vertical time date axis Elapsed Time support for linear and logarithmic coordinate systems
442. oating 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 individual data points and the coordinate system Chapter 15 adds a zooming class where mouse events define a new scaling range for a chart redrawing the chart axes and Introduction 21 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 elements 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 describes chart printing and the creation of JPEG files Chapte
443. ockPriceData 1 26 high stockPriceData 2 24 low ChartEvent currentEvent new ChartEvent currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode currentdate SetTOD 9 33 0 for i 07 1 lt nNumPnhts itt double position 1 xValues i ChartCalendar currentdate Clone i gt 0 stockPriceData 3 2 0 5 ChartSupport GetRandomDouble close stockPriceData 0 2 0 5 ChartSupport GetRandomDouble open minval Math Min stockPriceData 3 stockPriceData 0 maxval Math Max stockPriceData 3 stockPriceData 0 stockPriceData 1 maxval 1 5 ChartSupport GetRandomDouble high stockPriceData 2 minval 1 5 ChartSupport GetRandomDouble low currentEvent new ChartEvent xValues i position stockPriceData currentEvent AxisLabel XXX position ToString CurrentEvent ToolTip ToolTip position ToString eventArray i currentEvent currentdate Add incrementbase increment if currentdate Get ChartObj HOUR OF DAY gt 16 currentdate Add ChartObj DAY OF YEAR 1 currentdate SetTOD 9 30 0 Visual Basic Dim minval As Double 0 0 maxval As Double 0 0 Dim incrementbase As Integer ChartObj MINUTE Dim increment As Integer 10 Dim currentdate As New ChartCalendar Dim eventArray As ChartEvent New ChartEvent nNumPnts 1 sStockPriceData 3 25 5 close 138 Scaling and Coordinate S
444. odify the appearance by adjusting the following properties Regardless of how you initially setup the graph if you use the zoom routines or the RTScrollFrame routines in the QCRTGraph software the look of the axes will always revert to our auto scaling not your modified setup Because we cannot predict what you will do and cannot scale a completely different range of values based on whatever logic you use TickRule Controls the tick mark logic of the axis User one of the TICK RULE enumeration constants NO TICKS do not display any tick marks No tick marks means no axis labels MINOREVENT MAJOREVENT display a minor tick mark every AxisMinorNthTick event and a major tick mark every AxisMinorTicksPerMajor MAJOREVENT display a major tick mark every AxisMajorNthTick event MINORCROSSOVEREVENT MAJORCROSSOVEREVENT display a minor tick mark every AxisMinorNthTick minor crossover event and a major tick mark every AxisMajorNthTick major crossover event The minor and major crossover events are controlled by the MajorTickCrossoverEvent and MinorTickCrossoverEvent properties of the EventAxis The default is ChartObj TICK RULE MINORCROSSOVEREVENT MAJORCROSSOVEREVENT The term crossover event means that a field of date time timestamp changes If you specify a MinorTickCrossoverEvent of ChartObj SECOND and AxisMinorNthTick of 15 this will cause a minor tick mark to be displayed every 15 second if an event falls within
445. 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 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 Simple Plot Objects 271 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 CandlestickPlot constructor Visual Basic Overloads Public S
446. ofitAttrib 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 0 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 Simple Plot Objects 249 ChartPlot SimplePlot SimpleBarPlot The SimpleBarPlot 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 _ Ct public SimpleBarPlot PhysicalCoordinates transform SimpleDataset dataset double barwidth double barbase ChartAttribute attrib int barjust transform The coordinate system for th
447. ol 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 54 result AddLine 0 0f 0 5f 0 5f 1 0f result AddLine 0 5f 1 0f 1 0f 0 5f result CloseFigure return result Set the custom symbol using SimpleScatterPlot SetCustomScatterPlotSymbol method after the SimpleScatterPlot object is created Simple Plot Objects 253 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 ScatterPlots class SimpleScatter C pTransforml SetGraphBorderDiagonal 0 15 15 90 0 725 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color White chartVu AddChartObject background Define and add axes axes labels and grids to chart hartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid ttribl SetFillColor Color Blue ttribl SetFillFlag true ttribl SetSymbolSize 10 impleScatterPlot thePlotl new SimpleScatterPlot pTransforml Dataset2 ChartObj CROSS attribl chartVu AddChartObject thePlot1 hartAttribute attri
448. olName Designer cs file structure This split structure is NOT backward compaticle with VS 2003 2002 Differences between this and 1 6 version Elimination of the QCLicense License File 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 i e using this software in 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 Multicolor Gradients for Solid Fill Objects A ChartGradient class has been added to the software It works in conjunction with the ChartAttribute class Previously gradients were only used for the graph and plot area backgrounds Now any graphical object which uses a fill color can be assigned a gradient Gradients are not restricted to two colors An array of colors and associated breakpoints can map a color gradient to any solid fill object in a graph Colors can be mapped to breakpoints using the physical coordinates of a chart or normalized coordinates 0 0 to 1 0 DesignerSerializationVisibility We have long found the VS IDE habit of including long initialization lists for the ChartView properties when a Ch
449. olor Color Blue ttribl SetFillFlag True ttribl SetSymbolSize 10 im thePlotl As New SimpleScatterPlot pTransforml Dataset2 ChartObj CROSS attribl hartVu AddChartObject thePlotl nDO Dim attrib2 As New ChartAttribute Color Green 3 DashStyle Solid Dim thePlot2 As New SimpleLinePlot pTransforml Datasetl attrib2 chartVu AddChartObject thePlot2 Dim attrib3 As New ChartAttribute Color Red 1 DashStyle Solid attrib3 SetFillColor Color Red attrib3 SetFillFlag True attrib3 SetSymbolSize 6 Dim thePlot3 As New SimpleScatterPlot pTransforml Dataset3 ChartObj CIRCLE attrib3 chartVu AddChartObject thePlot3 Dim EnronixLabel As New ChartText pTransforml theFont Eronix x1 94 y2 94 ChartObj PHYS POS EnronixLabel SetXJust ChartObj JUSTIFY MAX EnronixLabel SetYJust ChartObj JUSTIFY MAX EnronixLabel SetTextNudge 4 4 chartVu AddChartObject EnronixLabel Dim IGG As New ChartText pTransforml theFont Quinn Curtis x1 0 y3 0 ChartObj PHYS POS IGG SetXJust ChartObj JUSTIFY MIN IGG SetYJust ChartObj JUSTIFY MAX IGG SetTextNudge 4 4 chartVu AddChartObject IGG Dim legendFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim legendAttributes As New ChartAttribute Color Gray 1 DashStyle Solid legendAttributes SetFillFlag False legendAttributes SetLineFlag False Dim legend As New StandardLegend 0 1 0 875 0 8 0 075 legendAttributes StandardLegend HO
450. omArgb 180 0 0 255 hartAttribute a ttribl BymbolB85i tribl new ChartAttribute transparentRed 1 DashStyle Solid a ChartAttribute a C a 7 trib2 new ChartAttribute Color Blue 1 DashStyle Solid cr m ct olor Blue ttrib2 SymbolSize 7 hartAttribute attrib3 new ChartAttribute Color Yellow 3 DashStyle Solid olor Yellow hartAttribute attrib4 new ChartAttribute Color MediumPurple 2 DashStyle Dot olor MediumPurple ntennaLineMarkerPlot thePlotl new AntennaLineMarkerPlot pAntennaTransform atasetl attribl hartVu AddChartObject thePlotl Gb E operi AntennaLineMarkerPlot thePlot2 new AntennaLineMarkerPlot pAntennaTransform Dataset2 attrib2 chartVu AddChartObject thePlot2 AntennaAnnotation thePlot3 new AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION ANGULAR T80 chartVu AddChartObject thePlot3 AntennaAnnotation thePlot4 new AntennaAnnotation pAntennaTransform ChartObj ANTENNA ANNOTATION RADIUS 12 attrib4 chartVu AddChartObject thePlot4 VB 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 D
451. omputer Week 100 150 200 Mean Family Income 1000 The Cell plot will plot rectangles of any size color and postion 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 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 Media Schedule Info Age 1 2003 Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 2004 Year of 2003 Floating bars are useful for creating scheduling charts 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 Price 35 30 25 NASDAQ Class Architecture 45 Daily Stock Price ERI i T 1 05 09 FloatingStackedBarPlot T T T T T T 1 12 09 1 19 09 1 26 09 2 02 09 This class is a concrete implementation of the GroupPlot 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 stack
452. ons 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 intersects 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 FAQs 451 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
453. ont SansSerif 8 FontStyle Regular contourlabel SetDecimalPos 0 contour SetTextFont contourLabelFont contourlabel TextBgMode true contourlabel TextBgColor Color White thePlotl SetPlotLabelTemplate contourlabel chartVu AddChartObject thePlot1 Visual Basic Dim contourlevels As Double flags labelflags numcontourlevels ChartObj CONTOUR LINE 1000 1200 1400 1600 1800 1900 2000 2100 2200 2400 2600 2800 3000 Dim theFont As Font chartVu Me Dim i As Integer theFont New Font SansSerif 10 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
454. ont As Font _ ByVal tstring As String _ ByVal x As Double _ ByVal y As Double _ ByVal npostype 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 _ ByVal npostype As Integer ByVal xjust As Integer _ ByVal yjust As Integer ByVal rotation As Double _ public StringLabel PhysicalCoordinates transform Font font string tstring double x double y int npostype public StringLabel PhysicalCoordinates transform Font tfont string tstring double x double y int npostype int xjust int yjust double rotation Text Classes 375 tstring A reference to a string object Place text in 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 MouseListeners class MoveDatapoints 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 pTransforml subheadFont classlAverage 0 9 0 35 ChartObj NORM GRAPH POS ChartObj DECIMALFORMAT 1 chartVu AddCh
455. ont As New Font SansSerif 14 FontStyle Bold Dim chartLabell As New ChartText pTransforml1 theLabelFont Sales _ xValues 1 GetCalendarMsecs groupBarData 1 1 ChartObj PHYS POS chartLabell SetColor Color White chartLabell SetYJust ChartObj AXIS MIN chartVu AddChartObject chartLabell 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 constructors 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 ntitletype As Integer _ ByVal ntitlepos As Integer _ public ChartTitle PhysicalCoordinates transform Font tfont string tstring public ChartTitle PhysicalCoordinates transform Font tfont 368 Text Classes string tstring int ntitletype int ntitlepos transform Places the text in the coordinate system defined by transform tfont 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 ntitlepos The title can be centered with respect to the entire graph area or the
456. ontrolLibrary 1 Create directory For solution S Right click on Reference in the Solution Explorer window and select Add Reference Browse to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL View the UserControll vb code Change the base class of UserControll to com quinncurtis chart2dnet ChartView To do this you will need to change the base class of the associated UserControl1 Designer vb file Right click on the Show Files icon top second from left of the Solution Explorer You should see an associated UserControl1 Designer vb file as a node under UserControll vb If so go into that file and change the base class to com quinncurtis chart2dnet ChartView lt Global Microsoft VisualBasic CompilerServices DesignerGenerated gt _ Partial Class UserControll Inherits com quinncurtis chart2dnet ChartView Back to the the UserControll vb file The form code should now look like Public Class UserControll End Class Critical Step Make sure you add the following lines to the top of the UserChartControll cs code to resolve the QCChart2D and other graphics classes used in the example Using QCChart2D for Net to Create Web Applications 433 Imports com quinncurtis chart2dnet Imports System Drawing Imports System Drawing Drawing2D Build the Solution Build Build Solution This will compile the UserControl1 class and generate the WindowsControlLibraryl DLL file If the project fails
457. oo 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 How do I use this charting software to generate chart images on the fly 22 Can QCChart2D for Net be used to create programs that run like Java applets in web browsers 1 Is the QCChart2D for Net software backward compatible with the Charting Tools for Windows and the Graphics Class Libraries for MFC No the QCChart2D for Net software is not backward compatible with earlier Quinn Curtis products It was developed explicitly for the new Net programming object oriented programming framework You should have no problems recreating any charts that you created using our older Windows software in most cases it will take far fewer lines of code 2 How do you create a chart with multiple coordinate systems and axes A chart can have as many coordinate systems and axes as you want 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 have 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 valu
458. oordinate systems 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 for Net 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 Fifth an end user needs to interact with the graph using the mouse and or keyboard The QCChart2D for Net architecture includes classes that implement the Net 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 24 Class Architecture QCChart2D for Net 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
459. oordinates New TimeCoordinates simpleTimeScale AutoScale dataset Using similar logic you can define a TimeSimpleDataset with numeric x values and ChartCalendar y values If you auto scale the coordinate system using that dataset you will end up with a numeric x axis and a time y axis 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 122 Scaling and Coordinate Systems 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 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 199
460. oordinates transform Font tfont string tetring double x double y int npostype int xjust int yj3ust int rotation public ChartText PhysicalCoordinates transform Font tfont string tstring double x double y int npostype transform tfont tstring X y npostype xjust yjust rotation Places the text in the coordinate system defined by transform A reference to a Font object A reference to a string object 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 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 360 to 360 degrees of the text in the normal viewing plane 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 366 Text Classes ChartText example extracted from the example program MultiLinePlots class Multilines Font theLabelFont
461. oose 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 182 Axes 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 device coordinates majorticklength The length of major tick marks in Net device coordinates ticdir The direction of the tick marks Use one of the tick mark direction constants AXIS MIN AXIS CENTER or AXIS MAX The SetLineWidth SetLineStyle and SetColor methods are used to customize the drawing properties of the lines used to draw the axis line and tick marks Simple log axis example double xMin 0 double 1000 double yMin 0 27 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 LinearAx
462. orObj SetEnable true chartVu SetCurrentMouseListener dataCursorObj Visual Basic Public Class CustomChartDatatCursor 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 Data Markers and Data Cursors 309 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 coordinate 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 SimpleLinePlot ScatterPlot etc in the graph determines the nearest data point to the mouse cursor
463. ordinate systems and axes ChartZoom constructor Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal transforms As PhysicalCoordinates ByVal brescale As Boolean _ public ChartZoom ChartView component PhysicalCoordinates transforms bool brescale Zooming 323 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 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 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 Inter
464. osition and draw objects in a graph Examples of some of the coordinate systems include the device coordinates of the current window normalized 28 Class Architecture coordinates for the current window and plotting area and scaled physical coordinates of the plotting area UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates TimeCoordinates ElapsedTimeCoordinates PolarCoordinates AntennaCoordinates This class manages the interface to the System Drawing classes and contains routines for drawing lines rectangles and text using Net device coordinates This class derives from the UserCoordinates class and maps a device independent world coordinate system on top of the Net device coordinate system 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 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 ChartScale derived are installed for converting physical x and y coordinate values into working coordinate values This class is a concrete implementation of the PhysicalCoordinates class and implements a coordinate system used
465. ouble 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 New ChartView Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarGrid Antenna Grids Class AntennaGrid GraphObj t 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 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 AntennaAxes ByVal gridtype As Integer _ Overloads Public Sub New _ ByVal baseaxis As AntennaAxes _ ByVal gridmagtype As Integer ByVal gridangletype As Integer _ public AntennaGrid Axis Grids 243 AntennaAxes baseaxis int gridtype public AntennaGrid AntennaAxes baseaxis int gridmagtype int gridangletype baseaxis The antenna
466. ouble startindex pTransforml SetScaleStopX double startindex 100 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 Scroll object sender UpdateXScaleAndAxes hScrollBarl Value private void vScrollBarl Scroll object sender UpdateYScaleAndAxes vScrollBarl Value Visual Basic Public Sub UpdateXScaleAndAxes ByVal index As Integer Dim startindex As Integer index pTransforml SetScaleStartX CDbl startindex pTransforml SetScaleStopX CDbl startindex 100 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 SetScaleStartY CDbl startindex pTransforml SetScaleStopY CDbl startindex xAxis CalcAutoAxis yAxis CalcAutoAxis xAxisLab CalcAutoAxisLabels yAxisLab CalcAutoAxisLabels Me UpdateDraw End Sub UpdateYScaleAndAxes Private Sub HScrollBar2 Scroll ByVal s
467. oupPlot 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 transform As PhysicalCoordinates ByVal dataset As GroupDataset ByVal attrib As ChartAttribute _ Ct public CellPlot 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 color and line style 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
468. ownload 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 for Net interactive charting package designed to run on any hardware that has Net or higher interpreter available for it Chapter 2 presents the overall class architecture of the QCChart2D for Net 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 the color gradient and background classes Chapters 7 8 and 9 describe the classes that 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 fl
469. p at that location and display the data value represented by the top of the bar Data ToolTips 331 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 _ public DataToolTip ChartView component public DataToolTip ChartView component MouseButtons buttonmask component A reference to the
470. pe As Integer _ Overloads Public Sub New _ ByVal dstart As ChartCalendar ByVal starttime As Long _ ByVal yl As Double ByVal dstop As ChartCalendar ByVal stoptime Long _ ByVal y2 As Double _ ByVal ntimeaxis As Integer _ ByVal nweektype As Integer _ public TimeCoordinates ChartCalendar dstart long starttime double yl ChartCalendar dstop long stoptime double y2 int nweektype public TimeCoordinates ChartCalendar dstart long starttime double yl ChartCalendar dstop long stoptime double y2 int ntimeaxis int nweektype TimeCoordinates constructor example for a 5 day week and 9 30 AM to 4 00 PM time of day range Scaling and Coordinate Systems 127 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 stockTimeScale new TimeCoordinates dstart starttod yl dstop stoptod 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 ChartCalenda
471. pecifies 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 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 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 _ Ct 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 Chart Datasets 75 columnskip For each row of data skip this many columns before s
472. pl int 17 for is0 i lt numpl i angl i ChartSupport ToRadians double i 360 0 double nump1 magl i Math Abs 30 Math Sin 2 angl i Math Cos 2 angl il theFont new Font SansSerif 10 FontStyle Bold chartVu this 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 hartVu AddChartObject background PolarTransform AutoScale Datasetl olarAxes pPolarAxis pPolarTransform GetCompatibleAxes hartVu AddChartObject pPolarAxis PolarGrid pPolarGrid new PolarGrid pPolarAxis PolarGrid GRID MAJOR hartVu AddChartObject pPolarGrid Q PolarAxesLabels pPolarAxisLabels PolarAxesLabels pPolarAxis GetCompatibleAxesLabels chartVu AddChartObject pPolarAxisLabels Q hartAttribute attribl new ChartAttribute Color Blue 2 0 PolarLinePlot thePlotl new PolarLinePlot pPolarTransform Datasetl attribl hartVu AddChartObject thePlotl Q Q hartAttribute attrib2 new ChartAttribute Color Red 1 0 Color Red ttrib2 SetFillFlag true PolarScatterPlot thePlot2 new PolarScatterPlot pPolarTransform Datasetl ChartObj CIRCLE attrib2 chartVu AddChartObject thePlot2 Visua
473. plays 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 LineGapPlot MultiLinePlot P E Collector Current mA Class Architecture 47 Sales vs Cost Gap The Line Gap chart is useful for emphasizing the difference between two lines 8 2 e 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 Kb 350uA Mb 300uA i Mb 250 Mb 200uA Kb 150uA Kb 100uA Collector Emitter Voltage The MultLinePlot will plot a multiple y vectors vs a single x vector 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 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 48 Class Architecture Daily Stock Price Price Volume NASDAQ Scroll Week 7 22 02 7 29 02 8 05 02 8 12 02 8 19 02 The classic stock price chart combines a open high low close plot line plot
474. plot area Use one of the title position constants CENTER GRAPH or CENTER PLOT ChartTitle example extracted from the example program SimpleLinePlots class LineFill C Font theTitleFont new Font SansSerif 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 Font theFooterFont new Font SansSerif 9 FontStyle Bold footer new ChartTitle pTransforml theFooterFont Graphs can have background gradients semi transparent colors 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 SansSerif 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 SansSerif 10 FontStyle Bold footer New ChartTitle pTransforml theFooterFont _ Graphs can have background gradients semi transparent colors legends titles and data tooltips foot
475. 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 ScatterPlots class CellPlotChart C GroupDataset Datasetl new GroupDataset First xl yl Datasetl SetAutoScaleNumberGroups 1 picks up on width but because data is 274 Simple Plot Objects should still work CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml 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 pTransforml 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 Blus attribl SetFillFlag true CellPlot thePlotl new CellPlot pTransforml Datasetl attribl for i20 i lt numPoints itt thePlotl SetSegmentColor i Color FromArgb int xl i int yllO 21 2 0 unt yll 211 chartVu AddChartObject thePlot
476. polar and antenna charts Polar Plots Class PolarLinePlot GraphObj ChartPlot PolarPlot 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 Cf 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 and line style for the line plot Polar and Antenna Charts 345 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 PolarCharts PolarLineAndScatterChart C int numpl 100 double magl new double numpl double Jangl new double num
477. protected against the error condition of taking the log of any number lt 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 Positioning the Plot Area in Graph Area The WorkingCoordinates class has a group of methods SetGraphBorderFrame SetGraphBorderDiagonal and SetGraphBorderlInsets 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 108 Scaling and Coordinate Systems redundant and only one need be called The default positio
478. provides for elapsed time labels It adds extensive time formatting capability Use it to label axes created using the ElapsedTimeAxis class Elapsed Time Label formats 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 _ 224 Axis Labels ByVal baseaxis As ElapsedTimeAxis 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 _
479. r 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 default 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 _ Overloads Public Sub SetTimeCoordinateBounds _ ByVal x1 As Double _ ByVal dstart As ChartCalendar ByVal starttod As Long ByVal x2 As Double _ ByVal dstop As ChartCalendar ByVal stoptod As Long _ ByVal nweektype As Integer _ public void SetTimeCoordinateBounds ChartCalendar dstart long starttod double yl ChartCalendar dstop long stoptod double y2 int nweektype public void SetTimeCoordinateBounds double x1 ChartCalendar dstart long starttod double x2 128 Scaling and Coordinate Systems ChartCalendar dstop long stoptod 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
480. r 24 is a tutorial that describes how to use QCChart2D to create Windows applications using Visual Studio Net Visual C and Visual Basic Chapter 25 is a tutorial that describes how to use QCChart2D to create ASP NET web applications using Visual Studio Net Visual and Visual Basic Chapter 26 is a collection of Frequently Asked Questions about QCChart2D for Net 2 Class Architecture of the QCChart2D for Net Class Library Major Design Considerations This chapter presents an overview of the QCChart2D for Net 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 amp 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 classes using System EventHandler delegate event driven model The chapter also summarizes the classes in the QCChart2D for Net library There are five primary features of the overall architecture of the QCChart2D for Net classes These features address major
481. r 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 15 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 97 Visual Basic Overloads Public Sub New _ ByVal csv As CSV _ ByVal filename As String _ ByVal rowskip As Integer ByVal columnskip As Integer _ Ct public ElapsedTimeGroupDataset CSV csv string filename int rowskip int colummeskip 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 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 mil
482. rGroups 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 modified using the SetSegment methods where the segment number parameter cooresponds to the group number These methods include SetSegmentAttributes SetSegmentFillColor SetSegmentLineColor and SetSegmentColor Group bar plot example extracted from the example program Bargraphs class GroupBargraphs 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 pTransforml 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
483. ram Bargraphs class FloatingBars C GroupDataset Datasetl new GroupDataset Actual Sales x1l yl CartesianCoordinates pTransforml new CartesianCoordinates pTransforml SetScaleStartX 0 pTransforml SetScaleStartY 0 pTransforml SetScaleStopX 12 pTransforml 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 thePlotl floatingBarPlot Datasetl 0 75 attribl ChartObj JUSTIFY CENTER thePlotl SetBarOrient ChartObj HORIZ DIR Visual Basic Dim Datasetl As New GroupDataset Actual Sales 1 yl Dim pTransforml As New CartesianCoordinates pTransforml SetScaleStartX 0 pTransforml SetScaleStartY 0 pTransforml 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 Bargraphs class FloatingBars2s C int nnumpnts 18 int numgroups 2 double xl new double nnumpnts ChartCalendar yl new Ch
484. raph 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 is 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 six concrete implementations of the PhysicalCoordinates class CartesianCoordinates TimeCoordinates ElapsedTimeCoordinates EventCoordinates PolarCoordinates and AntennaCoordinates Use the CartesianCoordinates class for any combination of linear and logarithmic scaling for the x and y coordinate Use 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 EventCoordinates if you have discontinuous or irregular time suchs as that found in worldwide financial markets Use the ElapsedTimeCoordinates class when you want a 106 Scaling and Coordinate Systems elapsed time scale no d
485. rary 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 1s 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 of the plots will overlay the same area of the graph Many advanced charting packages do not support more than one coordinate 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 c
486. rdinate system is for the GRADIENT MAPTO PLOT PHYSICAL COORDINATES GRADIENT MAPTO PLOT NORMALIZED COORDINATES and Background Colors Textures and Gradients 167 GRADIENT MAPTO GRAPH NORMALIZED COORDINATES mapping modes The example below uses the GRADIENT MAPTO PLOT PHYSICAL COORDINATES mapping mode to map four colors to the physical coordinates of the plot area C ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green Color barcolors Color Red Color Orange Color Yellow Color White double barbreakpoints 0 0 80 160 240 int gradmode ChartGradient GRADIENT MAPTO PLOT PHYSICAL COORDINATES ChartGradient cg new ChartGradient pTransforml gradmode barcolors barbreakpoints 90 attribl Gradient cg Visual Basic Dim attribl As New ChartAttribute Color Green 0 DashStyle Solid Color Green Dim barcolors As Color Color Red Color Orange Color Yellow Color White Dim barbreakpoints As Double 0 0 80 160 240 Dim gradmode As Integer ChartGradient GRADIENT MAPTO PLOT PHYSICAL COORDINATES Dim cg As ChartGradient New ChartGradient pTransforml gradmode barcolors _ barbreakpoints 90 attribl Gradient cg The example below uses the GRADIENT MAPTO OBJECT mapping mode to map four colors to each bar of the bar plot regardless of the bar size C ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green
487. re Two common examples that use logarithmic scales are hi fi speaker charts db vs log frequency and stock market charts Class LogAxis GraphObj t 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 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 Axes 179 0 1 to 100 0 0 1 1 0 10 0 100 0 20 to 50 000 20 200 2000 20000 104 1 0 10 10 10 107 1 0 The minor tick marks for a logarithmic axis use a linear interval between the tick marks
488. reate inherited controls from the UserChartControll class that you already created Create an inherited control by selecting Project Add Inherited Control Give the inherited control a unique name 1 UserInheritedControll When you select Open choose UserControll in the Inheritance Picker The result is new control added to the project Build the solution and the UserInheritedControll control will be added to the WindowsControlLibraryl DLL in addition to the UserControll View the UserChartControll cs underlying C code We placed all of the chart creation code in the InitializeChart method This method is called in the UserControll constructor otherwise the UserControll appears as an empty shell Add whatever properties you need to get data from the HTML file into the chart control ChartTitleText and YMax in the example below System System Collections Generic System ComponentModel System Drawing System Data System Text System Windows Forms System Drawing Drawing2D com quinncurtis chart2dnet namespace WindowsControlLibraryl public partial class UserControll com quinncurtis chart2dnet ChartView ChartTitle mainTitle new ChartTitle TimeCoordinates pTransforml new TimeCoordinates LinearAxis yAxis new LinearAxis public UserControll InitializeComponent InitializeChart private void InitializeChart ChartView chartVu this Font theFont int nnumpnts 8
489. riceData 2 minval 1 5 ChartSupport GetRandomDouble low currentdate Add incrementbase increment if currentdate Get ChartObj HOUR OF DAY 16 currentdate Add ChartObj DAY OF YEAR 1 currentdate SetTOD 9 30 0 currentEvent new ChartEvent xValues i position stockPriceData currentEvent AxisLabel XXX position ToString currentEvent ToolTip ToolTip position ToString eventArray i currentEvent EventGroupDataset Datasetl new EventGroupDataset Stock Data eventArray 4 EventSimpleDataset Dataset2 Datasetl ConvertToEventSimpleDataset 1 EventCoordinates pTransforml new EventCoordinates Datasetl VB Dim minval As Double 0 0 maxval As Double 0 0 Dim incrementbase As Integer ChartObj MINUTE Dim increment As Integer 10 Dim currentdate As New ChartCalendar Dim eventArray As ChartEvent New ChartEvent nNumPnts 1 stockPriceData 3 25 5 close StockPriceData 0 24 5 open StockPriceData 1 26 high stockPriceData 2 24 low Dim currentEvent As New ChartEvent currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode currentdate SetTOD 9 33 0 For 0 To nNumPnts 1 Dim position As Double i 1 xValues i DirectCast currentdate Clone ChartCalendar If i gt 0 Then stockPriceData 3 2 0 5 ChartSupport GetRandomDouble close stockPriceData 0 2 0 5 ChartSupport GetRandomDouble
490. rloads Public Sub New _ ByVal component As ChartView _ ByVal buttonmask As MouseButtons ByVal objectifilter As String Overloads Public Sub New _ ByVal component As ChartView ByVal buttonmask As MouseButtons _ public MoveObj ChartView component MouseButtons buttonmask string objectifilter public MoveObj ChartView component MouseButtons buttonmask Moving Objects and Data Points 313 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 1s used to filter the desired class objects The string ChartText 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
491. rogrammers 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 chart image will have 500 1000 pixels as the horizontal resolution of the plotting area This would imply that in the 100M data point example above every horizontal pixel would represent 50K to 100K 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 100M data points and compress them down to 2K 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 also 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 that a 2000 point compressed dataset where there are at least two data points per pixel of horizontal resolution will look just like the 100 000 000 point dataset only display hundreds of times faster The Datset classes all include compression methods SimpleDataset CompressSimpleDataset GroupDataset CompressGroupDataset TimeSimpleDataset CompressTimeSimpleDataset and TimeGroupDataset CompressTimeGroupDat
492. roupDataset First xl yl 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 pTransforml SetScaleStartY 0 Background background new Background pTransforml ChartObj PLOT BACKGROUND Color FromArgb 255 255 255 3 chartVu AddChartObject background pTransforml SetGraphBorderDiagonal 0 15 15 90 0 75 298 Simple Plot Objects Define axes axes labels and grids ChartAttribute attribl new ChartAttribute attribl SetFillFlag true tribl SetLineFlag false artAttribute attribArray i20 i lt numGroups i attribArray i ChartAttribute tribArray 0 SetFillColor Color Blue LtribArray 1 SetFillColor Color Yellow tribArray SetFillColor Color Magenta tribArray SetFillColor Color Orange tribArray SetFillColor Color Gray tribArray 5 SetFillColor Color Red tribArray 6 SetFillColor Color Green tackedLinePlot thePlotl new StackedLinePlot pTr chartVu AddChartObject thePlot n o Ov 21 31 41 1 toner ck ct ict Gt ict a a a a a a a 5 ansforml Dat 1 Visual Basic Dim Dim Dim Dim numPoints As Integer 100 numGroups As Integer 7 xl numPoints 1 As Double yl numGroups 1 numPoints 1 As Double Initialize
493. rrow 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 ScatterPlots class ArrowChart C GroupDataset Datasetl new GroupDataset First x1 y1 Datasetl SetAutoScaleNumberGroups 1 CartesianCoordinates pTransforml 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 pTransforml SetGraphBorderDiagonal 0 15 15 90 0 75 Define axes axes labels and grids ChartAttribute attribl new ChartAttribute Color Blue 1 DashStyle Solid attribl SstFrillColor Color Bl s attribl SetFillFlag true Arrow basearrow new Arrow ArrowPlot thePlotl new ArrowPlot pTransforml Datasetl basearrow attribl chartVu AddChartObject thePlotl1 Visual Basic Dim Datasetl As New GroupDataset First 1 yl Datasetl SetAutoScaleNumberGroups 1 Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE _ ChartObj LINEAR SCALE pTra
494. rtAttribute ChartGradient ChartPrint BufferedImage System Windows Forms UserControl ChartView Rectangle2D p Point2D Point3D GroupPoint2D DoubleArray DoubleArray2D BoolArray Polysurface 64 Class Architecture GraphObj AntennaAnnotation TickMark Axis LinearAxis PolarAxes AntennaAxes LogAxis TimeAxis ElapsedTimeAxis EventAxis ChartText ChartTitle AxisTitle ChartLabel NumericLabel BarDatapointValue TimeLabel ElapsedTimeLabel StringLabel AxisLabels NumericAxisLabels TimeAxisLabels ElapsedTimeAxisLabels StringAxisLabels PolarAxesLabels AntennaAxesLabels EventAxisLabels 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 Group VersaPlot PieChart RingChart PolarPlot PolarLinePlot PolarScatterPlot AntennaPlot AntennaLinePlot AntennaScatterPlot AntennaLineMarkerPlot Background ChartImage ChartShape ChartSymbol Marker ChartZoom 3 Chart Datasets ChartDataset SimpleDataset TimeSimpleDataset ElapsedTimeSimpleDataset ContourDataset EventSimpleDataset GroupDataset TimeGroupDataset ElapsedTimeGroupData
495. rtObj GRAPH BACKGROUND Color White chartVu AddChartObject graphbackgroundl LinearAxis xAxisl new LinearAxis pTransforml ChartObj X AXIS xAxisl SetColor Color Black chartVu AddChartObject xAxis1 LinearAxis yAxisl new LinearAxis pTransforml ChartObj Y AXIS yAxisl SetColor Color Red chartVu AddChartObject yAxis1 NumericAxisLabels xAxisLabl new NumericAxisLabels xAxis1 xAxisLabl SetColor Color Black chartVu AddChartObject xAxisLabl NumericAxisLabels yAxisLabl new NumericAxisLabels yAxis1 418 Using QCChart2D for Net to Create Web Applications yAxisLabl SetColor Color Red chartVu AddChartObject yAxisLabl ChartAttribute attribl new ChartAttribute Color Red 3 DashStyle Solid SimpleLinePlot thePlotl new SimpleLinePlot pTransforml Datasetl attribl r chartVu AddChartObject thePlot1 Font theTitleFont new Font SansSerif 18 FontStyle Bold String GraphTitle WebApplicationl ChartTitle mainTitle new ChartTitle pTransforml theTitleFont GraphTitle mainTitle SetTitleType ChartObj CHART HEADER mainTitle SetTitlePosition ChartObj CENTER GRAPH mainTitle SetColor Color Black chartVu AddChartObject mainTitle return chartVu Modify the Page_Load method that was included by default when the behind code page was created In the example below parameters that were appended to the ASP page request are retrieved using th
496. rtObj MONTH 3 TimeSimpleDataset Datasetl new TimeSimpleDataset Sales x1 y1 TimeSimpleDataset Dataset2 new TimeSimpleDataset Expenses x1l y2 Visual Basic Dim nnumpnts As Integer 32 Dim xl nnumpnts 1 As ChartCalendar Dim yl nnumpnts 1 As Double Dim y2 nnumpnts 1 As Double Dim currentdate As New ChartCalendar 1998 ChartObj JANUARY 1 y1 0 100 y2 0 30 x1 0 currentdate Clone currentdate Add ChartObj MONTH 3 For 1 To nnumpnts 1 currentdate Clone 1 1 yl i 1 5 1 0 75 ChartSupport GetRandomDouble 2 1 y2 i 1 15 i 0 95 ChartSupport GetRandomDouble currentdate Add ChartObj MONTH 3 Next i Dim Datasetl As New TimeSimpleDataset Sales 1 yl Dim Dataset2 As New TimeSimpleDataset Expenses 1 2 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 Chart Datasets 73 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 datas
497. ructor for StringAxisLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As Axis _ public StringAxisLabels Axis baseaxis baseaxis This is the axis the axis labels are for The axis strings and 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 Declaration Public Sub SetAxisLabels _ font As Font rotation As Double _ labdir As Integer _ labelends As Integer _ labcolor As Color tickstrings As String _ numtickstrings As Integer _ public void SetAxisLabels Font font double rotation int labdir int labelends Color l boolor stringi tickstrings int numtickstrings 216 Axis Labels 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
498. ructor 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 system 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 xl 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 Dim pTransforml As CartesianCoordinates _ 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 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
499. s 500W x 692H 400W x 554H 300W x 415 etc If you are printing in landscape mode then the chart width and height values would be swapped ChartPrint example extracted from the example program LinePlotSalesVolume class LinePlotSalesVolume This routine invokes the chart objects PageSetupItem method 392 File and Printer Rendering public void PageSetup object sender System EventArgs e ChartView chartVu this if chartVu null if printobj null printobj new ChartPrint chartVu else chartVu printobj PrintChartView ex printobj PageSetupItem sender This routine invokes the chart objects printer setup dialog method public void PrinterSetup object sender System EventArgs e ChartView chartVu this if chartVu null if printobj null printobj new ChartPrint chartVu else printobj PrintChartView printobj DoPrintDialog chartVu This routine invokes the chart objects PrintPreviewItem method public void PrintPreview object sender System EventArgs e ChartView chartVu this if chartVu null if printobj null printobj new ChartPrint chartVu else printobj PrintChartView chartVu printobj PrintPreviewItem sender e This routine prints a chart by invoking the chart objects DocPrintPage method public void PrintPage object sender System EventArgs e ChartView chartVu this if chartVu
500. s Applications Add Reference NET COM Projects Browse Recent Look jn CJ lib 2 QcsPCChartNet dl 8 QCRTGraphNet dll 9 ocmatviewNet dll 8 QCMatPackNet dll QCChart2DNet dll gacutil exe File name QCChart2DNet dll Files of type Component Files dll olb manifest View the UserChartControll cs code Change the base class of UserChartControllto com quinncurtis chart2dnet ChartView This adds local version of the control to the project The C form code should now look like using System using System Collections Generic using System ComponentModel using System Drawing using System Data using System Text using System Windows Forms namespace UserChartExamplel public partial class UserChartControll UserControl public 11 InitializeComponent Critical Step Make sure you add the following lines to the top of the UserChartControll cs code to resolve the QCChart2D and other graphics classes used in the example using System Drawing Drawing2D using com quinncurtis chart2dnet using using using using using using using using using System System System System System System System System Using QCChart2D for Net to Create Windows Applications 411 The step of creating and defining a User Control that inherits from
501. s associated debugging errors in user controls at design time Collections Generic ComponentModel Drawing Data Text Windows Forms Drawing Drawing2D com quinncurtis chart2dnet namespace UserChartExamplel public partial class UserChartControll ChartView public UserChartControll InitializeComponent public void InitializeChart ChartView chartVu this 412 Using QCChart2D for Net to Create Windows Applications Font theFont int numPoints 95 double x1 new double numPoints double 1 new double numPoints double y2 new double numPoints double y3 new double numPoints int i for i 0 i lt numPoints i xl i double i 1 ylii 20 0 50 0 1 Math Bxp xl i 200013 y2 i ylli 20 0 2 wl i 0 6 ChartSupport GetRandomDouble 5 y3 i yl i 20 0 4 1 1 0 4 ChartSupport GetRandomDouble vZ 94 y3 0 95 theFont new Font Microsoft Sans Serif 10 FontStyle Bold SimpleDataset Datasetl new SimpleDataset First xl yl SimpleDataset Dataset2 new SimpleDataset Second xl y2 SimpleDataset Dataset3 new SimpleDataset Third x1 y3 CartesianCoordinates pTransforml new CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Dataset3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetGraphBorderDiagonal 0 15
502. s 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 CartesianCoordinates xMax yMin xMin 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 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 ChartCalendar xMin new ChartCalendar 1996 ChartObj FEBRUARY 5 ChartCalendar xMax new ChartCalendar 2002 ChartObj JANUARY 5 double yMin 0 double yMax 15 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 Dim simpleTimeScale As TimeCoordinates simpleTimeScale New TimeCoordinates xMax yMin xMin yMax Use the TimeCoordinates SetCoordinateBounds method
503. s one y for every x Simple plot types include line plots scatter plots bar graphs and line marker plots SimplePlot This class is an abstract base class for all simple plot classes Class Architecture 53 Production of Green Bars is Up P 4 E 1 a n rur Tee Tp 1998 1999 2000 2001 2002 2003 2004 2005 Bar plots can have the values of the bars displayed above or inside each bar 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 SimpleBarPlot History Test Results 100 5 5 4 83 23 15 90 nn 51 2 4 3 Coe nek oii Bene i AE 5 5 15 20 0 5 10 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 54 Class Architecture Sales Volume is Rising Faster than Forecast 1999 2000 2001 2002 2003 2004 2005 2006 Presentation quality graphs with background gradients semi transparent colors legends and titles SimpleLinePlot This class is a concrete implementation of the SimpleP
504. s pTransforml new EventCoordinates Datasetl pTransforml SetScaleStartY 0 EventAxis xAxis new EventAxis pTransforml EventAxis TICK RULE MAJOREVENT ChartObj X AXIS xAxis SetColor Color White chartVu AddChartObject xAxis LinearAxis yAxis new LinearAxis pTransforml ChartObj Y AXIS yAxis SetColor Color White chartVu AddChartObject yAxis Axis Labels 231 EventAxisLabels xAxisLab new EventAxisLabels xAxis xAxisLab SetAxisLabelsFormat ChartObj TIMEDATEFORMAT Y2000 xAxisLab SetColor Color White chartVu AddChartObject xAxisLab Visual Basic Dim Datasetl As New EventSimpleDataset Actual Sales chartevents Dim pTransforml New EventCoordinates Datasetl pTransforml SetScaleStartY 0 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 Dim xAxis As New EventAxis pTransforml EventAxis TICK RULE MAJOREVENT ChartObj X AXIS xAxis SetColor Color White chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS yAxis SetColor Color White chartVu AddChartObject yAxis Dim xAxisLab As New EventAxisLabels xAxis xAxisLab SetAxisLabelsFormat ChartObj TIMEDATEFORMAT Y2000 xAxisLab SetColor Color White chartVu AddChartObject xAxisLab Custom time ax
505. s 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 ChartZoom 320 Zooming The ChartZoom class implements Net 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 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 ChartVi
506. s posted causing a momentary flash when the chart is redraw Using the HTML approach the chart is redrawn without the flash making it a better method for real time applications Embedding a QCChart2D Object into Internet Explorer Special Note This technique only works with the commercial version of the software It will NOT work with the trial version of the software In order to embed a QCChart2D object into Internet Explorer the client must have the QCChart2DNet DLL installed in the system GAC Global Assembly Cache This gives the DLL the necessary security clearance to run in a browser Perform the following steps Locate the Gacutil exe found in your Visual Studio installation program and copy it to our Quinn Curtis DotNet Lib Run Gacutil exe from the DOS prompt while you are in the Quinn Curtis DotNet Lib directory using the following command line Gacutil i QCChart2DNet DLL You will find an endless source of information about the GAC on the web and there is no need to repeat it Here is a starting point http www codeproject com dotnet DemystifyGAC asp In general you should not be installing any of our Net DLL s in the system GAC unless you have an overriding reason to so In general our Net DLLs should just be distributed as part of an application program and would normally reside in the same folder as the application programs executable One exception is if you expect a QCChart2D derived UserControl
507. s 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 rwidth As Double _ attrib As ChartAttribute _ CH public BoxWhiskerPlot PhysicalCoordinates transform double rwidth Simple Plot Objects 265 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 bo
508. sLabels 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 used to create a NumericAxisLabels object for the class This object draws the labels for the positive section of the x axis PolarAxisLabels constructor There is only one main constructor for PolarAxesLabels objects Visual Basic Overloads Public Sub New _ ByVal baseaxis As PolarAxes Ct public PolarAxesLabel1s 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 Axis Labels 233 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 _ Ct public void SetAxisLabelsFormat int format The font object used to display the axis label text labcolor The color of the label tex
509. se 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 Table of Contents Cona n TOME ace ora rait nte cut cda a 1 NER RERUM 1 D for Nel Background 12 DCE hag D ior Net Depenudeneled asse cler coi EH dara edn Eod pt bi Hic bad 13 Critical Note Running the Example Programs eese 19 Chapter SUMMA EORR e 20 2 Class Architecture of the QCChart2D for Net Class Library 22 Major Design Considerations od peer pti cp bd n 22 LC Dara D jor Net Class SUMMA 24 Charn Wiodow Classes oscar On ca ta Pli eu E a oa Ong ca 23 IEEE SACER 25 Simple Numerio DOSE uiid dccus b bald a it 66 Simple Date Time Dataset chet t d te 69 Date Time Group Dataset a M Md Es 91 Elapsed Time TP 95 Event Group aa sacha rds bti ne 98 4 Scaling and Coordinate tasti cet 103 Plot arca and Be E CNN 103 oc meme 105 Chart Scaling and the Net Dravwmg2D Mati iu aei Lite teta ri ad rasan 106 Important
510. set EventGroupDataset 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 datasets include a simple dataset type that can substitute ChartCalendar values or TimeSpan as the x or y values There are datasets used to plot contour data And there is a simple and group datasets which can plot ChartEvent data Except in the case of the ChartEvent datasets EventSimpleDataset and EventGroupDatast 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 The ChartEvent datasets are different Because they contain an array of ChartEvent objects and these objects can be quite large a copy of the ChartEvent objects is NOT made Instead the dataset classes reference the ChartEvent objects passed into the constructor 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
511. sforml New Dimension 0 05 0 2 magnifyObj SetButtonMask MouseButtons Left magnifyObj SetEnable True magnifyObj UpdateDuringDrag True MagniViewChartl SetCurrentMouseListener magnifyObj 328 Zooming 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 is placed in target A reference to the target ChartView object that the magnified view of the chart is placed in transforms An arry of PhysicalCoordinates objects associated with the chart 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 d
512. 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 is 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 t 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 Ove
513. shortcomings in existing charting software for use with both Net and other computer languages First QCChart2D for Net 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 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 Class Architecture 23 The new derived class localizes custom source code and the source of the underlying classes remains unchanged In the QCChart2D for Net classes a user 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 Third the lib
514. sical 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 system 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 ref
515. side the plot area 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 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 phy
516. 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 Colors Gradients and Backgrounds Class ChartAttribute ChartObj ChartAttribute All graphical object derived from our abstract GraphObj class include an instance of the ChartAttribute class This class encapsulates common graphical line and fill style characteristics into a single class If a graphical object is line based it can have a line color line style and a line thickness Line based graphical objects include line based plots SimpleLinePlot MultiLinePlot OHLCPlot all types of axes and all types of text If an object is area based it can have a solid fill color or a gradient of fill colors or possibly a texture The fill color fills the interior of the area object Most area fill objects also use line attributes to define the color and line thickness of the outline of the area object A bar can have an outline color different from the interior fill color All of the bar graph plot types scatter plot types and pie charts are example of graphical objects which use the area fill solid color ChartAttribute constructors Use the constructor below for simple line and fill attributes There are similar constructors with fewer parameters if all you want to do is set a line color or a line color with a line thickness
517. soft Net PrintDocument component to implement printing Since the aspect ratio of the printed page is different from the aspect raion of common displays options are included that allow different modes for positioning and sizing the chart on the printed page The BufferedImage class converts a chart into a Net Bitmap object or saves the chart to a file in any of the graphics formats supported by the System Drawing Imaging ImageFormat class The image file is placeable in a web page or an application program You can create a headless Net application and render charts without displaying a Windows form saving the charts as image files Printing a Chart Class ChartPrint ChartObj ChartPrint The ChartPrint class uses the Microsoft Net PrintDocument component to implement printing The class selects setups and outputs a chart to a printer ChartPrint constructor Visual Basic Overloads Public Sub New _ ByVal component As ChartView _ ByVal nsizemode As Integer _ Cf public ChartPrint ChartView component int nsizemode component Specifies the ChartView object to be printed File and Printer Rendering 391 nsizemode Specifies the printer mapping mode Use one of the mapping mode constants PRT MAX Print the view so that paper is used maximally Text prints proportional to other objects aspect ratio is maintained PRT EXACT Print the view at the same size as the screen at least as far as Net m
518. 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 for Net 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 Class TimeCoordinates Scaling and Coordinate Systems 119 PhysicalCoordinates t TimeCoordinates The TimeCoordinates class scales the chart plot area for physical coordinate systems that use date time scaling The basic techniq
519. ss 7 19 2002 3 15 11 12 Hour Mode 1234000 Percent 19 07 2002 3 15 12 Hour Mode 1 23401 04 Exponent 02 12340 Currency 7102 719 02 19 07 02 49 Multi line and rotated 0 360 degrees July gor axis labels are supported Jul S J 49 Friday Western Eastern Southern Northern Sales Sales Sales Sales Region Region Region Region Fri F In addition to the predefined formats programmers can define custom time date and numeric formats AxisLabels 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 axis label text can be rotated 360 degrees in one degree increments NumericAxisLabels 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 StringAxisLabels This class labels the major tick marks of the LinearAxis and LogAxis classes using user defined strings TimeAxis Labels ElapsedTimeA xisLabels PolarAxesLabels AntennaAxesLabels EventAxisLabels Chart Plot Classes ChartPlot ContourPlot GroupPlot PieChart PolarPlot AntennaPlot SimplePlot Class Architecture 309 This class labels the major tick marks of the associated
520. ss Data cursors combine the Net mouse event delegates with the Marker class creating a marker that tracks the mouse and Data Markers and Data Cursors 307 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 Integer _ ByVal rsize As Double _ Cf 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 nmarkdertype The marker type Use one of the Marker marker type constants MARKER VLINE MARKER BOX rsize The size in Net 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 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 c
521. ss 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 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 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 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 usi
522. start The starting date value for the axis dstop The ending date value for the axis 190 Axes ntickmarkbase 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 Other axis properties axis intercept tick mark lengths tick mark direction 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 _ 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 _ public void SetAxisTicksAttributes double minorticklength double majorticklength itt tigbdir Sets the intercept of this axis with the perpendicular axis in physical coordinates minorticklength Specifies the length of a minor tick mark in Net device coordinates majorticklength Specifies the length of a major tick mark in Net 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 Axes 191
523. summary gt Set Get the yMax lt summary gt Public Property YMax As Double Get Return pTransforml GetScaleStopY End Get Set ByVal Value As Double pTransforml SetScaleStopY Value yAxis CalcAutoAxis Me UpdateDraw End Set End Property End Class S Once you can compile the project copy the resulting WindowsControlLibrary1 DLL file to the desired folder on your web site In our example we copied the DLL to the http quinn curtis com UserControlTestRev2 OCCH2D folder The DLL file size should be quite small since the underlying QCChart2DNet DLL file is not included as part of the WindowsControlLihraryl DLL When Internet Explorer views a web page that properly references the WindowsControlLihraryl DLL and its internal UserControll user control it will download just that DLL Internet Explorer will not attempt to download the QCChart2DNet DLL and will look to the system GAC for it instead Create the HTML File That Displays the User Control Create an HTML file however you normally would do it You will need to add HTML text to it using some sort of HTML editor You will find 436 Using QCChart2D for Net to Create Web Applications HTMLPagel htm our example in the WindowsControlLibraryl folder The control is referenced in the HTML file as lt OBJECT id MyTestUserControll height 496 width 646 classid http quinn curtis com UserControlTestRev2 QCCHT2D WindowsControlLibraryl dll4WindowsControlLibrary
524. t Public 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 MyBase New achartview thetransform nmarkertype rsize cplotl plotl cplot2 plot2 End Sub New Public Dim Dim Dim Dim Dim Dim MyB If Data Markers and Data Cursors 311 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 mouseevent mouseevent Button And GetButtonMask 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 lt _ nearestPointObj2 GetNearestPointMinDistance Then 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 _ nearestPoint Ge
525. t 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 PolarCoordinates polarscale new PolarCoordinates polarmagnitude PolarAxes polarAxes new PolarAxes polarscale PolarAxesLabels polarAxesLabels new PolarAxesLabels polarAxes polarAxesLabels SetAxisLabelsFormat ChartObj DECIMALFORMAT polarAxesLabels SetAxisLabelsDecimalPos 2 Create the ChartView object to place graph objects in ChartView chartVu new ChartView 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 234 Axis Labels 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 New ChartView Add the polar axes to the chartVu object chartVu AddChartObject polarAxes chartVu AddChartObject polarAxesLabels Antenna Axes Labels C
526. t GroupPlot t LineGapPlot The LineGapPlot class extends the GroupPlot class and displays a line gap chart The number of groups must be two 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 attrib 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 SetSegmentA ttributes methods in the manner described for SimplePlot objects Line gap bar plot example extracted from the example program MiscCharts class LineGapChart C int nNumPnts 5 nNumGroups 2 ChartCalendar xValues new ChartCalendar nNumPnts double groupBarData new double nNumGroups n
527. t 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 Note Do not use the TimeGroupDataset if you want to display data using the elapsed time The TimeGroupDataset uses a full GregorianCalendar date time and it is not suitable for the display of elapsed time since time intervals do not have an explicit date i e 10 11 2008 Use the ElapsedTimeGroupDataset class in combination with an ElapsedTimeCoordinateSystem if you plan to create an elapsed time chart 92 Chart Datasets This constructor creates a new group TimeGroupDataset object where the x values are ChartCalendar values and the y values are floating point numbers TimeGroupDataset constructors Visual Basic Overloads Public Sub New _ ByVal sname As String _ ByVal x As ChartCalendar ByVal As Double _ public TimeGroupDataset string sname ChartCalendar x double y 3 sname 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
528. t 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 _ Ct public void SetAxisIntercept double intercept 176 Axes 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 _ public void SetAxisTicks double tickorigin double tickspace int ntickspermajor public void SetAxisTicks double tickorigin double tickspace int nminortickspermajor double minorticklength double majorticklength int tisbdir intercept Sets the intercept of this axis with the perpendicular axis in physical coordinates tickorigin The tick marks start at this value tickspace Specifies the spacing between minor tick marks ntickspermajor Specifies the number of minor tick marks per major tick mark minorticklength The length of minor tick marks in Net device coordinates majorticklength
529. t 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 Overloads 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 Simple Plot Objects 263 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 rotation of the arrow using the point of the a
530. t 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 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 new ChartView 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 New ChartView Add the polar axes to the chartVu object chartVu AddChartObject polarAxes Custom polar axes example C double polarmagnitude 15 0 PolarCoordinates polarscale new PolarCoordinates polarmagnitude PolarAxes polarAxes new PolarAxes polarscale double axestickspace 1 int axesntickspermajor double angletickspace 5 57 0 int anglentickspermajor 6 Axes 203 double minorticlength 5 double majort
531. t objects and move them Moveable chart objects include axes axes labels titles legends arbitrary text 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 cursor 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 d
532. tObj TIMEDATEFORMAT Y2000 xAxisLab SetColor Color White chartVu AddChartObject xAxisLab NumericAxisLabels yAxisLab new NumericAxisLabels yAxis yAxisLab SetColor Color White yAxisLab SetAxisLabelsFormat ChartObj CURRENCYFORMAT chartVu AddChartObject yAxisLab AxisTitle yaxistitle new AxisTitle yAxis theFont Millions yaxistitle SetColor Color White chartVu AddChartObject yaxistitle Grid ygrid new Grid xAxis yAxis ChartObj Y AXIS ChartObj GRID MAJOR ygrid SetColor Color White ygrid SetLineWidth 1 chartVu AddChartObject ygrid ChartAttribute attribl new ChartAttribute Color Green 0 DashStyle Solid Color Green attribl SetFillFlag true SimpleBarPlot thePlotl new SimpleBarPlot pTransforml Datasetl hartCalendar GetCalendarWidthValue ChartObj MONTH 8 0 0 attribpl ChartObj JUSTIFY CENTER NumericLabel bardatavalue thePlotl GetPlotLabelTemplate bardatavalue SetTextFont theFont bardatavalue SetNumericFormat ChartObj CURRENCYFORMAT bardatavalue SetDecimalPos 0 N 430 Using QCChart2D for Net to Create Web Applications bardatavalue SetColor Color White thePlotl SetPlotLabelTemplate bardatavalue thePlotl SetShowDatapointValue true chartVu AddChartObject thePlot1 Font theTitleFont new Font Microsoft Sans Serif 14 FontStyle Bold mainTitle new ChartTitle pTransforml theTitleFont Production of Green Bars is Up
533. tObject thePlot2 Class PolarScatterPlot GraphObj ChartPlot PolarPlot PolarScatterPlot 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 Polar and Antenna Charts 347 Cf public PolarScatterPlot PolarCoordinates transform SimpleDataset dataset int symtype ChartAttribute attrib transform The coordinate system for the new PolarScatterPlot object 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
534. tView 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 int xAxisMinorTicksPerMajor 5 double xAxisMinorTickLength 5s double xAxisMajorTickLength 10 int xAxisTickDirection ChartObj AXIS MIN xAxis SetAxisIntercept xAxisIntercept xAxis SetAxisTicks xAxisOrigin xAxisMinorTickSpace xAxisMinorTicksPerMajor xAxisMinorTickLength 178 Axes 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 Double 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 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 natu
535. tX nearestPoint GetY 10 0 PHYS POS chartview AddChartObject amarker rNu Add p Y po ch ch End End If End Sub End Class Another c mericLabelCntr 1 0 a numeric label the identifies the marker ointLabel 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 intLabel SetTextNudge 5 5 artview AddChartObject pointLabel artview UpdateDraw Df OnMouseUp CustomChartDataCursor ommon reason for locating a data point is to display information associated with that data point A good example is stock market data 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
536. tall 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 purchased 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 yu 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
537. tarting 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 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 simple elapsed time datasets extracted from the NewDemosRev2 ElapsedTimeChart example program C int numPoints 100 TimeSpan xl new TimeSpan numPoints double yl new double numPoints double y2 new double numPoints ine Lr 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 il TotalSeconds 20 0 gt 0 yl i 20 0 50 0 0 5 ChartSupport GetRandomDouble Math Sin x1 i1 TotalSeconds 5 else yl i 20 0 5 0 0 5 ChartSupport GetRandomDouble Math Sin xl i TotalS
538. tarts at 1 not 0 If 0 was used the first data point would exactly on the edge of the clipping window and this would cut off half of a bar scatter plot candlestick or OHLC symbol positioned in the first position The default auto scaling values scale the ChartCoordinates scale from 0 to N 1 where N is then number of unique ChartEvent Positon values This way ChartEvent objects are not cut off on the left or the right Scaling and Coordinate Systems 143 There is a specialized axis class EventAxis and axis labels class EventAxisLabels to use with event data Unlike our regular LinearAxis and TimeAxis classes which are independent of the data in the chart the EventAxis is dependent on the underlying data The tick marks of the EventAxis are placed at the x position of the associated ChartEvent objects If there are more than 10 20 ChartEvent objects in the graph the tick mark labels would start to overlap so we divide the tick marks into major tick marks which are those that get a label and minor tick marks which do not get a label Further if there are more than 100 200 ChartEvent objects in the graph then the tick marks may start to overlap So the software has the option of drawing a minor or a major tick mark every Nth event to keep them from overlapping Most of this is taken care of by the auto axis routines Though it is possible you do not like the results you can t please everybody So once the axis is created you can m
539. taset 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 2 3 4 5 6 7 8 9 double xData 1 yData 22 33 44 55 46 33 25 14 double SimpleDataset dataset new SimpleDataset Sales xData yData CartesianCoordinates simpleScale new CartesianCoordinates simpleScale AutoScale dataset simpleScale SetScaleStopX 10 simpleScale SetScaleStartX 1 0 Visual Basic Dim xD ta Double 1 2 3 4 5 90 7 8 9 10 Dim yData As Double 1D0
540. ted data point available using get methods You can place your tooltip text in the ChartText object internal 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 Data ToolTips 335 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 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 mo
541. ted for actual viewing of the charts Using Net you can create console applications that are designed to display in text mode under the DOS prompt without a graphical display Creating charts using headless rendering is almost identical to displaying the charts on a Windows form There are are two important differences First since the ChartView component of your chart is not added to a form size information is not assigned to it by the Visual Studio Designer You must therefore explicity size the ChartView component to produce a memory bitmap of the size you want the chart rendered at ChartView chartVu new ChartView chartVu Size new Size 600 300 Second since the ChartView component is not to be viewed you do NOT want it added to some underlying Windows Forms Controls list This would be done if you explicitly added the ChartView component to a Windows form or if you explicitly added the ChartView component to some Windows Forms Controls list This is usually hidden in the Forms Designer part of the code though there are cases where you might do this manually Since our ChartView compoenent relies on System Windows Forms classes you still have to have System Windows Forms Sysem Drawing and QCChart2DNet namespaces referenced in the Solution references section And you will need add the following using or import references in addition to those included in a standard Console app using System Drawing using System Drawin
542. teger For 0 To numPoints 1 xl i e CDbl i D 2 For j 0 To numGroups 1 yli 1 eg 5 01 CDbl j 1 5 0 1 0 Math Exp xl i 0 7 Next j Next i 292 Simple Plot Objects 1 0 5 ChartObj rBadDataValue yl 3 15 ChartObj rBadDataValue theFont New Font SansSerif 10 FontStyle Bold Dim Datasetl As New GroupDataset First 1 yl Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE _ ChartObj LINEAR SCALE pTransforml AutoScale Datasetl ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR pTransforml SetScaleStartX 0 pTransforml SetScaleStartY 0 Dim background 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 thePlotl Open High Low Close Plots Class OHLCPlot GraphObj ChartPlot GroupPlot OHLCPlot 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 on
543. tennascale double axestickspace 1 int axesntickspermajor S double angletickspace 5 int anglentickspermajor 6 double minorticlength 5 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 antennaAxes SetAntennaAxesTicks axestickspace axesntickspermajor angletickspace anglentickspermajor minorticlength majorticlength maxvalue maxvalue 207 tickdir Add the Antenna axes to the chartVu object chartVu AddChartObject antennaAxes 8 Axis Labels AxisLabels NumericAxis Labels TimeA xisLabels ElapsedTimeAxisLabels EventAxisLabels StringAxisLabels PolarAxesLabels AntennaAxesLabels Axis Labels Axis labels are numeric or text strings placed next to axis tick marks
544. tes ChartCalendar dstart double yl ChartCalendar dstop double y2 SetTimeCoordinateBounds method Visual Basic Overloads Public Sub SetTimeCoordinateBounds _ ByVal dstart ChartCalendar ByVal yl As Double _ ByVal dstop As ChartCalendar ByVal y2 As Double ByVal nweektype As Integer _ Overloads Public Sub SetTimeCoordinateBounds _ ByVal dstart As ChartCalendar ByVal yl As Double _ ByVal dstop As ChartCalendar _ Scaling and Coordinate Systems 125 ByVal y2 As Double Overloads Public Sub SetTimeCoordinateBounds _ ByVal xi Double ByVal dstart As ChartCalendar ByVal x2 As Double _ ByVal dstop As ChartCalendar public void SetTimeCoordinateBounds ChartCalendar dstart double yl ChartCalendar dstop double y2 int nweektype public void SetTimeCoordinateBounds ChartCalendar dstart double yl ChartCalendar dstop double y2 public void SetTimeCoordinateBounds double 1 ChartCalendar dstart double x2 ChartCalendar dstop ys SetWeekType method Visual Basic Public Sub SetWeekType _ ByVal weektype As Integer _ 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 routines need to take into account the week type For example C TimeSimpleDataset dataset new TimeSimpleDataset Sales xData y
545. that range So if your events are spaced approximately 5 seconds apart you will get a minor tick mark for approximately every three events If you choose a MajorTickCrossoverEvent of ChartObj MINUTE and an AxisMajorNthTick of 1 this 144 Scaling and Coordinate Systems will cause a major tick mark to be displayed every minute if an event falls within that range Tick marks only show up on an event so if there are no events within the time interval no tick mark will appear Every tick mark can have a custom label So if you do not want to use the default time date labels but instead want label the event tick marks with a custom string you can do that The string will track the exact tick mark associated with a given event This makes scrolling through the data easier because the custom tick mark strings stick to the tick mark and don t have to be recalculated Candlestick Chart OHLC Custom Axis Labels Elapsed Time Vertical Event Axis Numeric Multiline Sales Are On Fire Millions 0 XY1 XY2 XY3 4 5 XY6 XY7 XY8 XY9 Bar plots can have the values of the bars displayed above or inside each bar After scrolling the data to the left Form Millions Scaling and Coordinate Systems 145 hart OHLC Custom Axis Labels Elapsed Time Vertical Event xis Numeric Multiline Candlestick C Sales Are On Fire 121 121 113 114 115 XY35 XY36 XY37 XY38 XY39
546. the bars displayed above or inside each bar Note how in this example the range of colors in each bar red orange yellow and white depends on the bar height GRADIENT MAPTO PLOT NORMALIZED COORDINATES In this mapping mode the breakpoints are expected to be in the range of 0 0 to 1 0 The break points are applied as percentages to the plot area The value 0 0 corresponds to the start of the plot area and the value 1 0 corresponds to the end of the plot area Unlike the GRADIENT MAPTO OBJECT mapping mode a small area fill object will not show all of the colors of the gradient Only an area fill object the size of the plot area would show all of the colors Otherwise it can be used much the same as the GRADIENT MAPTO PLOT PHYSICAL COORDINATES mapping mode except in this case you are using normalized coordinates 0 0 1 0 instead of physical coordinates GRADIENT MAPTO GRAPH NORMALIZED COORDINATES Much the same as the GRADIENT MAPTO PLOT PHYSICAL COORDINATES except that in this case the breakpoints are applied to the entire graph area not the plot area ChartGradient constructors 166 Background Colors Textures and Gradients Use the constructor below for simple line and fill attributes There are similar constructors with fewer parameters if all you want to do is set a line color or a line color with a line thickness Visual Basic Overloads Public Sub New _ ByVal transform As PhysicalCoordinates ByVal gradmode As
547. the chart Imports com quinncurtis chart2dnet Imports System Drawing Imports System Drawing Drawing2D Imports System Drawing Imaging Partial Public Class Default Inherits System Web UI Page Private Sub Page Load ByVal sender As System Object ByVal e As System EventArgs Handles MyBase Load Get Input from HTML ASP page request Dim widthstring As String Request Params Get 0 Dim heightstring As String Request Params Get 1 Dim imagewidth As Integer Integer Parse widthstring Dim imageheight As Integer Integer Parse heightstring Dim chartVu As ChartView GetInitializeChart imagewidth imageheight Stream chart back as a JPeg image Dim ChartImage As BufferedImage New BufferedImage chartVu ImageFormat Jpeg get your binary image data here Response ContentType image jpeg ChartImage Savelmage Response OutputStream End Sub 422 Using QCChart2D for Net to Create Web Applications Private Function GetInitializeChart ByVal imagewidth As Integer ByVal imageheight As Integer As ChartView Dim xvalues As Double 0 1 2 3 4 5 Dim yvalues As Double dae Xa Be ly 3 Dim chartVu As ChartView New ChartView Set size of view to match the size of target image for best rendering chartVu Size New Size imagewidth imageheight Dim theFont As Font New Font SansSerif 10 FontStyle Bold Dim Datasetl As SimpleDataset New SimpleDataset First xvalues yvalues Dim pTransforml As Cartesia
548. the closest date time rounds down to the nearest ChartEvent for the TimeScaleStart property and rounds up for the TimeScaleStop property When using the time date values for scaling an EventCoordinate system you cannot set a time date value not bounded by the range of values found in the attached datasets In other words you cannot create datasets using ChartEvents that use time date values in 2011 and try and scale the x axis for a range of 2011 to 2013 The largest value you can scale the x axis for is the time date value of the ChartEvent with the largest or latest time stamp value The only time date values which exist in a EventCoordinates based Scaling and Coordinate Systems 149 coordinate system are the time stamps of the ChartEvents in the datasets attached to the coordinate systems Other times and dates do not exist unless you add a ChartEvent containing the date time to one of the attached datasets 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 magni
549. the modified dataset force the graph to redraw using ChartView UpdateDraw method Example of creating a simple event datasets extracted from the ChartEventExamples CandlestickEventChart example program C double minval 0 0 maxval 0 0 int incrementbase ChartObj MINUTE int increment 10 ChartCalendar currentdate new ChartCalendar ChartEvent eventArray new ChartEvent nNumPnts ChartEvent currentEvent new ChartEvent for i 0 i lt nNumPnts i double position 1 if i 0 Chart Datasets 101 currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode currentdate SetTOD 9 33 0 xValues 0 ChartCalendar currentdate Clone currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode stockPriceData 3 25 close stockPriceData 0 25 open stockPriceData 1 26 high stockPriceData 2 24 low currentEvent new ChartEvent xValues 0 1 stockPriceData currentEvent AxisLabel XXX 1 eventArray 0 currentEvent else xValues i ChartCalendar currentdate Clone stockPriceData 3 2 0 5 ChartSupport GetRandomDouble close stockPriceData 0 2 0 5 ChartSupport GetRandomDouble open minval Math Min stockPriceData 3 stockPriceData 0 maxval Math Max stockPriceData 3 stockPriceData 0 stockPriceData 1 maxval 1 5 ChartSupport GetRandomDouble high stockP
550. 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 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 160 The Chart View 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 and line thickness If the charts aspect ratio changes drastically the font size and line thickness 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 resizeMultiplier for any objects requiring a size change using the Gr
551. 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 Axes 175 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 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 ByVal maxval As Double _ 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 intercep
552. tingBarPlot 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 Simple Plot Objects 277 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 the justification constants JUSTIFY MIN JUSTIFY CENTER JUSTIFY MAX 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
553. tl new SimpleLinePlot pTransforml Datasetl attribl thePlotl SetLineStyle DashStyle DashDot chartVu AddChartObject thePlot1 ChartAttribute attrib2 new ChartAttribute Color Yellow 3 DashStyle Solid Dataset2 SortByX true thePlot2 new SimpleLinePlot pTransforml Dataset2 attrib2 chartVu AddChartObject thePlot2 Color transparentRed Color FromArgb 200 255 0 0 Color transparentGreen Color FromArgb 200 0 255 0 ChartAttribute lossAttrib new ChartAttribute transparentRed 1 DashStyle Solid transparentRed ChartAttribute profitAttrib new ChartAttribute transparentGreen 1 DashStyle Solid transparentGreen 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 yValues Dataset3 GetYData thePlot3 SetSegmentAttributesMode true for i90 i lt Dataset3 GetNumberDatapoints i if yValues i gt 0 0 thePlot3 SetSegmentAttributes i profitAttrib else thePlot3 SetSegmentAttributes i lossAttrib chartVu AddChartObject thePlot3 248 Simple Plot Objects Visual Basic Dim DatasetArray As TimeSimpleDataset Datasetl Dataset2 Dataset3 Dim pTransforml As
554. to compile you need to go back and check the previous steps You can add as many custom chart controls as you need for the given HTML page you plan to display charts in Each custom chart control will inherit from the com quinncurtis chart2dnet ChartView control Or Optional You can create inherited controls from the UserChartControll class that you already created Create an inherited control by selecting Project Add Inherited Control Give the inherited control a unique name 1 e UserInheritedControll When you select Open choose UserControll in the Inheritance Picker The result is new control added to the project Build the solution and the UserInheritedControll control will be added to the WindowsControlLibraryl DLL in addition to the UserControll View the UserChartControll vb underlying VB code We placed all of the chart creation code in the InitializeChart method This method is called in the UserControll constructor otherwise the UserControll appears as an empty shell Add whatever properties you need to get data from the HTML file into the chart control ChartTitleText and YMax in the example below Imports System Drawing Imports System Drawing Drawing2D Imports com quinncurtis chart2dnet Public Class UserControll Dim mainTitle As ChartTitle Dim pTransforml As TimeCoordinates Dim yAxis As LinearAxis Private Sub InitializeChart Dim chartVu As ChartView Me Dim theFont As Font Dim nnumpnts As Inte
555. 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 intermediate 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
556. to run in Internet Explorer In that case the QCChart2DNet DLL must be installed as part of the GAC so that it has the necessary security clearance and so that IE can find it when it has to display the control If you have installed it correctly you should be able to view the web page below that references a QCChart2D derived user control http www quinn curtis com UserControlTestRev2 OCCHT2D IEQCChart2D htm 426 Using QCChart2D for Net to Create Web Applications Once the QCChart2DNet DLL has been successfully installed in the system GAC you must create a ChartView derived UserControl that creates the chart you want to display in the browser This can be done using either C or VB And you must create a HTML page that displays the chart and provides whatever interaction you expect The ChartView derived UserControl cannot do anything that would violate the security policy of the browser This would include all forms of disk I O and anything in general that tries to access anything on the client computer 2 Embed a QCChart2D User Control In Internet Explorer Windows Internet Expla j le http www quinn curtis com LiserControlTest QCCHT2D IEQC oot File Edit View Favorites Tools Help Ww dir Embed a QCChart2D User Control In Internet Explorer EI E 2 2000 2001 2002 2003 2004 2005 2006 Bar plots can have the values of the bars displayed above or inside each bar Change Title
557. to see if it returns ChartObj OBJECT MOVEABLE Alternatively you can call the MoveObj IsMoveableObject method passing in a reference to the object 314 Moving Chart Objects and Data Points 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 moveable 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 new ChartView 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 New ChartView Dim pTransforml As CartesianCoordinates New CartesianCoordinates 0 0 0 0 10 0 20 0 pTransforml AutoScale Datasetl ChartObj AUTOAXES
558. to the Quinn Curtis DotNet lib subdirectory and select the QCChart2DNet DLL View the UserControll cs code Change the base class of UserControll to com quinncurtis chart2dnet ChartView The C form code should now look like using System using System Collections Generic using System ComponentModel using System Drawing using System Data using System Text using System Windows Forms using System Drawing Drawing2D using com quinncurtis chart2dnet namespace WindowsControlLibraryl public partial class UserControll com quinncurtis chart2dnet ChartView i public UserControll InitializeComponent Critical Step Make sure you add the following lines to the top of the UserChartControll cs code to resolve the QCChart2D and other graphics classes used in the example using using using using using using using using using 428 Using QCChart2D for Net to Create Web Applications using System Drawing Drawing2D using com quinncurtis chart2dnet Build the Solution Build Build Solution This will compile the UserControll class and generate the WindowsControlLibrary1 DLL file If the project fails to compile you need to go back and check the previous steps You can add as many custom chart controls as you need for the given HTML page you plan to display charts in Each custom chart control will inherit from the com quinncurtis chart2dnet ChartView control Or Optional You can c
559. toAxis yAxisLab2 CalcAutoAxisLabels yAxis3 CalcAutoAxis yAxisLab3 CalcAutoAxisLabels yAxis3 SetAxisIntercept pTransform3 GetStopX yAxis3 SetAxisTickDir ChartObj AXIS MAX this UpdateDraw VB Public Sub UpdateScaleAndAxesUsingDates ByVal startindex As Integer Dim startdate As ChartCalendar DirectCast datastartdate Clone ChartCalendar Dim stopdate As New ChartCalendar Startdate Add ChartCalendar DAY OF YEAR startindex Stopdate DirectCast startdate Clone ChartCalendar stopdate Add ChartObj MONTH 1 pTransforml TimeScaleStart startdate pTransforml TimeScaleStop stopdate pTransform2 TimeScaleStart startdate pTransform2 TimeScaleStop stopdate pTransform3 TimeScaleStart startdate pTransform3 TimeScaleStop stopdate xAxisl CalcAutoAxis yAxisl CalcAutoAxis xAxisLabl CalcAutoAxisLabels yAxisLabl CalcAutoAxisLabels xAxis2 CalcAutoAxis xAxis2 SetAxisIntercept pTransform2 GetStopY xAxis2 SetAxisTickDir ChartObj AXIS MAX yAxis2 CalcAutoAxis yAxisLab2 CalcAutoAxisLabels yAxis3 CalcAutoAxis yAxisLab3 CalcAutoAxisLabels yAxis3 SetAxisIntercept pTransform3 GetStopX yAxis3 SetAxisTickDir ChartObj AXIS MAX Me UpdateDraw End Sub If you specify a date time value which is an exact match for one of the date values of a ChartEvent then the ChartEvent Position property becomes the scale value If it is not an exact match then the binary search for
560. tructor 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 Integer C public DatasetViewer ChartView chartvu PhysicalCoordinates transform Rectangle2D posrect ChartDataset dataset int rows int cals 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 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 Text Classes 379 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 a
561. ts 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 SansSerif 10 FontStyle Bold xValues 0 New ChartCalendar 1998 ChartObj JANUARY 1 groupBarData 0 0 43 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 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 pTransforml 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 290 Simple Plot Objects 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
562. tude The following equations convert from polar coordinates to Cartesian coordinates x magnitude cos angle y magnitude sine angle magnitude Polar coordinate magnitude angle Plot coordinate angle 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 150 Scaling and Coordinate Systems PolarCoordinates constructors 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 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 B
563. ub New _ ByVal transform As PhysicalCoordinates ByVal dataset As GroupDataset _ ByVal rwidth As Double _ ByVal defaultattrib As ChartAttribute ByVal fillattrib As ChartAttribute Ct public CandlestickPlot PhysicalCoordinates transform GroupDataset dataset double rwidth ChartAttribute defaultattrib ChartAttribute fillattrib transform The coordinate system for the new CandlestickPlot object dataset The CandlestickPlot plot represents the group open high low close values in 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 rwidth The width of the candlestick box in physical coordinates defaultattrib Specifies the default attributes line color and fill color of the candlestick lines and box fillattrib 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 272 Simple Plot Objects Candlestick plot example extracted from the example program Finan
564. ubblePlotLegendItem that holds the symbols and descriptive text for the symbols BubblePlotLegend constructors Visual Basic 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 ChartAttribute _ Overloads Public Sub New _ ByVal plot As BubblePlot _ ByVal rx As Double _ ByVal ry As Double _ ByVal attrib ChartAttribute _ Ct public BubblePlotLegend BubblePlot plot double rx double ry double rwidth double rheight ChartAttribute attrib 2 public BubblePlotLegend BubblePlot plot ChartAttribute attrib plot The bubble plot object the legend is associated with rx The x position in chart normalized coordinates of the legend rectangle ry The y position in chart normalized coordinates of the legend rectangle Legends 361 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 outline line style 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 _
565. uble 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 _ public void SetAxisTicks double tickorigin double tickspace int ntickspermajor public void SetAxisTicks double tickorigin double tickspace int nminortickspermajor double minorticklength double majorticklength int tickdir intercept Sets the intercept of this axis with the perpendicular axis in physical coordinates tickorigin The tick marks start at this value tickspace Specifies the spacing between minor tick marks 195 ntickspermajor Specifies the number of minor tick marks per major tick mark minorticklength The length of minor tick marks in Net device coordinates majorticklength 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 axis line and tick marks Simple elapsed time axis example
566. ue 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 ChartView chartVu new ChartView LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS xAxis SetZOrder 30 chartVu AddChartObject xAxis Visual Basic Dim chartVu As ChartView New ChartView 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 new ChartView LinearAxis xAxis new LinearAxis pTransforml ChartObj X AXIS The Chart View 157 chartVu AddChartObject xAxis xAxis SetColor Color Red chartVu UpdateDraw Visual Basic Dim chartVu As ChartView New ChartView Dim xAxis As LinearAxis New LinearAxis pTransforml ChartObj X AXIS chartVu AddChartObject x
567. ues 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 or y 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 of a time based x scale and a numeric based y scale C ChartCalendar xMin ChartCalendar xMax double yMin Ds double yMax 105 new ChartCalendar 1996 ChartObj FEBRUARY 5 new ChartCalendar 2002 ChartObj JANUARY 5 TimeCoordinates simpleTimeScale simpleTimeScale new TimeCoordinates xMin yMin xMax yMax Visual Basic Dim xMin As ChartCalendar Dim xMax As ChartCalendar Dim yMin As Double 0 Dim yMax As Double 105 New ChartCalendar 1996 ChartObj FEBRUARY 5 New ChartCalendar 2002 ChartObj JANUARY 5 Dim simpleTimeScale As TimeCoordinates simpleTimeScale new TimeCoordin
568. um Microsoft wanted to create their own version of Java optimized for Windows that would not run on other platforms Sun disapproved of any company creating flavors of Java that relied on platform specific features and disbanded the consortium rather than let Microsoft or any other company proceed down that path At that point Microsoft decided to compete directly with Java using the Net languages Microsoft is loath to aid the marketing of a competitor and steadfastly refuses to distribute Sun s version of the Java virtual machine with the Windows XP operating system In order to run Java applications on a Windows platform you need to download the Java virtual machine from Sun and install it on your computer While this is easy to do it does not represent the far wider distribution of the Java virtual machine that Sun is looking for and the company has had Microsoft in court seeking some remedy for many years Introduction 13 Microsoft Net includes a very rich 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 combination of the features found in the Win32 graphics API and those in the Java API Most of the programming features found in the Java Graphics2D API are duplicated in one form or another in Net API While the Java graphics classes are more extensive and in many cases more elegant than those in Net Microsoft did a good
569. ure 27 The ChartScale abstract base class defines coordinate transformation functions for a single dimension It is useful to be able to mix and match different 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 pAysical 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 ElapsedTimeScale A concrete implementation of the ChartScale class converts an elapsed time coordinate system into the working coordinate system EventScale A concrete implementation of the ChartScale class converts an event coordinate system into the working coordinate system Coordinate Transform Classes UserCoordinates WorldCoordinates WorkingCoordinates PhysicalCoordinates CartesianCoordinates ElapsedTimeCoordinates PolarCoordinates AntennaCoordinates EventCoordinates TimeCoordinates The coordinate transform classes maintain a 2D coordinate system Many different coordinate systems are used to p
570. usepos SetLocation mouseevent X mouseevent Y base OnMouseDown mouseevent ChartPlot selectedPlot ChartPlot GetSelectedPlotObj if selectedPlot null int selectedindex GetNearestPoint GetNearestPointIndex 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 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 336 Data ToolTips ChartObj DECIMALFORMAT String closeObj ChartSupp ChartObj DECIMALFORMAT String volumeOCbj ChartObj DECIMALFORMAT String nasdaqOCbj ChartObj DECIMALFORMAT TimeLabel timelabel new xValues selectedindex i m tSt ESE tSt ESE LOL AddNewLineTex AddNewLineTex AddNewLineTe
571. using graph normalized coordinates 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 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 42 simpleScale SetGraphBorderFrame 0 5 0 0 0 5 0 5 Example 43 simpleScale SetGraphBorderDiagonal 0 5 0 0 1 0 0 5 Example 44 simpleScale SetGraphBorderInsets 0 5 0 0 0 0 0 5 Visual Basic Scaling and Coordinate Systems 111 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 41 simpleScale SetGraphBorderFrame new Rectangle2D 0 5 0 0 0 5 0 5 Example 42 simpleScale SetGraphBorderFrame 0 5 0 0 0 5 0 5 Example 43 simpleScale SetGraphBorderDiagonal 0 5 0 0 1 0 0 5 Example 4 simpleScale SetGraphBorderInsets 0 5 0 0 0 0 0 5 Linear and Logarithmic Coordinate Scaling Class Cartesia
572. ven though the working hours are only a 9 30 to 16 00 subset of the 24 hours of a day E Form1 rey CandestickChart FinLogPlot DHLCChart OpeningScreen FinancialOptions Techrical nalysis Candlestick Plots in Technical Analysis 12 00 00 13 00 00 14 00 00 15 00 00 9 30 00 11 00 00 12 00 00 13 00 00 14 00 00 15 00 00 7 03 12 The Open Close box is filled if the open price is greater than the close price 7 06 12 7 09 12 7 10 12 7 11 12 7 03 12 7 05 12 The Open Close box is filled if the open price is greater than the close price Scaling and Coordinate Systems 137 Creating a chart using the event classes uses the same basic sequence as our other coordinate systems First create the data in this case an array of ChartEvent objects Most of the code below is just the simulation of some raw data taking into account a 9 30 to 16 00 working day with no weekends Note that each ChartEvent object is defined using both a TimeStamp value xvalues i and a Position value 1 The value of i controls the position of the ChartEvent object in the plot and the value of the TimeStamp controls the x axis tick marks and labels C double minval 0 0 maxval 0 0 int incrementbase ChartObj MINUTE int increment 10 ChartCalendar currentdate new ChartCalendar ChartEvent eventArray new ChartEvent nNumPnts stockPriceData 3 25 5 close stockPriceData 0 24 5 open st
573. ventCoordinates class scales the chart plot area for a physical coordinate system which uses an event scale in combination with a linear or logarithmic scaling The underlying event scale uses a simple linear scale scaled from 0 to N 1 where N is the number of ChartEvents with a unique time stamp in the attached ChartEvent based datasets EventSimpleDataset and EventGroupDataset Unlike the other coordinate systems an EventCoordinate object requires an event dataset as part of its definition The ChartEvent class incorporates two x value positioning properties the Position and the TimeStamp and one or more numeric y values for each event A single event therefore defines both the x and y values of the event in the underlying coordinate system A collection or array of ChartEvent objects define the data for a plot the same way as arrays of x and y values define a plot when using a simple dataset class with a Cartesian coordinate system The critical element of the ChartEvent which permit it to be used for the plotting of discontinuous data is that the Position of the event in a chart is related but independent of the TimeStamp of the event Event data can be positioned contiguously and evenly spaced in a chart even if the time stamps of the events are not contiguous or evenly spaced Here is a simple example of a standard financial candlestick plot chart using our TimeCoordinates class as the coordinate system where the time date data is not
574. void SetAxisLabels Font font double rotation int lasbgir int decimalpos int labelends Color labcolor SetAxisLabelsFormat method Visual Basic Public Sub SetAxisLabelsFormat _ ByVal format As Integer _ Ct public void SetAxisLabelsFormat int format Axis Labels 213 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 x double xMax 151 double yMin OF double yMax 105 CartesianCoordinates simpleScale new CartesianCoordinates xMin xMax yMax Create the x and y axes LinearAxis xAxis
575. x 0 5 ChartSupport GetRandomDouble 0 5 0 5 ChartSupport GetRandomDouble 0 5 Chart Datasets 81 z 2000 950 Math Sin Math Sqrt x x y y Return z End Function CalcZValue End Class ZValueFunctionClass Sub CreateRegularGridPolysurface Dim zValueFunction As New ZValueFunctionClass datasetl New ContourDataset Contour Dataset 32 32 _ fiha Fely 721 7 1 EgValuefunction End Sub CreateRegularGridPolysurface Simple Event Dataset Class EventSimpleDataset ChartObj ChartDataset SimpleDataset EventSimpleDataset Background for ChartEvent datasets Most coordinate systems used in plotting represent a continuous domain In the QCChart2D software these includes linear logarithmic simple time date elapsed time polar and antenna coordinate systems The one exception is a variant of the time date scale which allows for periodic yet discontinuous time In the time date scale case it is possible to remove weekends from the time scale and to define the hours of the day to be some subset of the standard 24 hour cycle The most often used example is the stock trading day used in the US which is from 9 30 to 16 00 and does not include weekends Unfortunately the time coordinate system even with discontinuous time is still insufficient to plot the great variety of time plots needed in the financial services and other industries Some of these special requirements are
576. x AddNewLineTex AddNewLineTex AddNewLineTextSt kpanel AddNewLineTextSt tockpanel SetChartObjEnabl raphics g2 Precalculates the tex known before it is drawn tockpanel PreCalcTextBound Rectangle2D boundingbox 5 Reposition tool COC COC COC COC COC COC LOC kpanel kpanel kpanel kpanel kpanel kpanel MOOD DH o vo o 2 ort NumToString close 2 ChartSupport NumToString volume 0 ChartSupport NumToString nasdaq 2 imeLabel transform ChartObj TIMEDATEFORMAT STANDARD ring timelabel GetTextString ring Open openObj ringi High 4 highobj ring Low 1 003 ring Close closeObj ring Volume volumeObj ring NASDAQ nasdaqObj e ChartObj OBJECT ENABLE GetToolTipGraphics t bounding box so that the size is ingBox g2 tockpanel GetTextBox ip 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 GetyY boundingbox GetHeight lt 1 mousepos SetLocation mousepos GetX mousepos Ge Stockpanel SetLocation tY boundingbox GetHeight mousepos ChartObj DEV POS Draws the tooltip text panel to the chart graphics context Stockpanel Draw GetToolTipG CustomToolTip stocktooltip new CustomToolTip chartVu stockVolumeData xValues raphics stockPriceDat
577. x you wrote for the user control The user control in this HTML file has the id MyTestUserControll and the properties for the user control are accessed using that id Note that an automatic string to double conversion takes place in the case of the YMax property since YMax is a double and text2 is a string script function ChangeTitle MyTestUserControll ChartTitleText textl value function ChangeYMax MyTestUserControll YMax text2 value lt soript gt lt P gt lt input type text id textl gt amp nbsp amp nbsp amp nbsp lt input type button value Change Title onclick ChangeTitle ID Button1 NAME Button1 gt lt P gt lt P gt lt P gt Using QCChart2D for Net to Create Web Applications 437 P lt input type text id text2 NAME text2 amp nbsp lt input type button value Change Y Max onclick ChangeYMax ID Button2 NAME Button2 gt lt P gt See the complete HTML file below It is probably easier to view the IEQCChart2D HTM file in the WindowsControlLibaryl project folder html lt head gt lt title gt Embed a QCChart2D User Control In Internet Explorer lt title gt lt meta http equiv Content Language content de gt lt meta http equiv Content Type content text html charset windows 1252 gt lt script gt function ChangeTitle MyTestUserControll ChartTitleText textl value function ChangeYMax MyTestUserControll YMax text2 value lt
578. x in the box and whisker plot Visual Basic Public Sub AddPopulation _ pop As Double _ xvalue As Double _ 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 WHISKER BW 15 WHISKER OUTLIERS BW 10615 WHISKER ALLPOINTS BW MINMAX WHISKER Plot minimum maximum values as whiskers and the median q25 and q75 values 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 IQRI5 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 266 Simple Plot Objects as the box and plot all points as scatter plot symbols Where q25 fora given population 425 is the 25th percentile point in the population 475 fora given population 475 is the 75th percentile point in the population IOR fora given population IOR is the value q75 q25 Outlier 130 0 l Whisker 529 8 475 75th percentile 73 6 Median 57 5 q25 25th percentile 39 5 Whisker 31 5 Turn on the numeric labeling o
579. x1 y3 Dim pTransforml As New CartesianCoordinates ChartObj LINEAR SCALE ChartObj LINEAR SCALE pTransforml AutoScale Dataset3 ChartObj AUTOAXES FAR ChartObj AUTOAXES FAR 406 Using QCChart2D for Net to Create Windows Applications pTransforml SetGraphBorderDiagonal 0 125 0 15 0 95 0 725 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 Dim xAxisLab As New NumericAxisLabels xAxis xAxisLab SetTextFont theFont chartVu AddChartObject xAxisLab Dim yAxisLab As New NumericAxisLabels yAxis yAxisLab SetTextFont theFont chartVu AddChartObject yAxisLab Dim titleFont As New Font Microsoft Sans Serif 10 FontStyle Bold Dim yaxistitle As New AxisTitle yAxis titleFont Measurable work output chartVu AddChartObject yaxistitle Dim xaxistitle As New AxisTitle xAxis titleFont f MBAs 1000 employees chartVu AddChartObject xaxistitle 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 hartVu AddChartObject ygrid im attribl As New ChartAttribute Color Blue 1 DashStyle Solid ttribl SetFillC
580. 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 1 yAxisLabl SetAxisLabelsFormat ChartObj CURRENCYFORMAT yAxisLabl SetColor Color White chartVu AddChartObject 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 attribArray ChartObj JUSTIFY CENTER thePlotl SetBarOverlap 0 0
581. 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 Example of explicit scaling of a TimeCoordinates object numeric x scale and time y scale using the TimeCoordinates SetTimeCoordinateBounds method double 0 double 105 ChartCalendar yMin new 1 1996 ChartObj FEBRUARY 5 ChartCalendar new ChartCalendar 2002 ChartObj JANUARY 5 TimeCoordinates simpleTimeScale new TimeCoordinates rj SimpleTimeScale SetTimeCoordinateBounds xMin yMin xMax yMax Visual Basic Dim xMin As Double 0 Dim xMax As Double 105 Dim yMin As ChartCalendar New ChartCalendar 1996 ChartObj FEBRUARY 5 Dim yMax As ChartCalendar New ChartCalendar 2002 ChartObj JANUARY 5 Dim simpleTimeScale As TimeCoordinates New TimeCoordinates Scaling and Coordinate Systems 121 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
582. xValueTemplate new NumericLabel ChartObj DECIMALFORMAT 0 NumericLabel yValueTemplate new NumericLabel ChartObj DECIMALFORMAT 1 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 Green 414 Using QCChart2D for Net to Create Windows Applications toolTipSymbol SetSymbolSize 10 0 datatooltip SetTextTemplate textTemplate datatooltip SetXValueTemplate xValueTemplate datatooltip SetYValueTemplate yValueTemplate datatooltip SetDataToolTipFormat ChartObj DATA TOOLTIP XY ONELINE datatooltip SetToolTipSymbol toolTipSymbol datatooltip SetEnable true chartVu SetCurrentMouseListener datatooltip private void UserChartControll Load object sender EventArgs e InitializeChart Display the UserChartControll in Design mode and double click on it This will add a UserChartControl Load method to the UserChartControll class The chart initialization code will be invoked by this event private void UserChartControll Load object sender EventArgs e InitializeChart Go to the main form Form1 Go to the toolbox and select the UserChartControll from the Windows Forms list Drop it onto the main form and size it Define the chart by customizing the UserChartControll InitializeChart met
583. xes labels ChartEventExamples A variety of examples using ChartEvent objects as the source data ConsoleApplicationl a headless console app that renders chart images directly to an image file without displaying the chart on a Windows form ContourPlots Line and filled contour plots CustomDataToolTips Creating custom data tooltips for an OHLC plot multiple stacked graphs and a pie chart DataCursorsAndMarkers Using data cursors and markers 18 Introduction DynamicCharts Scrolling lines bars scatter plots data logging instrument simulation chart animation EditChartExample Dialog box for chart example FinancialExamples OHLC plots candlestick plots financial log plots option chart technical analysis chart FormControlExamples Adding check boxes scrollbars and tables to charts ImageCharts Using images as chart data elements chart backgrounds and annotations LabeldDatapoints Label the data points of a simple line chart LinePlotSalesVolume Simple line plot example with printing and save image menu LogPlots Logarithmic plots for financial charts and engineering charts MiscCharts A line gap chart MouseListeners Data tooltips data cursors moving data points moving chart objects MultiLinePlots Group multi line plots stacked line plots multiple single line graphs MultipleAxes Multiple axes graphs NewDemosRev2 New examples for Revision
584. xis 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 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 _ Cf public virtual void SetColor Color rgbcolor SetLineWidth method Visual Basic Overridable Public Sub SetLineWidth _ ByVal linewidth As Double _ Cf public virtual void SetLineWidth double linewidth SetLineStyle method Visual Basic Overridable Public Sub SetLineStyle _ ByVal linestyle As DashStyle Cf public virtual void SetLineStyle DashStyle linestyle Axis Grids 239 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 Use one of the Net Drawing2D DashStyle enumerated constants Dash DashDot DashDotDot Dot or Solid Grid example C Define the coordinate system double xMin 5 double xMax 15 double yMin 0 double yMax 105 CartesianCoordinates simpleScale new Cart
585. xis pTransforml ChartObj Y AXIS yAxis SetColor Color White chartVu AddChartObject yAxis Visual Basic Dim Datasetl As New EventSimpleDataset Actual Sales chartevents Dim pTransforml As New EventCoordinates Datasetl pTransforml SetScaleStartY 0 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 ChartO0bj Y AXIS chartVu AddChartObject background Dim xAxis As New EventAxis pTransforml EventAxis TICK RULE MAJOREVENT ChartObj X AXIS xAxis SetColor Color White chartVu AddChartObject xAxis Dim yAxis As New LinearAxis pTransforml ChartObj Y AXIS yAxis SetColor Color White chartVu AddChartObject yAxis 200 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 1 LinearAxis PolarAxes 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 Linear
586. xis extents 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 if 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 _ 205 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 _ public void SetAntennaAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor public void SetAntennaAxesTicks double axestickspace int axesntickspermajor double angletickspace int anglentickspermajor double minorticklength double majorticklength int tiekdir axestickspace Specifies the spacing between minor tick marks for the x and y axes axesntickspermajor Specifies the number of minor tick marks per ma
587. xis 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 55 new LinearAxis pTransform5 ChartObj Y AXIS yAxis5 SetAxisIntercept xAxis GetAxisMax yAxisb5b 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 yAxisl yAxisLabl SetTextFont theFont yAxisLabl SetAxisLabelsFormat ChartObj BUSINESSFORMAT chartVu AddChartObject yAxisLabl NumericAxisLabels yAxisLab2 new NumericAxisLabels yAxis2 yAxisLab2 SetTextFont theFont chartVu AddChartObject yAxisLab2 yAxisLab3 SetTextFont chartVu AddChartObject heFont yAxisLab3 yAxisLab4 SetTextFont chartVu AddChartObject heFont yAxisLab4 NumericAxisLabels yAxisLab3 new NumericAxisLabels yAxis3 NumericAxisLabels yAxisLab4 new NumericAxisLabels yAxis4 NumericAxisLabels yAxisLab5 new NumericAxisLabels yAxis
588. xisLabels 37 38 64 208 209 210 211 212 213 214 222 225 226 232 234 284 301 302 369 370 398 401 417 422 429 443 445 NumericAxisLabels 37 38 64 208 209 210 211 212 213 214 222 225 226 232 234 284 301 302 369 370 398 401 406 412 417 422 429 434 443 445 NumericLabel56 57 64 251 257 259 260 286 287 296 302 303 309 310 311 330 332 333 334 340 341 342 364 370 371 375 376 429 430 446 NumericLabel 56 57 64 251 257 259 260 286 287 296 302 303 309 310 311 330 332 333 334 340 341 342 364 370 371 375 376 407 413 429 430 434 446 OHLECGPIOot e cte dere rao dee que OHLCPlot41 48 64 162 261 281 292 293 294 331 Open High Low Close plots41 48 64 162 261 292 293 294 331 OHLCPIot41 48 64 162 261 281 292 293 294 331 Physical coordinates sse PhysicalCoordinates 27 28 30 31 63 103 105 106 111 119 129 133 149 150 166 168 169 171 173 175 178 180 193 197 246 249 252 255 258 262 264 269 271 273 2775 276 280 282 285 288 290 292 293 294 297 299 300 304 307 315 317 320 322 323 326 328 335 337 338 339 364 365 367 371 372 373 374 378 382 383 385 PhysicalCoordinates 27 28 30 31 63 103 105 106 111 119 129 133 149 150 166 168 169 171 173 175 178 180 193 197 246 249 252 255 258 262 264 269 271
589. xt 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 58 Class Architecture 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 This class displays one of five marker types in a graph The marker is used to create data cursors or to mark data points ChartImage This class encapsulates System Drawing Image class defining a rectangle in chart coordinates that the image is placed in JPEG and other image files can be imported using the System Drawing Image class
590. y numeric range that a user wants to plot This incorporates the entire range of floating point numbers support under Net 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 floating point format These types of numbers are often found in databases and representing non initialized or improperly initialized data Net 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
591. y 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 Antenna axes labels example 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 236 Axis Labels 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
592. y 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 C Font toolTipFont new Font SansSerif 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 SansSerif 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 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 Th
593. yVal spiestringis As String _ ByVal attribs As ChartAttribute ByVal labelinoutl As Integer _ ByVal pielabelformat As Integer _ Ct public RingChart PhysicalCoordinates transform SimpleDataset dataset string spiestringls ChartAttribute attribs int labelinoutl int pielabelformat transform The pie ring chart is placed in the coordinate system defined by transform dataset 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 spiestrings An array of strings size dataset GetNumberDatapoints used as labels for the pie ring slices attribs An array of ChartAttribute objects size dataset GetNumberDatapoints that specify the attributes outline color and fill color for each wedge of a pie ring chart labelinout An array of integer size dataset GetNumberDatapoints specifying if a specific pie ring slice text label is drawn inside the pie ring slice or outside of the pie ring slice Use one of the constants PIELABEL OUTSLICE or PIELABEL INSLICE pielabelformat 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 340 Pie Charts PIELABEL STRING Display only the pie ring text strings no numeric values PIEL
594. ystems StockPriceData 0 24 5 open StockPriceData 1 26 high StockPriceData 2 24 low Dim currentEvent As New ChartEvent currentdate ChartCalendar CalendarDaysAdd currentdate 1 weekmode currentdate SetTOD 9 33 0 For i 0 To nNumPnts 1 Dim position As Double 1 xValues i DirectCast currentdate Clone ChartCalendar If gt 0 Then stockPriceData 3 2 0 5 ChartSupport GetRandomDouble close StockPriceData 0 2 0 5 ChartSupport GetRandomDouble open minval Math Min stockPriceData 3 stockPriceData 0 maxval Math Max stockPriceData 3 stockPriceData 0 StockPriceData 1 maxval 1 5 ChartSupport GetRandomDouble high low stockPriceData 2 minval 1 5 ChartSupport GetRandomDouble End If currentEvent New ChartEvent xValues i position stockPriceData currentEvent AxisLabel XXX amp position ToString currentEvent ToolTip ToolTip amp position ToString eventArray i currentEvent currentdate Add incrementbase increment If currentdate Get ChartObj HOUR OF DAY 16 Then currentdate Add ChartObj DAY OF YEAR 1 currentdate SetTOD 9 30 0 End If Next Create an EventSimpleDataset or EventGroupDataset using the source data EventGroupDataset Datasetl new EventGroupDataset Stock Data eventArray 4 VB Dim Datasetl As New EventGroupDataset Stock Data eventArray 4 Create an Eve
595. ze 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 9 21 20 40 30 Soy Sy 56 Clip 2 Uap oy 20 be GroupDataset Datasetll new GroupDataset First xl yl Chart Datasets 91 Visual Basic Dim x1 As Double 10 20 30 40 50 Dim yi As Double 9 21 20 40 30 too 35 ID 961 159 25 15 30 407 Dim Datasetl As GroupDataset New GroupDataset First yl Example of creating a group 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 poin

Download Pdf Manuals

image

Related Search

Related Contents

ecoRoute™  NETGEAR SPH200D Cordless Telephone User Manual  オリジナルの翻訳 - Avanti Online  LED 電源取扱説明書 - Shindengen  HygroPalm HP22 Hand-Held Indicator Sort form User Guide  catalogo - Imequadri Duestelle SpA  SKK プラ夏よらランセット  PortaBilling: User Manual  Vogel's CABLE 4 BLACK Cable cover 94 cm  

Copyright © All rights reserved.
Failed to retrieve file