home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-01 | 116.1 KB | 3,455 lines |
- Attribute VB_Name = "FormatCode"
- Option Explicit
-
- Sub AreaChart()
-
- Dim series As Object, i%
-
- Call DefaultChart
-
- With frmMain.vtchart1
- Select Case AreaIndex
- Case 0 ' 2D Area
- .ChartType = VtChChartType2dArea
- Call QReadData(App.Path + VAREADATA1)
-
- Case 1 ' Stacked Area
- .ChartType = VtChChartType2dArea
- Call QReadData(App.Path + VAREADATA1)
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- Case 2 ' Smoothed Area
- .ChartType = VtChChartType2dArea
- Call QReadData(App.Path + VAREADATA2)
-
- For Each series In .Plot.SeriesCollection
- series.SmoothingFactor = 10
- series.SmoothingType = VtSmoothingTypeQuadraticBSpline
- Next series
-
- Case 3 ' Guide Lines
- .ChartType = VtChChartType2dArea
- Call QReadData(App.Path + VAREADATA2)
-
- With .Plot.SeriesCollection.Item(1)
- ' Turn on Guidelines
- .ShowGuideLine(VtChAxisIdX) = True
-
- ' Set series guideline colors
- .GuideLinePen.Width = 1
- .GuideLinePen.VtColor.Set 192, 192, 50
- End With
-
- '' OCX -- minor & major pens switched ???
- .Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- Case 4 ' 3D Area
- .ChartType = VtChChartType3dArea
- Call QReadData(App.Path + VAREADATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
-
- ' Set rotation and elevation
- .Plot.View3d.rotation = 42
- .Plot.View3d.elevation = 3
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Turn off X and Z axis
- Call QSetAxisLabel(VtChAxisIdX, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- ' Make Y and Y2 axis larger
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY2, True, 14, 0, 0, 202)
-
- Case 5 ' 3D Labeled
- .ChartType = VtChChartType3dArea
- Call QReadData(App.Path + VAREADATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
-
- ' Set rotation and elevation
- .Plot.View3d.rotation = 67
- .Plot.View3d.elevation = 12
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- '' Set all data points at once
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- ' Turn point the labels on
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 14
- .VtFont.VtColor.Set 0, 0, 255
- End With
- Next series
-
- ' Turn X, Y, Z axis off
- Call QSetAxisLabel(VtChAxisIdX, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- ' Turn Y2 axis on
- Call QSetAxisLabel(VtChAxisIdY2, True, 14, 0, 0, 202)
-
- Case 6 ' 3D Wide Area
- .ChartType = VtChChartType3dArea
- Call QReadData(App.Path + VAREADATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 10
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- Case 7 ' 3D Smoothed Area
- .ChartType = VtChChartType3dArea
- Call QReadData(App.Path + VAREADATA2)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
-
- ' Set rotation and elevation
- .Plot.View3d.rotation = 46
- .Plot.View3d.elevation = 0
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Smooth the areas
- For Each series In .Plot.SeriesCollection
- series.SmoothingFactor = 10
- series.SmoothingType = VtSmoothingTypeQuadraticBSpline
- Next series
-
- ' Turn Z axis off
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- End Select
- End With
- End Sub
-
-
- Sub BubbleChart()
-
- Dim series As Object
-
- Call DefaultChart
-
- With frmMain.vtchart1
- .ChartType = VtChChartType2dBubble
-
- Select Case BubbleIndex
- Case 0 ' Bubble
- Call QReadData(App.Path + BUBBLEDATA1)
- .Plot.MaxBubbleToAxisRatio = 0.2
- .Plot.UniformAxis = False
-
- Case 1 ' Bubble Ratio
- Call QReadData(App.Path + BUBBLEDATA1)
- .Plot.MaxBubbleToAxisRatio = 0.4
- .Plot.UniformAxis = False
-
- Case 2 ' Bubble Labels
- Call QReadData(App.Path + BUBBLEDATA1)
- .Plot.MaxBubbleToAxisRatio = 0.2
-
- For Each series In .Plot.SeriesCollection
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel
- .LocationType = VtChLabelLocationTypeCenter
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 0
- End With
- Next series
-
- .Plot.UniformAxis = False
-
- End Select
- End With
- End Sub
-
- Sub ComboChart()
- Dim i%
-
- ' Reset all chart options
- Call DefaultChart
-
- With frmMain.vtchart1
-
- Select Case ComboIndex
-
- Case 0 'Line/Bar
- Call QReadData(App.Path + COMBODATA1)
- .ChartType = VtChChartType2dCombination
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType2dLine
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType2dBar
-
- Case 1 ' Bar/Line/Hi-Low
- Call QReadData(App.Path + COMBODATA9)
- .ChartType = VtChChartType2dHiLo
-
- ' First Series is the volume bar
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType2dBar
-
- ' Second series is the trend line
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType2dLine
-
- ' Series 3 through 6 are the OHLC columns
- With .Plot.SeriesCollection
- For i = 3 To .Count
- ' Set to Open-Hi-Lo-Close
- .Item(i).seriesType = VtChSeriesType2dOHLC
- .Item(i).SeriesLabel.VtFont.VtColor.Set 0, 0, 0
- Next i
- End With
-
- ' Set Y1 axis for stock hi-low prices
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 35
- .Minimum = 10
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- ' Turn on Y2 axis for volume
- .Plot.SeriesCollection.Item(1).SecondaryAxis = True
- With .Plot.Axis(VtChAxisIdY2).AxisScale
- .Type = VtChScaleTypeLinear
- .Hide = False
- .LogBase = 10
- .PercentBasis = VtChPercentAxisBasisMaxChart
- End With
-
- ' Set Y2 Axis limits for stock volume
- With .Plot.Axis(VtChAxisIdY2).ValueScale
- .Auto = False
- .Maximum = 4000
- .Minimum = 0
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- Case 2 ' 3D Line/Bar
- Call QReadData(App.Path + COMBODATA1)
- .ChartType = VtChChartType3dCombination
-
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType3dLine
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType3dBar
-
- Case 3 ' 3D Line/Bar/Area
- Call QReadData(App.Path + COMBODATA3)
- .Visible = False
- .ChartType = VtChChartType3dCombination
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Make sure legend is off
- .Legend.Location.Visible = False
-
- ' Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 0
-
- ' Change each series type
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType3dLine
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType3dBar
- .Plot.SeriesCollection.Item(3).seriesType = VtChSeriesType3dArea
-
- ' Set line to dashed line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleDashed
- .Join = VtPenJoinMiter
- .Cap = VtPenCapButt
- .Width = 8
- End With
-
- ' Set bar shapes to cylinder
- .Plot.SeriesCollection.Item(2).Bar.TopRatio = 1
- .Plot.SeriesCollection.Item(2).Bar.Sides = 32
-
- ' Smooth the area
- .Plot.SeriesCollection.Item(3).SmoothingFactor = 10
- .Plot.SeriesCollection.Item(3).SmoothingType = VtSmoothingTypeQuadraticBSpline
-
- ' Change Series Colors
- Call QSetSeriesColor(1, 77, 191, 64) ' Greenish
- Call QSetSeriesColor(i, 50, 163, 205) ' Blueish
- Call QSetSeriesColor(i, 208, 47, 139) ' Redish
-
- ' Chart walls
- .Plot.Wall.Width = 10
- .Plot.Wall.Brush.Style = VtBrushStyleSolid
-
- .Visible = True
-
- Case 4 ' 3D Step/Area
- Call QReadData(App.Path + COMBODATA4)
- .Visible = False
- .ChartType = VtChChartType3dCombination
-
- ' Set series types
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType3dStep
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType3dArea
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
-
- ' Smooth the area
- .Plot.SeriesCollection.Item(2).SmoothingFactor = 10
- .Plot.SeriesCollection.Item(2).SmoothingType = VtSmoothingTypeQuadraticBSpline
-
- ' Turn off Z axis
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
- .Visible = True
- End Select
- End With
- End Sub
-
- Sub DefaultChart()
-
- Dim theRow%, theCol%
-
- Screen.MousePointer = 11 ' Hourglass
-
- With frmMain.vtchart1
- ' Reset everything to defaults
- .ToDefaults
-
- ' Put the chart in a defined state
- .ChartType = VtChChartType2dBar
-
- ' ----- Set default data -----
-
- ' Set the number of rows and columns
- .rowCount = 2
- .ColumnCount = 2
-
- ' Set Column Labels
- .Column = 1
- .ColumnLabel = "Col 1"
- .Column = 2
- .ColumnLabel = "Col 2"
-
- ' Set Row Labels
- .Row = 1
- .RowLabel = "Row 1"
- .Row = 2
- .RowLabel = "Row 2"
-
- ' Set Data Points
- For theRow = 1 To 2
- .Row = theRow
- For theCol = 1 To 2
- .Column = theCol
- .Data = ((theCol - 1) * 2) + theRow
- Next theCol
- Next theRow
-
- ' ----- Set up the Title -----
- With .Title
- ' Set the new title
- .Text = "Default Chart"
-
- ' Set the title font
- .VtFont.Size = 16
- .VtFont.VtColor.Set 0, 0, 255
-
- ' Set title backdrop
- .Backdrop.Fill.VtPicture.filename = ""
- .Backdrop.Fill.Style = VtFillStyleNull
- .Backdrop.Frame.Style = VtFrameStyleNull
-
- ' Set title location and make it visible
- .Location.LocationType = VtChLocationTypeTop
- .Location.Visible = True
- End With
-
- ' ----- Set up legend -----
- With .Legend
- ' Set the legend font
- .VtFont.Size = 12
- .VtFont.VtColor.Set 255, 0, 0
-
- ' Put a frame on the Legend
- .Backdrop.Frame.Style = VtFrameStyleSingleLine
- .Backdrop.Fill.VtPicture.filename = ""
-
- ' Position the legend
- .Location.LocationType = VtChLocationTypeRight
- .Location.Visible = True
- End With
-
- ' ----- Set up Chart Backdrop -----
- ' Set the chart background to Gray
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Fill
- .VtPicture.filename = ""
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 192, 192, 192 'gray
- End With
- End With
-
- ' ----- Set up Plot Backdrop -----
- ' Single line frame
- .Plot.Backdrop.Frame.Style = VtFrameStyleSingleLine
-
- ' Add Shadow
- With .Plot.Backdrop.Shadow
- .Style = VtShadowStyleDrop
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 0, 0, 0
- .Offset.Set 2.5, 2.5
- End With
-
- ' Backdrop color is Gray
- With .Plot.Backdrop.Fill
- .VtPicture.filename = ""
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 192, 192, 192
- End With
-
- ' ----- Set the perspective, elevation and rotation -----
- Call QSet3DView(60, 30)
-
- ' Set Perspective
- .Plot.Perspective.Set 0.5, 0.5, 2
-
- End With
-
- Screen.MousePointer = 0
-
- End Sub
-
-
- Sub DoughnutChart()
-
- Dim series As Object, i%
-
- Call DefaultChart
-
- ' Make X axis fonts larger (X axis is same as individual donut label)
- Call QSetAxisLabel(VtChAxisIdX, True, 12, 0, 0, 255)
-
- With frmMain.vtchart1
-
- Select Case DoughnutIndex
-
- Case 0 ' Doughnut
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- Case 1 ' Multiple Doughnuts
- Call QReadData(App.Path + PIEDATA2)
- .ChartType = VtChChartType3dDoughnut
-
- Case 2 ' Exploded Pieces
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- ' Explode the pieces
- For Each series In .Plot.SeriesCollection
- series.DataPoints.Item(1).Offset = 0.1
- Next series
-
- Case 3 ' Labels
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- .VtFont.Size = 10
- .VtFont.VtColor.Set 0, 0, 255
- .LocationType = VtChLabelLocationTypeOutside
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleBent
- .Custom = False
- End With
- Next series
-
- Case 4 ' Weighting
- Call QReadData(App.Path + PIEDATA3)
- .ChartType = VtChChartType3dDoughnut
-
- ' Turn on weighting
- .Plot.Weighting.Basis = VtChPieWeightBasisTotal
- .Plot.Weighting.Style = VtChPieWeightStyleDiameter
-
- Case 5 ' Interior Ratio
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- ' Change Radius
- .Plot.Doughnut.Sides = 4
- .Plot.Doughnut.InteriorRatio = 0.3
-
- Case 6 ' Thickness
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- ' Change the thickness
- .Plot.Pie.ThicknessRatio = 0.66
- .Plot.Pie.TopRadiusRatio = 1
-
- Case 7 ' Shapes
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- ' Change Number of sides
- .Plot.Doughnut.Sides = 5
- .Plot.Doughnut.InteriorRatio = 0.5
-
- ' Change the thickness
- .Plot.Pie.ThicknessRatio = 0.5
- .Plot.Pie.TopRadiusRatio = 1
-
- Case 8 ' Round
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dDoughnut
-
- ' Change number of sides
- .Plot.Doughnut.Sides = 60
- .Plot.Doughnut.InteriorRatio = 0.5
-
- ' Change the thickness
- .Plot.Pie.ThicknessRatio = 0.5
- .Plot.Pie.TopRadiusRatio = 1
-
- ' Turn the edge pen off so they look nice
- .Plot.light.EdgeVisible = False
-
- End Select
- End With
- End Sub
-
- Sub GanttChart()
-
- Dim dataPoint As Object
-
- ' Reset all chart options
- Call DefaultChart
-
- With frmMain.vtchart1
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- Select Case GanttIndex
-
- Case 0 '2D Gantt
- Call QReadData(App.Path + GANTT1)
- .ChartType = VtChChartType2dGantt
-
- ' Set date axis options
- With .Plot.Axis(VtChAxisIdY).DateScale
- .Auto = False
- .Maximum = 34606
- .Minimum = 34547
- .MajInt = VtChDateIntervalTypeWeekly
- .MinInt = VtChDateIntervalTypeDaily
- .MajFreq = 1
- .MinFreq = 1
- .SkipWeekend = True
- End With
-
- 'set axis label format
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "m/d"
-
- ' Set Axis Font
- Call QSetAxisLabel(VtChAxisIdY, True, 8, 0, 0, 0)
-
-
- Case 1 ' Labeled Gantt
- .ChartType = VtChChartType2dGantt
- Call QReadData(App.Path + GANTT1)
-
- 'Set date axis options
- With .Plot.Axis(VtChAxisIdY).DateScale
- .Auto = False
- .Maximum = 34606
- .Minimum = 34547
- .MajInt = VtChDateIntervalTypeWeekly
- .MinInt = VtChDateIntervalTypeDaily
- .MajFreq = 1
- .MinFreq = 1
- .SkipWeekend = True
- End With
-
- 'set axis label format
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "m/d"
-
- ' Set Axis Font
- Call QSetAxisLabel(VtChAxisIdY, True, 8, 0, 0, 0)
-
- For Each dataPoint In .Plot.SeriesCollection.Item(1).DataPoints
- With dataPoint.DataPointLabel
- 'Set label location and style
- .LocationType = VtChLabelLocationTypeBase
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- 'Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 255
-
- .ValueFormat = "mmm-dd"
- .PercentFormat = ""
- End With
- Next dataPoint
-
- Case 2 ' Multiple series
- .ChartType = VtChChartType2dGantt
- Call QReadData(App.Path + GANTT3)
-
- ' Turn the legend on
- .Legend.Location.LocationType = VtChLocationTypeRight
- .Legend.Location.Visible = True
-
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.VtColor.Set 160, 160, 160
-
- 'set axis label formats
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "mmm"
-
- 'set axis font
- Call QSetAxisLabel(VtChAxisIdY, True, 8, 0, 0, 0)
-
- Case 3 ' Picture Bars -- doesn't quite work yet (problems with pictures)
- Call QReadData(App.Path + GANTT1)
- .ChartType = VtChChartType2dGantt
-
- 'Set date axis options
- With .Plot.Axis(VtChAxisIdY).DateScale
- .Auto = False
- .Maximum = 34606
- .Minimum = 34547
- .MajInt = VtChDateIntervalTypeWeekly
- .MinInt = VtChDateIntervalTypeDaily
- .MajFreq = 1
- .MinFreq = 1
- .SkipWeekend = True
- End With
-
- 'set axis label format
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "dd"
- '.Plot.axis(VtChAxisIdY).Labels.Item(2).Format = "mmmm"
-
- ' Set Axis Font
- Call QSetAxisLabel(VtChAxisIdY, True, 8, 0, 0, 0)
-
- ' Put pictures in bars
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).VtPicture
- .Type = VtPictureTypeBMP
- .Map = VtPictureMapTypeFitted
- .filename = App.Path & VTBMP1
- End With
-
- Case 4 ' 3D Default
- Call QReadData(App.Path + GANTT1)
- .ChartType = VtChChartType3dGantt
-
- 'Set date axis options
- With .Plot.Axis(VtChAxisIdY).DateScale
- .Auto = False
- .Maximum = 34606
- .Minimum = 34547
- .MajInt = VtChDateIntervalTypeWeekly
- .MinInt = VtChDateIntervalTypeDaily
- .MajFreq = 1
- .MinFreq = 1
- .SkipWeekend = True
- End With
-
- 'set axis label format
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "m/d"
-
- ' Set Axis Font
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 0, 0, 0)
-
- ' Turn minor grids off
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MajorPen.Style = VtPenStyleNull
-
- 'Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 0.3
- .Plot.DepthToHeightRatio = 4
-
- ' Set the elevation and rotation
- Call QSet3DView(4, 6)
-
- ' Set Projection to oblique
- .Plot.Projection = VtProjectionTypeOblique
-
- ' Turn off all current lights
- .Plot.light.LightSources.Remove (-1)
-
- ' Set the new light high center
- .Plot.light.LightSources.Add 0, -1, 2, 1
-
- Case 5 ' 3D Labeled Gantt
- Call QReadData(App.Path + GANTT1)
- .ChartType = VtChChartType3dGantt
-
- 'Set date axis options
- With .Plot.Axis(VtChAxisIdY).DateScale
- .Auto = False
- .Maximum = 34606
- .Minimum = 34547
- .MajInt = VtChDateIntervalTypeWeekly
- .MinInt = VtChDateIntervalTypeDaily
- .MajFreq = 1
- .MinFreq = 1
- .SkipWeekend = True
- End With
-
- 'set axis label format
- .Plot.Axis(VtChAxisIdY).Labels.Item(1).Format = "m/d"
-
- ' Set Axis Font
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 0, 0, 0)
-
- ' Turn axis grids off
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MajorPen.Style = VtPenStyleNull
-
- .Plot.WidthToHeightRatio = 0.3
- .Plot.DepthToHeightRatio = 4
-
- ' Set the elevation and rotation
- Call QSet3DView(57, 21)
-
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel
- ' Set label format
- .ValueFormat = "mmm-dd"
- .PercentFormat = ""
-
- ' Label the Point
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 160, 240
- End With
-
- End Select
- End With
- End Sub
-
- Sub HBarChart()
-
- Dim dataPoint As Object, series As Object, i%
-
- ' Reset all chart options
- Call DefaultChart
-
- With frmMain.vtchart1
-
- Select Case HBarIndex
-
- Case 0 'Default Chart
- Call QReadData(App.Path + HBARDATA20)
- .ChartType = VtChChartType2dHorizontalBar
-
- Case 1 ' Labeled Bars
- .ChartType = VtChChartType2dHorizontalBar
- Call QReadData(App.Path + HBARDATA21)
-
- For Each dataPoint In .Plot.SeriesCollection.Item(1).DataPoints
- With dataPoint.DataPointLabel
- ' Label the series
- .LocationType = VtChLabelLocationTypeBelowPoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 255
- End With
- Next dataPoint
-
- Case 2 ' +/- Data
- .ChartType = VtChChartType2dHorizontalBar
- Call QReadData(App.Path + VBARDATA2)
-
- Case 3 ' Picture Bars
- Call QReadData(App.Path + VBARDATA3)
- .ChartType = VtChChartType2dHorizontalBar
-
- ' Set the picture for each bar
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).VtPicture
- .Type = VtPictureTypeBMP
- .Map = VtPictureMapTypeFitted
- .Embedded = 0
- End With
- Next series
- .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).VtPicture.filename = App.Path & VTBMP1
- .Plot.SeriesCollection.Item(2).DataPoints.Item(-1).VtPicture.filename = App.Path & VTBMP2
- .Plot.SeriesCollection.Item(3).DataPoints.Item(-1).VtPicture.filename = App.Path & VTBMP3
-
- Case 4 ' Stacked
- Call QReadData(App.Path + VBARDATA4)
- .ChartType = VtChChartType2dHorizontalBar
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- Case 5 ' Stacked Percent
- Call QReadData(App.Path + VBARDATA5)
- .ChartType = VtChChartType2dHorizontalBar
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- ' Set axis to percent scaling
- .Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypePercent
- .Plot.Axis(VtChAxisIdY).AxisScale.PercentBasis = VtChPercentAxisBasisSumRow
-
- Case 6 ' 3D Default
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType3dHorizontalBar
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 0.3
- .Plot.DepthToHeightRatio = 4
-
- ' Set the elevation and rotation
- Call QSet3DView(4, 3)
-
- ' Set Projection to oblique
- .Plot.Projection = VtProjectionTypeOblique
-
- ' Set lighting
- .Plot.light.LightSources.Remove (-1)
- .Plot.light.LightSources.Add 0, -1, 2, 1
-
- Case 7 ' 3D Labeled
- Call QReadData(App.Path + VBARDATA9)
- .ChartType = VtChChartType3dHorizontalBar
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- '' Set all At Once ???
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel
- 'Set label location above point
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = 1
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 255
- End With
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 0.3
- .Plot.DepthToHeightRatio = 4
-
- ' Set the elevation and rotation
- Call QSet3DView(4, 3)
-
- ' Set Projection to oblique
- .Plot.Projection = VtProjectionTypeOblique
-
- ' Set lighting
- .Plot.light.LightSources.Remove (-1)
- .Plot.light.LightSources.Add 0, -1, 2, 1
-
- ' Change the axis label font size and color
- Call QSetAxisLabel(VtChAxisIdX, True, 8, 0, 0, 0)
-
- Case 8 ' 3D With Walls
- Call QReadData(App.Path + VBARDATA8)
- .ChartType = VtChChartType3dHorizontalBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 0.3
- .Plot.DepthToHeightRatio = 0.4
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Turn on walls
- .Plot.Wall.Width = 20
- .Plot.Wall.Brush.Style = VtBrushStyleSolid
-
- ' Change the axis label font size and color
- Call QSetAxisLabel(VtChAxisIdX, True, 14, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 0, 0, 255)
-
- End Select
- End With
- End Sub
-
- Sub HiLowChart()
-
- Dim series As Object
- Dim seriesType%
-
- Call DefaultChart
-
- Select Case HilowIndex
- Case 0 ' Hi-Low
- Call QReadData(App.Path + HILODATA)
- seriesType = VtChSeriesType2dHiLo
- Case 1 ' Hi-Low-Close
- Call QReadData(App.Path + HILOCLDATA)
- seriesType = VtChSeriesType2dHLC
- Case 2 ' Open-Hi-Low-Close
- Call QReadData(App.Path + OPENHILOCLDATA)
- seriesType = VtChSeriesType2dOHLC
- Case 3 ' Hi-Low-Close-Side Bar
- Call QReadData(App.Path + HILOCLDATA)
- seriesType = VtChSeriesType2dHLCRight
- Case Else ' Open-Hi-Low-Closed - Bar
- Call QReadData(App.Path + OPENHILOCLDATA)
- seriesType = VtChSeriesType2dOHLCBar
- End Select
-
- With frmMain.vtchart1
- ' Set the chart type to hi-low
- .ChartType = VtChChartType2dHiLo
- For Each series In .Plot.SeriesCollection
- series.seriesType = seriesType
- Next series
-
- ' Change bar color to blue
- Call QSetSeriesColor(1, 0, 0, 255)
-
- ' Change the gain and loss colors
- With .Plot.SeriesCollection.Item(1).HiLo
- .GainColor.Automatic = False
- .GainColor.Set 0, 255, 0
- .LossColor.Automatic = False
- .LossColor.Set 255, 0, 0
- End With
- End With
-
- End Sub
-
- Sub LineChart()
-
- Dim series As Object, dataPoint As Object, i%, theLineStyle%
-
- Call DefaultChart
-
- With frmMain.vtchart1
- Select Case LineIndex
-
- Case 0 ' 2D Line
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA9)
-
-
- Case 1 ' Labeled
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA7)
-
- ' Label the points
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
-
- ' Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 255
- End With
- Next series
-
- 'Set Y axis scale
- '' If maximum > minimum, the maximum MUST be set first
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 1050
- .Minimum = 800
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- Case 2 ' Series Labels
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VAREADATA1)
-
- For Each series In .Plot.SeriesCollection
- With series.SeriesLabel
- .LocationType = VtChLabelLocationTypeRight
- .LineStyle = VtChLabelLineStyleNone
- ' Set the label font
- .VtFont.Size = 8
- .VtFont.VtColor.Set 0, 0, 255
-
- ' Set the label backdrop
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Frame.FrameColor.Set 0, 0, 0
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleSolid
- .Fill.Brush.FillColor.Set 225, 225, 225
- End With
- End With
- Next series
-
- Case 3 ' +/- Data
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA2)
-
- Case 4 ' Smoothed
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA10)
-
- ' Smooth the series
- With .Plot.SeriesCollection
- .Item(2).SmoothingFactor = 10
- .Item(2).SmoothingType = VtSmoothingTypeQuadraticBSpline
- .Item(3).SmoothingFactor = 10
- .Item(3).SmoothingType = VtSmoothingTypeCubicBSpline
- End With
-
- Case 5 ' Markers
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA1)
-
- ' Set markers on
- For Each series In .Plot.SeriesCollection
- series.SeriesMarker.show = True
- series.ShowLine = True
- Next series
-
- Case 6 ' Line Styles
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA1)
-
- 'set all lines to smooth
- theLineStyle = VtPenStyleDashed
- For Each series In .Plot.SeriesCollection
- series.SmoothingFactor = 10
- series.SmoothingType = VtSmoothingTypeQuadraticBSpline
- With series.Pen
- .Style = theLineStyle
- .Join = VtPenJoinMiter
- .Cap = VtPenCapButt
- .Width = 4
- End With
- theLineStyle = theLineStyle + 1
- Next series
-
- Case 7 ' Thick Lines
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA1)
-
- ' Make lines smooth and thick
- For Each series In .Plot.SeriesCollection
- series.SmoothingFactor = 10
- series.SmoothingType = VtSmoothingTypeQuadraticBSpline
- With series.Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapRound
- .Width = 8
- End With
- Next series
-
- Case 8 ' Log Axis
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA6)
-
- ' Set to log axis
- .Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypeLogarithmic
- .Plot.Axis(VtChAxisIdY).AxisScale.PercentBasis = VtChPercentAxisBasisMaxChart
-
- Case 9 ' 2nd Y Axis
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA5)
-
- ' Turn on second Y axis
- .Plot.Axis(VtChAxisIdY2).AxisScale.Type = VtChScaleTypeLinear
- .Plot.Axis(VtChAxisIdY2).AxisScale.PercentBasis = VtChPercentAxisBasisMaxChart
- .Plot.Axis(VtChAxisIdY2).AxisScale.Hide = False
- .Plot.SeriesCollection.Item(2).SecondaryAxis = True
-
- ' Set Axis Scale
- '' If max > existing min, MUST set max first
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 80
- .Minimum = 70
- .MajorDivision = 5
- .MinorDivision = 1
- End With
- With .Plot.Axis(VtChAxisIdY2).ValueScale
- .Auto = False
- .Maximum = 0.7
- .Minimum = 0.3
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- Case 10 ' Missing Data
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA7)
-
- ' Clear some data so it is missing
- .Row = 5
- .Column = 1
- .Data = ""
-
- ' Set the pen to create a thick line ???
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapRound
- .Width = 6
- End With
-
- ' Set Y axis scale
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 1050
- .Minimum = 800
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- Case 11 ' Statistics
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA7)
-
- ' Turn the statistics on
- With .Plot.SeriesCollection.Item(1).StatLine
- .Flag = VtChStatsMinimum Or VtChStatsMaximum Or VtChStatsMean Or VtChStatsStddev Or VtChStatsRegression
- .VtColor.Set 255, 0, 0
- .Width = 1
- End With
-
- ' Make the Series Line Blue
- Call QSetSeriesColor(1, 0, 0, 255)
-
- ' Set Y axis scale
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 1050
- .Minimum = 800
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- Case 12 ' 2D Guidelines
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA2)
-
-
- ' Turn on Guidelines
- For Each series In .Plot.SeriesCollection
- series.ShowGuideLine(VtChAxisIdX) = True
- Next series
-
- '' Turn off the axis grid
- .Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- Case 13 ' 3D Line
- .ChartType = VtChChartType3dLine
- Call QReadData(App.Path + VLINEDATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
-
- ' Set the elevation and rotation
- Call QSet3DView(65, 19)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Thicken the line
- For Each series In .Plot.SeriesCollection
- With series.Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapButt
- .Width = 8
- End With
- Next series
-
- ' Turn off X, Y, Y2 and Z axis
- Call QSetAxisLabel(VtChAxisIdX, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY2, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- Case 14 ' 3D Labeled
- .ChartType = VtChChartType3dLine
- Call QReadData(App.Path + VLINEDATA4)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
-
- ' Set the elevation and rotation
- Call QSet3DView(77, 27)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Thicken the line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapButt
- .Width = 6
- End With
-
- ' Label the point
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- 'Make the labels larger and change color
- .VtFont.Size = 14
- .VtFont.VtColor.Set 0, 0, 255
- End With
-
- ' Set Y axis scale
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 125
- .Minimum = 100
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- ' Turn off X, Y, Y2 and Z axis
- Call QSetAxisLabel(VtChAxisIdX, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY2, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- Case 15, 16 ' Smoothed and 3D Line Styles
- .ChartType = VtChChartType3dLine
- Call QReadData(App.Path + VLINEDATA11)
-
- ' Turn title off
- .Title.Location.Visible = False
-
- ' Turn Plot Frame Off
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 1.5
- .Plot.DepthToHeightRatio = 1.5
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Smooth the series lines
- For Each series In .Plot.SeriesCollection
- series.SmoothingFactor = 12
- series.SmoothingType = VtSmoothingTypeQuadraticBSpline
-
- 'set the style and pen to create a thick styled line
- With series.Pen
- .Style = IIf(LineIndex = 15, VtPenStyleSolid, VtPenStyleDashed)
- .Join = VtPenJoinMiter
- .Cap = VtPenCapButt
- .Width = 6
- End With
- Next series
-
- ' Set the elevation and rotation
- Call QSet3DView(39, 7)
-
- ' Set Projection and perspective
- .Plot.Projection = VtProjectionTypePerspective
- .Plot.Perspective.Set 0.5, 0.5, 0.5
-
- ' Set axis grids to null -- major / minor reversed
- .Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdZ).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- ' Turn off X and Z axis, Turn on Y and Y2
- Call QSetAxisLabel(VtChAxisIdX, False, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- ' Make Y and Y2 axis fonts larger
- Call QSetAxisLabel(VtChAxisIdY, True, 18, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY2, True, 18, 0, 0, 202)
-
- ' Set lighting to upper right corner
- ' first turn off all current lights
- .Plot.light.LightSources.Remove (-1)
- .Plot.light.LightSources.Add -3, -1, 2, 1
-
- ' Turn Edge Lighting Off
- .Plot.light.EdgeVisible = False
-
- ' Turn ambient light down
- .Plot.light.AmbientIntensity = 0
-
- ' Change Series Colors
- Call QSetSeriesColor(3, 128, 0, 128) ' Purple
- Call QSetSeriesColor(4, 0, 160, 240) ' Blue
- Call QSetSeriesColor(5, 255, 35, 170) ' Pink
-
- End Select
- End With
- End Sub
-
- Sub MultiChart()
-
- Dim theRow%, theCol%, theLabel$
-
- Call DefaultChart
-
- Call QReadData(App.Path + MDDATA1)
-
- With frmMain.vtchart1
- .ColumnCount = 4 ' Data has two sets of 4
-
- ' Add extra dimension
- .RowLabelCount = .RowLabelCount + 1
- .rowCount = .rowCount * 2
- .RowLabelIndex = 2
- .Row = 1
- .RowLabel = "1993"
- .Row = 5
- .RowLabel = "1994"
-
- ' Replicate the inside labels
- .RowLabelIndex = 1
- For theRow = 1 To 4
- .Row = theRow
- theLabel = .RowLabel
- .Row = theRow + 4
- .RowLabel = theLabel
- Next theRow
-
- ' Add New Data Points
- For theRow = 1 To 4
- .Column = theRow
- For theCol = 1 To 8
- .Row = theCol
- frmData.Grid1.Row = theRow + 1
- frmData.Grid1.Col = theCol + 1
- .Data = Val(frmData.Grid1.Text)
- Next theCol
- Next theRow
-
- Select Case MultiIndex
- Case 0 '2D Multi Combo
- .ChartType = VtChChartType2dCombination
- Case 1 '3D Multi Combo
- .ChartType = VtChChartType3dCombination
- Case 2 '3D Multi Pie
- .ChartType = VtChChartType3dPie
- End Select
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Make sure legend is off
- .Legend.Location.Visible = False
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 0
-
- ' Change each series
- With .Plot.SeriesCollection
- .Item(1).seriesType = VtChSeriesType3dLine
- .Item(2).seriesType = VtChSeriesType3dBar
- .Item(3).seriesType = VtChSeriesType3dArea
- .Item(4).seriesType = VtChSeriesType3dStep
- End With
-
- ' Set line to dashed line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleDashed
- .Join = VtPenJoinMiter
- .Cap = VtPenCapButt
- .Width = 8
- End With
-
- ' Set bar shapes to cylinder
- .Plot.SeriesCollection.Item(2).Bar.Sides = 32
- .Plot.SeriesCollection.Item(2).Bar.TopRatio = 1
-
- ' Smooth the area
- .Plot.SeriesCollection.Item(3).SmoothingFactor = 10
- .Plot.SeriesCollection.Item(3).SmoothingType = VtSmoothingTypeQuadraticBSpline
-
- ' Change Series Colors
- Call QSetSeriesColor(1, 77, 191, 64) ' Greenish
- Call QSetSeriesColor(2, 50, 163, 205) ' Blueish
- Call QSetSeriesColor(3, 208, 47, 139) ' Redish
-
- ' Set the chart background to gradient
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Fill.Style = VtFillStyleGradient
- With .Fill.Gradient
- .Style = VtGradientStyleRectangle
- .FromColor.Set 255, 255, 255
- .ToColor.Set 100, 100, 255
- End With
- End With
-
- ' Plot Backdrop is Null
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
- .Plot.Backdrop.Fill.Style = VtFillStyleNull
-
- ' Chart walls a little thick
- .Plot.Wall.Width = 10
- .Plot.Wall.Brush.Style = VtBrushStyleSolid
-
- ' Change the axis label font size and color
- Call QSetAxisLabel(VtChAxisIdX, True, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdZ, True, 14, 0, 0, 202)
-
- ' Set 2nd level axis labels
- '' should this work with type three
- If MultiIndex <> 2 Then
- With .Plot.Axis(VtChAxisIdX).Labels.Item(2).VtFont
- .Size = 16
- .VtColor.Set 0, 0, 202
- End With
- End If
-
- End With
- End Sub
-
- Sub OptionChart()
-
- Dim series As Object, dataPoint As Object
- Dim i%
-
- ' Reset all chart options
- Call DefaultChart
-
- With frmMain.vtchart1
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- Select Case OptionIndex
-
- Case 0 'Title Fill
- .ChartType = VtChChartType2dLine
- Call QReadData(App.Path + VLINEDATA9)
-
- ' Set chart backdrop to rectangle gradient
- With .Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleVertical
- .Gradient.FromColor.Set 225, 252, 252
- .Gradient.ToColor.Set 96, 96, 96
- End With
-
- 'Set the Plot background to Null (Invisible)
- With .Plot.Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Shadow
- .Style = VtShadowStyleDrop
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 0, 0, 0
- .Offset.X = 2.5
- .Offset.Y = 2.5
- End With
- With .Fill
- .VtPicture.filename = ""
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleNull
- End With
- End With
-
- For Each series In .Plot.SeriesCollection
- ' Turn markers and lines on
- series.SeriesMarker.Auto = False
- series.SeriesMarker.show = True
- series.ShowLine = True
-
- ' Change the marker to a Circle
- With series.DataPoints.Item(-1).Marker
- .Style = VtMarkerStyleCircle
- .Pen.VtColor.Set 0, 0, 255
- .Pen.Width = 2
- End With
- Next series
-
- ' Set the title backdrop and color
- With .Title.Backdrop
- .Frame.Style = VtFrameStyleThickOuter
- .Frame.FrameColor.Set 0, 0, 0
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleSolid
- .Fill.Brush.FillColor.Set 3, 182, 177
- End With
-
- ' Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 255
-
- ' Set Axis Grids and Fonts to White
- For i = VtChAxisIdX To VtChAxisIdZ
- With .Plot.Axis(i)
- .AxisGrid.MinorPen.VtColor.Set 249, 253, 215
- .AxisGrid.MajorPen.VtColor.Set 249, 253, 215
- .Pen.VtColor.Set 249, 253, 215
- End With
- Next i
-
- Case 1 'Title Gradient
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- ' Set title backdrop
- With .Title.Backdrop
- .Frame.Style = VtFrameStyleThickOuter
- .Frame.FrameColor.Set 0, 0, 255
- 'Set to gradient fill
- .Fill.Style = VtFillStyleGradient
- With .Fill.Gradient
- .Style = VtGradientStyleOval
- .FromColor.Set 255, 255, 255
- .ToColor.Set 100, 100, 255
- End With
- End With
-
- 'Set the title font
- .Title.VtFont.Size = 18
- .Title.VtFont.VtColor.Set 255, 0, 0
-
- ' Put a picture in each bar
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).VtPicture
- .Type = VtPictureTypeWMF
- .Map = VtPictureMapTypeTiled
- .Embedded = 0
- .filename = App.Path & VTWMF6
- End With
- Next series
-
- .Plot.xGap = 0.05
-
- Case 2 'Title Picture
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- ' Put picture in title
- With .Title.Backdrop.Fill
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 255, 255, 0
- .VtPicture.filename = App.Path & VTWMF5
- .VtPicture.Map = VtPictureMapTypeStretched
- .VtPicture.Type = VtPictureTypeWMF
- End With
-
- .Title = " "
-
- ' Set the Plot background
- With .Plot.Backdrop
- .Shadow.Style = VtShadowStyleNull
- .Frame.Style = VtFrameStyleNull
- With .Fill
- .VtPicture.filename = ""
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 255, 255, 0
- End With
- End With
-
- ' Set plot size
- .Plot.AutoLayout = False
- .Plot.LocationRect.Min.Y = 1
-
- ' Set title size
- .Title.Location.Visible = True
- .Title.Location.LocationType = VtChLocationTypeCustom
- .Title.Location.Rect.Max.Set .Plot.LocationRect.Max.X, .Plot.LocationRect.Min.Y
- .Title.Location.Rect.Min.Set .Plot.LocationRect.Min.X, 0.18
-
- Case 3 'BD Gradient Rectangle
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dLine
-
- ' Set the pen to create a thick line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleDotted
- .Join = VtPenJoinRound
- .Cap = VtPenCapRound
- .Width = 12
- End With
-
- 'Set chart backdrop to rectangle gradient
- With .Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleRectangle
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 100, 100, 255
- End With
-
- 'Set the plot background to null (invisible)
- With .Plot.Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Shadow.Style = VtShadowStyleDrop
- .Shadow.Brush.Style = VtBrushStyleSolid
- .Shadow.Brush.FillColor.Set 0, 0, 0
- .Shadow.Offset.X = 2.5
- .Shadow.Offset.Y = 2.5
- .Fill.VtPicture.filename = ""
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleNull
- End With
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 255
-
- Case 4 'BD Gradient Oval
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(112, 31)
-
- ' Make bars into pyramids
- .Plot.SeriesCollection.Item(1).Bar.Sides = 4
- .Plot.SeriesCollection.Item(1).Bar.TopRatio = 0
-
- 'Oval Gradient
- With .Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleOval
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 100, 100, 255
- End With
-
- 'Set the plot background to null (invisible)
- With .Plot.Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Shadow
- .Style = VtShadowStyleDrop
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 0, 0, 0
- .Offset.X = 2.5
- .Offset.Y = 2.5
- End With
- .Fill.VtPicture.filename = ""
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleNull
- End With
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 0
-
- Case 5 'BD Gradient Horizontal
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dLine
-
- ' Set the pen to create a thick line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleDashDot
- .Join = VtPenJoinRound
- .Cap = VtPenCapRound
- .Width = 12
- End With
-
- 'Horizontal Gradient
- With .Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleHorizontal
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 100, 100, 255
- End With
-
- 'Set the plot background to null (invisible)
- With .Plot.Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Shadow
- .Style = VtShadowStyleDrop
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 0, 0, 0
- .Offset.X = 2.5
- .Offset.Y = 2.5
- End With
- .Fill.VtPicture.filename = ""
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleNull
- End With
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 0, 0
-
- Case 6 'BD Gradient Vertical
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- 'VerticalGradient
- With .Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleVertical
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 100, 100, 255
- End With
-
- 'Set the plot background to null (invisible)
- With .Plot.Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Shadow
- .Style = VtShadowStyleDrop
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set 0, 0, 0
- .Offset.X = 2.5
- .Offset.Y = 2.5
- End With
- With .Fill
- .VtPicture.filename = ""
- .Style = VtFillStyleBrush
- .Brush.Style = VtBrushStyleNull
- End With
- End With
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 0
-
- ' Change the color/fill of the series
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1)
- With .Brush
- .Style = VtBrushStyleHatched
- .Index = VtBrushHatchDiagonalCross
- .FillColor.Set 255, 0, 0
- .PatternColor.Set 0, 0, 255
- End With
- With .EdgePen
- .Style = VtPenStyleSolid
- .Width = 2
- .VtColor.Set 255, 0, 0
- .VtColor.Automatic = False
- End With
- End With
-
- Case 7 'BD Picture Tiled
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dArea
-
- ' Set chart backdrop to tiled BMP picture
- .Backdrop.Fill.Style = VtFillStyleNull
- .Backdrop.Fill.VtPicture.filename = App.Path & VTBMP3
- .Backdrop.Fill.VtPicture.Map = VtPictureMapTypeTiled
-
- ' Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 0, 0, 255
-
- 'Set Title frame and backdrop
- With .Title.Backdrop
- .Frame.Style = VtFrameStyleThickOuter
- .Frame.FrameColor.Set 0, 0, 255
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleSolid
- .Fill.Brush.FillColor.Set 255, 255, 255
- End With
-
- ' Set plot backdrop to gradient
- With .Plot.Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleHorizontal
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 255, 87, 87
- End With
-
- ' Change the color/fill of the series
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1)
- .Brush.Style = VtBrushStylePattern
- .Brush.Index = VtBrushPattern94Percent
- .Brush.FillColor.Set 0, 0, 255
- .Brush.PatternColor.Set 255, 0, 0
- .EdgePen.Style = VtPenStyleSolid
- .EdgePen.Width = 2
- .EdgePen.VtColor.Set 0, 0, 255
- End With
-
- Case 8 'Plot Fill
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- ' Set bar spacing small
- .Plot.xGap = 0.1
-
- 'Set plot backdrop
- With .Plot.Backdrop.Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleHorizontal
- .Gradient.FromColor.Set 0, 160, 240
- .Gradient.ToColor.Set 192, 64, 192
- End With
-
- 'Set the chart background
- .Backdrop.Fill.Style = VtFillStyleBrush
- .Backdrop.Fill.Brush.Style = VtBrushStyleSolid
- .Backdrop.Fill.Brush.FillColor.Set 0, 0, 0
-
- 'Set title frame and backdrop
- With .Title.Backdrop
- .Frame.Style = VtFrameStyleThickOuter
- .Frame.FrameColor.Set 0, 160, 240
-
- 'Fill the backdrop with solid fill
- .Fill.Style = VtFillStyleBrush
- .Fill.Brush.Style = VtBrushStyleSolid
- .Fill.Brush.FillColor.Set 255, 255, 255
- End With
-
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 0, 0, 255
-
- Case 9 'Plot Picture BMP
- Call QReadData(App.Path + VLINEDATA8)
- .ChartType = VtChChartType2dLine
-
- With .Plot.Backdrop.Fill
- .Style = VtFillStyleNull
- .VtPicture.Type = VtPictureTypeBMP
- .VtPicture.filename = App.Path & VTBMP6
- .VtPicture.Map = VtPictureMapTypeTiled
- End With
-
- ' Set the pen to create a thick line
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapButt
- .Width = 8
- End With
-
- With .Plot.SeriesCollection.Item(1).DataPoints
- For i = 3 To 11
- With .Item(i).DataPointLabel
- Select Case i
- Case 3
- .Text = "Carter Elected"
- .LocationType = VtChLabelLocationTypeBelowPoint
- Case 5
- .Text = "Regan Elected"
- .LocationType = VtChLabelLocationTypeBelowPoint
- Case 9
- .Text = "Bush Elected"
- .LocationType = VtChLabelLocationTypeAbovePoint
- Case 11
- .Text = "Clinton Elected"
- .LocationType = VtChLabelLocationTypeBelowPoint
- Case Else
- .Text = ""
- .Component = 0
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
- .VtFont.Size = 8
- .VtFont.VtColor.Set 0, 0, 0
- With .Backdrop.Frame
- .Style = VtFrameStyleThickOuter
- .FrameColor.Set 0, 0, 0
- End With
- With .Backdrop.Fill
- .Style = VtFillStyleBrush
- .Brush.FillColor.Set 255, 255, 255
- End With
- End Select
- End With
- Next i
- End With
-
- ' Change the axis grid thickness and color
- With .Plot.Axis(VtChAxisIdY)
- .AxisGrid.MinorPen.Width = 3
- .AxisGrid.MinorPen.VtColor.Set 0, 160, 240
- .Pen.Width = 3
- .Pen.VtColor.Set 0, 160, 240
- End With
-
- With .Plot.Axis(VtChAxisIdX)
- .AxisGrid.MinorPen.Width = 3
- .AxisGrid.MinorPen.VtColor.Set 0, 160, 240
- .Pen.Width = 3
- .Pen.VtColor.Set 0, 160, 240
- End With
-
- ' Change the axis label font size and color
- Call QSetAxisLabel(VtChAxisIdX, True, 14, 255, 0, 0)
- Call QSetAxisLabel(VtChAxisIdY, True, 14, 255, 0, 0)
-
- Case 10 'Plot Picture WMF
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dLine
-
- ' Smooth the line
- With .Plot.SeriesCollection.Item(1)
- .SmoothingFactor = 10
- .SmoothingType = VtSmoothingTypeQuadraticBSpline
- End With
-
- 'Put WMF picture in the backdrop
- With .Plot.Backdrop.Fill
- .Style = VtFillStyleNull
- .VtPicture.filename = App.Path & VTWMF4
- .VtPicture.Type = VtPictureTypeWMF
- .VtPicture.Map = VtPictureMapTypeFitted
- End With
-
- Case 11 'Projection Oblique
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(0, 17)
-
- ' Set Projection
- .Plot.Projection = VtProjectionTypeOblique
-
- ' Set bars to columns
- .Plot.SeriesCollection.Item(1).Bar.Sides = 32
- .Plot.SeriesCollection.Item(1).Bar.TopRatio = 1
-
- ' Set lighting to upper right corner
- .Plot.light.LightSources.Remove (-1)
- ' Set the new light
- .Plot.light.LightSources.Add -3, -1, 2, 1
-
- Case 12 'Projection Perspective
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 4
-
- ' Set the elevation and rotation
- Call QSet3DView(167, 0)
-
- ' Set Projection
- .Plot.Projection = VtProjectionTypePerspective
-
- ' Set Perspective
- .Plot.Perspective.Set 1, 1, 0.5
-
- Case 13 ' Area Highlighted with Line
- Call QReadData(App.Path + COMBODATA5)
- .ChartType = VtChChartType2dCombination
-
- ' Make sure legend is off
- .Legend.Location.Visible = False
-
- ' Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 208, 47, 139
-
- 'Change each series
- .Plot.SeriesCollection.Item(1).seriesType = VtChSeriesType2dLine
- .Plot.SeriesCollection.Item(2).seriesType = VtChSeriesType2dArea
-
- ' Set the pen to create a thick line -- causes illegal operation error
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleSolid
- .Join = VtPenJoinRound
- .Cap = VtPenCapRound
- .Width = 4
- End With
-
- ' Redish
- Call QSetSeriesColor(1, 208, 47, 139)
-
- ' Blueish
- Call QSetSeriesColor(2, 50, 163, 205)
-
- ' Set the chart background to gradient
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- With .Fill
- .Style = VtFillStyleGradient
- .Gradient.Style = VtGradientStyleRectangle
- .Gradient.FromColor.Set 255, 255, 255
- .Gradient.ToColor.Set 192, 192, 192
- End With
- End With
-
- ' Plot backdrop is null
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
- .Plot.Backdrop.Fill.Style = VtFillStyleNull
-
- Case 14 ' 3D Stick Charts
- .ChartType = VtChChartType3dBar
- Call QReadData(App.Path + VLINEDATA11)
-
- ' Set bars to very thin by adjusting the bar gaps
- .Plot.xGap = 20
- .Plot.zGap = 20
-
- ' Set the elevation and rotation
- Call QSet3DView(23, 19)
-
- ' Set axis grids to null -- major/minor switched ???
- .Plot.Axis(VtChAxisIdX).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
- .Legend.Location.Visible = False
-
- ' Turn on markers
- For Each series In .Plot.SeriesCollection
- series.ShowLine = False
- series.SeriesMarker.show = True
- Next series
-
- Case 15 ' 3D bars with no space
- .ChartType = VtChChartType3dBar
- Call QReadData(App.Path + VBARDATA12)
-
- ' Set bars to very thin by adjusting the bar gaps
- .Plot.xGap = 0
- .Plot.zGap = 0
-
- ' Set the elevation and rotation
- Call QSet3DView(23, 19)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Make all series the same color
- For i = 1 To .Plot.SeriesCollection.Count
- Call QSetSeriesColor(i, 255, 64, 64)
- Next i
-
- ' Set base thickness to be real thin
- ' Turn on walls
- .Plot.PlotBase.BaseHeight = 0
-
- ' Set lighting to upper right corner
- .Plot.light.LightSources.Remove (-1)
- ' Set the new light
- .Plot.light.LightSources.Add 0, -1, 2, 1
-
- Case 16
- Call QReadData(App.Path + COMBODATA7)
- .ChartType = VtChChartType2dCombination
-
- ' Make sure legend is off
- .Legend.Location.Visible = False
-
- 'Set the title font
- .Title.VtFont.Size = 20
- .Title.VtFont.VtColor.Set 0, 0, 255
-
- ' Change each series -- doesn't quite work correctly
- With .Plot.SeriesCollection
- .Item(1).seriesType = VtChSeriesType2dLine
- .Item(2).seriesType = VtChSeriesType2dStep
- .Item(3).seriesType = VtChSeriesType3dStep
- .Item(4).seriesType = VtChSeriesType3dStep
- .Item(5).seriesType = VtChSeriesType3dStep
- .Item(6).seriesType = VtChSeriesType3dStep
- End With
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 3 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 2
- .StackOrder = i
- End With
- Next i
- End With
-
- ' Set line to dashed line -- causes illegal instruction error
- With .Plot.SeriesCollection.Item(1).Pen
- .Style = VtPenStyleDashed
- .Join = VtPenJoinMiter
- .Cap = VtPenCapButt
- .Width = 4
- End With
-
- ' Change Series Colors
- Call QSetSeriesColor(1, 0, 0, 112) ' Blueish
- Call QSetSeriesColor(2, 255, 0, 0) ' Red
- Call QSetSeriesColor(3, 255, 255, 0) ' Yellow
- Call QSetSeriesColor(4, 0, 255, 0) ' Green
- Call QSetSeriesColor(5, 255, 255, 0) ' Yellow
- Call QSetSeriesColor(6, 255, 0, 0) ' Red
-
- End Select
- End With
- End Sub
-
- Sub PieChart()
-
- Dim series As Object, thedatapoint%
-
- Call DefaultChart
-
- With frmMain.vtchart1
- ' Turn off the edge lighting - makes 3D pies look nicer
- .Plot.light.EdgeVisible = False
-
- ' Make X axis fonts larger (X axis is same as individual pie label)
- Call QSetAxisLabel(VtChAxisIdX, True, 12, 0, 0, 255)
-
- Select Case PieIndex
-
- Case 0 ' 2D Pie
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType2dPie
-
- Case 1 ' Multiple Pies
- Call QReadData(App.Path + PIEDATA2)
- .ChartType = VtChChartType2dPie
- ' Change the pie label font
-
- Case 2 ' Exploded Pieces
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType2dPie
- For Each series In .Plot.SeriesCollection
- series.DataPoints.Item(1).Offset = 0.1
- Next series
-
- Case 3 ' Labels
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType2dPie
-
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- .VtFont.Size = 10
- .VtFont.VtColor.Set 0, 0, 255
- .LocationType = VtChLabelLocationTypeOutside
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleBent
- .Custom = False
- End With
- Next series
-
- ' Pull out a piece
- .Plot.SeriesCollection.Item(1).DataPoints.Item(1).Offset = 0.2
-
- Case 4 ' Weighting
- Call QReadData(App.Path + PIEDATA3)
- .ChartType = VtChChartType2dPie
-
- ' Turn weighting on
- .Plot.Weighting.Basis = VtChPieWeightBasisTotal
- .Plot.Weighting.Style = VtChPieWeightStyleDiameter
-
- Case 5 ' Start Angle
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType2dPie
-
- ' Change the starting angle
- .Plot.StartingAngle = 0
-
- ' Pull out a piece
- .Plot.SeriesCollection.Item(1).DataPoints.Item(1).Offset = 0.2
-
- Case 6 ' Sorting
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType2dPie
-
- ' Sort in descending order
- .Plot.Sort = VtSortTypeDescending
-
- 'Pull out a piece
- .Plot.SeriesCollection.Item(1).DataPoints.Item(1).Offset = 0.2
-
- Case 7 ' 3D Pie
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
-
- Case 8 ' Multiple 3D Pies
- Call QReadData(App.Path + PIEDATA2)
- .ChartType = VtChChartType3dPie
-
- Case 9 ' Exploded 3D Pieces
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
-
- ' Explode all the pieces
- For Each series In .Plot.SeriesCollection
- series.DataPoints.Item(1).Offset = 0.2
- Next series
-
- Case 10 ' Labels
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
-
- ' Label the Points
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- .VtFont.Size = 10
- .VtFont.VtColor.Set 0, 0, 255
- .LocationType = VtChLabelLocationTypeOutside
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleBent
- .Custom = False
- .Backdrop.Fill.Style = VtFillStyleBrush
- .Backdrop.Fill.Brush.FillColor.Set 255, 128, 128
- End With
- series.DataPoints.Item(1).Offset = 0.1
- Next series
-
- ' Set the elevation
- Call QSet3DView(0, 47)
-
- Case 11 ' Thickness
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
-
- ' Make the pie very thick
- .Plot.Pie.Set 1, 1
-
- ' Explode the Pie
- For Each series In .Plot.SeriesCollection
- series.DataPoints.Item(1).Offset = 0.2
- Next series
-
- Case 12 ' Thin
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
-
- ' Make the pie very thin
- .Plot.Pie.Set 0.05, 1
-
- ' Set the elevation
- Call QSet3DView(0, 25)
-
- ' Explode the Pie
- For Each series In .Plot.SeriesCollection
- series.DataPoints.Item(1).Offset = 0.2
- Next series
-
- Case 13 ' Radius (Cone)
- Call QReadData(App.Path + PIEDATA1)
- .ChartType = VtChChartType3dPie
- .Plot.Pie.Set 1, 0
-
- End Select
- End With
-
- End Sub
-
- Sub PolarChart()
-
- Call DefaultChart
-
- With frmMain.vtchart1
- ' Set the pen to create a thicker line
- .Plot.SeriesCollection.Item(1).Pen.Width = 4
-
- Select Case PolarIndex
- Case 0 ' 2D Polar
- Call QReadData(App.Path + POLARDATA1)
- .ChartType = VtChChartType2dPolar
-
- Case 1 ' 2D Polar No Axis
- Call QReadData(App.Path + POLARDATA2)
- .ChartType = VtChChartType2dPolar
-
- ' Hide Axis
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleNull
-
- Case 2 ' Start Angle
- Call QReadData(App.Path + POLARDATA3)
- .ChartType = VtChChartType2dPolar
-
- 'Change the starting angle
- .Plot.StartingAngle = 0
- .Plot.Clockwise = False
-
- Case 3 ' Line Styles
- Call QReadData(App.Path + POLARDATA4)
- .ChartType = VtChChartType2dPolar
-
- ' Set the pen to create a thick line
- With .Plot.SeriesCollection.Item(1).Pen
- .Width = 6
- .Style = VtPenStyleDashDot
- End With
-
- End Select
- End With
-
- End Sub
-
- Sub QGridToChart(rowCount%, colCount%)
-
- Dim theRow%, theCol%, TheType%
- Dim chHandle&, dataValue#
- Dim grid As Object
-
- On Error GoTo 0
-
- Set grid = frmData.Grid1
-
- With frmMain.vtchart1
- ' Put Grid Information into Chart
- ' Set the new title
- .Title = frmData.TitleBox.Text
-
- ' Read the number of rows and columns
- rowCount = rowCount - 1
- colCount = colCount - 1
- .rowCount = rowCount
- .ColumnCount = colCount
- .ColumnLabelCount = 1
- .RowLabelCount = 1
-
- ' Set Data Points
- For theRow = 1 To rowCount
- .Row = theRow
-
- ' Set Row Labels
- .RowLabelIndex = 0
- grid.Row = theRow + 1
- grid.Col = 1
- .RowLabel = grid.Text
-
- For theCol = 1 To colCount
- .Column = theCol
- grid.Row = theRow
- grid.Col = theCol + 1
-
- ' Set Column Labels
- If theRow = 1 Then
- .ColumnLabelIndex = 0
- .ColumnLabel = grid.Text
- End If
-
- ' Set Data Value
- grid.Row = theRow + 1
- grid.Col = theCol + 1
- .Data = Val(grid.Text)
- Next theCol
- Next theRow
- End With
-
- End Sub
-
- Sub QReadData(WorkSheetName As String)
-
- Dim theRow%, theCol%
- Dim gridRow%, gridCol%
- Dim header$, junk$, theTitle$, theText$
-
- On Error Resume Next
-
- Screen.MousePointer = 11 'hourglass
-
-
- ' Clear the grid
- With frmData.Grid1
- For theRow = 1 To GlobalRowCount + 1
- For theCol = 1 To GlobalColCount + 1
- .Row = theRow
- .Col = theCol
- .Text = ""
- Next theCol
- Next theRow
- End With
-
- ' Read the worksheet
- GlobalFileName = WorkSheetName
-
- Open GlobalFileName For Input As #1
- If Err Then
- MsgBox "Can't open file: " + GlobalFileName
- Exit Sub
- End If
-
- ' Load text file
- Input #1, header
- Input #1, junk, theTitle
- frmData.TitleBox.Text = theTitle
- Input #1, junk, GlobalRowCount
- Input #1, junk, GlobalColCount
- frmData.Text2.Text = Str$(GlobalRowCount) + "," + Str$(GlobalColCount)
-
- With frmData.Grid1
- For theRow = 1 To GlobalRowCount
- For theCol = 1 To GlobalColCount
- .ColWidth(theCol) = 1440
- Input #1, gridRow, gridCol, theText
- .Row = gridRow
- .Col = gridCol
- .Text = theText
- Next theCol
- Next theRow
- End With
-
- Close #1
-
- 'Move the data from the grid to the chart
- Call QGridToChart(GlobalRowCount, GlobalColCount)
-
-
- Screen.MousePointer = 0 ' Normal mouse pointer
-
- End Sub
-
- Function QSet3DView(rotation!, elevation!) As Long
-
- With frmMain.vtchart1.Plot.View3d
- .rotation = rotation
- .elevation = elevation
- End With
-
- End Function
-
- Function QSetAxisLabel(whichAxis%, ShowAxis%, fontSize%, r%, g%, b%) As Long
-
- With frmMain.vtchart1.Plot.Axis(whichAxis)
- .AxisScale.Hide = Not ShowAxis
-
- If ShowAxis Then
- .Labels.Item(1).VtFont.Size = fontSize
- .Labels.Item(1).VtFont.VtColor.Set r, g, b
- End If
- End With
-
- End Function
-
- Sub QSetFootnote(show As Boolean)
-
- With frmMain.vtchart1.Footnote
- If show = True Then
- 'Set the footnote font to yellow
- .VtFont.Size = 12
- .VtColor.Set 255, 255, 0
-
- 'Default footnote backdrop
- .Backdrop.Fill.VtPicture.filename = ""
- .Backdrop.Fill.Style = VtFillStyleNull
- .Backdrop.Frame.Style = VtFrameStyleNull
-
- 'Set footnote text
- .Text = "Visual Components, Inc."
- .Location = VtChLocationTypeBottomLeft
- .Location.Visible = True
- Else
- .Location.Visible = False
- End If
- End With
-
- End Sub
-
- Function QSetPointColor(series%, dataPoint%, r%, g%, b%) As Long
-
- On Error GoTo QSetPointColorError
-
- QSetPointColor = 0
-
- With frmMain.vtchart1.Plot.SeriesCollection.Item(series).DataPoints.Item(dataPoint)
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set r, g, b
- .EdgePen.Style = VtPenStyleSolid
- .EdgePen.VtColor.Set , r, g, b
- End With
-
- Exit Function
- QSetPointColorError:
- QSetPointColor = Err.Number
- End Function
-
- Function QSetSeriesColor(series%, r%, g%, b%) As Long
-
- On Error GoTo QSetSeriesColorError
-
- QSetSeriesColor = 0
-
- With frmMain.vtchart1.Plot.SeriesCollection.Item(series).dataPoint(-1)
- .Brush.Style = VtBrushStyleSolid
- .Brush.FillColor.Set r, g, b
- .EdgePen.Style = VtPenStyleSolid
- .EdgePen.VtColor.Set , r, g, b
- End With
-
- Exit Function
- QSetSeriesColorError:
- QSetSeriesColor = Err.Number
- End Function
-
- Sub QWriteData()
-
- Dim theRow%, theCol%
- Dim gridRow%, gridCol%
- Dim header$, junk$, theTitle$, theText$
- Dim cherror&
-
- On Error GoTo FileWriteError
-
- With frmMain.CommonDialog1
- .DialogTitle = "Write First Impression Data"
- .DefaultExt = "vtx"
- .Filter = "First Impression Data|*.vtx"
- .flags = &H2
- .CancelError = True
- .InitDir = App.Path
- .ShowSave
- End With
-
- On Error Resume Next
-
- Open frmMain.CommonDialog1.filename For Output As #1
- If Err Then
- MsgBox "Can't open file: " + frmMain.CommonDialog1.filename
- Exit Sub
- End If
-
- ' Write text file
- Write #1, "VisualTools Chart Data"
- Write #1, "Title", frmMain.vtchart1.Title
-
- Write #1, "Rows", frmMain.vtchart1.rowCount + 1
- Write #1, "Cols", frmMain.vtchart1.ColumnCount + 1
-
- For theRow = 0 To frmMain.vtchart1.rowCount
- For theCol = 0 To frmMain.vtchart1.ColumnCount
-
- If theRow = 0 Then
- If theCol = 0 Then
- Write #1, theRow + 1, theCol + 1, ""
- Else
- frmMain.vtchart1.Column = theCol
- Write #1, theRow + 1, theCol + 1, frmMain.vtchart1.ColumnLabel
- End If
- Else
- If theCol = 0 Then
- frmMain.vtchart1.Row = theRow
- Write #1, theRow + 1, theCol + 1, frmMain.vtchart1.RowLabel
- Else
- frmMain.vtchart1.Row = theRow
- frmMain.vtchart1.Column = theCol
- Write #1, theRow + 1, theCol + 1, Format$(frmMain.vtchart1.Data, "####0.00")
- End If
- End If
-
- Next theCol
- Next theRow
-
- Close #1
-
- Exit Sub
-
- FileWriteError:
- MsgBox Error
-
- End Sub
-
- Sub RadarChart()
-
- Dim series As Object
-
- Call DefaultChart
-
- With frmMain.vtchart1
-
- Select Case RadarIndex
-
- Case 0 ' 2D Radar
- .ChartType = VtChChartType2dRadar
- Call QReadData(App.Path + RADARDATA1)
-
- ' Set to Lines
- For Each series In .Plot.SeriesCollection
- series.seriesType = VtChSeriesType2dRadarLine
- Next series
-
- Case 1 ' 2D Radar No Axis
- .ChartType = VtChChartType2dRadar
- Call QReadData(App.Path + RADARDATA1)
-
- ' Set to Lines
- For Each series In .Plot.SeriesCollection
- series.seriesType = VtChSeriesType2dRadarLine
- Next series
-
- ' Hide Axis
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleNull
-
- Case 2 ' 2D Area Radar
- .ChartType = VtChChartType2dRadar
- Call QReadData(App.Path + RADARDATA1)
-
- ' Set to areas
- For Each series In .Plot.SeriesCollection
- series.seriesType = VtChSeriesType2dRadarArea
- Next series
-
- End Select
- End With
- End Sub
-
- Sub StepChart()
-
- Dim series As Object, i%
-
- Call DefaultChart
-
- With frmMain.vtchart1
- Select Case StepIndex
-
- Case 0 ' 2D Step
- .ChartType = VtChChartType2dStep
- Call QReadData(App.Path + VAREADATA1)
-
- Case 1 ' Stacked Step
- .ChartType = VtChChartType2dStep
- Call QReadData(App.Path + VAREADATA1)
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- Case 2 ' 3D Step
- .ChartType = VtChChartType3dStep
- Call QReadData(App.Path + VAREADATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
- .Legend.Location.Visible = False
-
- Case 3 ' 3D Labeled
- .ChartType = VtChChartType3dStep
- Call QReadData(App.Path + VLINEDATA4)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 3
- .Legend.Location.Visible = False
-
- ' Set the elevation and rotation
- Call QSet3DView(68, 14)
-
- ' Label the Points
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 12
- .VtFont.VtColor.Set 0, 0, 255
- End With
- Next series
-
- ' Set Y axis scale
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 125
- .Minimum = 100
- .MajorDivision = 5
- .MinorDivision = 1
- End With
-
- ' Turn off Z axis
- Call QSetAxisLabel(VtChAxisIdZ, False, 14, 0, 0, 202)
-
- Case 4 ' 3D Wide Step
- .ChartType = VtChChartType3dStep
- Call QReadData(App.Path + VAREADATA1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 10
- .Legend.Location.Visible = False
-
- End Select
- End With
- End Sub
-
- Sub SurfaceChart()
-
- Dim series As Object, i%
- Dim ContourGradient As Object
-
-
- Call DefaultChart
-
- With frmMain.vtchart1
- ' Turn off axis
- Call QSetAxisLabel(VtChAxisIdX, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdZ, False, 16, 0, 0, 255)
-
- ' Turn off Y, Y2 grids
- .Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdZ).AxisGrid.MajorPen.Style = VtPenStyleNull
-
- Select Case SChartIndex
- Case 0 ' 2D Countour lines
- .ChartType = VtChChartType2dContour
- Call QReadData(App.Path + CONTOUR1)
-
- ' Smooth the data
- .Plot.elevation.ColSmoothing = 2
- .Plot.elevation.RowSmoothing = 2
-
- ' Turn on Lines
- .Plot.elevation.Contour.DisplayType = VtChContourDisplayTypeCLines
-
-
- Case 1 ' 2D Countour bands
- .ChartType = VtChChartType2dContour
- Call QReadData(App.Path + CONTOUR1)
-
- ' Smooth the data
- .Plot.elevation.ColSmoothing = 2
- .Plot.elevation.RowSmoothing = 2
-
-
- Case 2, 3 ' 3D Surface
- .ChartType = VtChChartType3dSurface
- Call QReadData(App.Path + SURFACE1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(306, 20)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 255
-
- 'Set Footnote
- .Footnote.Text = "Geological Surveyors, Inc."
- .Footnote.VtFont.Size = 8
-
- ' Set the chart background to gradient
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Fill.Style = VtFillStyleGradient
- With .Fill.Gradient
- .Style = VtGradientStyleHorizontal
- .FromColor.Set 108, 108, 255
- .ToColor.Set 255, 255, 255
- End With
- End With
-
- ' Plot Backdrop is Null
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
- .Plot.Backdrop.Fill.Style = VtFillStyleNull
-
- ' Set Pedestal color to gray
- .Plot.PlotBase.Brush.FillColor.Set 176, 176, 176
-
- ' Set walls and floor color depending on chart
- If SChartIndex = 2 Then
- ' Turn off walls
- .Plot.Wall.Pen.Style = VtPenStyleNull
-
- ' Make floor invisible and change grid colors
- With .Plot.PlotBase
- .BaseHeight = 0
- .Brush.Style = VtBrushStyleNull
- .Pen.Width = 0
- .Pen.Style = VtPenStyleNull
- End With
- End If
-
- 'Set Y axis scale
- '' If maximum > minimum, the maximum MUST be set first
- '' This is important because even though we aren't going to show
- '' the axis, the number of divisions determines the number of
- '' contour bands.
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 50
- .Minimum = -50
- .MajorDivision = 10
- .MinorDivision = 1
- End With
-
- ' Set surface to solid
- .Plot.elevation.Surface.DisplayType = VtChSurfaceDisplayTypeSolid
- .Plot.elevation.Surface.RowWireframe = VtChSurfaceWireframeTypeNone
- .Plot.elevation.Surface.ColWireframe = VtChSurfaceWireframeTypeNone
-
- ' Set Surface color
- .Plot.elevation.Surface.Brush.Style = VtBrushStyleSolid
- .Plot.elevation.Surface.Brush.FillColor.Set 10, 128, 10
-
- ' Set base to bands or pedestal
- If SChartIndex = 2 Then
- .Plot.elevation.Surface.Base = VtChSurfaceBaseTypeStandardWithCBands
- Else
- .Plot.elevation.Surface.Base = VtChSurfaceBaseTypePedestal
- End If
-
- ' Set upper projection to lines
- .Plot.elevation.Surface.Projection = VtChSurfaceProjectionTypeCLines
-
- '' Turn on the auto values
- .Plot.elevation.AutoValues = True
-
- '' Set the surface chart color type to gradient
- .Plot.elevation.ColorType = VtChContourColorTypeGradient
-
- '' Change the from color and to color
- Set ContourGradient = .Plot.elevation.ContourGradient
- ContourGradient.FromBrushColor.Set 255, 0, 0
- ContourGradient.ToBrushColor.Set 255, 255, 0
-
- Case 4 ' 3D Surface with contours
- .ChartType = VtChChartType3dSurface
- Call QReadData(App.Path + SURFACE1)
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(306, 20)
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 255
-
- 'Set Footnote
- .Footnote.Text = "Geological Surveyors, Inc."
- .Footnote.VtFont.Size = 8
-
- ' Set the chart background to gradient
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Fill.Style = VtFillStyleGradient
- With .Fill.Gradient
- .Style = VtGradientStyleHorizontal
- .FromColor.Set 108, 108, 255
- .ToColor.Set 255, 255, 255
- End With
- End With
-
- ' Plot Backdrop is Null
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
- .Plot.Backdrop.Fill.Style = VtFillStyleNull
-
- 'Set Y axis scale
- '' If maximum > minimum, the maximum MUST be set first
- '' This is important because even though we aren't going to show
- '' the axis, the number of divisions determines the number of
- '' contour bands.
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 30
- .Minimum = -30
- .MajorDivision = 6
- .MinorDivision = 1
- End With
-
- ' Set Pedestal color to gray
- .Plot.PlotBase.Brush.FillColor.Set 176, 176, 176
-
- ' Set surface to bands
- .Plot.elevation.Surface.DisplayType = VtChSurfaceDisplayTypeCBands
- .Plot.elevation.Surface.RowWireframe = VtChSurfaceWireframeTypeNone
- .Plot.elevation.Surface.ColWireframe = VtChSurfaceWireframeTypeNone
-
- ' Put in Pedestal for base
- .Plot.elevation.Surface.Base = VtChSurfaceBaseTypePedestal
-
- '' Turn on the auto values
- .Plot.elevation.AutoValues = True
-
- Case 5 ' 3D Surface Wireframe
- .ChartType = VtChChartType3dSurface
- Call QReadData(App.Path + SURFACE1)
-
- ' Smooth the data
- .Plot.elevation.ColSmoothing = 2
- .Plot.elevation.RowSmoothing = 2
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(306, 20)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- 'Set the title font
- .Title.VtFont.Size = 16
- .Title.VtFont.VtColor.Set 255, 255, 255
-
- 'Set Footnote
- .Footnote.Text = "Geological Surveyors, Inc."
- .Footnote.VtFont.Size = 8
-
- ' Set the chart background to gradient
- With .Backdrop
- .Frame.Style = VtFrameStyleSingleLine
- .Fill.Style = VtFillStyleGradient
- With .Fill.Gradient
- .Style = VtGradientStyleHorizontal
- .FromColor.Set 108, 108, 255
- .ToColor.Set 255, 255, 255
- End With
- End With
-
- ' Plot Backdrop is Null
- .Plot.Backdrop.Frame.Style = VtFrameStyleNull
- .Plot.Backdrop.Shadow.Style = VtShadowStyleNull
- .Plot.Backdrop.Fill.Style = VtFillStyleNull
-
- 'Set Y axis scale
- '' If maximum > minimum, the maximum MUST be set first
- '' This is important because even though we aren't going to show
- '' the axis, the number of divisions determines the number of
- '' contour bands.
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 30
- .Minimum = -30
- .MajorDivision = 6
- .MinorDivision = 1
- End With
-
- ' Turn on walls
- .Plot.Wall.Width = 0
- .Plot.Wall.Brush.Style = VtBrushStyleSolid
-
- ' Set surface to Wireframe
- .Plot.elevation.Surface.DisplayType = VtChSurfaceDisplayTypeNone
- .Plot.elevation.Surface.RowWireframe = VtChSurfaceWireframeTypeMajor
- .Plot.elevation.Surface.ColWireframe = VtChSurfaceWireframeTypeMajor
- .Plot.elevation.Surface.WireframePen.VtColor.Set 255, 0, 0
-
- ' Put in Standard base
- .Plot.elevation.Surface.Base = VtChSurfaceBaseTypeStandard
-
- '' Turn on the auto values
- .Plot.elevation.AutoValues = True
-
- End Select
- End With
-
- End Sub
-
- Sub VBarChart()
-
- Dim series As Object, dataPoint As Object, i%
-
- ' Reset all chart options
- Call DefaultChart
-
- With frmMain.vtchart1
- Select Case VBarIndex
-
- Case 0 'Default Chart
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- Case 1 ' Labeled Bars
- .ChartType = VtChChartType2dBar
- Call QReadData(App.Path + VBARDATA7)
-
- '' Format the data point labels
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).DataPointLabel
- ' Label the Point
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = VtChLabelComponentValue
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
-
- ' Make the labels larger and change color
- .VtFont.Size = 14
- .VtFont.VtColor.Set 255, 0, 0
- End With
- Next series
-
- ' Change the color of the 1st series
- Call QSetSeriesColor(1, 0, 0, 255)
-
- Case 2 ' +/- Data
- .ChartType = VtChChartType2dBar
- Call QReadData(App.Path + VBARDATA2)
-
- Case 3 ' Tiled Picture Bars
- Call QReadData(App.Path + VBARDATA23)
- .ChartType = VtChChartType2dBar
-
- For i = 1 To .Plot.SeriesCollection.Count
- With .Plot.SeriesCollection.Item(i).DataPoints.Item(-1).VtPicture
- .Type = VtPictureTypeWMF
- .Map = VtPictureMapTypeTiled
- .Embedded = 0
- If i = 1 Then
- .filename = App.Path + VTWMF1
- ElseIf i = 2 Then
- .filename = App.Path + VTWMF2
- Else
- .filename = App.Path + VTWMF3
- End If
- End With
- Next i
-
- Case 4 ' Stretched Pictures
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType2dBar
-
- ' Put a picture in each bar
- For Each series In .Plot.SeriesCollection
- With series.DataPoints.Item(-1).VtPicture
- .Type = VtPictureTypeWMF
- .Map = VtPictureMapTypeStretched
- .Embedded = 0
- .filename = App.Path & VTWMF4
- End With
- Next series
-
- Case 5 ' Stacked
- Call QReadData(App.Path + VBARDATA4)
- .ChartType = VtChChartType2dBar
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- Case 6 ' Stacked Percent
- Call QReadData(App.Path + VBARDATA5)
- .ChartType = VtChChartType2dBar
-
- ' Stack all series on top of series 1
- With .Plot.SeriesCollection
- For i = 2 To .Count
- With .Item(i).Position
- .Excluded = False
- .Hidden = False
- .Order = 1
- .StackOrder = i
- End With
- Next i
- End With
-
- ' Set axis to percent scaling
- .Plot.Axis(VtChAxisIdY).AxisScale.PercentBasis = VtChPercentAxisBasisSumRow
- .Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypePercent
-
- Case 7 ' 3D Default
- Call QReadData(App.Path + VBARDATA1)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(76, 26)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- ' Change Bar Colors
- Call QSetPointColor(1, 2, 128, 0, 128) ' purple
- Call QSetPointColor(1, 3, 0, 160, 240) ' Blue
- Call QSetPointColor(1, 4, 255, 35, 170) ' Pink
- Call QSetPointColor(1, 5, 255, 255, 0) ' Yellow
-
- ' Make X axis 14 point Blue
- Call QSetAxisLabel(VtChAxisIdX, True, 14, 0, 0, 255)
-
- ' Make Y and Y2 axis 12 point Blue
- Call QSetAxisLabel(VtChAxisIdY, True, 12, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, True, 12, 0, 0, 255)
-
- ' Turn Z axis off
- Call QSetAxisLabel(VtChAxisIdZ, False, 12, 0, 0, 255)
-
- Case 8 ' 3D Labeled
- Call QReadData(App.Path + VBARDATA9)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- ' Set the elevation and rotation
- Call QSet3DView(80, 21)
-
- ' Turn the legend off
- .Legend.Location.Visible = False
-
- '' Do all at once
- With .Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel
- .LocationType = VtChLabelLocationTypeAbovePoint
- .Component = 1
- .LineStyle = VtChLabelLineStyleNone
- .Custom = False
- .VtFont.Size = 14
- .VtFont.VtColor.Set 255, 35, 170
- End With
-
- ' Set the bars to cones
- For Each series In .Plot.SeriesCollection
- series.Bar.Sides = 16
- series.Bar.TopRatio = 0
- Next series
-
- ' Make X axis 16 point Blue
- Call QSetAxisLabel(VtChAxisIdX, True, 16, 0, 0, 255)
-
- ' Make Y and Y2 axis 12 point Blue
- Call QSetAxisLabel(VtChAxisIdY, True, 12, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, True, 12, 0, 0, 255)
-
- ' Turn Z axis off
- Call QSetAxisLabel(VtChAxisIdZ, False, 12, 0, 0, 255)
-
- ' Stand the X axis labels up
- .Plot.Axis(VtChAxisIdX).Labels.Item(1).Standing = True
-
- Case 9 ' 3D Bar Styles
- Call QReadData(App.Path + VBARDATA10)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- 'Turn legend off
- .Legend.Location.Visible = False
-
- 'Set bar shapes to cylinder, pyramid, pentagon
- With .Plot.SeriesCollection
- For i = 1 To .Count
- .Item(i).Bar.TopRatio = 1
- Select Case i
- Case 1
- .Item(i).Bar.Sides = 3
- Case 2
- .Item(i).Bar.Sides = 4
- Case 3
- .Item(i).Bar.Sides = 5
- Case 4
- .Item(i).Bar.Sides = 8
- Case Else
- .Item(i).Bar.Sides = 32
- End Select
- Next i
- End With
-
- ' Set the elevation and rotation
- Call QSet3DView(37, 14)
-
- ' Turn off Axis
- Call QSetAxisLabel(VtChAxisIdX, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdZ, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, False, 16, 0, 0, 255)
-
- ' Turn off Y, Y2 grids
- .Plot.Axis(VtChAxisIdY).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MajorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- ' Set X and Z grids to a color
- With .Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen
- .Width = 3
- .VtColor.Set 0, 128, 192
- End With
-
- With .Plot.Axis(VtChAxisIdZ).AxisGrid.MajorPen
- .Width = 3
- .VtColor.Set 0, 128, 192
- End With
-
- ' Turn off walls
- .Plot.Wall.Pen.Style = VtPenStyleNull
-
- ' Make floor invisible and change grid colors
- With .Plot.PlotBase
- .BaseHeight = 0
- .Brush.Style = VtBrushStyleNull
- .Pen.Width = 0
- .Pen.VtColor.Set 0, 128, 192
- End With
-
- Case 10 ' 3D With Walls
- Call QReadData(App.Path + VBARDATA8)
- .ChartType = VtChChartType3dBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- 'Turn the legend off
- .Legend.Location.Visible = False
-
- ' Turn on walls
- .Plot.Wall.Width = 20
- .Plot.Wall.Brush.Style = VtBrushStyleSolid
-
- ' Set bars to columns
- For Each series In .Plot.SeriesCollection
- series.Bar.TopRatio = 1
- series.Bar.Sides = 16
- Next series
-
- ' Set the elevation and rotation
- Call QSet3DView(7, 42)
-
- ' Turn off X and Z axis, Turn on Y and Y2
- Call QSetAxisLabel(VtChAxisIdX, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdZ, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY, True, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, True, 16, 0, 0, 255)
-
- Case 11 ' 3D Clustered
- Call QReadData(App.Path + VBARDATA6)
- .ChartType = VtChChartType3dClusteredBar
-
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 3
- .Plot.DepthToHeightRatio = 2
-
- 'Turn the legend off
- .Legend.Location.Visible = False
-
- ' Set bars to columns
- For Each series In .Plot.SeriesCollection
- series.Bar.TopRatio = 1
- series.Bar.Sides = 16
- Next series
-
- ' Set the elevation and rotation
- Call QSet3DView(79, 36)
-
- ' Make the axis fonts larger and change color
- Call QSetAxisLabel(VtChAxisIdX, True, 18, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY, True, 12, 0, 0, 202)
- Call QSetAxisLabel(VtChAxisIdY2, True, 12, 0, 0, 202)
-
- Case 12 ' +/- 3D Bars
- Call QReadData(App.Path + VBARDATA18)
- .ChartType = VtChChartType3dBar
- ' Set the width for a more pleasing view
- .Plot.WidthToHeightRatio = 2
- .Plot.DepthToHeightRatio = 2
-
- 'Turn the legend off
- .Legend.Location.Visible = False
-
- ' Set bars to columns
- For Each series In .Plot.SeriesCollection
- series.Bar.TopRatio = 1
- series.Bar.Sides = 32
- Next series
-
- ' Set the elevation and rotation
- Call QSet3DView(37, 14)
-
- ' Turn off Axis
- Call QSetAxisLabel(VtChAxisIdX, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdZ, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY, False, 16, 0, 0, 255)
- Call QSetAxisLabel(VtChAxisIdY2, False, 16, 0, 0, 255)
-
- ' Turn off Y, Y2 grids
- .Plot.Axis(VtChAxisIdY).AxisGrid.MinorPen.Style = VtPenStyleNull
- .Plot.Axis(VtChAxisIdY2).AxisGrid.MinorPen.Style = VtPenStyleNull
-
- ' Set X and Z grids to a color
- With .Plot.Axis(VtChAxisIdX).AxisGrid.MajorPen
- .Width = 3
- .VtColor.Set 0, 128, 192
- End With
-
- With .Plot.Axis(VtChAxisIdZ).AxisGrid.MajorPen
- .Width = 3
- .VtColor.Set 0, 128, 192
- End With
-
- ' Turn off walls
- .Plot.Wall.Pen.Style = VtPenStyleNull
-
- ' Make floor invisible and change grid colors
- With .Plot.PlotBase
- .BaseHeight = 0
- .Brush.Style = VtBrushStyleNull
- .Pen.Width = 0
- .Pen.VtColor.Set 0, 128, 192
- End With
-
- End Select
- End With
-
- End Sub
-
- Sub XYChart()
-
- Dim series As Object, dataPoint As Object
-
- Call DefaultChart
-
- With frmMain.vtchart1
-
- Select Case XYIndex
-
- Case 0 ' Default XY
- Call QReadData(App.Path + XYDATA1)
- .ChartType = VtChChartType2dXY
- With .Plot.Axis(VtChAxisIdY).ValueScale
- .Auto = False
- .Maximum = 0.5
- .Minimum = -0.2
- End With
-
- '' Allow scale on x and y to be different
- .Plot.UniformAxis = False
-
- Case 1 ' Markers
- Call QReadData(App.Path + XYDATA2)
- .ChartType = VtChChartType2dXY
-
- ' Turn on markers
- For Each series In .Plot.SeriesCollection
- series.SeriesMarker.show = True
- series.ShowLine = False
- Next series
-
- '' Allow scale on x and y to be different
- .Plot.UniformAxis = False
-
- Case 2 ' Picture Markers
- Call QReadData(App.Path + XYDATA3)
- .ChartType = VtChChartType2dXY
-
- ' Put a picture in the backdrop
- For Each series In .Plot.SeriesCollection
- series.SeriesMarker.Auto = False
- series.SeriesMarker.show = True
- series.DataPoints.Item(-1).Marker.Style = VtMarkerStyle3dBall
- Next
-
- End Select
- End With
- End Sub
-