comparison artifacts/src/main/java/org/dive4elements/river/exports/DischargeGenerator.java @ 9123:1cc7653ca84f

Cleanup of ChartGenerator and ChartGenerator2 code. Put some of the copy/pasted code into a common abstraction.
author gernotbelger
date Tue, 05 Jun 2018 19:21:16 +0200
parents e6d0fc817e20
children ef5754ba5573
comparison
equal deleted inserted replaced
9122:b8e7f6becf78 9123:1cc7653ca84f
37 37
38 @Override 38 @Override
39 public void addDatasets(XYPlot plot) { 39 public void addDatasets(XYPlot plot) {
40 super.addDatasets(plot); 40 super.addDatasets(plot);
41 41
42 Object pnp = context.getContextValue(PNP); 42 Object pnp = getContext().getContextValue(PNP);
43 if (!(pnp instanceof Number)) { 43 if (!(pnp instanceof Number)) {
44 return; 44 return;
45 } 45 }
46 46
47 pnpValue = ((Number)pnp).doubleValue(); 47 pnpValue = ((Number)pnp).doubleValue();
50 if (wAxisIndex == -1) { 50 if (wAxisIndex == -1) {
51 log.warn("No W axis found."); 51 log.warn("No W axis found.");
52 return; 52 return;
53 } 53 }
54 54
55 AxisDataset data = datasets.get(wAxisIndex); 55 AxisDataset data = getDatasets().get(wAxisIndex);
56 if (data == null) { 56 if (data == null) {
57 // No W axis 57 // No W axis
58 return; 58 return;
59 } 59 }
60 60
92 DEFAULT_FONT_NAME, 92 DEFAULT_FONT_NAME,
93 Font.BOLD, 93 Font.BOLD,
94 getYAxisFontSize(wAxisIndex)); 94 getYAxisFontSize(wAxisIndex));
95 95
96 String axisName = "W.in.cm"; 96 String axisName = "W.in.cm";
97 String axisLabel = Resources.getMsg(context.getMeta(), 97 String axisLabel = msg( I18N_AXIS_LABEL, "W [cm]" );
98 I18N_AXIS_LABEL, "W [cm]");
99 98
100 IdentifiableNumberAxis axis = new IdentifiableNumberAxis( 99 IdentifiableNumberAxis axis = new IdentifiableNumberAxis(
101 axisName, axisLabel); 100 axisName, axisLabel);
102 101
103 axis.setAutoRangeIncludesZero(false); 102 axis.setAutoRangeIncludesZero(false);

http://dive4elements.wald.intevation.org