1 39 40 41 package org.krysalis.jcharts.properties; 42 43 44 import org.krysalis.jcharts.properties.util.ChartFont; 45 import org.krysalis.jcharts.properties.util.ChartStroke; 46 import org.krysalis.jcharts.test.HTMLGenerator; 47 import org.krysalis.jcharts.test.HTMLTestable; 48 49 import java.lang.reflect.Field ; 50 51 52 public class AxisTypeProperties extends Properties implements HTMLTestable 53 { 54 public static final int TICKS_NONE = 0; 55 public static final int TICKS_ALL = 1; 56 public static final int TICKS_ONLY_WITH_LABELS = 2; 57 58 public static final int GRID_LINES_NONE = 0; 59 public static final int GRID_LINES_ALL = 1; 60 public static final int GRID_LINES_ONLY_WITH_LABELS = 2; 61 62 63 private int showTicks = TICKS_ALL; 64 private ChartStroke tickChartStroke= ChartStroke.DEFAULT_TICKS; 65 66 private int showGridLines = GRID_LINES_NONE; 67 private ChartStroke gridLineChartStroke= ChartStroke.DEFAULT_GRIDLINES; 68 69 private ChartFont scaleChartFont = ChartFont.DEFAULT_AXIS_SCALE; 70 private ChartFont axisTitleChartFont= ChartFont.DEFAULT_AXIS_TITLE; 71 72 private ChartStroke axisStroke = ChartStroke.DEFAULT_AXIS; 73 74 75 private float paddingBetweenAxisTitleAndLabels = 25.0f; 76 private float axisTickMarkPixelLength = 3.0f; 77 78 private float paddingBetweenLabelsAndTicks = 3.0f; 80 81 private float paddingBetweenAxisAndLabels = 3.0f; 83 84 private float paddingBetweenAxisLabels = 5.0f; 86 87 88 private boolean showEndBorder = true; 89 private boolean showAxisLabels= true; 90 91 private ChartFont scaleChartFontRight = ChartFont.DEFAULT_AXIS_SCALE; 95 private boolean showRightAxis = false; 96 private float secondScaleRight=1; 97 private double minRightAxis = 0; 98 private double maxRightAxis = 0; 99 100 private ChartFont titleChartFont= ChartFont.DEFAULT_AXIS_TITLE; 101 102 103 106 public AxisTypeProperties() 107 { 108 super(); 109 } 110 111 112 public ChartFont getTitleChartFont() 113 { 114 return titleChartFont; 115 } 116 117 118 public void setTitleChartFont( ChartFont titleChartFont ) 119 { 120 this.titleChartFont = titleChartFont; 121 } 122 123 124 public boolean showAxisLabels() 125 { 126 return showAxisLabels; 127 } 128 129 130 public void setShowAxisLabels( boolean showAxisLabels ) 131 { 132 this.showAxisLabels = showAxisLabels; 133 } 134 135 136 public int getShowTicks() 137 { 138 return showTicks; 139 } 140 141 142 public void setShowTicks( int showTicks ) 143 { 144 this.showTicks = showTicks; 145 } 146 147 148 public ChartStroke getTickChartStroke() 149 { 150 return this.tickChartStroke; 151 } 152 153 154 public void setTickChartStroke( ChartStroke tickChartStroke ) 155 { 156 this.tickChartStroke = tickChartStroke; 157 } 158 159 160 public int getShowGridLines() 161 { 162 return showGridLines; 163 } 164 165 166 public void setShowGridLines( int showGridLines ) 167 { 168 this.showGridLines = showGridLines; 169 } 170 171 172 public ChartStroke getGridLineChartStroke() 173 { 174 return this.gridLineChartStroke; 175 } 176 177 178 public void setGridLineChartStroke( ChartStroke gridLineChartStroke ) 179 { 180 this.gridLineChartStroke = gridLineChartStroke; 181 } 182 183 184 public float getPaddingBetweenAxisTitleAndLabels() 185 { 186 return paddingBetweenAxisTitleAndLabels; 187 } 188 189 190 public void setPaddingBetweenAxisTitleAndLabels( float paddingBetweenAxisTitleAndLabels ) 191 { 192 this.paddingBetweenAxisTitleAndLabels = paddingBetweenAxisTitleAndLabels; 193 } 194 195 196 public float getAxisTickMarkPixelLength() 197 { 198 return axisTickMarkPixelLength; 199 } 200 201 202 public void setAxisTickMarkPixelLength( float axisTickMarkPixelLength ) 203 { 204 this.axisTickMarkPixelLength = axisTickMarkPixelLength; 205 } 206 207 208 public float getPaddingBetweenLabelsAndTicks() 209 { 210 return paddingBetweenLabelsAndTicks; 211 } 212 213 214 public void setPaddingBetweenLabelsAndTicks( float paddingBetweenLabelsAndTicks ) 215 { 216 this.paddingBetweenLabelsAndTicks = paddingBetweenLabelsAndTicks; 217 } 218 219 220 public float getPaddingBetweenAxisAndLabels() 221 { 222 return paddingBetweenAxisAndLabels; 223 } 224 225 226 public void setPaddingBetweenAxisAndLabels( float paddingBetweenAxisAndLabels ) 227 { 228 this.paddingBetweenAxisAndLabels = paddingBetweenAxisAndLabels; 229 } 230 231 232 public ChartStroke getAxisStroke() 233 { 234 return axisStroke; 235 } 236 237 238 public void setAxisStroke( ChartStroke axisStroke ) 239 { 240 this.axisStroke = axisStroke; 241 } 242 243 244 public ChartFont getScaleChartFont() 245 { 246 return scaleChartFont; 247 } 248 249 250 public void setScaleChartFont( ChartFont scaleChartFont ) 251 { 252 this.scaleChartFont = scaleChartFont; 253 } 254 255 public ChartFont getScaleChartFontRight() 257 { 258 return scaleChartFontRight; 259 } 260 261 262 public void setScaleChartFontRight( ChartFont scaleChartFontRight ) 263 { 264 this.scaleChartFontRight = scaleChartFontRight; 265 } 266 267 public ChartFont getAxisTitleChartFont() 268 { 269 return axisTitleChartFont; 270 } 271 272 273 public void setAxisTitleChartFont( ChartFont axisTitleChartFont ) 274 { 275 this.axisTitleChartFont = axisTitleChartFont; 276 } 277 278 279 public boolean getShowEndBorder() 280 { 281 return this.showEndBorder; 282 } 283 284 285 public void setShowEndBorder( boolean showEndBorder ) 286 { 287 this.showEndBorder = showEndBorder; 288 } 289 290 291 public boolean getShowRightAxis() 293 { 294 return this.showRightAxis; 295 } 296 297 298 public void setShowRightAxis( boolean showRightAxis ) 299 { 300 this.showRightAxis = showRightAxis; 301 } 302 303 304 public float getSecondScaleRight() 305 { 306 return this.secondScaleRight; 307 } 308 309 310 public void setSecondScaleRight(float secondScaleRight) 311 { 312 this.secondScaleRight=secondScaleRight; 313 } 314 315 public double getMinRightAxis() 316 { 317 return this.minRightAxis; 318 } 319 320 321 public void setMinRightAxis(double minRightAxis) 322 { 323 this.minRightAxis=minRightAxis; 324 } 325 326 327 public double getMaxRightAxis() 328 { 329 return this.maxRightAxis; 330 } 331 332 333 public void setMaxRightAxis(double maxRightAxis) 334 { 335 this.maxRightAxis=maxRightAxis; 336 } 337 338 339 public float getPaddingBetweenAxisLabels() 340 { 341 return this.paddingBetweenAxisLabels; 342 } 343 344 345 public void setPaddingBetweenXAxisLabels( float paddingBetweenAxisLabels ) 346 { 347 this.paddingBetweenAxisLabels = paddingBetweenAxisLabels; 348 } 349 350 351 356 public void toHTML( HTMLGenerator htmlGenerator ) 357 { 358 htmlGenerator.propertiesTableStart( AxisTypeProperties.class.getName() ); 359 360 super.toHTML( htmlGenerator ); 361 362 Field [] fields = this.getClass().getDeclaredFields(); 363 for( int i = 0; i < fields.length; i++ ) 364 { 365 try 366 { 367 htmlGenerator.addField( fields[ i ].getName(), fields[ i ].get( this ) ); 368 } 369 catch( IllegalAccessException illegalAccessException ) 370 { 371 System.out.println( "can not access field: " + fields[i].getName() ); 372 } 374 } 375 376 htmlGenerator.propertiesTableEnd(); 377 } 378 379 380 } 381 | Popular Tags |