This project has retired. For details please refer to its Attic page.
Chart xref
View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.apache.hadoop.chukwa.hicc.bean;
20  
21  
22  import java.util.HashMap;
23  import java.util.List;
24  
25  public class Chart {
26    private String id;
27    private ChartType type;
28    private String title;
29    private List<SeriesMetaData> series;
30    private boolean xLabelOn;
31    private boolean yLabelOn;
32    private boolean yRightLabelOn;
33    private int width;
34    private int height;
35    private List<String> xLabelRange;
36    private HashMap<String, Long> xLabelRangeHash;
37    private boolean legend = true;
38    private String xLabel = "";
39    private String yLabel = "";
40    private String yRightLabel = "";
41    private double max = 0;
42    private double min = 0;
43    private boolean userDefinedMax = true;
44    private boolean userDefinedMin = true;
45    private String yUnitType = "";
46    private String icon = "";
47    private String bannerText = "";
48    private String suffixText = "";
49    private String threshold = "";
50  
51    public Chart(String id) {
52      this.id = id;
53      this.type = ChartType.TIME_SERIES;
54      this.title = "Untitled Chart";
55      this.xLabelOn = true;
56      this.yLabelOn = true;
57      this.width = 100;
58      this.height = 100;
59      this.legend = true;
60      this.max = 0;
61      this.userDefinedMax = false;
62      this.userDefinedMin = false;
63    }
64  
65    public ChartType getType() {
66      return this.type;
67    }
68    
69    public void setType(ChartType type) {
70      this.type = type;
71    }
72  
73    public void setYMax(double max) {
74      this.max = max;
75      this.userDefinedMax = true;
76    }
77  
78    public double getYMax() {
79      return this.max;
80    }
81  
82    public boolean getUserDefinedMax() {
83      return this.userDefinedMax;
84    }
85  
86    public void setYMin(double min) {
87      this.min = min;
88      this.userDefinedMin = true;
89    }
90  
91    public double getYMin() {
92      return this.min;
93    }
94  
95    public boolean getUserDefinedMin() {
96      return this.userDefinedMin;
97    }
98  
99    public void setSize(int width, int height) {
100     this.width = width;
101     this.height = height;
102   }
103 
104   public int getWidth() {
105     return this.width;
106   }
107 
108   public int getHeight() {
109     return this.height;
110   }
111 
112   public void setTitle(String title) {
113     this.title = title;
114   }
115 
116   public String getTitle() {
117     return this.title;
118   }
119 
120   public void setId(String id) {
121     this.id = id;
122   }
123 
124   public String getId() {
125     return this.id;
126   }
127 
128   public void setSeries(List<SeriesMetaData> series) {
129     this.series = series;
130   }
131   
132   public List<SeriesMetaData> getSeries() {
133     return this.series;
134   }
135   
136   public void setXAxisLabelsOn(boolean toggle) {
137     xLabelOn = toggle;
138   }
139 
140   public boolean isXAxisLabelsOn() {
141     return xLabelOn;
142   }
143 
144   public void setYAxisLabels(boolean toggle) {
145     yLabelOn = toggle;
146   }
147 
148   public boolean isYAxisLabelsOn() {
149     return yLabelOn;
150   }
151 
152   public void setYAxisRightLabels(boolean toggle) {
153     yRightLabelOn = toggle;
154   }
155 
156   public boolean isYAxisRightLabelsOn() {
157     return yRightLabelOn;
158   }
159 
160   public void setXAxisLabel(String label) {
161     xLabel = label;
162   }
163 
164   public String getXAxisLabel() {
165     return xLabel;
166   }
167 
168   public void setYAxisLabel(String label) {
169     yLabel = label;
170   }
171 
172   public String getYAxisLabel() {
173     return yLabel;
174   }
175 
176   public void setYAxisRightLabel(String label) {
177     yRightLabel = label;
178   }
179 
180   public String getYAxisRightLabel() {
181     return yRightLabel;
182   }
183 
184   public void setXLabelsRange(List<String> range) {
185     xLabelRange = range;
186     xLabelRangeHash = new HashMap<String, Long>();
187     long value = 0;
188     for (String label : range) {
189       xLabelRangeHash.put(label, value);
190       value++;
191     }
192   }
193 
194   public List<String> getXLabelsRange() {
195     return xLabelRange;
196   }
197   
198   public void setLegend(boolean toggle) {
199     legend = toggle;
200   }
201 
202   public boolean getLegend() {
203     return legend;
204   }
205 
206   public void setYUnitType(String yUnitType) {
207     this.yUnitType = yUnitType;
208   }
209   
210   public String getYUnitType() {
211     return this.yUnitType;
212   }
213 
214   public void setIcon(String icon) {
215     this.icon = icon;
216   }
217 
218   public String getIcon() {
219     return this.icon;
220   }
221 
222   public void setBannerText(String bannerText) {
223     this.bannerText = bannerText;
224   }
225 
226   public String getBannerText() {
227     return this.bannerText;
228   }
229 
230   public void setSuffixText(String suffixText) {
231     this.suffixText = suffixText;
232   }
233 
234   public String getSuffixText() {
235     return this.suffixText;
236   }
237 
238   public void setThreshold(String direction) {
239     this.threshold = direction;
240   }
241   
242   public String getThreshold() {
243     return this.threshold;
244   }
245 }