fixed unit string in wind chart tool tip, depending on type of series

This commit is contained in:
Axel Uhl committed 2012-03-06 12:56:08 +01:00
1 parent 696475e778
commit cc55bdd422
1 file changed
+3 -3
@@ -76,7 +76,7 @@ public class WindChart implements Component<WindChartSettings>, RaceSelectionCha
* server and displayed in this chart. If no race is selected, the chart is cleared.
*/
public WindChart(SailingServiceAsync sailingService, RaceSelectionProvider raceSelectionProvider,
Timer timer, WindChartSettings settings, StringMessages stringMessages, ErrorReporter errorReporter) {
Timer timer, WindChartSettings settings, final StringMessages stringMessages, ErrorReporter errorReporter) {
super();
this.sailingService = sailingService;
this.stringMessages = stringMessages;
@@ -97,12 +97,12 @@ public class WindChart implements Component<WindChartSettings>, RaceSelectionCha
new Marker().setEnabled(false).setHoverState(
new Marker().setEnabled(true).setRadius(4))).setShadow(false)
.setHoverStateLineWidth(LINE_WIDTH));
final String unit = "deg";
final NumberFormat numberFormat = NumberFormat.getFormat("0");
chart.setToolTip(new ToolTip().setEnabled(true).setFormatter(new ToolTipFormatter() {
@Override
public String format(ToolTipData toolTipData) {
// TODO consider using toolTipData.getPoint().getName() instead...
final String unit = toolTipData.getSeriesName().startsWith(stringMessages.fromDeg()+" ") ? stringMessages.degreesShort() :
stringMessages.averageSpeedInKnotsUnit();
return "<b>" + toolTipData.getSeriesName() + (toolTipData.getPointName() != null ? " "+toolTipData.getPointName() : "")
+ "</b><br/>" +
dateFormat.format(new Date(toolTipData.getXAsLong())) + ": " +