Mobile API Reference  MicroStrategy 2019
SeriesRenderer.h
Go to the documentation of this file.
1 //=======================================================================
2 // Filename: SeriesRenderer.h
3 // Date: 2008-10-06
4 // Authors: Bing Huang, Liang Liu
5 
6 // Copyright (C) 1997-2008 MicroStrategy Incorporated
7 // All rights reserved
8 //=======================================================================
9 
10 #ifndef MsiChart_SeriesRenderer_h
11 #define MsiChart_SeriesRenderer_h
12 
13 #include "PDCHeader/PDCset"
14 
15 #include "GraphCollectionObject.h"
16 #include "GraphObjectManager.h"
17 #include "Legend.h"
18 #include "TrendLineObject.h"
19 #include "Plot.h"
20 #include "Vector2D.h"
21 #include "TextObject.h"
22 #include "PiePlotRenderer.h"
23 
24 namespace MsiChart
25 {
26  //enumerations and structs
27 
32  struct SeriesInfo
33  {
34  SeriesInfo(Int32 iSeriesId, Int32 iSeriesIndex, Int32 iDataIndex, EnumValueAxis iValueAxis)
35  : mSeriesId(iSeriesId),
36  mSeriesIndex(iSeriesIndex),
37  mDataIndex(iDataIndex),
38  mValueAxis(iValueAxis)
39  {}
40 
45 
46  };
47 
48  //pre-declarations
49  class ABLPlot;
50  struct ABLPlotContext;
51 
53  {
54  public:
56 
57  SeriesRenderer(const TripleId& irTripleId, GraphObjectManager* ipManager, Dataset::Ptr iDatasetPtr, Legend::Ptr iLegendPtr);
58 
59  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
60 
61  virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double& orValue, double& orPercentValue, Int32 iOffset = 0);
62 
71  virtual void GenerateByValueAxis(EnumValueAxis iValueAxis, std::vector<GraphObject::Ptr>& iorGraphObjectList) = 0;
72 
80  void AddSeries(Int32 iSeriesId, Int32 iSeriesIndex, Int32 iDataIndex, EnumValueAxis iValueAxis);
81 
87  void UpdateCumulateData(EnumValueAxis iValueAxis);
88  void GetCumulateData(EnumValueAxis iValueAxis, std::vector<double>& iorCumulatedValue);
89 
95  void AddBaseToCumulateData(EnumValueAxis iValueAxis, double iBaseValue);
96 
105  void GetMinMaxValue(EnumValueAxis iValueAxis, double& iorMin, double& iorMax, bool& iorAreInitialized, Int32 iValueAxisDirection = 1);
106 
112  virtual void SetDeviceDataArea(const Rect2D& irDeviceDataArea);
113 
122  virtual void AddTextToMapAndList(std::map<TripleId, GraphObject::Ptr>& iorGraphObjectMap, std::vector<GraphObject::Ptr>& iorGraphObjectList);
123 
132  void MoveLabel(Int32 iGroupId, TextObject::Ptr iTextObjectPtr, const Point2D& irMax, const Point2D& irMin, Int32 iInfoIndex);
133 
134  virtual void UpdateGroupStackInfoWithBase(double& orBaseValue,double& orOffsetValue,EnumValueAxis iValueIndex,Int32 iSeriseID,Int32 iGroupID,double iAxisOriginValue);
135  virtual void AddObjectsToDataLabelManager(DataLabelManager::Ptr iDataLabelManagerPtr);
136 
137  void GetReferenceLineData(int iSeriesID, int iGroupID, std::string &orRefLineType, int& orMetricIndex, std::string &orValue);
138  void hCreateDataMarkerForDataLabel(bool iOnlyForDisplayedDataLable = true);
139  protected:
145  Int32 GetIndexFromSeriesId(Int32 iSeriesId) const;
146 
155  bool GetTrendlLinePoint(Int32 iInfoIndex, Int32 iGroupId, Point<double>& orPoint) const;
156 
166  bool GetData(Int32 iInfoIndex, Int32 iGroupId, double& orValue, bool iPreValue = false, Int32 iDataGroup = 0) const;
167 
176  void hGetAccompanyPoints(bool iIsVertical, const Point2D& irBasePoint, double lOffset, Point2D& orLowPoint, Point2D& orHighPoint);
177 
182 
183  void CreateRefLines();
184 
185  TextObject::Ptr hCreateRefLineLable(Int32 iSeriesInfo, Int32 iRefLineIndex);
186 
191  std::vector<Point2D> hProcessPointsForTrendline(const std::vector<Point2D>& irPoints);
192  bool hCalcTrendLinePoint(Point2D& iorPoint, Int32 iInfoIndex, Int32 iGroupId, double lValue);
193 
203  void CreateTrendLine(Int32 iInfoIndex, std::vector<double>& irCategory, std::vector<double>& irValue);
204 
214  void AddLegendMarkerToCollection(Int32 iSeriesIndex, GraphCollectionObject* ipRiserCollection, bool iIsLineCollection = false, bool iIsShownMarker = true, unsigned char iMarkerShape = 1, bool iIsShownLine = true);
215 
225  bool IsReverseSeriesOrder(EnumValueAxis iValueAxisIndex);
226 
233  bool IsReverseGroupOrder();
234 
247  bool PriorToNextSeries(const TVector2D<Int32>& iSideDirection, Int32 iGroupId);
248 
249 
257  TextObject::Ptr CreateRiserLabel(const Int32 iInfoIndex, const Int32 iGroupId, GraphCollectionObject::Ptr iTextCollectionPtr);
258 
259 
261  void CreateMarkerForDataLabel(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D& irCenterPoint, bool isAreaChart);
262  TextObject::Ptr hCreateDataLabelForGraphMatrix(const Int32 iSeriesId, const Int32 iGroupId,const double &irValue, GraphCollectionObject *ipCollection);
263  bool hIsUseCustomMinMax(const EnumValueAxis iValueAxis);
264  bool hIsDataLabelInDataArea(const Rect2D& iDLRect);
265 
273  TextObject::Ptr CreateTotalLabel(const EnumValueAxis iValueAxis, const Int32 iGroupId, GraphCollectionObject::Ptr iTotalCollectionPtr);
274 
282  const Int32 GetUpmostIndexByValueAxisAndGroup(const EnumValueAxis iValueAxis, const Int32 iGroupId) const;
283 
290  std::vector<SeriesInfo> mSeriesInfo;
291  //data for Y1 and Y2, cumulate or not
292  std::vector<double> mCumulateData[2];
293  //series count for each axis
295  //for text collection
296  std::vector<GraphCollectionObject::Ptr> mTextCollection;
297  std::vector<TrendLineObject::Ptr> mTrendLineObjects;
298  std::vector<TextObject::Ptr> mTrendLineTextObjects;
299 
300  // The following data members are added for access convenience. These data members are used frequently in renderers.
303  bool mUseDepth;
304  //Indicate whether the renderer has negative value
305  //Tt will be initialized in UpdateCumulateData() since it is used in Stacked/Percent Depth Chart only
310 
311  //For Graph Matrix.
312  mutable std::map<Int32, Int32> mGroupIdMapPerSeries; //<the current map for current continus section.
313  Int32 hGetCorrectGroupIdInSeriesPoints(Int32 iIndex, Int32 iCandidate) const;
321  GraphObject::Ptr hDrawSingleShape(const TripleId& irTripleId, const Point2D& irPoint, bool iIsLineAsDots = false);
322 
323  // GM Combination Support
324  Int32 hConvertCEShapeToGMShape(Int32 iSeriesType);
325 
326  std::vector<GraphObject::Ptr > hDrawSingleDataPoint(const TripleId& irTripleId, Int32 iSeriesInfo, const Point2D& irPoint, bool iIsLineAsDots = false);
327  Point2D hGetPieCenter(Int32 iGroupId, Int32 iSeriesId, Int32 iAngleIndex);
328  bool hGetGMPiePositon(Point2D& orCood, Int32 iInfoIndex, double iXInput, double iYInput, Int32 iXSubIndex, Int32 iYSubIndex, Int32 iXSectionCount, Int32 iYSectionCount);
330  std::map<TripleId, Point2D> mPieCentersPool;
331 
333 
334 
335  private:
344  double hGetCumulateData(EnumValueAxis iValueAxis, Int32 iDataIndex, Int32 iGroupId) const;
349  //void hUpdateTrendLineFormatLine(TrendLineObject::Ptr iTrendLinePtr);
350  };
351 }
352 
353 #endif
Definition: Vector2D.h:21
Definition: SeriesRenderer.h:32
bool hIsDataLabelInDataArea(const Rect2D &iDLRect)
void AddBaseToCumulateData(EnumValueAxis iValueAxis, double iBaseValue)
ABLPlotContext * mpABLPlotContext
Definition: SeriesRenderer.h:301
void GetReferenceLineData(int iSeriesID, int iGroupID, std::string &orRefLineType, int &orMetricIndex, std::string &orValue)
std::vector< GraphCollectionObject::Ptr > mTextCollection
Definition: SeriesRenderer.h:296
void hGetAccompanyPoints(bool iIsVertical, const Point2D &irBasePoint, double lOffset, Point2D &orLowPoint, Point2D &orHighPoint)
bool mUseDepth
Definition: SeriesRenderer.h:303
virtual void AddObjectsToDataLabelManager(DataLabelManager::Ptr iDataLabelManagerPtr)
void AddLegendMarkerToCollection(Int32 iSeriesIndex, GraphCollectionObject *ipRiserCollection, bool iIsLineCollection=false, bool iIsShownMarker=true, unsigned char iMarkerShape=1, bool iIsShownLine=true)
Int32 mStartLevel
Definition: SeriesRenderer.h:309
EnumValueAxis mValueAxis
Definition: SeriesRenderer.h:44
MSynch::SmartPtr< SeriesRenderer > Ptr
Definition: SeriesRenderer.h:55
void UpdateCumulateData(EnumValueAxis iValueAxis)
Int32 mDepthDirection
Definition: SeriesRenderer.h:308
bool GetTrendlLinePoint(Int32 iInfoIndex, Int32 iGroupId, Point< double > &orPoint) const
SeriesInfo(Int32 iSeriesId, Int32 iSeriesIndex, Int32 iDataIndex, EnumValueAxis iValueAxis)
Definition: SeriesRenderer.h:34
Dataset::Ptr mDatasetPtr
Definition: SeriesRenderer.h:288
TextObject::Ptr CreateTotalLabel(const EnumValueAxis iValueAxis, const Int32 iGroupId, GraphCollectionObject::Ptr iTotalCollectionPtr)
bool hIsUseCustomMinMax(const EnumValueAxis iValueAxis)
Definition: GraphCollectionObject.h:19
Definition: ABLPlot.h:157
EnumValueAxis
Definition: Plot.h:54
void CreateMarkerForDataLabel(Int32 iInfoIndex, Int32 iGroupId, GraphCollectionObject::Ptr iMarkerCollectionPtr, Point2D &irCenterPoint, bool isAreaChart)
Int32 mSeriesNumber[2]
Definition: SeriesRenderer.h:294
std::vector< TrendLineObject::Ptr > mTrendLineObjects
Definition: SeriesRenderer.h:297
virtual void UpdateGroupStackInfoWithBase(double &orBaseValue, double &orOffsetValue, EnumValueAxis iValueIndex, Int32 iSeriseID, Int32 iGroupID, double iAxisOriginValue)
virtual void AddTextToMapAndList(std::map< TripleId, GraphObject::Ptr > &iorGraphObjectMap, std::vector< GraphObject::Ptr > &iorGraphObjectList)
Definition: Dataset.h:198
void AddSeries(Int32 iSeriesId, Int32 iSeriesIndex, Int32 iDataIndex, EnumValueAxis iValueAxis)
bool PriorToNextSeries(const TVector2D< Int32 > &iSideDirection, Int32 iGroupId)
bool IsReverseSeriesOrder(EnumValueAxis iValueAxisIndex)
const Int32 GetUpmostIndexByValueAxisAndGroup(const EnumValueAxis iValueAxis, const Int32 iGroupId) const
std::vector< SeriesInfo > mSeriesInfo
Definition: SeriesRenderer.h:290
Int32 mDepth
Definition: SeriesRenderer.h:307
Int32 hConvertCEShapeToGMShape(Int32 iSeriesType)
#define Int32
Definition: BasicTypes.h:20
ABLPlot * mpABLPlot
Definition: SeriesRenderer.h:285
virtual void SetDeviceDataArea(const Rect2D &irDeviceDataArea)
Int32 mDataIndex
Definition: SeriesRenderer.h:43
TextObject::Ptr hCreateDataLabelForGraphMatrix(const Int32 iSeriesId, const Int32 iGroupId, const double &irValue, GraphCollectionObject *ipCollection)
Point2D hGetPieCenter(Int32 iGroupId, Int32 iSeriesId, Int32 iAngleIndex)
Int32 mSeriesId
Definition: SeriesRenderer.h:41
TextObject::Ptr CreateRiserLabel(const Int32 iInfoIndex, const Int32 iGroupId, GraphCollectionObject::Ptr iTextCollectionPtr)
bool hCalcTrendLinePoint(Point2D &iorPoint, Int32 iInfoIndex, Int32 iGroupId, double lValue)
Definition: SmartPtr.h:38
std::map< Int32, Int32 > mGroupIdMapPerSeries
Definition: SeriesRenderer.h:312
std::map< TripleId, Point2D > mPieCentersPool
Definition: SeriesRenderer.h:330
bool hGetGMPiePositon(Point2D &orCood, Int32 iInfoIndex, double iXInput, double iYInput, Int32 iXSubIndex, Int32 iYSubIndex, Int32 iXSectionCount, Int32 iYSectionCount)
void GetMinMaxValue(EnumValueAxis iValueAxis, double &iorMin, double &iorMax, bool &iorAreInitialized, Int32 iValueAxisDirection=1)
SeriesRenderer(const TripleId &irTripleId, GraphObjectManager *ipManager, Dataset::Ptr iDatasetPtr, Legend::Ptr iLegendPtr)
std::vector< GraphObject::Ptr > hDrawSingleDataPoint(const TripleId &irTripleId, Int32 iSeriesInfo, const Point2D &irPoint, bool iIsLineAsDots=false)
Definition: ABLPlot.h:21
Definition: ABLPlot.h:144
GraphObject::Ptr hDrawSingleShape(const TripleId &irTripleId, const Point2D &irPoint, bool iIsLineAsDots=false)
Legend::Ptr mLegendPtr
Definition: SeriesRenderer.h:289
bool GetData(Int32 iInfoIndex, Int32 iGroupId, double &orValue, bool iPreValue=false, Int32 iDataGroup=0) const
bool mHasNegativeValue
Definition: SeriesRenderer.h:306
std::vector< double > mCumulateData[2]
Definition: SeriesRenderer.h:292
Int32 GetIndexFromSeriesId(Int32 iSeriesId) const
void GetCumulateData(EnumValueAxis iValueAxis, std::vector< double > &iorCumulatedValue)
void MoveLabel(Int32 iGroupId, TextObject::Ptr iTextObjectPtr, const Point2D &irMax, const Point2D &irMin, Int32 iInfoIndex)
std::vector< TextObject::Ptr > mTrendLineTextObjects
Definition: SeriesRenderer.h:298
Int32 mSeriesCount
Definition: SeriesRenderer.h:287
bool mIsVertical
Definition: SeriesRenderer.h:302
std::vector< Point2D > hProcessPointsForTrendline(const std::vector< Point2D > &irPoints)
void hCreateDataMarkerForDataLabel(bool iOnlyForDisplayedDataLable=true)
void CreateTrendLine(Int32 iInfoIndex, std::vector< double > &irCategory, std::vector< double > &irValue)
Definition: Msi_ccomvariant.h:24
virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant *opValue) const
virtual void GenerateByValueAxis(EnumValueAxis iValueAxis, std::vector< GraphObject::Ptr > &iorGraphObjectList)=0
Definition: GraphObjectManager.h:37
Int32 mGroupCount
Definition: SeriesRenderer.h:286
Rect2D mDeviceDataArea
Definition: SeriesRenderer.h:284
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double &orValue, double &orPercentValue, Int32 iOffset=0)
TextObject::Ptr hCreateRefLineLable(Int32 iSeriesInfo, Int32 iRefLineIndex)
PiePlotRenderer::Ptr mPieRender
Definition: SeriesRenderer.h:332
Int32 hGetCorrectGroupIdInSeriesPoints(Int32 iIndex, Int32 iCandidate) const
Definition: Common.h:397
Definition: SeriesRenderer.h:52
Int32 mSeriesIndex
Definition: SeriesRenderer.h:42