Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/ChartArea.java @ 3468:f37e7e8907cb
merged flys-artifacts/2.8.1
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:39 +0200 |
parents | 9422b559b2d5 |
children |
comparison
equal
deleted
inserted
replaced
3387:5ffad8bde8ad | 3468:f37e7e8907cb |
---|---|
1 package de.intevation.flys.exports; | |
2 | |
3 import org.jfree.chart.axis.ValueAxis; | |
4 | |
5 import org.jfree.data.Range; | |
6 | |
7 /** Two Ranges that span a rectangular area. */ | |
8 public class ChartArea { | |
9 protected Range xRange; | |
10 protected Range yRange; | |
11 | |
12 public ChartArea(Range rangeX, Range rangeY) { | |
13 this.xRange = rangeX; | |
14 this.yRange = rangeY; | |
15 } | |
16 | |
17 public ChartArea(ValueAxis axisX, ValueAxis axisY) { | |
18 this.xRange = axisX.getRange(); | |
19 this.yRange = axisY.getRange(); | |
20 } | |
21 | |
22 public double ofLeft(double percent) { | |
23 return xRange.getLowerBound() | |
24 + xRange.getLength() * percent; | |
25 } | |
26 | |
27 public double ofRight(double percent) { | |
28 return xRange.getUpperBound() | |
29 - xRange.getLength() * percent; | |
30 } | |
31 | |
32 public double ofGround(double percent) { | |
33 return yRange.getLowerBound() | |
34 + yRange.getLength() * percent; | |
35 } | |
36 | |
37 public double atTop() { | |
38 return yRange.getUpperBound(); | |
39 } | |
40 | |
41 public double atGround() { | |
42 return yRange.getLowerBound(); | |
43 } | |
44 | |
45 public double atRight() { | |
46 return xRange.getUpperBound(); | |
47 } | |
48 | |
49 public double atLeft() { | |
50 return xRange.getLowerBound(); | |
51 } | |
52 | |
53 public double above(double percent, double base) { | |
54 return base + yRange.getLength() * percent; | |
55 } | |
56 } | |
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |