/** * @file XTPChartSeries.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(__XTPCHARTSERIES_H__) # define __XTPCHARTSERIES_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPChartSeriesView; class CXTPChartSeriesPointCollection; class CXTPChartSeriesPointView; class CXTPChartSeriesPoint; class CXTPChartContent; class CXTPChartDiagramView; class CXTPChartDiagram; class CXTPChartSeriesStyle; class CXTPChartNumberFormat; class CXTPChartLegendItem; /** * @brief * This class represents a series in the chart, which is a kind of * CXTPChartElement. */ class _XTP_EXT_CLASS CXTPChartSeries : public CXTPChartElement { /** @cond */ DECLARE_DYNAMIC(CXTPChartSeries) /** @endcond */ public: /** * @brief * Constructs a CXTPChartSeries object. */ CXTPChartSeries(); /** * @brief * Destroys a CXTPChartSeries object, handles cleanup. */ virtual ~CXTPChartSeries(); public: CXTPChartColor GetColor() const; CXTPChartColor GetColor2() const; public: /** * @brief * Call this function to get the legend item of the series. * * @return * Pointer to the CXTPChartLegendItem object of this series. */ CXTPChartLegendItem* GetLegendItem() const; /** * @brief * Call this function to gets the the collection of the series points. * * @return * A pointer to a CXTPChartSeriesPointCollection object. */ CXTPChartSeriesPointCollection* GetPoints() const; /** * @brief * Call this function to sets the the collection of the series points. * * @param pPoints new series point collection object pointer. */ void SetPoints(CXTPChartSeriesPointCollection* pPoints); /** * @brief * Use this function to get the series style of the chart series. * * @return * A pointer to a CXTPChartSeriesStyle object. The type of the specific * object depends on the style of series chosen, eg: bar style, bubble * style etc. */ CXTPChartSeriesStyle* GetStyle() const; /** * @brief * Call this function to set the series style of the chart series. * * @param pView A pointer to a CXTPChartSeriesStyle object. The type of the specific * object depends on the style of series chosen, eg: bar style, bubble * style etc. * @return Set series style of the chart series */ CXTPChartSeriesStyle* SetStyle(CXTPChartSeriesStyle* pView); /** * @brief * Use this function to set the diagram object associated with this object. * * @param pDiagram A pointer to a CXTPChartDiagram object. The type of the specific * object depends on the diagram type chosen, eg:2D or 3D diagram. * @return TRUE if operation is completed successfully, FALSE otherwise. */ BOOL SetDiagram(CXTPChartDiagram* pDiagram); /** * @brief * Call this function to get the diagram object associated with this object. * * @return * A pointer to a CXTPChartDiagram object. The type of the specific * object depends on the diagram type using, eg:2D or 3D diagram. */ CXTPChartDiagram* GetDiagram() const; /** * @brief * Use this function to set the scale type used for the argument. * * @param scaleType An enumerated value specifying the scale type used. The common scale * types used are Qualitative, Numerical and DateTime. */ void SetArgumentScaleType(XTPChartScaleType scaleType); /** * @brief * Call this function to get the scale type used for the argument. * * @return * An enumerated value specifying the scale type used. The common scale * types used are Qualitative, Numerical and DateTime. */ XTPChartScaleType GetArgumentScaleType() const; /** * @brief * Use this function to set the scale type used for the value. * * @param scaleType An enumerated value specifying the scale type used. The common scale * types used are Qualitative, Numerical and DateTime. */ void SetValueScaleType(XTPChartScaleType scaleType); /** * @brief * Call this function to get the scale type used for the value. * * @return * An enumerated value specifying the scale type used. The common scale * types used are Qualitative, Numerical and DateTime. */ XTPChartScaleType GetValueScaleType() const; /** * @brief * Use this function to get the palette index. * * @return * An integer value specifying the palette index. */ int GetPaletteIndex() const; /** * @brief * Call this function to set the name of the chart series. * * @param lpszName A LPCSTR value specifying the name of the series. */ void SetName(LPCTSTR lpszName); /** * @brief * Use this function to get the name of the chart series. * * @return * A LPCSTR value specifying the name of the series. */ CXTPChartString GetName() const; /** * @brief * Call this function to set the name of the legend item. * * @param lpszLegendText A LPCSTR value specifying the name of the legend item * for this series. */ void SetLegendText(LPCTSTR lpszLegendText); /** * @brief * Use this function to get the name of the legend item. * @returns Returns the name of the legend item */ CXTPChartString GetLegendText() const; /** * @brief * Call this function to get a pointer to CXTPChartNumberFormat that specifies * how to convert numbers to strings for the legend. * * @return * Pointer to CXTPChartNumberFormat class * * @see * CXTPChartNumberFormat */ CXTPChartNumberFormat* GetPointLegendFormat() const; /** * @brief * Obsolete method. Use GetPointLegendFormat()->SetPattern(lpszFormat) instead. * * @param lpszFormat New Pattern to be set * * @see * CXTPChartNumberFormat */ void SetPointLegendFormat(LPCTSTR lpszFormat); /** * @brief * Use this function to set the series visible/invisible. * * @param bVisible A BOOL value. TRUE to make the series visible, FALSE to hide the series. */ void SetVisible(BOOL bVisible); /** * @brief * Call this function to check if the series is visible. * * @return * A BOOL value. TRUE if the series is visible, FALSE otherwise. */ BOOL IsVisible() const; /** * @brief * Use this function to set the legend item visible/invisible. * * @param bVisible A BOOL value. TRUE to make the legend item visible, * FALSE to hide the legend item. */ void SetLegendVisible(BOOL bVisible); /** * @brief * Call this function to check if the legend item is visible. * * @return * A BOOL value. TRUE if the legend item is visible, FALSE otherwise. */ BOOL IsLegendVisible() const; public: virtual void DoPropExchange(CXTPPropExchange* pPX); void Release(); # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartSeries); afx_msg LPDISPATCH OleGetStyle(); afx_msg LPDISPATCH OleGetPoints(); afx_msg LPDISPATCH OleGetDiagram(); afx_msg void OleSetStyle(LPDISPATCH lpStyle); afx_msg void OleSetDiagram(LPDISPATCH lpDiagram); afx_msg long OleGetArgumentScaleType(); afx_msg void OleSetArgumentScaleType(long ArgumentScaleType); afx_msg long OleGetValueScaleType(); afx_msg void OleSetValueScaleType(long ValueScaleType); afx_msg void OleChartChanged(); afx_msg LPDISPATCH OleGetPointLegendFormat(); afx_msg LPDISPATCH OleGetLegendItem(); afx_msg BOOL OleGetLegendVisible(); afx_msg void OleSetLegendVisible(BOOL bValue); afx_msg void OleEnableVirtualMode(double MinRange, double MaxRange, double Step); /** @endcond */ # endif protected: CXTPChartLegendItem* m_pLegendItem; /**< The legend item*/ CXTPChartSeriesStyle* m_pStyle; /**< The series style object.*/ CXTPChartSeriesPointCollection* m_pPoints; /**< The collection of points which form the series.*/ XTPChartScaleType m_nArgumentScaleType; /**< The scale type of the argument.*/ XTPChartScaleType m_nValueScaleType; /**< The scale type of the value.*/ CXTPChartDiagram* m_pDiagram; /**< The diagram object.*/ CXTPChartString m_strName; /**< The name of the series.*/ CXTPChartString m_strLegendText; /**< The legend text of the series.*/ CXTPChartNumberFormat* m_pPointLegendFormat; /**< The legend text format of the series.*/ BOOL m_bVisible; /**< TRUE if the series visible and FALSE if it is invisible.*/ BOOL m_bLegendVisible; /**< TRUE if the legend item is visible, FALSE if not visible.*/ int m_nPaletteIndex; /**< The palette index.*/ protected: friend class CXTPChartSeriesCollection; friend class CXTPChartContent; }; /** * @brief * This class represents the collection of series in the chart, which is a * kind of CXTPChartElement. */ class _XTP_EXT_CLASS CXTPChartSeriesCollection : public CXTPChartElementCollection { public: /** * @brief * Constructs a CXTPChartSeriesCollection object. * * @param pOwner A pointer to the chart container object which owns the series * collection. */ CXTPChartSeriesCollection(CXTPChartContent* pOwner); /** * @brief * Destroys a CXTPChartSeriesCollection object, handles cleanup. */ virtual ~CXTPChartSeriesCollection(); public: /** * @brief * Call this function to add a series to the collection. * * @param pSeries A pointer to the chart series which is to be added to the * collection. * @return A newly added series object pointer. */ CXTPChartSeries* Add(CXTPChartSeries* pSeries); /** * @brief * Call this function to get a series at a particular index in the series * collection. * @param nIndex Point index. * @return * A pointer to a chart series object. */ CXTPChartSeries* GetAt(int nIndex) const; public: virtual void DoPropExchange(CXTPPropExchange* pPX); protected: # ifdef _XTP_ACTIVEX public: /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPChartSeriesCollection); afx_msg long OleGetItemCount(); afx_msg LPDISPATCH OleGetItem(long nIndex); afx_msg LPDISPATCH OleAdd(LPCTSTR lpszName); afx_msg LPDISPATCH OleAddTrendline(LPCTSTR lpszName); DECLARE_ENUM_VARIANT(CXTPChartSeriesCollection) /** @endcond */ # endif friend class CXTPChartContent; }; AFX_INLINE CXTPChartSeriesPointCollection* CXTPChartSeries::GetPoints() const { return m_pPoints; } AFX_INLINE CXTPChartSeriesStyle* CXTPChartSeries::GetStyle() const { return m_pStyle; } AFX_INLINE CXTPChartSeries* CXTPChartSeriesCollection::GetAt(int nIndex) const { return nIndex >= 0 && nIndex < m_arrElements.GetSize() ? (CXTPChartSeries*)m_arrElements.GetAt(nIndex) : NULL; } AFX_INLINE CXTPChartDiagram* CXTPChartSeries::GetDiagram() const { return m_pDiagram; } AFX_INLINE void CXTPChartSeries::SetArgumentScaleType(XTPChartScaleType scaleType) { m_nArgumentScaleType = scaleType; OnChartChanged(); } AFX_INLINE XTPChartScaleType CXTPChartSeries::GetArgumentScaleType() const { return m_nArgumentScaleType; } AFX_INLINE void CXTPChartSeries::SetValueScaleType(XTPChartScaleType scaleType) { m_nValueScaleType = scaleType; OnChartChanged(); } AFX_INLINE XTPChartScaleType CXTPChartSeries::GetValueScaleType() const { return m_nValueScaleType; } AFX_INLINE int CXTPChartSeries::GetPaletteIndex() const { return m_nPaletteIndex; } AFX_INLINE void CXTPChartSeries::SetName(LPCTSTR lpszName) { m_strName = lpszName; OnChartChanged(); } AFX_INLINE CXTPChartString CXTPChartSeries::GetName() const { return m_strName; } AFX_INLINE void CXTPChartSeries::SetLegendText(LPCTSTR lpszLegendText) { m_strLegendText = lpszLegendText; OnChartChanged(); } AFX_INLINE CXTPChartString CXTPChartSeries::GetLegendText() const { return m_strLegendText; } AFX_INLINE void CXTPChartSeries::SetVisible(BOOL bVisible) { m_bVisible = bVisible; OnChartChanged(); } AFX_INLINE BOOL CXTPChartSeries::IsVisible() const { return m_bVisible; } AFX_INLINE CXTPChartNumberFormat* CXTPChartSeries::GetPointLegendFormat() const { return m_pPointLegendFormat; } AFX_INLINE BOOL CXTPChartSeries::IsLegendVisible() const { return m_bLegendVisible; } AFX_INLINE void CXTPChartSeries::SetLegendVisible(BOOL bLegendVisible) { m_bLegendVisible = bLegendVisible; OnChartChanged(); } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif //#if !defined(__XTPCHARTSERIES_H__) /** @endcond */