/** * @file XTPChartStackedBarSeriesStyle.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPCHARTSTACKEDBARSERIESSTYLE_H__) # define __XTPCHARTSTACKEDBARSERIESSTYLE_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartSeriesView; /** * @brief * This class represents a bar series style for the chart, which is a kind of * CXTPChartSeriesStyle. * * @details * A bar chart or bar graph is a chart with rectangular bars with lengths * proportional to the values that they represent. Bar charts are used for * comparing two or more values that were taken over time or on different * conditions, usually on small data sets. */ class _XTP_EXT_CLASS CXTPChartStackedBarSeriesStyle : public CXTPChartBarSeriesStyle { /** @cond */ DECLARE_SERIAL(CXTPChartStackedBarSeriesStyle) /** @endcond */ public: /** * @brief * Constructs a CXTPChartStackedBarSeriesStyle object. */ CXTPChartStackedBarSeriesStyle(); /** * @brief * Destroys a CXTPChartStackedBarSeriesStyle object, handles cleanup. */ virtual ~CXTPChartStackedBarSeriesStyle(); public: void SetStackHeight(double dLevel = 100); double GetStackHeight() const; void SetStackGroup(int nStackGroup); int GetStackGroup() const; public: public: void DoPropExchange(CXTPPropExchange* pPX); protected: /** * @brief * Call this function to create the view of the bar series. * * @param pSeries A pointer to the chart series object to which this object * is associated with. * @param pDiagramView A pointer to the chart diagram view object to which this object * is associated with. * * @return * A pointer to CXTPChartSeriesView. Refers to the newly created * CXTPChartStackedBarSeriesView object. */ virtual CXTPChartSeriesView* CreateView(CXTPChartSeries* pSeries, CXTPChartDiagramView* pDiagramView); /** * @brief * Call this function to correct the axis side margins. * * @param pAxis A pointer to the chart axis object, to which this object * is associated with. * @param nMinValue A double specifying the minimum value. * @param nMaxValue A double specifying the maximum value. * @param nCorrection A reference to a double object, which specifies the correction * applied. */ virtual void CorrectAxisSideMargins(CXTPChartAxis* pAxis, double nMinValue, double nMaxValue, double& nCorrection); protected: double m_dStackHeight; int m_nStackGroup; # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartStackedBarSeriesStyle); DECLARE_OLECREATE_EX(CXTPChartStackedBarSeriesStyle) double OleGetStackHeight(); void OleSetStackHeight(double dStackHeight); /** @endcond */ # endif }; /** * @brief * This class represents the view of a bar series, which is a kind of * CXTPChartSeriesView. */ class _XTP_EXT_CLASS CXTPChartStackedBarSeriesView : public CXTPChartBarSeriesView { public: /** * @brief * Constructs a CXTPChartStackedBarSeriesView object. * * @param pSeries A pointer to the chart series object. * @param pDiagramView A pointer to the diagram view object. */ CXTPChartStackedBarSeriesView(CXTPChartSeries* pSeries, CXTPChartDiagramView* pDiagramView); virtual ~CXTPChartStackedBarSeriesView(); protected: /** * @brief * Call this function to create a view of the bar series point. * * @param pDC A pointer to the chart device context. * @param pPoint A pointer to the chart series point object. * @param pParentView Parent view pointer. * * @return * A pointer to CXTPChartSeriesPointView, which refers to the newly created * CXTPChartStackedBarSeriesPointView object. */ CXTPChartSeriesPointView* CreateSeriesPointView(CXTPChartDeviceContext* pDC, CXTPChartSeriesPoint* pPoint, CXTPChartElementView* pParentView); /** * @brief * Call this function to calculate the layout of the bar series. * * @param pDC A pointer to the chart device context. */ void UpdateRange(CXTPChartDeviceContext* pDC); protected: friend class CXTPChartStackedBarSeriesPointView; }; /** * @brief * This class represents the view of a bar series point, which is a kind of * CXTPChartPointSeriesPointView. */ class _XTP_EXT_CLASS CXTPChartStackedBarSeriesPointView : public CXTPChartBarSeriesPointView { public: /** * @brief * Constructs a CXTPChartStackedBarSeriesPointView object. * * @param pPoint A pointer to the chart series point object. * @param pParentView Parent view pointer. */ CXTPChartStackedBarSeriesPointView(CXTPChartSeriesPoint* pPoint, CXTPChartElementView* pParentView); public: CXTPChartRectF GetScreenRect() const; public: /** * @brief * This function creates a CXTPChartDeviceCommand object. This object * represents the rendering of a bar series point. * * @param pDC Pointer to a CXTPChartDeviceContext object. * * @return * Returns a CXTPChartDeviceCommand object. This object handles the * rendering of the bar series point. */ virtual CXTPChartDeviceCommand* CreateDeviceCommand(CXTPChartDeviceContext* pDC); public: protected: double m_dValueFrom; double m_dValueTo; friend class CXTPChartStackedBarSeriesView; }; AFX_INLINE void CXTPChartStackedBarSeriesStyle::SetStackHeight(double dStackHeight) { m_dStackHeight = dStackHeight; OnChartChanged(); } AFX_INLINE double CXTPChartStackedBarSeriesStyle::GetStackHeight() const { return m_dStackHeight; } AFX_INLINE void CXTPChartStackedBarSeriesStyle::SetStackGroup(int nStackGroup) { m_nStackGroup = nStackGroup; OnChartChanged(); } AFX_INLINE int CXTPChartStackedBarSeriesStyle::GetStackGroup() const { return m_nStackGroup; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTSTACKEDBARSERIESSTYLE_H__) /** @endcond */