Mobile API Reference  MicroStrategy 2019
FunnelPlot.h
Go to the documentation of this file.
1 //=======================================================================
2 // Filename: Kernel/SourceCode/ChartEngine/PrivateSource/FunnelPlot.h
3 // Date: 2009-04-03
4 // Authors: Bing Huang
5 
6 // Copyright (C) 1997-2008 MicroStrategy Incorporated
7 // All rights reserved
8 //=======================================================================
9 
10 #ifndef MsiChart_FunnelPlot_h
11 #define MsiChart_FunnelPlot_h
12 
13 #include "NumberObject.h"
14 #include "Plot.h"
15 
16 namespace MsiChart
17 {
18  typedef enum
19  {
23 
25  {
28  {
29  }
36  };
37 
39  {
41 
43  {
44  }
45 
48  };
49 
50  struct FunnelOption
51  {
56  {
57  }
58 
74  };
75 
76  //pre-declaration
78  struct ChartAdvFormat;
79  class FunnelObject;
80 
82  {
84 
85  FunnelTextLabelAndValue(const FunnelObject* ipFunnel, TextObject::Ptr iLabelPtr, TextObject::Ptr iValuePtr,
86  bool iLabelOnSlice, bool iValueOnSlice, Int32 iSeriesIndex)
87  : mpFunnel(ipFunnel), mSeriesIndex(iSeriesIndex)
88  {
89  mValueLabelPtr[0] = iLabelPtr;
90  mValueLabelPtr[1] = iValuePtr;
91  mValueLabelOnSlice[0] = iLabelOnSlice;
92  mValueLabelOnSlice[1] = iValueOnSlice;
93  }
94 
99  };
100 
101 
102 
103  class FunnelPlot : public Plot
104  {
105  public:
107 
108  FunnelPlot(const TripleId& irTripleId, GraphObjectManager* ipManager, const Rect2D& irDataArea);
109 
110  //virtual functions from GraphObjectManager
111  virtual void GenerateMapAndList();
112  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
113  virtual void Draw();
114  virtual void GenerateView();
115 
116  //override functions
117  virtual GraphObject::Ptr OnPointDetection(const Point2D& irCursor) const;
118  virtual void OnRectangleSelection(const Rect2D& irRect, std::vector<GraphObject::Ptr>& iorSelectedObjects) const;
119 
120  virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double& orValue, double& orPercentValue, Int32 iOffset = 0);
121 
122  private:
123 
127  bool hInit();
131  void hLoadProperties();
132 
137  void hLoadSeriesProperties(Int32 iSeriesIndex);
138 
144  EnumDSSGraphDataTextPosition hGetValuePosition(Int32 iSeriesIndex) const;
145 
151  void hSetValuePosition(Int32 iSeriesIndex, EnumDSSGraphDataTextPosition iPosition);
152 
158  EnumDSSGraphDataTextPosition hGetLabelPosition(Int32 iSeriesIndex) const;
159 
165  void hSetLabelPosition(Int32 iSeriesIndex, EnumDSSGraphDataTextPosition iPosition);
166 
167  void hCreateGroupLabel();
168 
169  void hGenerateForGroup(Int32 iGroupId, std::vector<GraphCollectionObject::Ptr>& irFunnelCollection, std::vector<GraphCollectionObject::Ptr>& irLabelCollection,
170  std::vector<GraphCollectionObject::Ptr>& irValueCollection);
171  void hCreateLabelsAndValues(Int32 iGroupId, Int32 iSeriesIndex, double& irValue, const FunnelObject* ipFunnel, GraphCollectionObject::Ptr iLabelCollectionPtr, GraphCollectionObject::Ptr iValueCollectionPtr);
172  void hCreateLeaderLinesForGroup(Int32 iGroupId, std::vector<GraphCollectionObject::Ptr>& irLeaderLineCollection);
173  void hFunnelSmartLabelForGroup(Int32 iGroupId);
174  void hFunnelSmartOnSliceForGroup(Int32 iGroupId);
175  void hFunnelSmartOutSliceForGroup(Int32 iGroupId);
176 
177  void hMoveLabel(Int32 iGroupId, FunnelTextLabelAndValue::Ptr iTextPtr);
178  void hGetRectForLabelAndValue(FunnelTextLabelAndValue::Ptr iTextPtr, bool iIsInside, Rect2D& orRect);
179  void hAdjustToOutside(Int32 iGroupId, FunnelTextLabelAndValue::Ptr iTextPtr);
180  void hSmartYDistance(std::vector<Int32>& iorDistance) const;
181  void hFunnelSmartOutSliceForGroupLeftOrRight(Int32 iGroupId, bool iIsLeft);
182  void hRelativeMoveOutsideLabel(FunnelTextLabelAndValue::Ptr iTextPtr, Int32 iYOffset);
183 
184  //initialize in hLoadProperties() & hLoadSeriesProperties.
185  FunnelOption mFunnelOption;
186  std::vector<FunnelSeriesOption::Ptr> mFunnelSeriesOptions;
187 
188  Int32 mSeriesCount;
189  Int32 mGroupCount;
190 
191  Int32 mFunnelsPerRowInChart;
192  Int32 mNumberRows;
193 
194  double mScale;
195  double mExplodeRatio;
196  double mCotangent;
197 
198  std::vector<double> mGroupTotals;
199 
200  std::vector<Rect2D> mGroupRects;
201  std::vector<Rect2D> mFunnelRects;
202 
203  Int32 mMaxGroupLabelsHeight;
204  Int32 mFunnelHeight;
205  Int32 mUpmostUnExplodeWidth;
206  Int32 mUpmostFunnelWidth;
207  Int32 mDownmostFunnelWidth;
208  Int32 mTotalFunnelHeight;
209  Int32 mFunnelHeightMargin;
210  Int32 mSpaceBetweenFunnels;
211 
212  std::vector<TextObject::Ptr> mGroupLabels;
213 
214  std::vector<FunnelTextLabelAndValue::Ptr> mTextForOneGroup;
215 
216  };
217 }
218 
219 #endif
Int32 mFunnelWidth
Definition: FunnelPlot.h:60
Int32 mDetachSlice
Definition: FunnelPlot.h:46
bool mShowDataValuesAsPercentage
Definition: FunnelPlot.h:66
virtual void GenerateMapAndList()
MSynch::SmartPtr< FunnelSeriesOption > Ptr
Definition: FunnelPlot.h:40
bool mShowFunnelName
Definition: FunnelPlot.h:65
MSynch::SmartPtr< FunnelPlot > Ptr
Definition: FunnelPlot.h:106
ChartAdvFormat mNumberFormat
Definition: FunnelPlot.h:35
virtual bool GetToolTipData(Int32 iSeriesID, Int32 iGroupID, double &orValue, double &orPercentValue, Int32 iOffset=0)
bool mShowLeaderLines
Definition: FunnelPlot.h:32
FunnelOption()
Definition: FunnelPlot.h:52
This struct is from ChartCtrl.h.
Definition: NumberObject.h:38
virtual GraphObject::Ptr OnPointDetection(const Point2D &irCursor) const
Definition: FunnelPlot.h:20
Definition: GraphCollectionObject.h:19
virtual void Draw()
bool mSmartLabelPlacement
Definition: FunnelPlot.h:67
const FunnelObject * mpFunnel
Definition: FunnelPlot.h:95
virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant *opValue) const
Int32 mFunnelExplode
Definition: FunnelPlot.h:62
bool mShowLabelsOnSide
Definition: FunnelPlot.h:68
EnumDSSGraphDataTextPosition
Definition: DSSIPhoneEnums.h:1836
Definition: FunnelPlot.h:50
FunnelPlot(const TripleId &irTripleId, GraphObjectManager *ipManager, const Rect2D &irDataArea)
#define Int32
Definition: BasicTypes.h:20
bool mValueLabelOnSlice[2]
Definition: FunnelPlot.h:97
Int32 mFunnelTilt
Definition: FunnelPlot.h:59
FunnelTextLabelAndValue(const FunnelObject *ipFunnel, TextObject::Ptr iLabelPtr, TextObject::Ptr iValuePtr, bool iLabelOnSlice, bool iValueOnSlice, Int32 iSeriesIndex)
Definition: FunnelPlot.h:85
bool mShowDataValues
Definition: FunnelPlot.h:69
Definition: FunnelObject.h:37
Definition: FunnelPlot.h:38
Definition: SmartPtr.h:38
bool mShowDataValues
Definition: FunnelPlot.h:30
Int32 mFunnelsPerRow
Definition: FunnelPlot.h:63
EnumFunnelDataLabelsPosition mDataLabelsPosition
Definition: FunnelPlot.h:72
Definition: FunnelPlot.h:21
Definition: FunnelPlot.h:81
Definition: FunnelPlot.h:103
Definition: ABLPlot.h:21
MSynch::SmartPtr< FunnelTextLabelAndValue > Ptr
Definition: FunnelPlot.h:83
bool mIs2DFunnel
Definition: FunnelPlot.h:64
Int32 mFunnelHeight
Definition: FunnelPlot.h:61
bool mShowDataLabels
Definition: FunnelPlot.h:31
ChartAdvFormat mGraphNumberFormat
Definition: FunnelPlot.h:73
EnumFunnelDataLabelsPosition mDataLabelsPosition
Definition: FunnelPlot.h:34
Definition: Msi_ccomvariant.h:24
bool mShowDataLabels
Definition: FunnelPlot.h:70
virtual void GenerateView()
Int32 mSeriesIndex
Definition: FunnelPlot.h:98
EnumFunnelDataLabelsPosition mDataValuesPosition
Definition: FunnelPlot.h:71
Definition: FunnelPlot.h:24
Definition: Plot.h:70
TextObject::Ptr mValueLabelPtr[2]
Definition: FunnelPlot.h:96
Definition: GraphObjectManager.h:37
FunnelSeriesOption()
Definition: FunnelPlot.h:42
GraphFunnelDataLabels mDataLabels
Definition: FunnelPlot.h:47
GraphFunnelDataLabels()
Definition: FunnelPlot.h:26
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
EnumFunnelDataLabelsPosition mDataValuesPosition
Definition: FunnelPlot.h:33
virtual void OnRectangleSelection(const Rect2D &irRect, std::vector< GraphObject::Ptr > &iorSelectedObjects) const
Definition: Common.h:397
EnumFunnelDataLabelsPosition
Definition: FunnelPlot.h:18