mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 22:01:02 +00:00
Fixed bug 1390: Hair line in charts that show current time point
This commit is contained in:
1 parent
22f66dadea
commit
3dfc34295c
3 files changed
+25
No files matched your search
+12
@@ -18,6 +18,7 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTip;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTipData;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTipFormatter;
|
||||
import org.moxieapps.gwt.highcharts.client.PlotLine.DashStyle;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEvent;
|
||||
@@ -179,6 +180,7 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
return dateFormatHoursMinutes.format(new Date(axisLabelsData.getValueAsLong()));
|
||||
}
|
||||
}));
|
||||
timePlotLine = chart.getXAxis().createPlotLine().setColor("#656565").setWidth(1.5).setDashStyle(DashStyle.SOLID);
|
||||
|
||||
if (compactChart) {
|
||||
chart.setSpacingBottom(10).setSpacingLeft(10).setSpacingRight(10).setSpacingTop(2)
|
||||
@@ -596,6 +598,10 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
return;
|
||||
}
|
||||
|
||||
if (allowTimeAdjust) {
|
||||
updateTimePlotLine(date);
|
||||
}
|
||||
|
||||
switch (timer.getPlayMode()) {
|
||||
case Live: {
|
||||
// is date before first cache entry or is cache empty?
|
||||
@@ -624,6 +630,12 @@ public abstract class AbstractChartPanel<SettingsType extends ChartSettings> ext
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTimePlotLine(Date date) {
|
||||
chart.getXAxis().removePlotLine(timePlotLine);
|
||||
timePlotLine.setValue(date.getTime());
|
||||
chart.getXAxis().addPlotLines(timePlotLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResize() {
|
||||
chart.setSizeToMatchContainer();
|
||||
|
||||
+2
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.client.shared.charts;
|
||||
import java.util.Date;
|
||||
|
||||
import org.moxieapps.gwt.highcharts.client.Chart;
|
||||
import org.moxieapps.gwt.highcharts.client.PlotLine;
|
||||
import org.moxieapps.gwt.highcharts.client.Point;
|
||||
import org.moxieapps.gwt.highcharts.client.Series;
|
||||
import org.moxieapps.gwt.highcharts.client.XAxis;
|
||||
@@ -28,6 +29,7 @@ import com.sap.sailing.gwt.ui.client.Timer.PlayModes;
|
||||
public abstract class RaceChart extends SimplePanel implements RaceSelectionChangeListener,
|
||||
TimeListener, TimeZoomChangeListener, TimeRangeChangeListener {
|
||||
protected Chart chart;
|
||||
protected PlotLine timePlotLine;
|
||||
|
||||
protected final Timer timer;
|
||||
protected final TimeRangeWithZoomProvider timeRangeWithZoomProvider;
|
||||
|
||||
+11
@@ -20,6 +20,7 @@ import org.moxieapps.gwt.highcharts.client.Series;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTip;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTipData;
|
||||
import org.moxieapps.gwt.highcharts.client.ToolTipFormatter;
|
||||
import org.moxieapps.gwt.highcharts.client.PlotLine.DashStyle;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEvent;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartClickEventHandler;
|
||||
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEvent;
|
||||
@@ -162,6 +163,7 @@ public class WindChart extends RaceChart implements Component<WindChartSettings>
|
||||
return dateFormatHoursMinutes.format(new Date(axisLabelsData.getValueAsLong()));
|
||||
}
|
||||
}));
|
||||
timePlotLine = chart.getXAxis().createPlotLine().setColor("#656565").setWidth(1.5).setDashStyle(DashStyle.SOLID);
|
||||
|
||||
chart.getYAxis(0).setAxisTitleText(stringMessages.fromDeg()).setStartOnTick(false).setShowFirstLabel(false)
|
||||
.setLabels(new YAxisLabels().setFormatter(new AxisLabelsFormatter() {
|
||||
@@ -245,6 +247,7 @@ public class WindChart extends RaceChart implements Component<WindChartSettings>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chart.redraw();
|
||||
}
|
||||
|
||||
@@ -504,6 +507,8 @@ public class WindChart extends RaceChart implements Component<WindChartSettings>
|
||||
if(!isVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
updateTimePlotLine(date);
|
||||
|
||||
switch(timer.getPlayMode()) {
|
||||
case Live:
|
||||
@@ -535,6 +540,12 @@ public class WindChart extends RaceChart implements Component<WindChartSettings>
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTimePlotLine(Date date) {
|
||||
chart.getXAxis().removePlotLine(timePlotLine);
|
||||
timePlotLine.setValue(date.getTime());
|
||||
chart.getXAxis().addPlotLines(timePlotLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResize() {
|
||||
chart.setSizeToMatchContainer();
|
||||
|
||||
Reference in new issue
Block a user