Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java @ 8892:87a242425467
Introduced ChartExtender that allows to tweak the charts for very specific use cases.
author | gernotbelger |
---|---|
date | Thu, 15 Feb 2018 13:46:35 +0100 |
parents | e5f688820951 |
children | 3ac9cb0029b2 |
comparison
equal
deleted
inserted
replaced
8891:f431aec10d2c | 8892:87a242425467 |
---|---|
20 import java.awt.image.BufferedImage; | 20 import java.awt.image.BufferedImage; |
21 import java.io.IOException; | 21 import java.io.IOException; |
22 import java.io.OutputStream; | 22 import java.io.OutputStream; |
23 import java.text.NumberFormat; | 23 import java.text.NumberFormat; |
24 import java.util.ArrayList; | 24 import java.util.ArrayList; |
25 import java.util.HashMap; | |
25 import java.util.List; | 26 import java.util.List; |
26 import java.util.Locale; | 27 import java.util.Locale; |
27 import java.util.Map; | 28 import java.util.Map; |
28 import java.util.SortedMap; | 29 import java.util.SortedMap; |
29 import java.util.TreeMap; | 30 import java.util.TreeMap; |
137 | 138 |
138 protected abstract List<AxisSection> buildYAxisSections(); | 139 protected abstract List<AxisSection> buildYAxisSections(); |
139 | 140 |
140 protected String outName; | 141 protected String outName; |
141 | 142 |
143 private Map<String, IdentifiableNumberAxis> axisNameToAxis = new HashMap<>(); | |
144 | |
142 /** | 145 /** |
143 * Default constructor that initializes internal data structures. | 146 * Default constructor that initializes internal data structures. |
144 */ | 147 */ |
145 public ChartGenerator2() { | 148 public ChartGenerator2() { |
146 datasets = new TreeMap<Integer, AxisDataset>(); | 149 datasets = new TreeMap<Integer, AxisDataset>(); |
1477 Font.BOLD, | 1480 Font.BOLD, |
1478 getYAxisFontSize(index)); | 1481 getYAxisFontSize(index)); |
1479 | 1482 |
1480 String axisName = axisIndexToName(index); | 1483 String axisName = axisIndexToName(index); |
1481 | 1484 |
1482 IdentifiableNumberAxis axis = new IdentifiableNumberAxis( | 1485 IdentifiableNumberAxis axis = new IdentifiableNumberAxis(axisName, getYAxisLabel(axisName)); |
1483 axisName, getYAxisLabel(axisName)); | |
1484 | 1486 |
1485 axis.setAutoRangeIncludesZero(false); | 1487 axis.setAutoRangeIncludesZero(false); |
1486 axis.setLabelFont(labelFont); | 1488 axis.setLabelFont(labelFont); |
1487 axis.setTickLabelFont(labelFont); | 1489 axis.setTickLabelFont(labelFont); |
1488 // REMARK: we overwrite the default values to 0.0, because in earlier version margins were never applied. | 1490 // REMARK: we overwrite the default values to 0.0, because in earlier version margins were never applied. |
1489 axis.setLowerMargin(0); | 1491 axis.setLowerMargin(0); |
1490 axis.setUpperMargin(0); | 1492 axis.setUpperMargin(0); |
1491 | 1493 |
1494 /* remember axis for lookup */ | |
1495 axisNameToAxis.put( axisName, axis ); | |
1496 | |
1492 return axis; | 1497 return axis; |
1493 } | 1498 } |
1494 | 1499 |
1495 | 1500 |
1496 /** | 1501 /** |
1597 * @return the CallContext instance | 1602 * @return the CallContext instance |
1598 */ | 1603 */ |
1599 public CallContext getCallContext() { | 1604 public CallContext getCallContext() { |
1600 return context; | 1605 return context; |
1601 } | 1606 } |
1607 | |
1608 public final IdentifiableNumberAxis getAxis(final String axisName) { | |
1609 return axisNameToAxis.get(axisName); | |
1610 } | |
1602 } | 1611 } |