Mobile API Reference  MicroStrategy 2019
ItemedLegend.h
Go to the documentation of this file.
1 /*
2  * ItemedLegend.h
3  * IPhoneChart
4  *
5  * Created by dong shi on 12/14/10.
6  * Copyright 2010 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 #ifndef MSICHART_ITEMEDLEGEND_H
11 #define MSICHART_ITEMEDLEGEND_H
12 
13 #include "Legend.h"
14 #include "FormatFill.h"
15 #include "GraphObject.h"
16 #include "Rect2D.h"
17 
18 
19 
20 namespace MsiChart
21 {
26  {
27  GraphOptionsLegend(bool iShowLegend, unsigned char iLegendPosition, unsigned char iLegendMarkersStyle, unsigned char iLegendBoxStyle)
28  : mShowLegend(iShowLegend),
29  mShowSeriesTitles(true),
30  mLegendPosition(iLegendPosition),
31  mLegendMarkersStyle(iLegendMarkersStyle),
32  mLegendBoxStyle(iLegendBoxStyle),
33  mLegendItemsNum(0),
34  mRecalculate(false),
35  mReposition(false),
36  mAxisLabelsAutoFit(true),
37  mIsByGroup(false),
38  mIsColorBy(false)
39  {}
42  unsigned char mLegendPosition;
43  unsigned char mLegendMarkersStyle;
44  unsigned char mLegendBoxStyle;
45  unsigned char mLegendItemsNum;
46  bool mVertical;
50  bool mIsByGroup;
51  bool mIsColorBy;
52  };
53 
54 
55 
56  class ItemedLegend: public Legend
57  {
58  public:
60 
61  ItemedLegend(const TripleId& irTripleId, GraphObjectManager* ipManager, Dataset::Ptr iDatasetPtr, Rect2D iArea);
62  ~ItemedLegend();
63 
64  virtual void Draw();
65  virtual void GenerateView();
66  virtual void GenerateMapAndList();
67  virtual void GetOptions(Int32 iPropertyId, CComVariant* opValue) const;
68  virtual void GetOptions(Int32 iSeriesId, Int32 iPropertyId, CComVariant* opValue) const;
69  virtual Int32 GetItemCount();
70 
75  bool SetFormatLineOfLegendMarkerLine(FormatLine::Ptr iFormatLine, Int32 iSeriesId, bool iIsLineVertical = false);
76 
81  bool IsByGroup() const; //For grid chart
82 
83  void UpdateFormatForLegendMarker(Int32 iIndex, FormatFill::Ptr iFormatFill, FormatLine::Ptr iFormatLine, bool iIsLineAssignedToLegnedMarkerLine = false, bool iIsLineVertical = false);
84 
85 
86  protected:
91 
92  private:
93  std::vector<StraightLineObject::Ptr> mLegendMarkerLines;
94  GraphOptionsLegend mGraphOptionsLegend;
95 
96  Int32 mItemMargin;
97  Int32 mEdgeMargin;
98  Int32 mLegendMarkerSize;
99  bool mIsExpanded;
100  Int32 mLegendItemCount;
101 
102  std::map<Int32, Int32> mLegendItemIndexToStockMetricIndex;
103  MBase::String mStockMetricValue[3];
104  unsigned char mStockMetricLayout[3];
105 
110  void hCalculateLegendLayoutParas(FormatFont::Ptr iFormatFontPtr);
111 
115  void hLoadProperties();
116 
123  void hCalculateLegendLayoutInDevice(const Rect2D &irArea, Rect2D &orLegendArea, GraphCollectionObject::Ptr iLegendTextCollectionPtr);
124 
131  void hGenerateLegendText(const Rect2D& irArea, Rect2D &orTextArea, GraphCollectionObject::Ptr iGraphCollectionObjectPtr);
132 
137  bool hIsReversedOrder();
138 
144  unsigned char hCalculateLegendPosition();
145 
146 
151  Int32 hGetItemCount();
152  };
153 
154  inline bool ItemedLegend::IsByGroup() const
155  {
156  return mGraphOptionsLegend.mIsByGroup;
157  }
158 
160  {
161  return mGraphOptionsLegend.mLegendPosition;
162  }
163 
164 
165 }
166 #endif
bool mAxisLabelsAutoFit
Definition: ItemedLegend.h:49
unsigned char mLegendBoxStyle
Definition: ItemedLegend.h:44
unsigned char mLegendItemsNum
Definition: ItemedLegend.h:45
bool IsByGroup() const
Definition: ItemedLegend.h:154
bool mIsByGroup
To Support GraphMatrix.
Definition: ItemedLegend.h:50
virtual void GenerateView()
Definition: Dataset.h:198
virtual void Draw()
Int32 hGetLegendPosition()
Definition: ItemedLegend.h:159
Definition: Legend.h:64
GraphOptionsLegend(bool iShowLegend, unsigned char iLegendPosition, unsigned char iLegendMarkersStyle, unsigned char iLegendBoxStyle)
Definition: ItemedLegend.h:27
#define Int32
Definition: BasicTypes.h:20
bool mIsColorBy
To Support GraphMatrix.
Definition: ItemedLegend.h:51
bool mVertical
Definition: ItemedLegend.h:46
Definition: ItemedLegend.h:25
ItemedLegend(const TripleId &irTripleId, GraphObjectManager *ipManager, Dataset::Ptr iDatasetPtr, Rect2D iArea)
bool mShowSeriesTitles
Definition: ItemedLegend.h:41
Definition: SmartPtr.h:38
virtual void GetOptions(Int32 iPropertyId, CComVariant *opValue) const
virtual void GenerateMapAndList()
std::basic_string< WCHAR, std::char_traits< WCHAR >, Allocator< WCHAR > > String
Definition: BaseString.h:26
Definition: ItemedLegend.h:56
MSynch::SmartPtr< ItemedLegend > Ptr
Definition: ItemedLegend.h:59
Definition: ABLPlot.h:21
unsigned char mLegendPosition
Definition: ItemedLegend.h:42
bool mRecalculate
Definition: ItemedLegend.h:47
void UpdateFormatForLegendMarker(Int32 iIndex, FormatFill::Ptr iFormatFill, FormatLine::Ptr iFormatLine, bool iIsLineAssignedToLegnedMarkerLine=false, bool iIsLineVertical=false)
unsigned char mLegendMarkersStyle
Definition: ItemedLegend.h:43
bool mShowLegend
Definition: ItemedLegend.h:40
Definition: Msi_ccomvariant.h:24
virtual Int32 GetItemCount()
Definition: GraphObjectManager.h:37
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
bool SetFormatLineOfLegendMarkerLine(FormatLine::Ptr iFormatLine, Int32 iSeriesId, bool iIsLineVertical=false)
bool mReposition
Definition: ItemedLegend.h:48
Definition: Common.h:397