Skip to content

Commit 3aab7df

Browse files
authored
Merge pull request #3 from GwtMaterialDesign/fixes/mk_022018
Updates / Fixes on AmChart core libraries.
2 parents 86bbb3d + 3b32442 commit 3aab7df

37 files changed

+1255
-1127
lines changed

src/main/java/gwt/material/design/amcharts/client/ui/chart/CoordinateChart.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
import gwt.material.design.amcharts.client.ui.chart.events.object.CoordinateGraphItemData;
3131
import gwt.material.design.amcharts.client.ui.chart.js.AmCoordinateChart;
3232
import gwt.material.design.amcharts.client.ui.chart.js.AmGraph;
33+
import gwt.material.design.amcharts.client.ui.chart.js.options.Guide;
3334
import gwt.material.design.amcharts.client.ui.chart.js.options.AmValueAxis;
3435
import gwt.material.design.amcharts.client.ui.chart.options.Graph;
35-
import gwt.material.design.amcharts.client.ui.chart.options.Guide;
3636
import gwt.material.design.amcharts.client.ui.chart.options.ValueAxis;
3737
import gwt.material.design.client.base.helper.ColorHelper;
3838
import gwt.material.design.client.constants.Color;
@@ -133,9 +133,7 @@ public void setGridAboveGraphs(boolean gridAboveGraphs) {
133133
* specify a different valueAxis for the guide.
134134
*/
135135
public void setGuides(Guide... guides) {
136-
for (int i = 0; i < guides.length; i++) {
137-
getChart().guides[i] = guides[i].getAmGuide();
138-
}
136+
getChart().guides = guides;
139137
}
140138

141139
/**

src/main/java/gwt/material/design/amcharts/client/ui/chart/GanttChart.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
import gwt.material.design.amcharts.client.ui.chart.base.constants.ChartType;
2323
import gwt.material.design.amcharts.client.ui.chart.js.AmGanttChart;
24-
import gwt.material.design.amcharts.client.ui.chart.js.AmGraph;
25-
import gwt.material.design.amcharts.client.ui.chart.js.options.AmValueAxis;
24+
import gwt.material.design.amcharts.client.ui.chart.options.Graph;
25+
import gwt.material.design.amcharts.client.ui.chart.options.ValueAxis;
2626

2727
//@formatter:off
2828

@@ -36,6 +36,7 @@
3636
//@formatter:on
3737
public class GanttChart extends SerialChart {
3838

39+
private AmGanttChart amGanttChart;
3940

4041
public GanttChart() {
4142
super(ChartType.GANTT);
@@ -83,8 +84,8 @@ public void setEndField(String endField) {
8384
* Graph of a Gantt chart. Gant chart actually creates multiple graphs (separate for each segment). Properties of
8485
* this graph are passed to each of the created graphs - this allows you to control the look of segments.
8586
*/
86-
public void setGraph(AmGraph graph) {
87-
getChart().graph = graph;
87+
public void setGraph(Graph graph) {
88+
getChart().graph = graph.getAmGraph();
8889
}
8990

9091
/**
@@ -94,6 +95,10 @@ public void setPeriod(String period) {
9495
getChart().period = period;
9596
}
9697

98+
public void setColorField(String colorField) {
99+
getChart().colorField = colorField;
100+
}
101+
97102
/**
98103
* Segments field in your data provider.
99104
*/
@@ -121,12 +126,16 @@ public void setStartField(String startField) {
121126
/**
122127
* Value axis of Gantt chart. Set it's type to "date" if your data is date or time based.
123128
*/
124-
public void setValueAxis(AmValueAxis valueAxis) {
125-
getChart().valueAxis = valueAxis;
129+
public void setValueAxis(ValueAxis valueAxis) {
130+
getChart().valueAxis = valueAxis.getAmValueAxis();
131+
valueAxis.load();
126132
}
127133

128134
@Override
129135
public AmGanttChart getChart() {
130-
return new AmGanttChart();
136+
if (amGanttChart == null) {
137+
amGanttChart = new AmGanttChart();
138+
}
139+
return amGanttChart;
131140
}
132141
}

src/main/java/gwt/material/design/amcharts/client/ui/chart/PieChart.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import gwt.material.design.amcharts.client.ui.chart.base.constants.ChartType;
2323
import gwt.material.design.amcharts.client.ui.chart.js.AmPieChart;
24+
import gwt.material.design.amcharts.client.ui.chart.js.options.GraphDataItem;
2425
import gwt.material.design.jquery.client.api.Functions;
2526

2627
//@formatter:off
@@ -57,7 +58,7 @@ public void setAngle(int angle) {
5758

5859
/**
5960
* If you set some function, the graph will call it and pass
60-
* {@link gwt.material.design.amcharts.client.ui.chart.options.GraphDataItem} object to it. This function
61+
* {@link GraphDataItem} object to it. This function
6162
* should return a string which will be displayed in a balloon.
6263
*/
6364
public void setBalloonFunction(Functions.Func balloonFunction) {

src/main/java/gwt/material/design/amcharts/client/ui/chart/RectangularChart.java

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import gwt.material.design.amcharts.client.ui.chart.options.TrendLine;
2727
import gwt.material.design.client.base.helper.ColorHelper;
2828
import gwt.material.design.client.constants.Color;
29+
import gwt.material.design.client.ui.MaterialToast;
2930

3031
//@formatter:off
3132

@@ -87,43 +88,36 @@ public void setDepth3D(int depth3D) {
8788
}
8889

8990
/**
90-
* Number of pixels between the container's bottom border and plot area. This space can be used for bottom axis'
91-
* values. If autoMargin is true and bottom side has axis, this property is ignored. Default to 20
91+
* Flag which should be set to false if you need margins to be recalculated on next chart.validateNow() call.
92+
* Default to false
9293
*/
93-
public void setMarginLeft(int marginLeft) {
94-
getChart().marginLeft = marginLeft;
94+
public void setMarginsUpdated(boolean marginsUpdated) {
95+
getChart().marginsUpdated = marginsUpdated;
9596
}
9697

97-
/**
98-
* Number of pixels between the container's bottom border and plot area. This space can be used for left axis' values.
99-
* If autoMargin is true and left side has axis, this property is ignored. Default to 20
100-
*/
101-
public void setMarginBottom(int marginBottom) {
102-
getChart().marginBottom = marginBottom;
98+
@Override
99+
public void setMargin(double margin) {
100+
super.setMargin(margin);
103101
}
104102

105-
/**
106-
* Number of pixels between the container's right border and plot area. This space can be used for Right axis'
107-
* values. If autoMargin is true and right side has axis, this property is ignored. Default to 20
108-
*/
109-
public void setMarginRight(int marginRight) {
110-
getChart().marginRight = marginRight;
103+
@Override
104+
public void setMarginTop(double marginTop) {
105+
getChart().marginTop = (int) marginTop;
111106
}
112107

113-
/**
114-
* Number of pixels between the container's top border and plot area. This space can be used for top axis' values.
115-
* If autoMargin is true and top side has axis, this property is ignored. Default to 20
116-
*/
117-
public void setMarginTop(int marginTop) {
118-
getChart().marginTop = marginTop;
108+
@Override
109+
public void setMarginBottom(double marginBottom) {
110+
getChart().marginBottom = (int) marginBottom;
119111
}
120112

121-
/**
122-
* Flag which should be set to false if you need margins to be recalculated on next chart.validateNow() call.
123-
* Default to false
124-
*/
125-
public void setMarginsUpdated(boolean marginsUpdated) {
126-
getChart().marginsUpdated = marginsUpdated;
113+
@Override
114+
public void setMarginLeft(double marginLeft) {
115+
getChart().marginLeft = (int) marginLeft;
116+
}
117+
118+
@Override
119+
public void setMarginRight(double marginRight) {
120+
getChart().marginRight = (int) marginRight;
127121
}
128122

129123
/**

src/main/java/gwt/material/design/amcharts/client/ui/chart/base/AbstractChart.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,14 @@ public void validateNow(Object validateData, boolean skipEvents) {
695695
getChart().validateNow(validateData, skipEvents);
696696
}
697697

698+
/**
699+
* This method should be called after you changed one or more properties of any class. The chart will redraw after
700+
* this method is called.Both attributes, validateData and skipEvents are optional (false by default).
701+
*/
702+
public void validateNow() {
703+
getChart().validateNow();
704+
}
705+
698706
/**
699707
* Adds chart to the specified DIV.
700708
*

src/main/java/gwt/material/design/amcharts/client/ui/chart/events/object/AxisGuideData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package gwt.material.design.amcharts.client.ui.chart.events.object;
2121

2222
import gwt.material.design.amcharts.client.ui.chart.js.AmRectangularChart;
23-
import gwt.material.design.amcharts.client.ui.chart.js.options.AmGuide;
23+
import gwt.material.design.amcharts.client.ui.chart.js.options.Guide;
2424
import jsinterop.annotations.JsOverlay;
2525
import jsinterop.annotations.JsPackage;
2626
import jsinterop.annotations.JsProperty;
@@ -33,7 +33,7 @@ public class AxisGuideData {
3333
private String type;
3434

3535
@JsProperty
36-
private AmGuide graph;
36+
private Guide graph;
3737

3838
@JsProperty
3939
private AmRectangularChart chart;
@@ -44,7 +44,7 @@ public final String getType() {
4444
}
4545

4646
@JsOverlay
47-
public final AmGuide getGraph() {
47+
public final Guide getGraph() {
4848
return graph;
4949
}
5050

src/main/java/gwt/material/design/amcharts/client/ui/chart/events/object/AxisItemData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import gwt.material.design.amcharts.client.ui.chart.js.AmRectangularChart;
2323
import gwt.material.design.amcharts.client.ui.chart.js.options.AmAxisBase;
24-
import gwt.material.design.amcharts.client.ui.chart.js.options.AmSerialDataItem;
24+
import gwt.material.design.amcharts.client.ui.chart.js.options.SerialDataItem;
2525
import gwt.material.design.amcharts.client.ui.chart.js.options.Label;
2626
import gwt.material.design.jquery.client.api.MouseEvent;
2727
import jsinterop.annotations.JsOverlay;
@@ -51,7 +51,7 @@ public class AxisItemData {
5151
private Object value;
5252

5353
@JsProperty
54-
private AmSerialDataItem serialDataItem;
54+
private SerialDataItem serialDataItem;
5555

5656
@JsOverlay
5757
public final String getType() {
@@ -64,7 +64,7 @@ public final Object getValue() {
6464
}
6565

6666
@JsOverlay
67-
public final AmSerialDataItem getSerialDataItem() {
67+
public final SerialDataItem getSerialDataItem() {
6868
return serialDataItem;
6969
}
7070

src/main/java/gwt/material/design/amcharts/client/ui/chart/events/object/CoordinateGraphItemData.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import gwt.material.design.amcharts.client.ui.chart.js.AmChart;
2323
import gwt.material.design.amcharts.client.ui.chart.js.AmGraph;
24-
import gwt.material.design.amcharts.client.ui.chart.js.options.AmGraphDataItem;
24+
import gwt.material.design.amcharts.client.ui.chart.js.options.GraphDataItem;
2525
import gwt.material.design.jquery.client.api.MouseEvent;
2626
import jsinterop.annotations.JsOverlay;
2727
import jsinterop.annotations.JsPackage;
@@ -35,7 +35,7 @@ public class CoordinateGraphItemData {
3535
private AmGraph graph;
3636

3737
@JsProperty
38-
private AmGraphDataItem item;
38+
private GraphDataItem item;
3939

4040
@JsProperty
4141
private int index;
@@ -52,7 +52,7 @@ public final AmGraph getGraph() {
5252
}
5353

5454
@JsOverlay
55-
public final AmGraphDataItem getItem() {
55+
public final GraphDataItem getItem() {
5656
return item;
5757
}
5858

src/main/java/gwt/material/design/amcharts/client/ui/chart/js/AmChart.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
import gwt.material.design.amcharts.client.ui.chart.js.options.Title;
2626
import gwt.material.design.amcharts.client.ui.chart.plugins.export.js.AmExportOption;
2727
import gwt.material.design.jquery.client.api.Functions;
28-
import jsinterop.annotations.JsMethod;
29-
import jsinterop.annotations.JsPackage;
30-
import jsinterop.annotations.JsProperty;
31-
import jsinterop.annotations.JsType;
28+
import jsinterop.annotations.*;
3229

3330
//@formatter:off
3431

@@ -533,6 +530,13 @@ public class AmChart {
533530
@JsMethod
534531
public native void validateNow(Object validateData, boolean skipEvents);
535532

533+
/**
534+
* This method should be called after you changed one or more properties of any class. The chart will redraw after
535+
* this method is called.Both attributes, validateData and skipEvents are optional (false by default).
536+
*/
537+
@JsMethod
538+
public native void validateNow();
539+
536540
/**
537541
* Adds chart to the specified DIV.
538542
*

src/main/java/gwt/material/design/amcharts/client/ui/chart/js/AmCoordinateChart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
package gwt.material.design.amcharts.client.ui.chart.js;
2121

22-
import gwt.material.design.amcharts.client.ui.chart.js.options.AmGuide;
22+
import gwt.material.design.amcharts.client.ui.chart.js.options.Guide;
2323
import gwt.material.design.amcharts.client.ui.chart.js.options.AmValueAxis;
2424
import jsinterop.annotations.JsMethod;
2525
import jsinterop.annotations.JsProperty;
@@ -69,7 +69,7 @@ public class AmCoordinateChart extends AmChart {
6969
* specify a different valueAxis for the guide.
7070
*/
7171
@JsProperty
72-
public AmGuide[] guides;
72+
public Guide[] guides;
7373

7474
/**
7575
* Specifies whether the animation should be sequenced or all objects should appear at once. Default to true

0 commit comments

Comments
 (0)