001 /*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016 package org.opengion.hayabusa.io;
017
018 import org.opengion.fukurou.util.StringUtil;
019 import org.opengion.hayabusa.common.HybsSystem;
020 import org.opengion.hayabusa.common.HybsSystemException;
021 import org.opengion.hayabusa.db.DBTableModel;
022
023 import java.util.List;
024 import java.util.ArrayList;
025 import java.util.Arrays;
026 import java.awt.Color;
027 import java.sql.Connection;
028 import java.sql.SQLException;
029 import java.text.NumberFormat;
030 import java.text.DecimalFormat; // 5.5.2.1 (2012/05/07)
031 import java.text.DecimalFormatSymbols; // 5.5.2.1 (2012/05/07)
032 import java.text.FieldPosition; // 5.5.2.1 (2012/05/07)
033
034 import org.jfree.data.general.Dataset;
035 import org.jfree.data.general.DefaultValueDataset;
036 import org.jfree.data.general.ValueDataset;
037 import org.jfree.chart.plot.ValueMarker;
038 import org.jfree.chart.axis.NumberAxis;
039 import org.jfree.chart.axis.NumberTickUnit;
040 import org.jfree.chart.renderer.category.CategoryItemRenderer;
041 import org.jfree.chart.renderer.category.BarRenderer;
042 import org.jfree.chart.renderer.category.LineAndShapeRenderer;
043 import org.jfree.chart.labels.CategoryItemLabelGenerator;
044 import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
045 import org.jfree.chart.urls.CategoryURLGenerator;
046 import org.jfree.ui.RectangleInsets;
047 import org.jfree.ui.TextAnchor;
048
049 import org.jfree.chart.plot.MeterPlot; // 5.7.8.0 (2014/07/04)
050 import org.jfree.chart.plot.ThermometerPlot; // 5.7.8.0 (2014/07/04)
051 import org.jfree.chart.plot.CompassPlot; // 5.7.8.0 (2014/07/04)
052 import org.jfree.chart.plot.Plot; // 5.7.8.0 (2014/07/04)
053 import java.awt.BasicStroke; // 5.7.8.0 (2014/07/04)
054 import org.jfree.data.Range; // 5.7.8.0 (2014/07/04)
055 import org.jfree.chart.plot.MeterInterval; // 5.7.8.0 (2014/07/04)
056 import org.jfree.chart.plot.DialShape; // 5.7.8.0 (2014/07/04)
057
058 /**
059 * ChartDataset は、Dataset および、JFreeChart の個別属æ?を管ç�?�—てã�?‚‹ãƒ??タ管ç�?‚¯ラスですã?
060 * JFreeChart のグラフ合成機è?のための、å?別のグラフ描画属æ?を管ç�?�—てã�?�¾すã?
061 * å†?ƒ¨çš?�«、引数のæ–?—å?ã‚?JFreeChart のå�?‚ªブジェクトへの変換なども行ってã�?�¾すã?
062 *
063 * @version 0.9.0 2007/06/21
064 * @author Kazuhiko Hasegawa
065 * @since JDK1.1,
066 */
067 public class ChartDataset {
068
069 private Dataset dataset = null; // Dataset オブジェクãƒ?
070 private String query = null; // 実行クエリー
071 private String chartType = null; // チャートã?種é¡?
072 private String needleType = null; // Needleの種é¡?
073 private boolean baseLegend = true; // シリーズ単位ã?凡ä¾?の表示可否
074 private String valueLabel = null;
075 private double[] markValues = null; // doubleの配å?
076 private Color[] markColors = new Color[] { Color.RED }; // Colorの配å?
077 private Color[] markOverColors = null; // 4.0.3.0 (2008/01/07) マã?カーラインのè¶?�Ž色
078 private boolean useMarkAnchor = true; // 4.1.1.0 (2008/02/04) 設定å?をラベル表示するかどã�?�‹
079 private int dynamicOCNo = -1; // 4.1.1.0 (2008/02/04) 動的なマã?カーラインの基準シリーズ番号
080 private int dynamicOCadrs = -1; // 4.1.1.0 (2008/02/21) 動的なマã?カーラインの基準番号
081 private String lowerBound = null; // double
082 private String upperBound = null; // double
083 private String tickSize = null; // double 4.0.3.0 (2008/01/07)
084 private boolean useGradient = false;
085 private boolean shapesVisible = true;
086 private Color[] shapeColors = null; // 4.0.3.0 (2008/01/07) ãƒ??タ毎にShapeをå?り替える時ã?色æŒ?®?
087 private String shapeScale = null; // 4.1.1.0 (2008/02/04) 基本形 Shape の表示倍率(double)
088 private boolean useDottedLine = false;
089 private Color[] seriesColors = null; // シリーズに対応した色æŒ?®?
090 private boolean isLabelsVisible = true; // 4.0.2.0 (2007/12/20) (縦軸)のラベルを表示するかどã�?�‹
091 private boolean isMarksVisible = true; // 4.0.2.0 (2007/12/20) (縦軸)のマã?カーを表示するかどã�?�‹
092 private boolean isItemValVisible= false; // 4.1.1.0 (2008/02/04) ãƒ??タの値(itemText)を表示するかどã�?�‹
093 private boolean isItemLastVisible= false; // 4.1.2.0 (2008/03/12) ãƒ??タの値(itemText)でæœ?¾Œã?み表示するかどã�?�‹
094 private boolean useItemLabelSep = true; // 4.1.2.0 (2008/03/12) ãƒ??タの値(itemText)の表示に桁区åˆ?‚Šæ–?—を使用するかどã�?�‹
095 private String barWidth = null; // 4.0.3.0 (2008/01/07) バã?å¹?double)
096 private String maxBarWidth = null; // 4.0.2.0 (2007/12/20) バã?å¹??æœ?¤§値(0.0??.0)
097 private String itemMargin = null; // 4.0.2.0 (2007/12/20) バã?アイãƒ?ƒ のマã?ジン(0.0??.0)
098 private String visibleLimit = null; // 4.0.3.0 (2008/01/07) 表示下限値(これ以下ã?ãƒ??タは未表示)
099 private String valueInset = null; // 4.0.3.0 (2008/01/07) 縦軸表示領域INSET値
100 private double domainMargin = 0.0; // 4.1.1.0 (2008/02/14) グラフã?書きå?し位置の調整比率
101
102 private String timeFormatType = null; // 5.5.2.1 (2012/05/07) 時刻の表示方æ³?E1/E2/E3/H1/H2/H3)
103 private boolean useVerticalLabels = false; // 5.5.2.1 (2012/05/07) ラベルの表示向き(横書ã�?false/縦書ã�?true)
104
105 /**
106 * Connection と query æ–?—å?から、Dataset オブジェクトを作æ?しますã?
107 *
108 * setChartType( String ) でæŒ?®šされたチャートタイプに応じて、Datasetオブジェクãƒ?
109 * を構築しますã?
110 * Dataset クラスはã€?org.jfree.data.jdbc.JDBCXXXXDataset" の XXXX のç®?‰€ã‚?
111 * ChartFactory クラスのチャートタイプ変換表に基づã�?�¦求めますã?
112 * 現状は、Category , Pie , XY の?“種類と、Value が指定可能ですã?
113 * ※ Value は、conn ã‚?sql を使用してã�?�¾せん。å?は、markValues を使用してã�?�¾すã?
114 * これは、現状の暫定方法であり、今後ã?変わる可能性がありますã?
115 *
116 * @og.rev 4.0.0.0 (2007/11/28) new Double(double) â‡?Double.valueOf(double) 変更
117 *
118 * @param conn Datasetの取得å?のコネクション
119 * @param sql 取得するクエリーæ–?—å?
120 * @throws SQLException ãƒ??タベã?ス実行エラーが発生したå?å�?
121 */
122 public void makeDataset( final Connection conn,final String sql ) throws SQLException {
123 dataset = ChartFactory.newDataset( conn,sql,chartType );
124 query = sql ;
125
126 // 暫定的対応ã?本当ã?、SQL を実行してそã?値をセãƒ?ƒˆすべã�?
127 if( dataset instanceof DefaultValueDataset ) {
128 if( markValues != null && markValues.length > 0 ) {
129 ((DefaultValueDataset)dataset).setValue( Double.valueOf( markValues[0] ) );
130 }
131 else {
132 String errMsg = "markValues が指定されてã�?�¾せんã€?;
133 throw new HybsSystemException( errMsg );
134 }
135 }
136 }
137
138 /**
139 * DBTableModelオブジェクトからã?Dataset オブジェクトを作æ?しますã?
140 *
141 * setChartType( String ) でæŒ?®šされたチャートタイプに応じて、Datasetオブジェクãƒ?
142 * を構築しますã?
143 *
144 * 現状は、Category , Pie , XY の?“種類と、Value が指定可能ですã?
145 * ※ Value は、DBTableModel を使用してã�?�¾せん。å?は、markValues を使用してã�?�¾すã?
146 * これは、現状の暫定方法であり、今後ã?変わる可能性がありますã?
147 *
148 * @og.rev 5.3.0.0 (2010/12/01) 新規追åŠ?
149 *
150 * @param table Datasetの取得å?のãƒ??ブルモãƒ?ƒ«
151 */
152 public void makeDataset( final DBTableModel table ) {
153 dataset = ChartFactory.newDataset( table,chartType );
154
155 // 暫定的対応ã?本当ã?、SQL を実行してそã?値をセãƒ?ƒˆすべã�?
156 if( dataset instanceof DefaultValueDataset ) {
157 if( markValues != null && markValues.length > 0 ) {
158 ((DefaultValueDataset)dataset).setValue( Double.valueOf( markValues[0] ) );
159 }
160 else {
161 String errMsg = "markValues が指定されてã�?�¾せんã€?;
162 throw new HybsSystemException( errMsg );
163 }
164 }
165 }
166
167 /**
168 * NumberAxis オブジェクトを作æ?しますã?
169 *
170 * NumberAxis オブジェクトã?、Value(縦軸)の属æ?を設定する為に使用されã‚?
171 * オブジェクトですã?
172 * これに、各種属æ?を設定して、å?を返しますã?
173 * 属æ?としては、isLineVisible、isLabelsVisible、isMarksVisibleã€?
174 * range(lowerBound、upperBound) ですã?
175 *
176 * @og.rev 4.0.2.0 (2007/12/20) 新規追åŠ?
177 * @og.rev 4.0.3.0 (2008/01/07) 縦軸レンジをå?別設定ã?チックå¹?Œ‡å®?
178 * @og.rev 4.1.1.0 (2008/02/04) HybsNumberAxis 採用
179 * @og.rev 4.1.1.0 (2008/02/04) setAxisLineVisible をã?isMarksVisible 値で設定するã?
180 * @og.rev 5.5.2.1 (2012/05/07) timeFormatType 、useVerticalLabels 属æ?を追åŠ?�™るã?
181 *
182 * @return 縦軸の属æ?(NumberAxisオブジェクãƒ?
183 */
184 protected NumberAxis makeNumberAxis() {
185 NumberAxis axis = new HybsNumberAxis( valueLabel );
186
187 // 縦軸レンジå¹??軸設å®?
188 if( lowerBound != null ) {
189 axis.setLowerBound( Double.parseDouble( lowerBound ) );
190 }
191
192 if( upperBound != null ) {
193 axis.setUpperBound( Double.parseDouble( upperBound ) );
194 }
195
196 if( tickSize != null ) {
197 axis.setTickUnit( new NumberTickUnit( Double.parseDouble( tickSize ) ) );
198 }
199
200 axis.setTickLabelsVisible( isLabelsVisible );
201 axis.setTickMarksVisible ( isMarksVisible );
202 axis.setAxisLineVisible ( isMarksVisible ); // 4.1.1.0 (2008/02/04)
203
204 if( valueInset != null ) {
205 double rightInset = Double.parseDouble( valueInset );
206 RectangleInsets base = axis.getTickLabelInsets();
207 RectangleInsets inset = new RectangleInsets(
208 base.getUnitType(), // UnitType unitType
209 base.getTop(), // double top
210 base.getLeft(), // double left
211 base.getBottom(), // double bottom
212 base.getRight() + rightInset // double right
213 );
214 axis.setTickLabelInsets( inset ) ;
215 }
216
217 // 5.5.2.1 (2012/05/07) 時刻の表示方æ³?E1/E2/E3/H1/H2/H3)
218 if( timeFormatType != null ) {
219 axis.setNumberFormatOverride( new HybsTimeFormat( timeFormatType ) );
220 }
221
222 // 5.5.2.1 (2012/05/07) ラベルの表示向き(横書ã�?false/縦書ã�?true)
223 if( useVerticalLabels ) {
224 axis.setVerticalTickLabels( true ); // 処ç�?š„には冗長ã€?
225 }
226
227 return axis;
228 }
229
230 /**
231 * 検索を行う クエリーæ–?—å?を返しますã?
232 *
233 * これは、makeDataset( Connection ,String ) メソãƒ?ƒ‰でæŒ?®šしたã?
234 * sql 属æ?の設定å?そã?もã?ですã?
235 *
236 * @return 取得するクエリーæ–?—å?
237 */
238 public String getQuery() { return query; }
239
240 /**
241 * Dataset オブジェクトを取得しますã?
242 *
243 * makeDataset( Connection,String ) で、予めオブジェクトを構築しておく
244 * å¿?¦�がありますã?
245 * Dataset クラスはã€?org.jfree.data.jdbc.JDBCXXXXDataset" の XXXX のç®?‰€ã‚?
246 * ChartFactory クラスのチャートタイプ変換表に基づã�?�¦求めますã?
247 * 現状は、Category , Pie , XY の?“種類と、Value が指定可能ですã?
248 *
249 * @return Datasetオブジェクãƒ?
250 * @see #makeDataset( Connection ,String )
251 */
252 protected Dataset getDataset() { return dataset; }
253
254 /**
255 * Dataset オブジェクトを作æ?する時ã?チャートタイプをæŒ?®šしますã?
256 *
257 * チャートタイãƒ?は、外部からチャートをæŒ?®šするã?に便利なように、キーåŒ?
258 * されてã�?�¾すã?こã?キーに基づã�?�¦、ChartFactory クラスの
259 * チャートタイプ変換表に基づã�?�¦、レンãƒ?ƒ©ーã‚??ãƒ??タセãƒ?ƒˆを作æ?しますã?
260 *
261 * @param type チャートタイãƒ?
262 */
263 public void setChartType( final String type ) {
264 if( type != null && type.length() > 0 ) {
265 chartType = type;
266 }
267 }
268
269 /**
270 * Dataset オブジェクトを作æ?する時ã?NeedleタイプをæŒ?®šしますã?
271 *
272 * Needleタイãƒ?は、MeterPlot,Compassチャートを使用する場合にæŒ?®šしますã?
273 *
274 * MeterPlot
275 * org.jfree.chart.plot.DialShape のæŒ?®šキ?°?œー??¾žとして、CHORD,CIRCLE,PIE が指定可能ですã?
276 * 初期値は、CIRCLE ですã?
277 *
278 * Compass
279 * org.jfree.chart.needle.MeterNeedle のæŒ?®šキ?°?œー??¾žとして、下記ã??™種類がæŒ?®š可能ですã?
280 * æŒ?®šã?、Arrow,Line,Long,Pin,Plum,Pointer,Ship,Wind,Arrow,MiddlePin とã�?�†æ–?—å?ですã?
281 * 初期値は、Pointer ですã?
282 *
283 * 0 = ArrowNeedle;
284 * 1 = LineNeedle;
285 * 2 = LongNeedle;
286 * 3 = PinNeedle;
287 * 4 = PlumNeedle;
288 * 5 = PointerNeedle;
289 * 6 = ShipNeedle;
290 * 7 = WindNeedle;
291 * 8 = ArrowNeedle;
292 * 9 = MiddlePinNeedle;
293 *
294 * @og.rev 5.7.8.0 (2014/07/04) 新規追åŠ?
295 *
296 * @param type Needleタイãƒ?
297 */
298 public void setNeedleType( final String type ) {
299 if( type != null && type.length() > 0 ) {
300 needleType = type;
301 }
302 }
303
304 /**
305 * Dataset オブジェクトを作æ?する時ã?チャートタイプを取得しますã?
306 *
307 * チャートタイãƒ?は、外部からチャートをæŒ?®šするã?に便利なように、キーåŒ?
308 * されてã�?�¾すã?こã?キーに基づã�?�¦、ChartFactory クラスの
309 * チャートタイプ変換表に基づã�?�¦、レンãƒ?ƒ©ーã‚??ãƒ??タセãƒ?ƒˆを作æ?しますã?
310 *
311 * @return チャートタイãƒ?
312 */
313 protected String getChartType() { return chartType; }
314
315 /**
316 * シリーズ単位ã?凡ä¾?の表示可否を設定しますã?
317 *
318 * @param baseLeg シリーズ単位ã?凡ä¾?の表示可否
319 */
320 public void setBaseLegend( final boolean baseLeg ) {
321 baseLegend = baseLeg;
322 }
323
324 /**
325 * Renderer 関連の共通インターフェースを返しますã?
326 *
327 * setChartType( String )で設定された、チャートタイプに応じたã?レンãƒ?ƒ©ーã‚?
328 * 返しますã?
329 * 対応表は、ChartFactory クラスに持ってã�?�¾すã?
330 * 基本çš?�«は、チャートタイãƒ?は、この、レンãƒ?ƒ©ー名称から決定してã�?�¾すã?
331 *
332 * @og.rev 4.1.1.0 (2008/02/04) useDynamicOC , isItemValVisible , shapeScale 属æ?追åŠ?
333 * @og.rev 4.1.1.0 (2008/02/04) クリãƒ?‚«ブル・マップã?設定を移動ã?serNo 引数追åŠ?
334 * @og.rev 4.1.1.0 (2008/02/04) 返す型を CategoryItemRenderer に変更
335 * @og.rev 4.1.1.0 (2008/02/16) HybsStackedBarRenderer に domainMargin を設å®?
336 * @og.rev 4.1.1.0 (2008/02/19) Shapes の設定をこちらに移動ã?
337 * @og.rev 4.1.2.0 (2008/03/12) isItemLastVisible の設å®?
338 *
339 * @param serNo シリアルNo
340 * @param urlGen CategoryURLGeneratorオブジェクãƒ?
341 *
342 * @return レンãƒ?ƒ©ーの共通インターフェース
343 * @see org.jfree.chart.renderer.category.CategoryItemRenderer
344 * @see org.jfree.chart.renderer.xy.XYItemRenderer
345 */
346 protected CategoryItemRenderer getRenderer( final int serNo , final CategoryURLGenerator urlGen ) {
347 TypeRenderer typeRen = ChartFactory.getTypeRenderer( chartType );
348 CategoryItemRenderer rend = (CategoryItemRenderer)typeRen.getRenderer();
349
350 // 4.1.1.0 (2008/02/19) LineAndShapeRenderer オブジェクトã?場合ã?設å®?
351 if( rend instanceof LineAndShapeRenderer ) {
352 LineAndShapeRenderer lsRend = (LineAndShapeRenderer)rend;
353
354 // シェーãƒ?四è§?表示。serNo å†??表示は、å?別に行いますã?
355 lsRend.setBaseShapesVisible( shapesVisible );
356 if( serNo >= 0 ) {
357 lsRend.setSeriesShapesVisible( serNo,true );
358 }
359
360 // 4.1.1.0 (2008/02/04) 繰返しshapeの開始番号(初期値:??
361 ShapeList shapeList = new ShapeList();
362 for( int i=0; i<shapeList.size(); i++ ) {
363 lsRend.setSeriesShape( i,shapeList.getShape(i) );
364 }
365 }
366
367 // 4.0.3.0 (2008/01/07) HybsLineRenderer 特別処ç�?
368 if( rend instanceof HybsLineRenderer ) {
369 HybsLineRenderer hyRend = (HybsLineRenderer)rend ;
370 if( shapeColors != null ) {
371 hyRend.setShapeColors( shapeColors );
372 }
373
374 // 4.1.1.0 (2008/02/04) shapeの大きさの倍率(初期値:null)
375 hyRend.setShapeScale( shapeScale );
376
377 // 縦軸マã?カーのè¶?�Ž時Shape色æŒ?®?未使用時ã? null)
378 if( markOverColors != null ) {
379 hyRend.setValueMarkOverColors( getValueMarkOverColors(),dynamicOCNo );
380 }
381
382 // 表示下限値(これ以下ã?ãƒ??タは未表示)の値(double)を指å®?
383 if( visibleLimit != null ) {
384 hyRend.setVisibleLimit( Double.valueOf( visibleLimit ) );
385 }
386 }
387
388 // 4.0.2.0 (2007/12/20) BarRenderer オブジェクトã?場合にマã?ジン等を設定しますã?
389 if( rend instanceof BarRenderer ) {
390 BarRenderer barRend = (BarRenderer)rend ;
391
392 // 棒ã?間を表示領域を1として小数点以下ã?数値でå¹?‚’設定すã‚?0.0??.0)
393 if( itemMargin != null ) {
394 double margin = Double.parseDouble( itemMargin );
395 barRend.setItemMargin( margin ) ;
396 }
397
398 // 棒ã?å¹?‚’設定すã€?¡¨示領域を1として小数点以下ã?数値でå¹?‚’設定すã‚?0.0??.0)
399 if( maxBarWidth != null ) {
400 barRend.setMaximumBarWidth( Double.parseDouble( maxBarWidth ) ) ;
401 }
402 }
403
404 // 4.1.1.0 (2008/02/16) HybsStackedBarRenderer オブジェクトã?場合に domainMargin を設定しますã?
405 if( rend instanceof HybsStackedBarRenderer ) {
406 HybsStackedBarRenderer stBarRend = (HybsStackedBarRenderer)rend ;
407
408 stBarRend.setDomainMargin( domainMargin ) ;
409 }
410
411 // シリーズ単位ã?凡ä¾?の表示可否
412 rend.setBaseSeriesVisibleInLegend( baseLegend );
413
414 // 4.1.1.0 (2008/02/04) ãƒ??タの値(itemText)を表示するかどã�?�‹
415 if( isItemValVisible ) {
416 // 4.1.2.0 (2008/03/12) 桁区åˆ?‚Šæ–?—を使用するかどã�?�‹
417 NumberFormat numForm = NumberFormat.getInstance();
418 numForm.setGroupingUsed( useItemLabelSep );
419
420 CategoryItemLabelGenerator labelGen
421 = new StandardCategoryItemLabelGenerator(
422 StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
423 numForm
424 );
425 rend.setBaseItemLabelGenerator( labelGen );
426
427 if( serNo >= 0 ) {
428 rend.setSeriesItemLabelsVisible( serNo,true );
429 }
430 else {
431 rend.setBaseItemLabelsVisible( true );
432 }
433 // 4.1.1.0 (2008/02/04) 動的なマã?カーラインを使用する場合ã?
434 // æŒ?®šã?番号は閾値なので、表示しませんã€?
435 if( dynamicOCNo >= 0 ) {
436 rend.setSeriesItemLabelsVisible( dynamicOCNo,false ); // 閾値
437 }
438
439 // 4.1.2.0 (2008/03/12) isItemLastVisible の設å®?
440 if( isItemLastVisible && rend instanceof HybsDrawItem ) {
441 ((HybsDrawItem)rend).setItemLabelLastVisible( true ) ;
442 }
443 }
444
445 // クリãƒ?‚«ブル・マッãƒ?
446 if( urlGen != null ) {
447 if( serNo >= 0 ) {
448 rend.setSeriesItemURLGenerator( serNo,urlGen );
449 }
450 else {
451 rend.setBaseItemURLGenerator( urlGen );
452 }
453 }
454
455 return rend;
456 }
457
458 /**
459 * 縦軸の表示名称を指定しますã?
460 *
461 * @param valLbl 縦軸の表示名称
462 */
463 public void setValueLabel( final String valLbl ) {
464 if( valLbl != null && valLbl.length() > 0 ) {
465 valueLabel = valLbl;
466 }
467 }
468
469 /**
470 * 縦軸の表示名称を取得しますã?
471 *
472 * @return 縦軸の表示名称
473 */
474 protected String getValueLabel() { return valueLabel; }
475
476 /**
477 * マã?カーラインの設定å?配å?を指定しますã?
478 *
479 * æŒ?®šã?値にマã?カーラインを引きますã?
480 * 色は、setMarkColor( String ) でæŒ?®šしますã?
481 * markColors と、あわせて設定するå¿?¦�がありますã?
482 * markColorsがã?æŒ?®šされてã�?�ªã�??合ã?、Color.RED で マã?カーされますã?
483 * dynamicOCNo を使用する場合ã?、そのValues の並びのç®?‰€にã€?
484 * "G" とã�?�†æ–?—å?を設定して下さã�??
485 * 例ï¼?000,G 基準1ã?ã€?000の直線ã?基準2ã?、グラãƒ?とã�?�†意味ã€?
486 *
487 * @og.rev 4.1.1.0 (2008/02/21) 基準ラインにグラフを使用する場合ã?位置æŒ?®?
488 *
489 * @param mkVal マã?カーラインの設定å?配å?
490 * @see #setMarkColors( String[] )
491 */
492 public void setMarkValues( final String[] mkVal ) {
493 if( mkVal != null && mkVal.length > 0 ) {
494 int size = mkVal.length;
495 markValues = new double[size];
496 for( int i=0; i<size; i++ ) {
497 if( "G".equals( mkVal[i] ) ) {
498 dynamicOCadrs = i;
499 markValues[i] = 0.0;
500 }
501 else {
502 markValues[i] = Double.parseDouble( mkVal[i] );
503 }
504 }
505 }
506 }
507
508 /**
509 * マã?カーラインの色をé?列指定しますã?
510 *
511 * マã?カーラインとは、縦軸設定ã?ラインの事で、縦軸の設定å?(markValues)に
512 * 横方向にラインを付与しますã?こã?ラインの色をã?カンマ区åˆ?‚Š形式で
513 * æŒ?®šしますã?
514 * markValues と、あわせて設定するå¿?¦�がありますã?
515 * 個数が異なるå?合ã?、markValues が優先されã?無æŒ?®šã?場合ã?、Color.REDで
516 * 表示されますã?
517 *
518 * <pre>
519 * BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY ,
520 * MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , (PURPLE)
521 * #XXXXXX形式ã?16bitRGB表è¨?でも指定可能ですã?
522 * </pre>
523 *
524 * @param mkCol マã?カーラインの色配å?
525 * @see java.awt.Color#BLACK
526 * @see #setMarkValues( String[] )
527 */
528 public void setMarkColors( final String[] mkCol ) {
529 if( mkCol != null && mkCol.length > 0 ) {
530 int size = mkCol.length;
531 markColors = new Color[size];
532 for( int i=0; i<size; i++ ) {
533 markColors[i] = StringUtil.getColorInstance( mkCol[i] );
534 }
535 }
536 }
537
538 /**
539 * マã?カーライン描画時に、その設定å?を表示しますã?
540 *
541 * マã?カーラインの縦軸の設定å?(markValues)に、設定å?をラベル表示しますã?
542 * 位置は、TextAnchor.BASELINE_LEFT 固定ですã?
543 * 初期値は、表示する(true)ですã?
544 *
545 * @og.rev 4.1.1.0 (2008/02/04) 新規追åŠ?
546 *
547 * @param useAnchor true:設定å?を表示するã€?
548 */
549 public void setUseMarkAnchor( final boolean useAnchor ) {
550 useMarkAnchor = useAnchor ;
551 }
552
553 /**
554 * マã?カーラインのè¶?�Ž時ã?Shape色をカンマ区åˆ?‚Š形式でè¤?•°æŒ?®šしますã?
555 *
556 * HybsLine でのみ使用可能ですã?
557 * マã?カーラインを使用する場合に、そのラインをè¶?�ˆなã�?‰²、è¶?�ˆる色を指定しますã?
558 * こã?色のæŒ?®šã?、ã?ーカーラインの色ã‚??ーカーラインの設定å?の個数?‹1に
559 * なりますã?つまりã?色?‘:設定å??‘:色?’:設定å??’:色??となりますã?
560 * 色?‘ã?、設定å??‘より小さã�??合に使用され、色?’ã?、設定å??‘より大きくã€?
561 * 設定å??’より小さã�??合ã?色?“ã?、設定å??’より大きい場合になりますã?
562 *
563 * æŒ?®š文字å?は、java.awt.Color クラスのstatic フィールド名でæŒ?®šしますã?
564 * BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY ,
565 * MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , (PURPLE) が指定できますã?
566 * またã?#XXXXXX形式ã?16bitRGB表è¨?でも指定可能ですã?
567 * markValues と、あわせて設定するå¿?¦�がありますã?
568 * どちらかがã?æŒ?®šされてã�?�ªã�??合ã?、ã?ーカー表示されませんã€?
569 * <pre>
570 * BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY ,
571 * MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , (PURPLE)
572 * #XXXXXX形式ã?16bitRGB表è¨?でも指定可能ですã?
573 * </pre>
574 *
575 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
576 *
577 * @param ovCol マã?カーラインのè¶?�Ž時ã?Shape色
578 * @see java.awt.Color#BLACK
579 */
580 public void setMarkOverColors( final String[] ovCol ) {
581 if( ovCol != null && ovCol.length > 0 ) {
582 int size = ovCol.length;
583 markOverColors = new Color[size];
584 for( int i=0; i<size; i++ ) {
585 markOverColors[i] = StringUtil.getColorInstance( ovCol[i] );
586 }
587 }
588 }
589
590 /**
591 * マã?カーラインのè¶?�Ž時ã?Shape色を規定するオブジェクトを返しますã?
592 *
593 * HybsLine でのみ使用可能ですã?
594 * 設定情報が存在しなã�??合ã?、null を返しますã?
595 *
596 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
597 * @og.rev 4.1.1.0 (2008/02/04) markColors 属æ?追åŠ?
598 * @og.rev 4.1.1.1 (2008/02/25) markValues での "G" æŒ?®šをè€??
599 *
600 * @return マã?カーラインのè¶?�Ž時ã?Shape色管ç�?‚ªブジェクãƒ?
601 */
602 private ValueMarkOverColors getValueMarkOverColors() {
603 ValueMarkOverColors vmoc = null;
604
605 if( markValues != null && markOverColors != null &&
606 markValues.length + 1 == markOverColors.length &&
607 markValues.length >= 1 ) {
608 int dynAdrs = (dynamicOCadrs >= 0) ? dynamicOCadrs : 0 ;
609
610 vmoc = new ValueMarkOverColors(
611 markValues,
612 markOverColors,
613 markColors[dynAdrs],
614 dynamicOCadrs
615 );
616 }
617
618 return vmoc ;
619 }
620
621 /**
622 * 動的なマã?カーラインの基準シリーズ番号を設定しまã�?初期値:-1)ã€?
623 *
624 * 動的なマã?カーラインを使用する場合ã?、基準å?となるシリーズ番号を指定しますã?
625 *
626 * マã?カーラインのæœ?¸‹位閾値に相当しますã?これは、グラフ化されますがã€?
627 * Shape は自動的に削除されますã?
628 * こã?設定を使用する場合ã?æœ??のãƒ??タには、å¿?�šShapeが付きますã?それ以外ã?
629 * ãƒ??タに、Shape を付けるかどã�?�‹は、shapesVisible 属æ?でæŒ?®šしますã?
630 * こã?線ã?色は、markColors でæŒ?®šしたã?æœ?¸‹位ã?色になりますã?またã?
631 * markValues でæŒ?®šしたã?æœ?¸‹位ã?値は、使用されません。たã�?�—、色æŒ?®šã?
632 * 関係上ã?設定しておくå¿?¦�がありますã?
633 * またã?isValueVisible == true で、設定å?の値表示を行う場合も、最下位ã?
634 * 値は表示しなã�?‚ˆã�?�«しますã?
635 * 初期値は、使用しなã�?-1)ですã?
636 *
637 * @og.rev 4.1.1.0 (2008/02/04) 新規追åŠ?
638 * @og.rev 4.1.1.0 (2008/02/19) setUseDynamicOC �setDynamicOCNo
639 *
640 * @param ocNo 動的なマã?カーラインの基準シリーズ番号
641 */
642 public void setDynamicOCNo( final int ocNo ) {
643 dynamicOCNo = ocNo;
644 }
645
646 /**
647 * マã?カーラインの ValueMarker オブジェクトé?列を返しますã?
648 *
649 * マã?カーライン は、markValues(double配å?) と markColors(Color配å?)
650 * より、ValueMarker オブジェクトをã€??次配å?化してã�?��ますã?
651 * useMarkAnchor == true の場合ã?、設定å?(markValues) の Anchor ã‚?
652 * 表示しますã?位置は、TextAnchor.BASELINE_LEFT 固定ですã?
653 * dynamicOCNo が指定された場合ã?、最下位ã?閾値は使用しませんã€?
654 *
655 * @og.rev 4.1.1.0 (2008/02/04) useMarkAnchor 属æ?追åŠ?
656 * @og.rev 4.1.1.0 (2008/02/04) 動的なオーバã?カラー useDynamicOC 属æ?追åŠ?
657 *
658 * @return マã?カーラインのオブジェクトé?åˆ?not null)
659 * @see java.awt.Color#BLACK
660 * @see #setMarkValues( String[] )
661 * @see #setMarkColors( String[] )
662 * @see #setUseMarkAnchor( boolean )
663 */
664 protected ValueMarker[] getValueMarkers() {
665 List<ValueMarker> markerList = new ArrayList<ValueMarker>();
666 int size = (markValues == null) ? 0 : markValues.length;
667 for( int i=0; i<size; i++ ) {
668 if( i != dynamicOCadrs ) {
669 ValueMarker marker = new ValueMarker( markValues[i] );
670 marker.setPaint( markColors[i] );
671 if( useMarkAnchor ) {
672 marker.setLabel( String.valueOf( markValues[i] ) );
673 marker.setLabelTextAnchor( TextAnchor.BASELINE_LEFT );
674 }
675 markerList.add( marker );
676 }
677 }
678
679 return markerList.toArray( new ValueMarker[markerList.size()] );
680 }
681
682 /**
683 * チャートã?縦軸のæœ?°�å?をセãƒ?ƒˆしまã�?初期値:自動計ç®?ã€?
684 *
685 * 何もæŒ?®šしなã�??合ã?、データのæœ?°�å?から、è?動的に計算しますã?
686 *
687 * @param lowBnd 縦軸のæœ?°�å?
688 * @see #setUpperBound( String )
689 */
690 public void setLowerBound( final String lowBnd ) {
691 if( lowBnd != null && lowBnd.length() > 0 ) {
692 lowerBound = lowBnd;
693 }
694 }
695
696 /**
697 * チャートã?縦軸のæœ?¤§値をセãƒ?ƒˆしまã�?初期値:自動計ç®?ã€?
698 *
699 * 何もæŒ?®šしなã�??合ã?、データのæœ?¤§値から、è?動的に計算しますã?
700 *
701 * @param upBnd 縦軸のæœ?¤§値
702 * @see #setLowerBound( String )
703 */
704 public void setUpperBound( final String upBnd ) {
705 if( upBnd != null && upBnd.length() > 0 ) {
706 upperBound = upBnd;
707 }
708 }
709
710 /**
711 * チャートã?縦軸の目盛ã?å¹?‚’セãƒ?ƒˆしまã�?初期値:自動計ç®?ã€?
712 *
713 * 何もæŒ?®šしなã�??合ã?、データのç¯?›²から、è?動的に計算しますã?
714 *
715 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
716 *
717 * @param size 縦軸のチック(目ç›?のå¹?
718 */
719 public void setTickSize( final String size ) {
720 if( size != null && size.length() > 0 ) {
721 tickSize = size;
722 }
723 }
724
725 /**
726 * バã?チャートã?グラãƒ??ション処ç�?‚’行うかどã�?�‹[true/false]をセãƒ?ƒˆしまã�?初期値:true)ã€?
727 *
728 * 通常のバã?チャートã?、単ä¸?‰²表示で表されますが、これにグラãƒ??ション効果を
729 * 付加するかどã�?�‹を指定しますã?
730 * 通常のバã?チャートが、少しきれã�?�«見えますã?
731 * 初期値は、true(グラãƒ??ション効果を付与すã‚?ですã?
732 *
733 * @param useGrad グラãƒ??ション処ç�?[true:する/false:しない]
734 */
735 public void setUseGradient( final boolean useGrad ) {
736 useGradient = useGrad;
737 }
738
739 /**
740 * バã?チャートã?グラãƒ??ション処ç�?‚’行うかどã�?�‹を取得しますã?
741 *
742 * 通常のバã?チャートã?、単ä¸?‰²表示で表されますが、これにグラãƒ??ション効果を
743 * 付加するかどã�?�‹を指定しますã?
744 * 通常のバã?チャートが、少しきれã�?�«見えますã?
745 * 初期値は、false(使用しなã�?ですã?
746 *
747 * @return グラãƒ??ション処ç�?する:true/しなã�?false)
748 * @see #setUseGradient( boolean )
749 */
750 protected boolean isUseGradient() { return useGradient; }
751
752 /**
753 * ラインチャートã?ポイントを四角表示するかどã�?�‹を指定しまã�?初期値:false)ã€?
754 *
755 * ラインチャートã?ã€??常、線å?で表され、各ポイントにつã�?�¦もã?線å?で接続されますã?
756 * shapesVisible ã‚?true に設定すると、各ポイントが、線上に四角く表示されã€?
757 * そã?ポイントã?位置をã?容易に判断出来るよã�?�«なりますã?
758 * 初期値は、ã?ーカーをå?れませんã€?
759 *
760 * @param shVisible ポイントを四角表示するかどã�?�‹
761 */
762 public void setShapesVisible( final boolean shVisible ) {
763 shapesVisible = shVisible;
764 }
765
766 /**
767 * ラインチャートã?ポイントを四角表示するかどã�?�‹を取得しますã?
768 *
769 * ラインチャートã?ã€??常、線å?で表され、各ポイントにつã�?�¦もã?線å?で接続されますã?
770 * shapesVisible ã‚?true に設定すると、各ポイントが、線上に四角く表示されã€?
771 * そã?ポイントã?位置をã?容易に判断出来るよã�?�«なりますã?
772 * 初期値は、ã?ーカーをå?れませんã€?
773 *
774 * @return ポイントを四角表示するかどã�?�‹
775 * @see #setShapesVisible( boolean )
776 */
777 protected boolean isShapesVisible() { return shapesVisible; }
778
779 /**
780 * ãƒ??タ毎にShapeをå?り替える時ã?色の繰返しパターンを文字å?配å?でæŒ?®šしますã?
781 *
782 * HybsLine でのみ使用可能ですã?
783 * これは、データそã?もã?がã?繰返し性のある場合に、その繰返し性に対応しã�?
784 * 形状のShape を表示させるå?合に使用しますã?
785 * 繰返しShapeの形状は、JFreeChart のシリーズ毎ã?繰返し標準形状を使用しますã?
786 * 現在のバã?ジョンではã€?¼‘0å?までの繰返しに対応可能ですã?
787 * 繰返し色をã?æŒ?®šしたå?ã�?�‘ã€??に使用されてã�?��ますã?
788 *
789 * æŒ?®š文字å?は、java.awt.Color クラスのstatic フィールド名でæŒ?®šしますã?
790 * BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY ,
791 * MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , (PURPLE) が指定できますã?
792 * またã?#XXXXXX形式ã?16bitRGB表è¨?でも指定可能ですã?
793 *
794 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
795 *
796 * @param colors ãƒ??タ毎ã?色の繰返しパターン(æ–?—å?配å?)
797 * @see java.awt.Color#BLACK
798 */
799 public void setShapeColors( final String[] colors ) {
800 if( colors != null && colors.length > 0 ) {
801 int size = colors.length;
802 shapeColors = new Color[size];
803 for( int i=0; i<size; i++ ) {
804 shapeColors[i] = StringUtil.getColorInstance( colors[i] );
805 }
806 }
807 }
808
809 /**
810 * shapeの大きさをå?çŽ?Œ‡定で変更しまã�?初期値:null)ã€?
811 *
812 * ラインチャートã?Shape(å�?‚°ラフã?ポイントã?マã?カー)の大きさはã€??常はã€?
813 * 自動設定されますã?
814 * こã?大きさをã?倍率æŒ?®šで、変更可能ですã?
815 * æŒ?®šã?、double 型ですã?
816 * 初期値は、null は、スケール変更しません(自動設定ã?ままの大きさ)
817 *
818 * @og.rev 4.1.1.0 (2008/02/04) 新規追åŠ?
819 *
820 * @param scale shapeの大きさの倍率
821 */
822 public void setShapeScale( final String scale ) {
823 shapeScale = scale;
824 }
825
826 /**
827 * ラインチャートã?線をドットラインにするかどã�?�‹を指定しまã�?初期値:false)ã€?
828 *
829 * ラインチャートã?ã€??常、線å?で表されますã?
830 * これに、点線で表すことで、グラフã?違いをã?色ã�?�‘でなく形状でも識別
831 * しやすくすることが可能ですã?
832 * 初期値は、線å?ですã?
833 *
834 * @param useDotLine ドットラインにするかどã�?�‹
835 */
836 public void setUseDottedLine( final boolean useDotLine ) {
837 useDottedLine = useDotLine;
838 }
839
840 /**
841 * ラインチャートã?線をドットラインにするかどã�?�‹を取得しますã?
842 *
843 * ラインチャートã?ã€??常、線å?で表されますã?
844 * これに、点線で表すことで、グラフã?違いをã?色ã�?�‘でなく形状でも識別
845 * しやすくすることが可能ですã?
846 * 初期値は、線å?ですã?
847 *
848 * @return ドットラインにするかどã�?�‹
849 * @see #setUseDottedLine( boolean )
850 */
851 protected boolean isUseDottedLine() { return useDottedLine; }
852
853 /**
854 * è¤?•°チャート描画時ã?チャート色の繰返しパターンを文字å?配å?でæŒ?®šしますã?
855 *
856 * 通常、è¤?•°のチャートを同時に表示させるå?合ã?、縦軸がå?通であればã€?
857 * ?‘回のSelectåˆ?�§è¤?•°ãƒ??タを取得しますã?
858 * こã?、データをシリーズと呼んでおり、これを区別する為に、色をå?けますã?
859 * 初期値は、JFreeChart がè?動で割り振りますã?
860 * これをã?外部からCVS形式で、カンマ区åˆ?‚Šで色コードをæŒ?®šしますã?
861 * æŒ?®šデータが多い場合ã?、多いåˆ??色は使用されません。少なã�??合ã?ã€?
862 * é ?•ªに繰り返して使用されますã?
863 * 例えばã€?¼‘色ã�?�‘æŒ?®šしたå?合ã?、すべてのシリーズが同じ色で表されますã?
864 *
865 * æŒ?®š文字å?は、java.awt.Color クラスのstatic フィールド名でæŒ?®šしますã?
866 * BLACK , BLUE , CYAN , DARK_GRAY , GRAY , GREEN , LIGHT_GRAY ,
867 * MAGENTA , ORANGE , PINK , RED , WHITE , YELLOW , (PURPLE) が指定できますã?
868 * またã?#XXXXXX形式ã?16bitRGB表è¨?でも指定可能ですã?
869 *
870 * @param colors チャート色の繰返しパターン(æ–?—å?配å?)
871 * @see java.awt.Color#BLACK
872 */
873 public void setSeriesColors( final String[] colors ) {
874 if( colors != null && colors.length > 0 ) {
875 int size = colors.length;
876 seriesColors = new Color[size];
877 for( int i=0; i<size; i++ ) {
878 seriesColors[i] = StringUtil.getColorInstance( colors[i] );
879 }
880 }
881 }
882
883 /**
884 * è¤?•°チャート描画時ã?チャート色の繰返しパターンをColor配å?でæŒ?®šしますã?
885 *
886 * @return チャート色の繰返しパターン(Color配å?)
887 * @see #setSeriesColors( String[] )
888 */
889 protected Color[] getSeriesColors() {
890 return seriesColors ;
891 }
892
893 /**
894 * Value(縦軸)のラベルを表示するかどã�?�‹を指定しまã�?初期値:true[表示する])ã€?
895 *
896 * ValueAxis にて設定される、縦軸æƒ??の、ラベルを表示するかどã�?�‹æŒ?®šしますã?
897 * 初期値は、true(表示する)ですã?
898 *
899 * @og.rev 4.0.2.0 (2007/12/20) 新規追åŠ?
900 *
901 * @param labelsVisible Value(縦軸)のラベルを表示するかどã�?�‹
902 */
903 public void setValueLabelsVisible( final boolean labelsVisible ) {
904 isLabelsVisible = labelsVisible;
905 }
906
907 /**
908 * Value(縦軸)のマã?カーを表示するかどã�?�‹を指定しまã�?初期値:true[表示する])ã€?
909 *
910 * ValueAxis にて設定される、縦軸æƒ??の、ã?ーカーを表示するかどã�?�‹æŒ?®šしますã?
911 * 初期値は、true(表示する)ですã?
912 *
913 * @og.rev 4.0.2.0 (2007/12/20) 新規追åŠ?
914 *
915 * @param marksVisible Value(縦軸)のマã?カーを表示するかどã�?�‹
916 */
917 public void setValueMarksVisible( final boolean marksVisible ) {
918 isMarksVisible = marksVisible;
919 }
920
921 /**
922 * ãƒ??タの値(itemText)を表示するかどã�?�‹[true/false/last]を指定しまã�?初期値:false[表示しない])ã€?
923 *
924 * CategoryItemRenderer 関連のグラフã?設定å?をグラフ上に表示するかどã�?�‹ã‚?
925 * æŒ?®šしますã?
926 * true に設定したå?合ã?通常の場合ã?、すべてのシリーズにラベル表示されますã?
927 * false に設定すると、表示されませんã€?
928 * last を設定すると、各シリーズのæœ?¾Œã?値のみ表示されますã?
929 * ChartCreate クラスに、seriesPikup が設定されてã�?‚‹場合ã?、指定ã?シリーズ
930 * のみの設定å?を表示しã?他ã?値は、表示しませんã€?
931 * 同様に、dynamicOCNo が指定されてã�?‚‹場å�?動的なマã?カーライン)
932 * æŒ?®šã?シリーズはã€?–¾値として使用されるためã?設定å?は表示されませんã€?
933 * ラベルの表示位置は、表示する線グラフã?傾きに応じてラベルの表示場æ‰?‚’
934 * 変えますã?山形、右坂ã?谷形、左å�?に応じて、上中、下右、下中、上右 に
935 * 位置を設定しますã?右にずらすã?はã€?0 ピクセル固定ですã?
936 * 初期値は、false(表示しなã�?ですã?
937 *
938 * @og.rev 4.1.1.0 (2008/02/04) 新規追åŠ?
939 * @og.rev 4.1.2.0 (2008/03/12) æ–?—å?のまま、受け取りるように変更
940 *
941 * @param visible ãƒ??タの値の表示のさせ方 [true/false/last]
942 * @see ChartCreate#setSeriesPikup( int )
943 */
944 public void setItemLabelVisible( final String visible ) {
945 if( "true".equalsIgnoreCase( visible ) ) {
946 isItemValVisible = true;
947 }
948 else if( "last".equalsIgnoreCase( visible ) ) {
949 isItemValVisible = true;
950 isItemLastVisible = true;
951 }
952 else if( visible != null && !"false".equalsIgnoreCase( visible ) ) {
953 String errMsg = "itemLabelVisible は、ã?true,false,last」から指定してくださいã€?"
954 + visible + "]";
955 throw new HybsSystemException( errMsg );
956 }
957 }
958
959 /**
960 * ãƒ??タの値(itemText)の表示に桁区åˆ?‚Šæ–?—を使用するかどã�?�‹を指定しますã?
961 *
962 * itemLabelVisible=true 時に、表示されるデータ値ラベルでã€?
963 * NumberFormat してã�?�¾すがã€?¼“桁区åˆ?‚Šæ–??123,456,789.0) の
964 * 区åˆ?‚Š記号を表示するかどã�?�‹を指定しますã?
965 * true を指定すると、表示しますã?false では、表示しませんã€?
966 * 初期値は、true(使用する)ですã?
967 *
968 * @og.rev 4.1.2.0 (2008/03/12) 新規追åŠ?
969 *
970 * @param used 桁区åˆ?‚Šæ–?—を使用するかどã�?�‹
971 */
972 public void setUseItemLabelSep( final boolean used ) {
973 useItemLabelSep = used;
974 }
975
976 /**
977 * 縦軸の表示領域INSET値(double)を指定しますã?
978 *
979 * 縦軸æ–?—表示領域(NumberAxis)のå¹??追åŠ??を設定しますã?
980 * これはã€??常の表示領域の左側にスペã?スを挿入しますã?
981 * あくまで、追åŠ?�™るå?なので、文字ã?長さã?含まれませんã€?
982 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
983 *
984 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
985 *
986 * @param inset Value(縦軸)の表示領域INSET値
987 */
988 public void setValueInset( final String inset ) {
989 valueInset = inset;
990 }
991
992 /**
993 * BOXチャートã?バã?å¹?double)を指定しますã?
994 *
995 * BOXチャートã?バã?å¹?double)を指定しますã?
996 * 設定されるのは、org.jfree.chart.renderer.category.BarRenderer ã‚?
997 * 使用した描画のみですã?
998 * 棒グラフã?バã?å¹?Œ‡定ã?、直接、CategoryItemRendererState に設定してã�?�¾すã?
999 * 通常は、barMaxWidth(0.0??.0)とbarItemMargin(0.0??.0)を用ã�?�¦比率でæŒ?®šしますã?
1000 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
1001 *
1002 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
1003 *
1004 * @param width BOXチャートã?バã?å¹?double)
1005 */
1006 public void setBarWidth( final String width ) {
1007 barWidth = width;
1008 }
1009
1010 /**
1011 * BOXチャートã?バã?å¹?double)を取得しますã?
1012 *
1013 * 設定されるのは、org.jfree.chart.renderer.category.BarRenderer ã‚?
1014 * 使用した描画のみですã?
1015 * 棒グラフã?バã?å¹?Œ‡定ã?、直接、CategoryItemRendererState に設定してã�?�¾すã?
1016 * 通常は、barMaxWidth(0.0??.0)とbarItemMargin(0.0??.0)を用ã�?�¦比率でæŒ?®šしますã?
1017 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
1018 *
1019 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
1020 *
1021 * @return BOXチャートã?バã?å¹?double)のæ–?—å?
1022 */
1023 protected String getBarWidth() {
1024 return barWidth ;
1025 }
1026
1027 /**
1028 * BOXチャートã?バã?å¹??æœ?¤§値(0.0??.0)を指定しますã?
1029 *
1030 * BOXチャートã?バã?å¹??比率のæœ?¤§値を指定しますã?
1031 * 表示領域を1として小数点以下ã?数値で棒ã?å¹?‚’設定しますã?
1032 * 設定したå¹?�«無ç�?�Œある時ã?適当なサイズに調整されますã?
1033 * (小さくしたときには棒が線ã?ようになã‚?
1034 * 設定されるのは、org.jfree.chart.renderer.category.BarRenderer ã‚?
1035 * 使用した描画のみですã?
1036 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
1037 *
1038 * @og.rev 4.0.2.0 (2007/12/20) 新規追åŠ?
1039 *
1040 * @param barWidth BOXチャートã?バã?å¹??æœ?¤§値(0.0??.0)
1041 */
1042 public void setBarMaxWidth( final String barWidth ) {
1043 maxBarWidth = barWidth;
1044 }
1045
1046 /**
1047 * BOXチャートã?バã?アイãƒ?ƒ のマã?ジン(0.0??.0)を指定しますã?
1048 *
1049 * BOXチャートã?バã?アイãƒ?ƒ のマã?ジンの比率を指定しますã?
1050 * 棒ã?間を表示領域を1として小数点以下ã?数値でå¹?‚’設定しますã?
1051 * 無ç�?�Œある時ã?適当なサイズに調整されますã?
1052 * barMaxWidth より優先されますã?
1053 * 設定されるのは、org.jfree.chart.renderer.category.BarRenderer ã‚?
1054 * 使用した描画のみですã?
1055 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
1056 *
1057 * @og.rev 4.0.2.0 (2007/12/20) 新規追åŠ?
1058 *
1059 * @param margin BOXチャートã?バã?アイãƒ?ƒ のマã?ジン(0.0??.0)
1060 */
1061 public void setBarItemMargin( final String margin ) {
1062 itemMargin = margin;
1063 }
1064
1065 /**
1066 * 表示下限値(これ以下ã?ãƒ??タは未表示)の値(double)を指定しますã?
1067 *
1068 * HybsLine でのみ使用可能ですã?
1069 * こã?設定å?以下ã?ãƒ??タは、存在しなã�?‰±ã�?�¨しますã?
1070 * Lineを引くときã?こã?ãƒ??タと、存在してã�?‚‹ãƒ??タ間にラインは引かれませんã€?
1071 * 何もæŒ?®šしなã�??合ã?、設定しませんã€?
1072 *
1073 * @og.rev 4.0.3.0 (2008/01/07) 新規追åŠ?
1074 *
1075 * @param limit 表示下限値(これ以下ã?ãƒ??タは未表示)
1076 */
1077 public void setVisibleLimit( final String limit ) {
1078 visibleLimit = limit;
1079 }
1080
1081 /**
1082 * グラフã?書きå?し位置の調整比率を指定しますã?
1083 *
1084 * グラフを描画する場合ã?、書きå?し位置を少しずらしますã?
1085 * これは、グラフã?å¹?�«対して、比率でæŒ?®šしますã?
1086 * 0.0(初期値)の場合ã?、å?期描画位置である、CategoryAnchor.Middle と
1087 * 同じç®?‰€から、書きå?されますã?
1088 * 1.0 の場合ã?中å¿?�‹らã?グラフå¹??半å?が加算されã?END位置にå¯?‚Šますã?
1089 * 同様にã€?1.0 の場合ã?、グラフå¹??半å?が減算されã?START 位置になりますã?
1090 * つまりã?中å¿?�‹らã?グラフå¹??半å?単位で、前方/後方にずらす事が出来ますã?
1091 * 書きå?し位置 ??中å¿?Middle) + (domainMargin)?Šå¹???
1092 * 初期値はã€?.0(真ん中:MIDDLE)ですã?
1093 *
1094 * @og.rev 4.1.1.0 (2008/02/14) 新規追åŠ?
1095 *
1096 * @param margin グラフã?書きå?し位置の調整比率
1097 */
1098 public void setDomainMargin( final double margin ) {
1099 domainMargin = margin;
1100 }
1101
1102 /**
1103 * 時刻を表すå?合ã?表現の仕方を指定しまã�?初期値:null)ã€?
1104 *
1105 * HybsNumberAxis にオーバã?ライドすã‚?時間を表示する DecimalFormat のå†?ƒ¨クラスを利用するに当たりã?
1106 * 時刻の表示方法をæŒ?®šしますã?
1107 * 外部から与える数字ã?ã€??続してã�?‚‹å¿?¦�があるためã€?¼‘0é?数ですã?
1108 * たとえã?ã€?700 â†?17:00 , 2150 â†?21:30 とã�?�†感じですã?
1109 * 2400 をè¶?�ˆると日付違ã�?�«なりますã?
1110 *
1111 * 英語表è¨?:)と日本語表è¨?æ™?の区別とã€?4時間をè¶?�ˆるå?合ã?表示方法によってã€?¼–種類ã?パターンが存在しますã?
1112 * ã€?1:そã?ままã€?4:00 となりã?åŠ?®—されてã�?��ã€?
1113 * ã€?2:そã?ままã€?:00 に戻るã?(日付ã?無è¦?
1114 * ã€?3:そã?ままã€? 00:00 と日付が付与されるã€?
1115 * ã€?1:そã?ままã€?4æ™?0åˆ?となりã?åŠ?®—されてã�?��ã€?
1116 * ã€?2:そã?ままã€?0æ™?0åˆ?に戻るã?(日付ã?無è¦?
1117 * ã€?3:そã?ままã€?日 00æ™?0åˆ?と日付が付与されるã€?
1118 * 初期値は、使用しなã�?-1)ですã?
1119 *
1120 * @og.rev 5.5.2.1 (2012/05/07) 新規追åŠ?
1121 *
1122 * @param type 時刻の表示方æ³?[E1/E2/E3/H1/H2/H3]
1123 */
1124 public void setTimeFormatType( final String type ) {
1125 timeFormatType = type;
1126 }
1127
1128 /**
1129 * ラベルの表示向きを縦にするかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
1130 *
1131 * ChartCreate の rotationLabel は、角度を指定できましたがã?NumberAxis ではã€?
1132 * 縦にするかどã�?�‹のæŒ?®šしかできませんã€?
1133 * ここでは、true を指定するとラベルは、縦書きになりますã?
1134 * 初期値は、false(横書ã�?ですã?
1135 *
1136 * @og.rev 5.5.2.1 (2012/05/07) 新規追åŠ?
1137 *
1138 * @param useVLavels ラベルの表示向き [false:横書ã�?:true:縦書き]
1139 */
1140 public void setUseVerticalLabels( final boolean useVLavels ) {
1141 useVerticalLabels = useVLavels;
1142 }
1143
1144 /**
1145 * MeterPlot にå¿?¦�なæƒ??を設定しますã?
1146 *
1147 * これは、ChartDataset(こã?クラス)にå¿?¦�な getterメソãƒ?ƒ‰を用意してã€?
1148 * 利用側のクラス(ChartPlot_Pie) でセãƒ?ƒˆすべきですが、メソãƒ?ƒ‰が増えるã?でã€?
1149 * こちらに MeterPlotオブジェクトを渡して、メソãƒ?ƒ‰数を減らそうとしてã�?‚‹ã�?�‘ですã?
1150 *
1151 * lowerBound は、最小å?(low)
1152 * upperBound は、最大値(upp)
1153 * markValues 値,A,B,C
1154 * markOverColors GREEN,BLUE,YELLOW,RED
1155 * low-A⇒GREEN , A-B⇒BLUE , B-C⇒YELLOW , C-upp⇒RED で、MeterIntervalを指定しますã?
1156 *
1157 * shapeColors に、NeedlePaint,ValuePaint,TickPaint,TickLabelPaint,DialBackgroundPaint,DialOutlinePaint を指定できますã?
1158 * 初期値は、BLACK,BLACK,BLACK,BLACK,透æ?,BLACK ですã?
1159 * needleType に、DialShape のæŒ?®šキ?°?œー??¾žとして、CHORD,CIRCLE,PIE が指定可能ですã?
1160 * æŒ?®š方法としては、taglib上で、chartType æŒ?®š時に、Meter_PIE などとæŒ?®šしますã?
1161 * shapeScale は、MeterAngle(メーターの表示角度) を指定できますã?
1162 * valueLabel は、MeterInterval の規定å?(値,A,B,C) に対応したå?例ラベルですã?
1163 *
1164 * @og.rev 5.7.8.0 (2014/07/04) 新規追åŠ?
1165 *
1166 * @return 値をセãƒ?ƒˆし終わったã?MeterPlotオブジェクãƒ?
1167 */
1168 protected Plot makeMeterPlot() {
1169 MeterPlot mplot = new MeterPlot();
1170
1171 // ç¯?›²(上限、下限)æŒ?®?
1172 double low= lowerBound == null ? 0.0 : Double.parseDouble( lowerBound ) ;
1173 double upp= upperBound == null ? 100.0 : Double.parseDouble( upperBound ) ;
1174 mplot.setRange( new Range( low, upp ) );
1175
1176 // markValues 値,A,B,C
1177 // markOverColors GREEN,BLUE,YELLOW,RED
1178 // low-A⇒GREEN , A-B⇒BLUE , B-C⇒YELLOW , C-upp⇒RED
1179 // ç¯?›²のæŒ?®?MeterInterval)は、markValues にã€?¼’番目の値が設定された場合に行うã€?
1180 if( markValues != null && markValues.length > 1 ) {
1181 int size = markValues.length ;
1182 if( markOverColors != null && size == markOverColors.length ) {
1183
1184 // BasicStroke に、大きな値を指定するとã€?–‹始位置がずれてしまã�??
1185 BasicStroke bs = new BasicStroke( 2.0F );
1186
1187 // valueLabel は、markValues の規定å?(A,B,C) に対応したå?例ラベルですã?
1188 String[] lbls = StringUtil.csv2Array( valueLabel );
1189 int lblSize = lbls.length ;
1190 int j = 0; // ラベルの配å?番号
1191
1192 double st = low;
1193 for( int i=1; i<=size; i++ ) {
1194 double en = i<size ? markValues[i] : upp ;
1195 Color co1 = markOverColors[i-1];
1196 Color co2 = new Color( co1.getRed() , co1.getGreen() , co1.getBlue() , 128 ); // 透過色(半é?æ˜?
1197 String lbl = j < lblSize ? lbls[j++] : "" ;
1198 mplot.addInterval( new MeterInterval( lbl, new Range( st, en ), co1, bs, co2 ) );
1199 st = en ;
1200 }
1201 }
1202 else {
1203 String errMsg = "Meter で、markValues をè¤?•°æŒ?®šするå?合ã?、同じ数のmarkOverColorsのæŒ?®šがå¿?¦�ですã?"
1204 + HybsSystem.CR ;
1205 throw new HybsSystemException( errMsg );
1206 }
1207 }
1208
1209 // ç¯?›²のæŒ?®?MeterInterval) のサンプル
1210 // mplot.addInterval(new MeterInterval("Battery LOW", new Range(0.0, 10.0),
1211 // Color.RED, new BasicStroke(2.0F), new Color(255, 0, 0, 128)));
1212 // mplot.addInterval(new MeterInterval("Moderate", new Range(10.0, 90.0),
1213 // Color.YELLOW, new BasicStroke(2.0F), new Color(255, 255, 0, 64)));
1214 // mplot.addInterval(new MeterInterval("Battery FULL", new Range(90.0, 100.0),
1215 // Color.GREEN, new BasicStroke(2.0F), new Color(0, 255, 0, 64)));
1216
1217 // TickSize を設定ã?null ならã?、å?期å?を使ã�??で、設定しなã�??
1218 if( tickSize != null ) {
1219 mplot.setTickSize( Double.parseDouble( tickSize ) );
1220 }
1221
1222 // shapeColors に、NeedlePaint,ValuePaint,TickPaint,TickLabelPaint,DialBackgroundPaint,DialOutlinePaint を指定できますã?
1223 // NeedlePaint , ValuePaint , TickPaint , TickLabelPaint , DialBackgroundPaint(=透æ?) , DialOutlinePaint
1224 Color[] shCols = new Color[] { Color.BLACK , Color.BLACK , Color.BLACK , Color.BLACK , new Color(255, 255, 255, 0), Color.BLACK }; // 初期値
1225 if( shapeColors != null && shapeColors.length > 0 ) {
1226 for( int i=0; i<shapeColors.length; i++ ) {
1227 shCols[i] = shapeColors[i];
1228 }
1229 }
1230 mplot.setNeedlePaint( shCols[0] ); // 針ã?色
1231 mplot.setValuePaint( shCols[1] ); // 値の色
1232 mplot.setTickPaint( shCols[2] ); // メモリの色
1233 mplot.setTickLabelPaint( shCols[3] ); // メモリのæ–?—ã?色
1234 mplot.setDialBackgroundPaint( shCols[4] ); // 背景色
1235 mplot.setDialOutlinePaint( shCols[5] ); // セãƒ?ƒˆしてもã?表示が変わらなã�??
1236
1237 // needleType 属æ?で、DialShape を指定できますã?
1238 DialShape dshape = DialShape.CIRCLE ; // 初期値
1239 if( needleType != null ) {
1240 if( "CHORD".equalsIgnoreCase( needleType ) ) { dshape = DialShape.CHORD; }
1241 else if( "CIRCLE".equalsIgnoreCase( needleType ) ) { dshape = DialShape.CIRCLE; } // 初期値
1242 else if( "PIE".equalsIgnoreCase( needleType ) ) { dshape = DialShape.PIE; }
1243 }
1244 mplot.setDialShape( dshape ); // CHORD,CIRCLE,PIE
1245
1246 // shapeScale は、MeterAngle(メーターの表示角度) を指å®?
1247 if( shapeScale != null ) {
1248 mplot.setMeterAngle( Integer.parseInt( shapeScale ) );
1249 }
1250
1251 // isLabelsVisible æŒ?®?
1252 mplot.setTickLabelsVisible( isLabelsVisible );
1253
1254 // そã?他決め打ちの値設å®?
1255 // mplot.setValueFont(new Font("Arial", Font.BOLD, 14));
1256 // mplot.setTickLabelFont(new Font("Arial", Font.BOLD, 14));
1257
1258 mplot.setDataset( (ValueDataset)dataset );
1259 return mplot;
1260 }
1261
1262 /**
1263 * ThermometerPlot にå¿?¦�なæƒ??を設定しますã?
1264 *
1265 * markValues 値,A,B
1266 * markOverColors GREEN,YELLOW,RED
1267 * xxx-low⇒GRAY , low-A⇒GREEN , A-B⇒YELLOW , B-upp⇒RED , upp-xxx⇒GRAY で、SubrangePaintを指定しますã?
1268 * markOverColors を指定しなã�??合ã?、ThermometerPlot.NORMAL , WARNING , CRITICAL がé?にæŒ?®šされますã?
1269 * これは、GREEN,YELLOW,RED になりますã?
1270 *
1271 * shapeColors に、ValuePaint,ThermometerPaint(温度計ã?æž?·?,MercuryPaint を指定できますã?
1272 *
1273 * @og.rev 5.7.8.0 (2014/07/04) 新規追åŠ?
1274 *
1275 * @return 値をセãƒ?ƒˆし終わったã?å…??ThermometerPlotオブジェクãƒ?
1276 */
1277 protected Plot makeThermometerPlot() {
1278 ThermometerPlot tplot = new ThermometerPlot();
1279
1280 // ç¯?›²(上限、下限)æŒ?®?
1281 double low= lowerBound == null ? 0.0 : Double.parseDouble( lowerBound ) ;
1282 double upp= upperBound == null ? 100.0 : Double.parseDouble( upperBound ) ;
1283 tplot.setRange( low , upp );
1284
1285 // markValues 値,A,B,C
1286 // markOverColors GREEN,YELLOW,RED
1287 // low-A⇒Red , A-B⇒Yellow , B-C⇒Green , C-upp⇒Blue
1288 // ç¯?›²のæŒ?®?MeterInterval)は、markValues にã€?¼’番目の値が設定された場合に行うã€?
1289 if( markValues != null && markValues.length > 1 ) {
1290 int size = markValues.length ;
1291
1292 // markOverColors が存在して、å?数がä¸??してã�?‚Œば、true
1293 boolean inCols = ( markOverColors != null && size == markOverColors.length ) ;
1294 if( inCols || markOverColors == null || markOverColors.length == 0 ) {
1295 double st = low;
1296 for( int i=1; i<=size; i++ ) {
1297 double en = i<size ? markValues[i] : upp ;
1298 // 第ä¸?¼•数は、i(é ?•ª)ではなくã?サブレンジ番号(ThermometerPlot.NORMAL , WARNING , CRITICAL)
1299 tplot.setSubrange( i-1, st, en );
1300
1301 if( inCols ) {
1302 Color co1 = markOverColors[i-1];
1303 tplot.setSubrangePaint( i-1,co1 );
1304 }
1305 st = en ;
1306 }
1307 }
1308 else {
1309 String errMsg = "Meter で、markValues をè¤?•°æŒ?®šするå?合ã?、同じ数のmarkOverColorsのæŒ?®šがå¿?¦�ですã?"
1310 + HybsSystem.CR ;
1311 throw new HybsSystemException( errMsg );
1312 }
1313 }
1314
1315 // ç¯?›²のæŒ?®?setSubrange) のサンプル
1316 // tplot.setSubrange(ThermometerPlot.NORMAL , 0.0, 55.0);
1317 // tplot.setSubrange(ThermometerPlot.WARNING , 55.0, 75.0);
1318 // tplot.setSubrange(ThermometerPlot.CRITICAL, 75.0, 150.0);
1319
1320 // shapeColors に、ValuePaint,ThermometerPaint(温度計ã?æž?·?,MercuryPaint を指定できますã?
1321 // ValuePaint , ThermometerPaint , MercuryPaint
1322 Color[] shCols = new Color[] { Color.BLACK , Color.BLACK , Color.GRAY }; // 初期値
1323 if( shapeColors != null && shapeColors.length > 0 ) {
1324 for( int i=0; i<shapeColors.length; i++ ) {
1325 shCols[i] = shapeColors[i];
1326 }
1327 }
1328 tplot.setValuePaint( shCols[0] ); // 値の色
1329 tplot.setThermometerPaint( shCols[1] ); // 温度計ã?æž?·?
1330 tplot.setMercuryPaint( shCols[2] ); // オーバã?時ã?色
1331
1332 // tplot.setValueFont(new Font("Arial", 1, 14));
1333
1334 tplot.setDataset( (ValueDataset)dataset );
1335 return tplot;
1336 }
1337
1338 /**
1339 * CompassPlot にå¿?¦�なæƒ??を設定しますã?
1340 *
1341 * shapeColors に、Compassの色を指定できますã?(å†?ƒ¨çš?�«は、SeriesPaint にセãƒ?ƒˆしてã�?�¾ã�?
1342 * SeriesPaint,SeriesOutlinePaint,RoseCenterPaint,RoseHighlightPaint,RosePaint を指定しますã?
1343 * needleType には、MeterNeedle のæŒ?®šキ?°?œー??¾žとして、下記ã??™種類がæŒ?®š可能ですã?
1344 * æŒ?®šã?、Arrow,Line,Long,Pin,Plum,Pointer,Ship,Wind,Arrow,MiddlePin とã�?�†æ–?—å?ですã?
1345 * 初期値は、Pointer ですã?
1346 *
1347 * @og.rev 5.7.8.0 (2014/07/04) 新規追åŠ?
1348 *
1349 * @return 値をセãƒ?ƒˆし終わったã?å…??CompassPlotオブジェクãƒ?
1350 */
1351 protected Plot makeCompassPlot() {
1352 CompassPlot cplot = new CompassPlot();
1353
1354 // Series æŒ?®šã?ã€? 固å®?
1355 final int serNo = 0;
1356
1357 // needleType 属æ?で、SeriesNeedle 番号を指定できますã?
1358 int sNeedle = 5 ; // Pointer
1359 if( needleType != null ) {
1360 if( "Arrow".equalsIgnoreCase( needleType ) ) { sNeedle = 0; } // 0 = ArrowNeedle;
1361 else if( "Line".equalsIgnoreCase( needleType ) ) { sNeedle = 1; } // 1 = LineNeedle;
1362 else if( "Long".equalsIgnoreCase( needleType ) ) { sNeedle = 2; } // 2 = LongNeedle;
1363 else if( "Pin".equalsIgnoreCase( needleType ) ) { sNeedle = 3; } // 3 = PinNeedle;
1364 else if( "Plum".equalsIgnoreCase( needleType ) ) { sNeedle = 4; } // 4 = PlumNeedle;
1365 else if( "Pointer".equalsIgnoreCase( needleType ) ) { sNeedle = 5; } // 5 = PointerNeedle;
1366 else if( "Ship".equalsIgnoreCase( needleType ) ) { sNeedle = 6; } // 6 = ShipNeedle;
1367 else if( "Wind".equalsIgnoreCase( needleType ) ) { sNeedle = 7; } // 7 = WindNeedle;
1368 else if( "Arrow".equalsIgnoreCase( needleType ) ) { sNeedle = 8; } // 8 = ArrowNeedle;
1369 else if( "MiddlePin".equalsIgnoreCase( needleType ) ) { sNeedle = 9; } // 9 = MiddlePinNeedle;
1370 }
1371 cplot.setSeriesNeedle( serNo, sNeedle );
1372
1373 // shapeColors に、SeriesPaint,SeriesOutlinePaint,RoseCenterPaint,RoseHighlightPaint,RosePaint を指å®?
1374 // SeriesPaint, SeriesOutlinePaint , RoseCenter , RoseHighlight, Rose
1375 Color[] shCols = new Color[] { Color.RED , Color.BLACK , Color.WHITE , Color.BLACK , Color.YELLOW }; // 初期値
1376 if( shapeColors != null && shapeColors.length > 0 ) {
1377 for( int i=0; i<shapeColors.length; i++ ) {
1378 shCols[i] = shapeColors[i];
1379 }
1380 }
1381 cplot.setSeriesPaint( serNo, shCols[0] ); // 針ã?色
1382 cplot.setSeriesOutlinePaint( serNo, shCols[1] ); // 針ã?æž??色
1383 cplot.setRoseCenterPaint( shCols[2] ); // æ–?—盤の中å¿??
1384 cplot.setRoseHighlightPaint( shCols[3] ); // æ–?—盤のæ–?—ã?æž?‰²
1385 cplot.setRosePaint( shCols[4] ); // æž??塗りつぶし色
1386
1387 cplot.addDataset( (ValueDataset)dataset );
1388
1389 return cplot;
1390 }
1391
1392 /**
1393 * HybsNumberAxis にオーバã?ライドすã‚?時間を表示する DecimalFormat のå†?ƒ¨クラスを定義しますã?
1394 *
1395 * これは、ChartPlot_XY で使用する、HybsNumberAxis に対して、拡張しますã?
1396 * ãƒ??タがã?時刻を表すå?合ã?Date型ã?オブジェクトを利用して、org.jfree.chart.axis.PeriodAxis
1397 * を利用できればよいのですが、単なる数字で扱ってã�?‚‹ケースがありã?時刻にå†?ƒ¨çš?�«
1398 * 変換するケースで使ã�?�¾すã?
1399 * 外部から与える数字ã?ã€??続してã�?‚‹å¿?¦�があるためã€?¼‘0é?数ですã?
1400 * たとえã?ã€?700 â†?17:00 , 2150 â†?21:30 とã�?�†感じですã?
1401 * 24時間をè¶?�ˆるå?合ã?ã€?
1402 * Type1:そã?ままã€?:00 に戻るã?
1403 * Type2:そã?ままã€?4:00 と、そのまま、加算されてã�?��ã€?
1404 * の?’種類が用意されてã�?�¾すã?
1405 *
1406 * @og.rev 5.5.2.1 (2012/05/07) 新規追åŠ?
1407 *
1408 */
1409 private static final class HybsTimeFormat extends DecimalFormat {
1410 /** For serialization. */
1411 private static final long serialVersionUID = 201205075512L ;
1412
1413 private final boolean is24repeat ;
1414 private final boolean useDay ;
1415
1416 private final int hsCode ;
1417
1418 /**
1419 * コンストラクター
1420 *
1421 * 引数に、時刻を表すå?合ã?表現の仕方を指定しますã?
1422 * ã€?1:そã?ままã€?4:00 となりã?åŠ?®—されてã�?��ã€?
1423 * ã€?2:そã?ままã€?:00 に戻るã?(日付ã?無è¦?
1424 * ã€?3:そã?ままã€? 00:00 と日付が付与されるã€?
1425 * ã€?1:そã?ままã€?4æ™?0åˆ?となりã?åŠ?®—されてã�?��ã€?
1426 * ã€?2:そã?ままã€?0æ™?0åˆ?に戻るã?(日付ã?無è¦?
1427 * ã€?3:そã?ままã€?日 00æ™?0åˆ?と日付が付与されるã€?
1428 *
1429 * @param type 時刻の表示方æ³?[E1/E2/E3/H1/H2/H3]
1430 */
1431 public HybsTimeFormat( final String inType ) {
1432 super();
1433
1434 DecimalFormatSymbols sym = new DecimalFormatSymbols();
1435 if( "E1".equals( inType ) ) {
1436 applyPattern( "#0.00" );
1437 sym.setDecimalSeparator( ':' );
1438 is24repeat = false; useDay = false;
1439 }
1440 else if( "E2".equals( inType ) ) {
1441 applyPattern( "#0.00" );
1442 sym.setDecimalSeparator( ':' );
1443 is24repeat = true; useDay = false;
1444 }
1445 else if( "E3".equals( inType ) ) {
1446 applyPattern( "#,#0.00" );
1447 sym.setDecimalSeparator( ':' );
1448 sym.setGroupingSeparator( ' ' );
1449 is24repeat = true; useDay = true;
1450 }
1451 else if( "H1".equals( inType ) ) {
1452 applyPattern( "#0.00� );
1453 sym.setDecimalSeparator( 'æ™? );
1454 is24repeat = false; useDay = false;
1455 }
1456 else if( "H2".equals( inType ) ) {
1457 applyPattern( "#0.00� );
1458 sym.setDecimalSeparator( 'æ™? );
1459 is24repeat = true; useDay = false;
1460 }
1461 else if( "H3".equals( inType ) ) {
1462 applyPattern( "#,#0.00� );
1463 sym.setDecimalSeparator( 'æ™? );
1464 sym.setGroupingSeparator( '日' );
1465 is24repeat = true; useDay = true;
1466 }
1467 else {
1468 String errMsg = "timeFormatType はã€?E1/E2/E3/H1/H2/H3) からæŒ?®šしてください。timeFormatType=[" + inType + "]" ;
1469 throw new HybsSystemException( errMsg );
1470 }
1471 setDecimalFormatSymbols( sym );
1472
1473 hsCode = super.hashCode() + Boolean.valueOf(is24repeat).hashCode() + Boolean.valueOf(useDay).hashCode();
1474 }
1475
1476 /**
1477 * double をフォーマットしてæ–?—å?を作æ?しまã�? format(double,StringBuffer,FieldPosition) のオーバã?ライãƒ?)
1478 *
1479 * timeFormatType によって、データの処ç�?�Œ変わりますã?
1480 * ã€?1:そã?ままã€?4:00 となりã?åŠ?®—されてã�?��ã€?
1481 * ã€?2:そã?ままã€?:00 に戻るã?(日付ã?無è¦?
1482 * ã€?3:そã?ままã€? 00:00 と日付が付与されるã€?
1483 * ã€?1:そã?ままã€?4æ™?0åˆ?となりã?åŠ?®—されてã�?��ã€?
1484 * ã€?2:そã?ままã€?0æ™?0åˆ?に戻るã?(日付ã?無è¦?
1485 * ã€?3:そã?ままã€?日 00æ™?0åˆ?と日付が付与されるã€?
1486 *
1487 * @param number フォーマットすã‚?double
1488 * @param result ãƒ?‚ストを追åŠ?�™る位置
1489 * @param fieldPos 入力では、å¿?¦�であれば位置合わせフィールドã? 出力では、その位置合わせフィールドã?オフセãƒ?ƒˆ
1490 * @return フォーマットされた数値æ–?—å?
1491 */
1492 public StringBuffer format( final double number, final StringBuffer result, final FieldPosition fieldPos ) {
1493 int day = (int)(number/100/24); // 日付ã?端数はåˆ?‚Š捨てるã?
1494 int hour = (int)(number/100); // 時間のみ取り出すã?
1495 if( is24repeat ) { hour = hour%24; } // ?’4時間をè¶?�ˆたå?合ã?余りのみ使用するã€?
1496
1497 int minute = (int)((number%100)*0.6); // 0.6 = 60/100 の事ã?100 ã�?60åˆ?となるã?
1498
1499 double timeVal = hour + minute/100.0 ;
1500 if( useDay ) { timeVal = timeVal + day*100 ; } // 端数をå?り捨てた日付に対してã€?00倍しておくã€?
1501 return super.format( timeVal, result, fieldPos );
1502 }
1503
1504 /**
1505 * こã?オブジェクトとæŒ?®šされたオブジェクトを比è¼?�—ますã?
1506 *
1507 * @og.rev 5.5.2.4 (2012/05/16) 新規追åŠ?findbug対å¿?
1508 *
1509 * @param anObject 比è¼?�•れるオブジェクãƒ?
1510 * @return æŒ?®šされたオブジェクトが等しã�??合ã? true、そã�?�§なã�??合ã? false
1511 */
1512 public boolean equals( final Object anObject ) {
1513 return this == anObject;
1514 }
1515
1516 /**
1517 * こã?オブジェクトã?ハッシュコードを取得しますã?
1518 *
1519 * @og.rev 5.5.2.4 (2012/05/16) 新規追åŠ?findbug対å¿?
1520 *
1521 * @return ハッシュコーãƒ?
1522 */
1523 public int hashCode() {
1524 return hsCode;
1525 }
1526 }
1527
1528 /**
1529 * こã?オブジェクトã?æ–?—å?表現を返しますã?
1530 * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
1531 *
1532 * @return こã?クラスのæ–?—å?表現
1533 */
1534 @Override
1535 public String toString() {
1536 StringBuilder rtn = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
1537
1538 rtn.append( "[" ).append( this.getClass().getName() ).append( "]" ).append( HybsSystem.CR );
1539 rtn.append( "chartType [" ).append( chartType ).append( "]" ).append( HybsSystem.CR );
1540 rtn.append( "valueLabel [" ).append( valueLabel ).append( "]" ).append( HybsSystem.CR );
1541 rtn.append( "markValues [" ).append( Arrays.toString( markValues ) ).append( "]" ).append( HybsSystem.CR );
1542 rtn.append( "markColors [" ).append( Arrays.toString( markColors ) ).append( "]" ).append( HybsSystem.CR );
1543 rtn.append( "lowerBound [" ).append( lowerBound ).append( "]" ).append( HybsSystem.CR );
1544 rtn.append( "upperBound [" ).append( upperBound ).append( "]" ).append( HybsSystem.CR );
1545 rtn.append( "useGradient [" ).append( useGradient ).append( "]" ).append( HybsSystem.CR );
1546 rtn.append( "shapesVisible [" ).append( shapesVisible ).append( "]" ).append( HybsSystem.CR );
1547 rtn.append( "useDottedLine [" ).append( useDottedLine ).append( "]" ).append( HybsSystem.CR );
1548
1549 return rtn.toString();
1550 }
1551 }