Mobile API Reference  MicroStrategy 2019
GridChartPlot.h
Go to the documentation of this file.
1 /*
2  * GridChartPlot.h
3  * IPhoneChart
4  *
5  * Created by dong shi on 12/3/10.
6  * Copyright 2010 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #ifndef GRIDPLOT_H
11 #define GRIDPLOT_H
12 
13 #include "GridBasePlot.h"
14 #include "CategoryAxis.h"
15 #include "MarkerObject.h"
16 #include "PiePlotRenderer.h"
17 
18 namespace MsiChart
19 {
20 
22  {
23  bool mIsDisPlayed; //<Whether this label is already been located
24  bool mIsValid; //Is Host marker valid ?
25 
28 
29  int mXIndex;
30  int mYIndex;
31 
33 
35 
37  {}
38 
40  {
41  Rect2D lRect;
42  mLabelPtr->GetBoundingRect(lRect);
43  return lRect;
44  }
45  };
46 
47  typedef std::vector<GridDataLabelInfo> GridDataLables;
48 
49 
50  class GridPlot : public GridBasePlot {
51  public:
52 
54 
55  GridPlot(const TripleId& irTripleId, GraphObjectManager* ipManager, const Rect2D& irPlotArea);
56  virtual ~GridPlot();
57 
58  //Re-implemention the virtual functions inherited from GraphObjectManager
59  virtual GraphObject::Ptr OnPointDetection(const Point2D& irCursor) const;
60  virtual void OnRectangleSelection(const Rect2D& irRect, std::vector<GraphObject::Ptr>& iorSelectedObjects) const;
61  virtual void Draw();
62  virtual void GenerateImageMap(ImageMap& iorImageMap);
63  virtual void GenerateMapAndList();
64  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
65  virtual Int32 GetMaxElementRadius();
66 
67  virtual void AssignSeries(const std::vector<Int32>& irSeries);
68 
69  static const double msMinVisibleRadius;
70 
71  protected:
72 
73  void hLoadProperties();
74  double hGetSize(Int32 iX, Int32 iY);
75  double hGetGMSizeValue(Int32 iX, Int32 iY);
76  std::vector<GraphObject::Ptr > hGetMarkersForOneDataPoint(Int32 iX, Int32 iY);
77  bool hNeedToDrawDataPoint(Int32 iX, Int32 iY);
78  Point2D hGetPieCenter(Int32 iGroupId, Int32 iSeriesId, Int32 iAngleIndex);
79  bool hGetGMPiePositon(Point2D& orCood, double iXInput, double iYInput, Int32 iXSubIndex, Int32 iYSubIndex, Int32 iXSectionCount, Int32 iYSectionCount);
80  RGBColor hGetColor(Int32 iX, Int32 iY);
83 
84  //void hShrinkMarker(MarkerObject::Ptr iMarkerPtr);
85  void hGetArity();
86  double hGetValueAt(Int32 iX, Int32 iY, Int32 iOffset = 0);
87  const double* hGetValueAddress(Int32 iX, Int32 iY, Int32 iOffset = 0);
88  bool hIsEmptyCell(Int32 iX, Int32 iY, Int32 iOffset = 0); //Whether one cell is empty cell in template.
89  Int32 hGetColorInGradientRange(double iIndex, Int32 iStartColor, Int32 iEndColor);
90 
94 
95  Rect2D hGetAdjustAutoFitRect(bool iIsInit); //To Support case when max size is specified.
96  Int32 hGetRectHLPosition(bool iIsForX, bool iIsForHighEnd, Int32 iIndex, const Point2D& irCenter);
97 
98 
99  //------------Data Labels Method--------------//
100  void hInitDataLabels();
102  void hPutDataLabel(int iIndex);
103  int hGetDataLabelIndexInVec(int iX,int iY);
105  void hValueToFormattedText(const double &irValue, MBase::String& orText, Int32 iSeriesId, Int32 iGroupId, GraphCollectionObject *ipCollection);
108  bool hIsFitPaddingToBorder(const Rect2D& iTextRect);
109 
110 
111  private:
112 
113  Int32 mXArity;
114  Int32 mYArity;
115  Int32 mColorIndex; //< index of the color metric
116  Int32 mSizeIndex; //< index of the size metric
117  Int32 mDataGroup; //< metric number, actually
118 
119  bool mIsSeriesByCol;
120  bool mIsAutoFitMode; //In scatter mode, each marker varies in size.
121  bool mIsColorUniform;//By x, By y and ByBoth
122  bool mIsColorBy; //ColorBymode.
123 
124  Int32 mDataLabelTextMode;
125 
126  double mMaxDataVal;
127  double mMinDataVal;
128 
129  double mMaxColorVal;
130  double mMinColorVal;
131 
132  double mMaxMarkerSize;
133  double mMinMarkerSize;
134 
135  Int32 mPreXCoord; //To compute the boundary of rectangle markers.
136  Int32 mPreYCoord;
137  Int32 mUniformColorMode; //by X ? by Y ? uniform for all?
138 
139  RGBColor mUniformColor; //used for uniform color case
140  RGBColor mPeakColor; //used for non-uniform case, upper bound.
141  RGBColor mLowColor; //used for non-uniform case, lower bound.
142 
143  std::vector<Int32> mSeriesSet;
144  std::vector<RGBColor> mColorsAlongAxis; //For color by row by col.
145 
146  std::vector<GraphCollectionObject::Ptr> mMarkerCollectionSet; //This is only used when color is by x or by y.
147 
148  Rect2D mAutoFitMarkerRect;
149  Rect2D mAdjustMarkerRect; //used for rectangel marker when max size is specified.
150 
151  GridDataLables mDataLabelsVec;
152  std::map<Int32, Int32> mLabelPositionFinder; //data label index -> data label position in mDataLabelsVec
153 
154  PiePlotRenderer::Ptr mPieRender;
155  std::map<TripleId, Point2D> mPieCentersPool;
156  };
157 
158  inline bool CompareOfDateLabelInfo(const GridDataLabelInfo& first, const GridDataLabelInfo& second)
159  {
160  if(first.mYIndex == second.mYIndex)
161  return first.mXIndex < second.mXIndex;
162  return first.mYIndex < second.mYIndex;
163  }
164 
165 }
166 
167 #endif
Definition: GridBasePlot.h:16
int mXIndex
Definition: GridChartPlot.h:29
static const double msMinVisibleRadius
Definition: GridChartPlot.h:69
Int32 mGroupId
Definition: GridChartPlot.h:27
const double * hGetValueAddress(Int32 iX, Int32 iY, Int32 iOffset=0)
double hGetSize(Int32 iX, Int32 iY)
bool hGetGMPiePositon(Point2D &orCood, double iXInput, double iYInput, Int32 iXSubIndex, Int32 iYSubIndex, Int32 iXSectionCount, Int32 iYSectionCount)
virtual void OnRectangleSelection(const Rect2D &irRect, std::vector< GraphObject::Ptr > &iorSelectedObjects) const
Rect2D hGetMarkerBoundingRect(Int32 iX, Int32 iY)
Point2D hGetPosition(Int32 iX, Int32 iY)
virtual void AssignSeries(const std::vector< Int32 > &irSeries)
bool hIsFitPaddingToBorder(const Rect2D &iTextRect)
Definition: GraphCollectionObject.h:19
void hAddLegnedMarkerToCollectionFor(Int32 iX, Int32 iY, GraphCollectionObject *ipCollection)
void hPutDataLabel(int iIndex)
virtual void GenerateImageMap(ImageMap &iorImageMap)
Rect2D hGetAdjustAutoFitRect(bool iIsInit)
virtual void GenerateMapAndList()
GridPlot(const TripleId &irTripleId, GraphObjectManager *ipManager, const Rect2D &irPlotArea)
TextObject::Ptr mLabelPtr
Definition: GridChartPlot.h:34
Rect2D hAddPaddingBoundToDataLabel(Rect2D &iTextRect)
bool mIsValid
Definition: GridChartPlot.h:24
Int32 mSeriesId
Definition: GridChartPlot.h:26
#define Int32
Definition: BasicTypes.h:20
void hPlaceDataLableWithoutOverlap()
RGBColor hGetColor(Int32 iX, Int32 iY)
MSynch::SmartPtr< GridPlot > Ptr
Definition: GridChartPlot.h:53
TextObject::Ptr hCreateDataLabelForGraphMatrix(int iX, int iY)
virtual GraphObject::Ptr OnPointDetection(const Point2D &irCursor) const
Definition: GridChartPlot.h:50
void hPopulateMarkerCollections()
virtual void GetBoundingRect(Rect2D &orBoundingRect) const
double hGetGMSizeValue(Int32 iX, Int32 iY)
virtual Int32 GetMaxElementRadius()
Rect2D hGetMarkerRect(Int32 iX, Int32 iY)
bool CompareOfDateLabelInfo(const GridDataLabelInfo &first, const GridDataLabelInfo &second)
Definition: GridChartPlot.h:158
std::basic_string< WCHAR, std::char_traits< WCHAR >, Allocator< WCHAR > > String
Definition: BaseString.h:26
void hValueToFormattedText(const double &irValue, MBase::String &orText, Int32 iSeriesId, Int32 iGroupId, GraphCollectionObject *ipCollection)
Definition: ABLPlot.h:21
std::vector< GridDataLabelInfo > GridDataLables
Definition: GridChartPlot.h:47
bool mIsDisPlayed
Definition: GridChartPlot.h:23
std::vector< AreaRec * > ImageMap
Definition: ImageMap.h:99
virtual void Draw()
Int32 hGetRectHLPosition(bool iIsForX, bool iIsForHighEnd, Int32 iIndex, const Point2D &irCenter)
bool hNeedToDrawDataPoint(Int32 iX, Int32 iY)
int mYIndex
Definition: GridChartPlot.h:30
virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant *opValue) const
Definition: Msi_ccomvariant.h:24
std::vector< GraphObject::Ptr > hGetMarkersForOneDataPoint(Int32 iX, Int32 iY)
Int32 hGetColorInGradientRange(double iIndex, Int32 iStartColor, Int32 iEndColor)
int hGetDataLabelIndexInVec(int iX, int iY)
bool hIsEmptyCell(Int32 iX, Int32 iY, Int32 iOffset=0)
Rect2D mHostMarkerBound
Definition: GridChartPlot.h:32
Definition: RGBColor.h:21
Point2D hGetPieCenter(Int32 iGroupId, Int32 iSeriesId, Int32 iAngleIndex)
GridDataLabelInfo()
Definition: GridChartPlot.h:36
double hGetValueAt(Int32 iX, Int32 iY, Int32 iOffset=0)
Definition: GraphObjectManager.h:37
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
GraphCollectionObject * hGetCollectionAsParentFor(Int32 iX, Int32 iY)
Definition: GridChartPlot.h:21
Definition: Common.h:397
Rect2D ToRectangle()
Definition: GridChartPlot.h:39