Moved JSNI method to show reset zoom button to BaseChart and added a

README.md to document patch on the highcharts sources.
This commit is contained in:
Benjamin Barth committed 2016-07-18 11:54:09 +02:00
1 parent ad0bc135a9
commit ec81896034
3 files changed
+88 -19

No files matched your search

@@ -225,16 +225,8 @@ public abstract class AbstractRaceChart<SettingsType extends Settings> extends A
@Override
public void onTimeZoomChanged(Date zoomStartTimepoint, Date zoomEndTimepoint) {
changeMinMaxAndExtremesInterval(zoomStartTimepoint, zoomEndTimepoint, true);
// Probably there is a function for this in a newer version of highcharts: http://jsfiddle.net/mqz3N/1071/
this.showResetZoom();
chart.showResetZoom(); // Patched method
}
// Because there is no method within highcharts Java API, the respective JS method is called via JSNI.
private native void showResetZoom() /*-{
var chartObject = this.@com.sap.sailing.gwt.ui.client.shared.charts.AbstractRaceChart::chart;
var chart = chartObject.@org.moxieapps.gwt.highcharts.client.Chart::getNativeChart()();
if (chart) chart.showResetZoom();
}-*/;
@Override
public void onTimeRangeChanged(Date fromTime, Date toTime) {
@@ -0,0 +1,18 @@
# Patches to GWT Highcharts Wrapper API
## Show reset zoom button
Added method to `org.moxieapps.gwt.highcharts.client.BaseChart` to provide highcharts functionality in Java API:
```
/**
* Patch, to provide highcharts functionality in Java API.
*/
public native void showResetZoom() /*-{
var chart = this.@org.moxieapps.gwt.highcharts.client.BaseChart::chart;
if (chart) chart.showResetZoom();
}-*/;
```
## Other changes
Some other change in the following classes are not documented yet:
- `org.moxieapps.gwt.highcharts.client.BaseChart`
- `org.moxieapps.gwt.highcharts.client.Series`
@@ -16,22 +16,73 @@
package org.moxieapps.gwt.highcharts.client;
import java.util.ArrayList;
import java.util.Iterator;
import org.moxieapps.gwt.highcharts.client.events.AxisSetExtremesEvent;
import org.moxieapps.gwt.highcharts.client.events.ChartClickEvent;
import org.moxieapps.gwt.highcharts.client.events.ChartClickEventHandler;
import org.moxieapps.gwt.highcharts.client.events.ChartLoadEvent;
import org.moxieapps.gwt.highcharts.client.events.ChartLoadEventHandler;
import org.moxieapps.gwt.highcharts.client.events.ChartRedrawEvent;
import org.moxieapps.gwt.highcharts.client.events.ChartRedrawEventHandler;
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEvent;
import org.moxieapps.gwt.highcharts.client.events.ChartSelectionEventHandler;
import org.moxieapps.gwt.highcharts.client.events.PointClickEvent;
import org.moxieapps.gwt.highcharts.client.events.PointLegendItemClickEvent;
import org.moxieapps.gwt.highcharts.client.events.PointMouseOutEvent;
import org.moxieapps.gwt.highcharts.client.events.PointMouseOverEvent;
import org.moxieapps.gwt.highcharts.client.events.PointRemoveEvent;
import org.moxieapps.gwt.highcharts.client.events.PointSelectEvent;
import org.moxieapps.gwt.highcharts.client.events.PointUnselectEvent;
import org.moxieapps.gwt.highcharts.client.events.PointUpdateEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesCheckboxClickEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesClickEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesHideEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesLegendItemClickEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesMouseOutEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesMouseOverEvent;
import org.moxieapps.gwt.highcharts.client.events.SeriesShowEvent;
import org.moxieapps.gwt.highcharts.client.labels.AxisLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.DataLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.LegendLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.StackLabelsData;
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaRangePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaSplinePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.AreaSplineRangePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.BarPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.BoxPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.BubblePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.CandlestickPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.ColumnPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.ColumnRangePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.ErrorBarPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.FunnelPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.GaugePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.LinePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.Marker;
import org.moxieapps.gwt.highcharts.client.plotOptions.OHLCPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.PiePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.PlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.ScatterPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.SeriesPlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.SplinePlotOptions;
import org.moxieapps.gwt.highcharts.client.plotOptions.WaterfallPlotOptions;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.json.client.*;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONBoolean;
import com.google.gwt.json.client.JSONNull;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.ui.Widget;
import org.moxieapps.gwt.highcharts.client.events.*;
import org.moxieapps.gwt.highcharts.client.labels.AxisLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.DataLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.LegendLabelsData;
import org.moxieapps.gwt.highcharts.client.labels.StackLabelsData;
import org.moxieapps.gwt.highcharts.client.plotOptions.*;
import java.util.ArrayList;
import java.util.Iterator;
/**
* The common base class for both {@link Chart} types as well as {@link StockChart} types.
@@ -2986,5 +3037,13 @@ public abstract class BaseChart<T> extends Widget {
private static native void nativeSetTitle(JavaScriptObject chart, JavaScriptObject title, JavaScriptObject subTitle) /*-{
chart.setTitle(title, subTitle);
}-*/;
/**
* Patch, to provide highcharts functionality in Java API.
*/
public native void showResetZoom() /*-{
var chart = this.@org.moxieapps.gwt.highcharts.client.BaseChart::chart;
if (chart) chart.showResetZoom();
}-*/;
}