BCGControlBar Pro for MFC
CBCGPChartVisualObject

Detailed Description

The CBCGPChartVisualObject class implements the functionality of Chart. It's derived from CBCGPBaseVisualObject and inherits all abilities of visual objects, like the ability to reside in container (so you can combine gauges and charts) and others.

The CBCGPChartVisualObject class it the key class for charting. It manages series, axes, legend and other chart elements.

The following is the list of chart elements you can manipulate and customize:

  • Chart Area. All other elements are located within Chart Area. It can be formatted using BCGPChartFormatArea options (use GetChartAreaFormat().
  • Title. The chart title is usually located at the top of Chart Area. It can be formatted using BCGPChartFormatLabel options (use GetTitleLabelFormat()). A title can overlap the Plot Area.
  • Legend. A Legend displays a list of series names or data points along with their keys. A Legend may be aligned at the left, top, right, bottom and top-right positions of the Chart Area. It may also overlap the Plot Area. Use GetLegendFormat() to obtain a reference to legend formatting options.
  • Plot Area. The Plot Area contains Chart Axes and Diagram Area. Use GetPlotAreaFormat() to obtain a reference to plot formatting options.
  • Chart Axes. A base axis is represented by CBCGPChartAxis class. An axis has the following formatable elements:
    • Axis line
    • Major tick marks
    • Minor tick marks
    • Labels
    • Major grid lines
    • Minor grid lines
    • Major interval interlacing
  • Diagram Area. The Diagram Area displays Series.
  • Series. A Series (the base series is represented by CBCGPChartSeries class) is built up from a list of Data Points. Appearance of each Data Point can be set up individually, or can inherit its parent Series settings.
  • Data Point. A data point is a simplest entity that can be shown on Diagram. Its appearance depends on Diagram type (later - Chart Type). For example, for the Funnel chart a data point is displayed as a funnel segment, but for the Bar chart - as a rectangle. Data Points are represented by CBCGPChartDataPoint class. A Data Point can be marked on the Diagram by Data Marker and annotated by Data Label.

A position of a Data Point on Diagram depends on its Chart Data. The Chart Data is represented by CBCGPChartData class, which contains an array of simplest chart entities - Chart Values (CBCGPChartValue).

Each Chart Value is located within Chart Data at Component Index. Components are actually X,Y and Z values that can make up a Data Point for a specific Chart Type. Some Chart Types (like range or bubble) require more than one Y component, and they are encoded as Y1, Y2 etc.

A Data Marker is always placed at a screen position of Chart Data (this position can be customized in a derived class) and can be connected with Data Label by (callout) line.

Each Series has a built in "implementation" - a series specific class that is responsible for drawing of actual diagram shapes and does some other series specific work, like calculating data label positions on the screen. The "implementation" is represented by CBCGPBaseChartImpl class.

Take the following steps to create a Chart in an application (view-based chart).

For advanced techniques please take a look at BCGPChartExample.

The Chart and Gauges work with CBCGPGraphicsManager layer, which implements transparent D2D and GDI back ends.

The list of classes used for charting:

and Windows Control helpers:

Formatting structures:

Color theme:

Chart Layout:

+ Inheritance diagram for CBCGPChartVisualObject:

Public Member Functions

 CBCGPChartVisualObjectConstructs a CBCGPChartVisualObject object.
 
 AddAxisAdds a custom axis to the internal list of axes.
 
 AddChartAxisMarkObjectAdds an axis mark Chart Object to the Chart.
 
 AddChartDataAdds data to a series.
 
 AddChartDataAdds data to a series.
 
 AddChartDataAdds data to a series.
 
 AddChartDataAdds data to a series.
 
 AddChartDataYXAdds a new data point with specified Y and X values.
 
 AddChartDataYXY1Adds a new data point with specified Y, Y1 and X values.
 
 AddChartDataYXY1Adds a new data point with specified Y, Y1 and X values.
 
 AddChartDataYXZAdds new data point with Y, X and Z values - should be used for 3D charts.
 
 AddChartDataYY1Adds a new data point with specified Y and Y1 values.
 
 AddChartDataYY1Y2Adds a new data point with specified Y, Y1 and Y2 components.
 
 AddChartEffectAdds a "Chart Effect" to a diagram.
 
 AddChartEmptyDataAdds empty data point.
 
 AddChartEmptyDataAdds empty data point.
 
 AddChartEmptyDataAdds empty data point.
 
 AddChartLineObjectAdds a new Line Chart Object to a diagram.
 
 AddChartLineObjectAdds a new Line Chart Object to a diagram.
 
 AddChartObjectAdds a new Chart Object.
 
 AddChartObjectAdds a new Chart Object.
 
 AddChartObjectAdds a new Chart Object.
 
 AddChartRangeObjectAdds a new Range Chart Object.
 
 AddChartTextObjectAdds a new Text Chart Object.
 
 AddDataPointsAdds several data points at once.
 
 AddDataPointsOptimizedAdds array of data points.
 
 AddRelatedLegendAssociate the chart with external legend object.
 
 AddSeriesAdds a new series to the internal list of series.
 
 AdjustLayoutAdjusts chart layout.
 
 BeginPanCalled when the user begins to drag the diagram area to scroll it (in Pan mode).
 
 BindDataSQLBind datasource to the chart.
 
 BindDataTableBind datatable to the chart.
 
 CalcDataTableSizeCalled to calculate data table size.
 
 CalcLegendSizeCalled to calculate legend size.
 
 CalcTitleSizeCalled to calculate a title size.
 
 ChartDataFromScreenPointGiven a screen point returns a chart data.
 
 CleanUpRemoves chart data, related legends and chart objects.
 
 CleanUpChartDataRemoves a specified series or all series.
 
 CreateSeriesCreates a series and adds it to the internal array of series.
 
 EnableAntialiasingEnables or disables anti aliasing.
 
 EnableDrawLegendShapeDisplays or hides legend border.
 
 EnableMagnifierEnables magnifier mode.
 
 EnableMouseTrackingModeEnables or disables mouse tracking mode.
 
 EnablePanEnables pan.
 
 EnableResizeAxesEnables to resize axes.
 
 EnableScrollEnables or disables scrolling
 
 EnableSelectionEnables selection.
 
 EnableSmartLabelsEnables or disables "smart labels" feature.
 
 EnableZoomEnables or disables zoom.
 
 FindChartObjectSearches for the chart object by ID.
 
 FindChartObjectSearches for the chart object by name.
 
 FindSeriesIndexGiven a pointer to a series returns series index.
 
 FireMouseMessageSends a mouse message to the chart's owner.
 
 FormatSeriesFormats a series with the specified index.
 
 GetAllNonFormulaSeriesReturns an array of non-formula and non-virtual series.
 
 GetAxisCountReturns a number of axes.
 
 GetChartAreaFormatGets chart area format.
 
 GetChartAxisReturns a pointer to an axis.
 
 GetChartCategoryReturns the current chart category.
 
 GetChartFillColorGets chart fill color.
 
 GetChartTitleReturns chart title.
 
 GetChartTypeReturns chart type.
 
 GetColorsReturns a reference to the current visual theme,
 
 GetDataLabelOptionsGets data label options.
 
 GetDataPointFormatReturns a pointer to a data point format.
 
 GetDataPointUserDataReturns user-defined data associated with a data point.
 
 GetDataPointValueReturns a data point value located at the specified component index.
 
 GetDataTableAreaReturns bounding rectangle of data table area.
 
 GetDataTableFormatGets data table format.
 
 GetDiagram3DGets the chart 3D diagram.
 
 GetDiagramAreaReturns bounding rectangle of diagram area.
 
 GetDiagramFillColorGets diagram fill color.
 
 GetHitTooltipFlagsReturns a combination of hit info flags (BCGPChartHitInfo::HitInfoTest) telling which chart elements should have tooltips.
 
 GetLegendAreaReturns bounding rectangle of legend area.
 
 GetLegendFormatGets legend format.
 
 GetMouseConfigReturns a reference to mouse configuration.
 
 GetNextCustomAxisIDReturns next available custom axis ID.
 
 GetPlotAreaFormatGets plot area format.
 
 GetPlotAreaPaddingCalled from AdjustLayout to determine plot area padding.
 
 GetRelatedLegendsGets external legends list.
 
 GetSeriesReturns a pointer to a series located at the specified index.
 
 GetSeriesCountReturns the number of series.
 
 GetSmartLabelsParamsReturns current "smart label" parameters.
 
 GetTitleLabelFormatGets title label format.
 
 GetVisibleSeriesCountReturns the number of visible series.
 
 HitTestHit tests the specified point.
 
 InvalidateTrendFormulaSeriesInvalidates trend formula series.
 
 IsChart3DTells whether the current chart category uses 3D engine.
 
 IsLegendHorizontalTells whether the legend is horizontal or vertical.
 
 IsMagnifierEnabledTells whether "magnifier" is enabled to zoom a diagram.
 
 IsPanEnabledTells whether "pan" is enabled to scroll a diagram.
 
 IsPanModeTells whether the chart is being scrolled using "pan",
 
 IsResizeAxesEnabledTells whether split axes can be resized.
 
 IsScrollEnabledTells whether scrolling is enabled.
 
 IsSelectionEnabledTells whether selection is enabled.
 
 IsShowSurfaceMapInLegendTells whether surface level values are included in the legend.
 
 IsSmartLabelsEnabledTells whether "smart labels" feature is enabled.
 
 IsThumbnailModeTells whether chart thumbnail mode is enabled.
 
 IsThumbTrackModeTells whether a chart is being scrolled using thumb track.
 
 IsZoomEnabledTells whether zoom is enabled.
 
 OnCalcAxisLabelSizeCalled to calculate axis label size.
 
 OnCalcAxisNameSizeCalled to calculate axis name size.
 
 OnCalcLegendKeySizeCalled to calculate legend key size.
 
 OnCalcLegendKeySizeExCalled by the framework to calculate a chart legend key size.
 
 OnCalcLegendLabelSizeCalled to calculate legend label size.
 
 OnCreateChartSeriesCalled to create a chart series.
 
 OnDrawCalled to draw the chart.
 
 OnDrawAxesCalled by the framework to draw chart axes.
 
 OnDrawAxesGridLinesCalled to draw axis grid lines.
 
 OnDrawAxisLabelCalled by the framework to draw an axis label.
 
 OnDrawAxisNameCalled to draw an axis name.
 
 OnDrawChartObjectsCalled by the framework to draw chart objects.
 
 OnDrawDiagramCalled to draw a diagram area.
 
 OnDrawDiagramDataLabelsCalled by the framework to draw chart diagram data labels.
 
 OnDrawDiagramErrorBarsCalled by the framework to draw chart error bars.
 
 OnDrawDiagramMarkersCalled by the framework to draw chart diagram markers.
 
 OnDrawSelectionCalled by the framework to draw a chart selection.
 
 OnDrawTickMarkCalled by the framework to draw a chart tick mark.
 
 OnFormatDataPointLabelTextCalled by the framework to obtain a data point text label.
 
 OnFormatDataPointTableTextCalled by the framework to obtain a data point table label.
 
 OnFormatDataPointTooltipCalled by framework to obtain a data point tooltip.
 
 OnFormatDataPointTooltipDescriptionCalled by framework to obtain a chart tooltip description.
 
 OnGetAxisNameAreaRectCalled to retrieve a bounding rectangle of axis name.
 
 OnGetWallThicknessReturns wall thickness for 3D charts.
 
 OnSetMouseCursorCalled to set the mouse cursor.
 
 RecalcMinMaxValuesRecalculates minimum and maximum values for all series.
 
 RemoveAllChartEffectsRemoves all chart effects.
 
 RemoveAllChartObjectsRemoves all Chart Objects.
 
 RemoveChartObjectRemoves a chart object from the diagram.
 
 RemoveCustomAxisRemoves a custom axis for the chart.
 
 RemoveRelatedLegendRemoves the related legend from the chart.
 
 ReplaceDefaultAxisReplaces a default axis with a custom axis.
 
 ResetAxesResets all axes to default state.
 
 ScreenPointFromChartDataGiven a chart data returns a screen point in chart's owner client coordinates.
 
 ScrollAxisScrolls an axis by specified number of units (in axis units).
 
 SetAutoDisplayRangeSets automatic display range.
 
 SetAxisNameSets axis name.
 
 SetChartDataSets a data point value at the specified component index.
 
 SetChartFillColorSets chart fill color.
 
 SetChartTitleSets the Chart title.
 
 SetChartTypeSets Chart category and type.
 
 SetColorsSets visual theme.
 
 SetColorsSets visual theme.
 
 SetCurveTypeSets curve type.
 
 SetDataLabelsOptionsSets common data label options.
 
 SetDataPointCategoryNameAssigns a category name to a data point.
 
 SetDataPointDataLabelTextSets custom data label text for specified data point.
 
 SetDataPointFormatApplies a custom style (format) to a data point.
 
 SetDataPointLegendLabelTextSets custom legend label text for the specified data point.
 
 SetDiagramFillColorSets diagram fill color.
 
 SetFixedDisplayRangeSets fixed display range.
 
 SetHitTooltipFlagsSpecify chart elements where tooltip need to be displayed.
 
 SetLegendPositionSets legend position or hides it.
 
 SetOptimizedDiagramAreaSpecifies whether diagram's layout should be optimized after one of axes moves inside/outside the diagram's area.
 
 SetPlotAreaPaddingSets plot area padding.
 
 SetSelectionTypeSets selection type.
 
 SetSeriesNameSets a series name.
 
 SetSeriesShadowEnables or disables the series shadow.
 
 SetSmartLabelsParamsCall this method to set "smart label" parameters.
 
 SetTernaryAxesLabelModeSets new label mode for all ternary axes.
 
 SetTernaryAxesTitleModeSets new title mode for all ternary axes.
 
 SetThemeOpacitySets opacity of current color theme.
 
 SetThumbnailModeEnables/disables chart thumbnail mode
 
 SetZoomScrollConfigSets zoom/scroll configuration.
 
 ShowAllDataLabelsShows or hides data labels on all data points.
 
 ShowAxisShows or hides an axis.
 
 ShowAxisGridLinesShows or hides major and minor grid lines for the specified axis.
 
 ShowAxisIntervalInterlacingEnables or disables major axis interval interlacing.
 
 ShowAxisNameShows or hides an axis name.
 
 ShowChartTitleShows or hides the chart title.
 
 ShowDataLabelsShows or hides data labels for all series.
 
 ShowDataMarkersShows or hides data markers for all series.
 
 ShowDataTableShows or hides the chart data table.
 
 ShowScrollBarShows or hides a scroll bar for the specified axis.
 
 ShowScrollBarsShows or hides scroll bars for all axes.
 
 ShowSeriesShows or hides a series.
 
 StartAnimationShow the chart series with animation effect.
 
 SwapAxesDirectionsRotates all axes on 90 degrees.
 
 UnZoomUnzooms a diagram.
 
 ZoomZooms the chart in or out.
 
- Public Member Functions inherited from CBCGPBaseVisualObject
 CBCGPBaseVisualObjectConstructor.
 
 CBCGPBaseVisualObjectCopy constructor.
 
 CopyToClipboardCopies visual object to the Clipboard.
 
 EnableImageCacheEnables or disables visual object image cache.
 
 ExportToBitmapExports the visual object to bitmap.
 
 ExportToFileExports the visual object to a file (BMP or PNG).
 
 ExportToImageExports the visual object to an image.
 
 GetDataGets an internal data object.
 
 GetDataAnimationTypeGets data animation type.
 
 GetDataCountReturns a number of data objects.
 
 GetEditFlagsGets editing flags.
 
 GetFillBrushRetrieves a visual object's background brush
 
 GetIDGets the object identifier.
 
 GetNameGets the object name.
 
 GetParentContainerGets the parent visual container.
 
 GetRectGets the object bounding rectangle.
 
 GetSelectedThemeObtain a currently selected visual theme.
 
 GetUserDataGets user-defined data associated with this object.
 
 GetValueGets the object value.
 
 GetVisualEffectRetrieves a visual effect
 
 IsAutoDestroyTells whether this object will be destroyed automatically.
 
 IsEditModeTells whether this object has the edit mode.
 
 IsEnabledTells whether the visual object is enabled.
 
 IsImageCacheTells whether image cache is enabled for this object.
 
 IsSelectedTells whether this object is selected in the parent container.
 
 IsVisibleTells whether the visual object is visible.
 
 RedrawRedraws this object.
 
 RedrawRectRedraws a specified rectangle.
 
 SetAutoDestroySpecifies whether the object should be destroyed automatically.
 
 SetDataAnimationTypeSets data animation type.
 
 SetDirtyInvalidates and redraws a visual object.
 
 SetEditFlagsSets editing flags.
 
 SetFillBrushSets a new fill brush.
 
 SetIDSets the object identifier.
 
 SetNameSets an object name.
 
 SetRectSets a new bounding rectangle.
 
 SetSelectedSelects or unselects the object in the parent container.
 
 SetUserDataSets user-defined data associated with this object.
 
 SetValueSets the object value.
 
 SetVisibleShows or hides the visual object.
 
 SetVisualEffectSets a visual effect.
 

Public Attributes

 m_chartLayoutCan be used to directly modify chart layout.
 

Protected Member Functions

 DoMouseRotateCalled by the framework when user rotates the chart.
 
 OnAddSeriesCalled when a new series is being added to the internal array of series.