diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/HighChart.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/HighChart.java index c59eca6..fba9ae4 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/HighChart.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/HighChart.java @@ -2,7 +2,7 @@ import com.vaadin.annotations.JavaScript; -@JavaScript({"jquery-2.1.3.min.js", "highcharts-more.js", "highcharts.js", "highcharts-connector.js"}) +@JavaScript({"jquery-2.1.3.min.js", "exporting.js", "funnel.js", "highcharts-more.js", "highcharts.js", "highcharts-connector.js"}) public class HighChart extends AbstractHighChart { private static final long serialVersionUID = -7326315426217377753L; } \ No newline at end of file diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java index 4d3c7ec..27ff3f9 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaRangeChartData.java @@ -1,5 +1,7 @@ package at.downdrown.vaadinaddons.highchartsapi.model.data; +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.RangeData; + /** * Projekt: VaadinHighChartsAPI
* Package: at.downdrown.vaadinaddons.highchartsapi.model.data
@@ -10,49 +12,10 @@ * * @author Manfred Huber (02ub0j08)
*/ -public class AreaRangeChartData implements HighChartsData { - - private double x; - private double low; - private double high; +public class AreaRangeChartData extends RangeData { public AreaRangeChartData(double x, double low, double high) { - this.x = x; - this.low = low; - this.high = high; + super(x, low, high); } - public double getX() { - return x; - } - - public void setX(double x) { - this.x = x; - } - - public double getLow() { - return low; - } - - public void setLow(double low) { - this.low = low; - } - - public double getHigh() { - return high; - } - - public void setHigh(double high) { - this.high = high; - } - - @Override - public String getHighChartValue() { - return "[" + x + ", " + low + ", " + high + "]"; - } - - @Override - public String toString() { - return this.getHighChartValue(); - } } diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java new file mode 100644 index 0000000..9c71998 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/AreaSplineRangeChartData.java @@ -0,0 +1,21 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data; + +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.RangeData; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data
+ * Klasse: AreaRangeChartData.class
+ * Erstellt am 21. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class AreaSplineRangeChartData extends RangeData { + + public AreaSplineRangeChartData(double x, double low, double high) { + super(x, low, high); + } + +} \ No newline at end of file diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BoxPlotChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BoxPlotChartData.java new file mode 100644 index 0000000..3688462 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BoxPlotChartData.java @@ -0,0 +1,100 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data
+ * Klasse: BoxPlotChartData.class
+ * Erstellt am 24. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class BoxPlotChartData implements HighChartsData { + + private String name = null; + private double minimum; + private double lowerQuartile; + private double median; + private double upperQuartile; + private double maximum; + + public BoxPlotChartData(String name, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum) { + this.name = name; + this.minimum = minimum; + this.lowerQuartile = lowerQuartile; + this.median = median; + this.upperQuartile = upperQuartile; + this.maximum = maximum; + } + + public BoxPlotChartData(double minimum, double lowerQuartile, double median, double upperQuartile, double maximum) { + this.minimum = minimum; + this.lowerQuartile = lowerQuartile; + this.median = median; + this.upperQuartile = upperQuartile; + this.maximum = maximum; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public double getMinimum() { + return minimum; + } + + public void setMinimum(double minimum) { + this.minimum = minimum; + } + + public double getLowerQuartile() { + return lowerQuartile; + } + + public void setLowerQuartile(double lowerQuartile) { + this.lowerQuartile = lowerQuartile; + } + + public double getMedian() { + return median; + } + + public void setMedian(double median) { + this.median = median; + } + + public double getUpperQuartile() { + return upperQuartile; + } + + public void setUpperQuartile(double upperQuartile) { + this.upperQuartile = upperQuartile; + } + + public double getMaximum() { + return maximum; + } + + public void setMaximum(double maximum) { + this.maximum = maximum; + } + + @Override + public String getHighChartValue() { + if (name != null) { + return "['" + name + "', " + minimum + ", " + lowerQuartile + ", " + median + ", " + upperQuartile + ", " + maximum + "]"; + } else { + return "[" + minimum + ", " + lowerQuartile + ", " + median + ", " + upperQuartile + ", " + maximum + "]"; + } + } + + @Override + public String toString() { + return this.getHighChartValue(); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java new file mode 100644 index 0000000..429c802 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/BubbleChartData.java @@ -0,0 +1,58 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data
+ * Klasse: BubbleChartData.class
+ * Erstellt am 24. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class BubbleChartData implements HighChartsData { + + private double x; + private double y; + private double z; + + public BubbleChartData(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void setY(double y) { + this.y = y; + } + + public double getZ() { + return z; + } + + public void setZ(double z) { + this.z = z; + } + + @Override + public String getHighChartValue() { + return "[" + x + ", " + y + ", " + z + "]"; + } + + @Override + public String toString() { + return this.getHighChartValue(); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java new file mode 100644 index 0000000..183ad0a --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/ColumnRangeChartData.java @@ -0,0 +1,20 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data; + +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.RangeData; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data
+ * Klasse: ColumnRangeChartData.class
+ * Erstellt am 25. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class ColumnRangeChartData extends RangeData { + + public ColumnRangeChartData(double x, double low, double high) { + super(x, low, high); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/DoubleData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/DoubleData.java new file mode 100644 index 0000000..b944e2f --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/DoubleData.java @@ -0,0 +1,38 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data.base; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data.base
+ * Klasse: DoubleData.class
+ * Erstellt am 25. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class DoubleData implements HighChartsBaseData { + + private double value; + + public DoubleData(double value) { + this.value = value; + } + + public double getValue() { + return value; + } + + public void setValue(double value) { + this.value = value; + } + + @Override + public String getHighChartValue() { + return String.valueOf(this.value); + } + + @Override + public String toString() { + return this.getHighChartValue(); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/ErrorBarChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/ErrorBarChartData.java new file mode 100644 index 0000000..87392b8 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/ErrorBarChartData.java @@ -0,0 +1,19 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data.base; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data.base
+ * Klasse: ErrorBarChartData.class
+ * Erstellt am 25. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class ErrorBarChartData extends RangeData { + + public ErrorBarChartData(double x, double low, double high) { + super(x, low, high); + } + +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/IntData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/IntData.java new file mode 100644 index 0000000..c791535 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/IntData.java @@ -0,0 +1,38 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.data.base; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.data.base
+ * Klasse: IntData.class
+ * Erstellt am 25. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class IntData implements HighChartsBaseData { + + private int value; + + public IntData(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + @Override + public String getHighChartValue() { + return String.valueOf(this.value); + } + + @Override + public String toString() { + return this.getHighChartValue(); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/AreaSplineRangeChartData.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/RangeData.java similarity index 89% rename from src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/AreaSplineRangeChartData.java rename to src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/RangeData.java index 89da083..d761c1f 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/AreaSplineRangeChartData.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/data/base/RangeData.java @@ -12,13 +12,13 @@ * * @author Manfred Huber (02ub0j08)
*/ -public class AreaSplineRangeChartData implements HighChartsData { +public class RangeData implements HighChartsData { private double x; private double low; private double high; - public AreaSplineRangeChartData(double x, double low, double high) { + public RangeData(double x, double low, double high) { this.x = x; this.low = low; this.high = high; diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java index 1167fc2..9e951ea 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaChartSeries.java @@ -1,6 +1,8 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; + import java.util.List; public class AreaChartSeries extends HighChartsSeriesImpl { @@ -10,19 +12,19 @@ public AreaChartSeries(String name) { this.name = name; } - public AreaChartSeries(String name, List data) { + public AreaChartSeries(String name, List data) { chartType = ChartType.AREA; this.name = name; this.data = data; } @Deprecated - public List getData() { + public List getData() { return data; } @Deprecated - public void setData(List data) { + public void setData(List data) { this.data = data; } } \ No newline at end of file diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineChartSeries.java index d454048..6ce2c67 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineChartSeries.java @@ -1,6 +1,7 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; @@ -21,7 +22,7 @@ public AreaSplineChartSeries(String name) { this.name = name; } - public AreaSplineChartSeries(String name, List data) { + public AreaSplineChartSeries(String name, List data) { chartType = ChartType.AREASPLINE; this.name = name; this.data = data; diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java index f1b2793..1343cc9 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/AreaSplineRangeChartSeries.java @@ -1,6 +1,7 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaSplineRangeChartData; import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java index 17c6ae8..b73377a 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BarChartSeries.java @@ -1,6 +1,8 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; + import java.util.List; public class BarChartSeries extends HighChartsSeriesImpl { @@ -10,19 +12,19 @@ public BarChartSeries(String name) { this.name = name; } - public BarChartSeries(String name, List data) { + public BarChartSeries(String name, List data) { chartType = ChartType.BAR; this.name = name; this.data = data; } @Deprecated - public List getData() { + public List getData() { return this.data; } @Deprecated - public void setData(List data) { + public void setData(List data) { this.data = data; } diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BoxPlotChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BoxPlotChartSeries.java new file mode 100644 index 0000000..bc67f9d --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BoxPlotChartSeries.java @@ -0,0 +1,131 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.series; + +import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.BoxPlotChartData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; + +import java.util.List; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.series
+ * Klasse: AreaRangeChartSeries.class
+ * Erstellt am 21. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class BoxPlotChartSeries extends HighChartsSeriesImpl { + + public BoxPlotChartSeries(String name) { + chartType = ChartType.BOXPLOT; + this.name = name; + } + + public BoxPlotChartSeries(String name, List data) { + chartType = ChartType.BOXPLOT; + this.name = name; + + if (!data.isEmpty()) { + for (BoxPlotChartData boxPlotChartData : data) { + this.data.add(boxPlotChartData); + } + } + } + + public void addData(BoxPlotChartData boxPlotChartData) { + this.data.add(boxPlotChartData); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(HighChartsData highChartsData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(int value) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(double value) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleDoubleData doubleDoubleData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleIntData doubleIntData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntDoubleData intDoubleData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntIntData intIntData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringDoubleData stringDoubleData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BoxPlotChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringIntData stringIntData) { + throw new UnsupportedOperationException("BoxPlot charts only accept BoxPlotChartData objects."); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java new file mode 100644 index 0000000..ad360b2 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/BubbleChartSeries.java @@ -0,0 +1,131 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.series; + +import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.BubbleChartData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; + +import java.util.List; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.series
+ * Klasse: AreaRangeChartSeries.class
+ * Erstellt am 21. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class BubbleChartSeries extends HighChartsSeriesImpl { + + public BubbleChartSeries(String name) { + chartType = ChartType.BUBBLE; + this.name = name; + } + + public BubbleChartSeries(String name, List data) { + chartType = ChartType.BUBBLE; + this.name = name; + + if (!data.isEmpty()) { + for (BubbleChartData bubbleChartData : data) { + this.data.add(bubbleChartData); + } + } + } + + public void addData(BubbleChartData bubbleChartData) { + this.data.add(bubbleChartData); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(HighChartsData highChartsData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(int value) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(double value) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleDoubleData doubleDoubleData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleIntData doubleIntData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntDoubleData intDoubleData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntIntData intIntData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringDoubleData stringDoubleData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(BubbleChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringIntData stringIntData) { + throw new UnsupportedOperationException("Bubble charts only accept BubbleChartData objects."); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnChartSeries.java index de0d618..960a5a5 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnChartSeries.java @@ -1,6 +1,7 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; @@ -11,19 +12,19 @@ public ColumnChartSeries(String name) { this.name = name; } - public ColumnChartSeries(String name, List data) { + public ColumnChartSeries(String name, List data) { chartType = ChartType.COLUMN; this.name = name; this.data = data; } @Deprecated - public List getData() { + public List getData() { return data; } @Deprecated - public void setData(List data) { + public void setData(List data) { this.data = data; } diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java new file mode 100644 index 0000000..0bf0f58 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ColumnRangeChartSeries.java @@ -0,0 +1,131 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.series; + +import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.ColumnRangeChartData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; + +import java.util.List; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.series
+ * Klasse: AreaRangeChartSeries.class
+ * Erstellt am 21. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class ColumnRangeChartSeries extends HighChartsSeriesImpl { + + public ColumnRangeChartSeries(String name) { + chartType = ChartType.COLUMNRANGE; + this.name = name; + } + + public ColumnRangeChartSeries(String name, List data) { + chartType = ChartType.COLUMNRANGE; + this.name = name; + + if (!data.isEmpty()) { + for (ColumnRangeChartData columnRangeChartData : data) { + this.data.add(columnRangeChartData); + } + } + } + + public void addData(ColumnRangeChartData columnRangeChartData) { + this.data.add(columnRangeChartData); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(HighChartsData highChartsData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(int value) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(double value) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleDoubleData doubleDoubleData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleIntData doubleIntData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntDoubleData intDoubleData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntIntData intIntData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringDoubleData stringDoubleData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ColumnRangeChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringIntData stringIntData) { + throw new UnsupportedOperationException("ColumnRange charts only accept ColumnRangeChartData objects."); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java new file mode 100644 index 0000000..7b6c1b1 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/ErrorBarChartSeries.java @@ -0,0 +1,130 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.series; + +import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; + +import java.util.List; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.series
+ * Klasse: AreaSplineRangeChartSeries.class
+ * Erstellt am 21. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class ErrorBarChartSeries extends HighChartsSeriesImpl { + + public ErrorBarChartSeries(String name) { + chartType = ChartType.ERRORBAR; + this.name = name; + } + + public ErrorBarChartSeries(String name, List data) { + chartType = ChartType.ERRORBAR; + this.name = name; + + if (!data.isEmpty()) { + for (ErrorBarChartData errorBarChartData : data) { + this.data.add(errorBarChartData); + } + } + } + + public void addData(ErrorBarChartData errorBarChartData) { + this.data.add(errorBarChartData); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(HighChartsData highChartsData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(int value) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(double value) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleDoubleData doubleDoubleData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(DoubleIntData doubleIntData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntDoubleData intDoubleData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(IntIntData intIntData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringDoubleData stringDoubleData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } + + /** + * @deprecated This method isn't implemented for this type. + * Use {@link #addData(ErrorBarChartData)} instead. + */ + @Deprecated + @Override + public void addData(StringIntData stringIntData) { + throw new UnsupportedOperationException("ErrorBar charts only accept ErrorBarChartData objects."); + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/FunnelChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/FunnelChartSeries.java new file mode 100644 index 0000000..601c7b5 --- /dev/null +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/FunnelChartSeries.java @@ -0,0 +1,30 @@ +package at.downdrown.vaadinaddons.highchartsapi.model.series; + +import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; + +import java.util.List; + +/** + * Projekt: VaadinHighChartsAPI
+ * Package: at.downdrown.vaadinaddons.highchartsapi.model.series
+ * Klasse: FunnelChartSeries.class
+ * Erstellt am 25. August 2015.
+ * Copyright © HSWE Allg. Applikationen.
+ *
+ * + * @author Manfred Huber (02ub0j08)
+ */ +public class FunnelChartSeries extends HighChartsSeriesImpl { + + public FunnelChartSeries(String name) { + this.chartType = ChartType.FUNNEL; + this.name = name; + } + + public FunnelChartSeries(String name, List data) { + this.chartType = ChartType.FUNNEL; + this.name = name; + this.data = data; + } +} diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeries.java index 5bbd8dd..cbbbb53 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeries.java @@ -16,9 +16,7 @@ public interface HighChartsSeries extends HighchartsObject { //Data manipulation void addData(HighChartsData highChartsData); - void addData(int value); - void addData(double value); void addData(DoubleDoubleData doubleDoubleData); void addData(DoubleIntData doubleIntData); @@ -26,4 +24,6 @@ public interface HighChartsSeries extends HighchartsObject { void addData(IntIntData intIntData); void addData(StringDoubleData stringDoubleData); void addData(StringIntData stringIntData); + + void clearData(); } diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeriesImpl.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeriesImpl.java index e7e450b..9a1edb2 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeriesImpl.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/HighChartsSeriesImpl.java @@ -20,7 +20,7 @@ public class HighChartsSeriesImpl implements HighChartsSeries { ChartType chartType; - List data = new ArrayList(); + List data = new ArrayList<>(); String name; public String getName() { @@ -49,7 +49,7 @@ public void addData(HighChartsData highChartsData) { */ @Override public void addData(int value) { - this.data.add(value); + this.data.add(new IntData(value)); } /** @@ -59,7 +59,7 @@ public void addData(int value) { */ @Override public void addData(double value) { - this.data.add(value); + this.data.add(new DoubleData(value)); } /** @@ -122,6 +122,14 @@ public void addData(StringIntData stringIntData) { this.data.add(stringIntData); } + /** + * Clears the list of data. + */ + @Override + public void clearData() { + this.data.clear(); + } + @Override public String getHighChartValue() { return "{ name: '" + this.name + "', type: '" + this.chartType.name().toLowerCase() + "', data: " + this.data + " }"; diff --git a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java index be2b29e..82c0fd8 100644 --- a/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java +++ b/src/main/java/at/downdrown/vaadinaddons/highchartsapi/model/series/LineChartSeries.java @@ -5,6 +5,7 @@ package at.downdrown.vaadinaddons.highchartsapi.model.series; import at.downdrown.vaadinaddons.highchartsapi.model.ChartType; +import at.downdrown.vaadinaddons.highchartsapi.model.data.HighChartsData; import java.util.List; @@ -15,19 +16,19 @@ public LineChartSeries(String name) { this.name = name; } - public LineChartSeries(String name, List data) { + public LineChartSeries(String name, List data) { chartType = ChartType.LINE; this.name = name; this.data = data; } @Deprecated - public List getData() { + public List getData() { return data; } @Deprecated - public void setData(List data) { + public void setData(List data) { this.data = data; } diff --git a/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/exporting.js b/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/exporting.js new file mode 100644 index 0000000..d2d552a --- /dev/null +++ b/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/exporting.js @@ -0,0 +1,263 @@ +/* + Highcharts JS v4.1.8 (2015-08-20) + Exporting module + + (c) 2010-2014 Torstein Honsi + + License: www.highcharts.com/license + */ +(function (g) { + var A = g.Chart, t = g.addEvent, B = g.removeEvent, C = HighchartsAdapter.fireEvent, j = g.createElement, p = g.discardElement, v = g.css, l = g.merge, m = g.each, q = g.extend, E = g.splat, F = Math.max, k = document, D = window, G = g.isTouchDevice, H = g.Renderer.prototype.symbols, r = g.getOptions(), y; + q(r.lang, { + printChart: "Print chart", + downloadPNG: "Download PNG image", + downloadJPEG: "Download JPEG image", + downloadPDF: "Download PDF document", + downloadSVG: "Download SVG vector image", + contextButtonTitle: "Chart context menu" + }); + r.navigation = + { + menuStyle: {border: "1px solid #A0A0A0", background: "#FFFFFF", padding: "5px 0"}, + menuItemStyle: {padding: "0 10px", background: "none", color: "#303030", fontSize: G ? "14px" : "11px"}, + menuItemHoverStyle: {background: "#4572A5", color: "#FFFFFF"}, + buttonOptions: { + symbolFill: "#E0E0E0", + symbolSize: 14, + symbolStroke: "#666", + symbolStrokeWidth: 3, + symbolX: 12.5, + symbolY: 10.5, + align: "right", + buttonSpacing: 3, + height: 22, + theme: {fill: "white", stroke: "none"}, + verticalAlign: "top", + width: 24 + } + }; + r.exporting = { + type: "image/png", url: "http://export.highcharts.com/", + buttons: { + contextButton: { + menuClassName: "highcharts-contextmenu", + symbol: "menu", + _titleKey: "contextButtonTitle", + menuItems: [{ + textKey: "printChart", onclick: function () { + this.print() + } + }, {separator: !0}, { + textKey: "downloadPNG", onclick: function () { + this.exportChart() + } + }, { + textKey: "downloadJPEG", onclick: function () { + this.exportChart({type: "image/jpeg"}) + } + }, { + textKey: "downloadPDF", onclick: function () { + this.exportChart({type: "application/pdf"}) + } + }, { + textKey: "downloadSVG", onclick: function () { + this.exportChart({type: "image/svg+xml"}) + } + }] + } + } + }; + g.post = function (b, a, e) { + var c, b = j("form", l({ + method: "post", + action: b, + enctype: "multipart/form-data" + }, e), {display: "none"}, k.body); + for (c in a)j("input", {type: "hidden", name: c, value: a[c]}, null, b); + b.submit(); + p(b) + }; + q(A.prototype, { + sanitizeSVG: function (b) { + return b.replace(/zIndex="[^"]+"/g, "").replace(/isShadow="[^"]+"/g, "").replace(/symbolName="[^"]+"/g, "").replace(/jQuery[0-9]+="[^"]+"/g, "").replace(/url\([^#]+#/g, "url(#").replace(/.*?$/, "").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"').replace(/ /g, "\u00a0").replace(/­/g, "\u00ad").replace(//g, "<$1title>").replace(/height=([^" ]+)/g, 'height="$1"').replace(/width=([^" ]+)/g, 'width="$1"').replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>').replace(/ id=([^" >]+)/g, ' id="$1"').replace(/class=([^" >]+)/g, 'class="$1"').replace(/ transform /g, + " ").replace(/:(path|rect)/g, "$1").replace(/style="([^"]+)"/g, function (a) { + return a.toLowerCase() + }) + }, getChartHTML: function () { + return this.container.innerHTML + }, getSVG: function (b) { + var a = this, e, c, f, z, h, d = l(a.options, b), s = d.exporting.allowHTML; + if (!k.createElementNS)k.createElementNS = function (a, b) { + return k.createElement(b) + }; + c = j("div", null, { + position: "absolute", + top: "-9999em", + width: a.chartWidth + "px", + height: a.chartHeight + "px" + }, k.body); + f = a.renderTo.style.width; + h = a.renderTo.style.height; + f = d.exporting.sourceWidth || + d.chart.width || /px$/.test(f) && parseInt(f, 10) || 600; + h = d.exporting.sourceHeight || d.chart.height || /px$/.test(h) && parseInt(h, 10) || 400; + q(d.chart, {animation: !1, renderTo: c, forExport: !s, width: f, height: h}); + d.exporting.enabled = !1; + delete d.data; + d.series = []; + m(a.series, function (a) { + z = l(a.options, {animation: !1, enableMouseTracking: !1, showCheckbox: !1, visible: a.visible}); + z.isInternal || d.series.push(z) + }); + b && m(["xAxis", "yAxis"], function (a) { + m(E(b[a]), function (b, c) { + d[a][c] = l(d[a][c], b) + }) + }); + e = new g.Chart(d, a.callback); + m(["xAxis", + "yAxis"], function (b) { + m(a[b], function (a, c) { + var d = e[b][c], f = a.getExtremes(), h = f.userMin, f = f.userMax; + d && (h !== void 0 || f !== void 0) && d.setExtremes(h, f, !0, !1) + }) + }); + f = e.getChartHTML(); + d = null; + e.destroy(); + p(c); + if (s && (c = f.match(/<\/svg>(.*?$)/)))c = '' + c[1] + "", f = f.replace("", c + ""); + f = this.sanitizeSVG(f); + return f = f.replace(/(url\(#highcharts-[0-9]+)"/g, "$1").replace(/"/g, "'") + }, + getSVGForExport: function (b, a) { + var e = this.options.exporting; + return this.getSVG(l({chart: {borderRadius: 0}}, e.chartOptions, a, { + exporting: { + sourceWidth: b && b.sourceWidth || e.sourceWidth, + sourceHeight: b && b.sourceHeight || e.sourceHeight + } + })) + }, exportChart: function (b, a) { + var e = this.getSVGForExport(b, a), b = l(this.options.exporting, b); + g.post(b.url, { + filename: b.filename || "chart", + type: b.type, + width: b.width || 0, + scale: b.scale || 2, + svg: e + }, b.formAttributes) + }, print: function () { + var b = this, a = b.container, e = [], c = a.parentNode, f = k.body, + g = f.childNodes; + if (!b.isPrinting)b.isPrinting = !0, C(b, "beforePrint"), m(g, function (a, b) { + if (a.nodeType === 1)e[b] = a.style.display, a.style.display = "none" + }), f.appendChild(a), D.focus(), D.print(), setTimeout(function () { + c.appendChild(a); + m(g, function (a, b) { + if (a.nodeType === 1)a.style.display = e[b] + }); + b.isPrinting = !1; + C(b, "afterPrint") + }, 1E3) + }, contextMenu: function (b, a, e, c, f, g, h) { + var d = this, s = d.options.navigation, l = s.menuItemStyle, n = d.chartWidth, o = d.chartHeight, k = "cache-" + b, i = d[k], u = F(f, g), w, x, p, r = function (a) { + d.pointer.inClass(a.target, + b) || x() + }; + if (!i)d[k] = i = j("div", {className: b}, { + position: "absolute", + zIndex: 1E3, + padding: u + "px" + }, d.container), w = j("div", null, q({ + MozBoxShadow: "3px 3px 10px #888", + WebkitBoxShadow: "3px 3px 10px #888", + boxShadow: "3px 3px 10px #888" + }, s.menuStyle), i), x = function () { + v(i, {display: "none"}); + h && h.setState(0); + d.openMenu = !1 + }, t(i, "mouseleave", function () { + p = setTimeout(x, 500) + }), t(i, "mouseenter", function () { + clearTimeout(p) + }), t(document, "mouseup", r), t(d, "destroy", function () { + B(document, "mouseup", r) + }), m(a, function (a) { + if (a) { + var b = + a.separator ? j("hr", null, null, w) : j("div", { + onmouseover: function () { + v(this, s.menuItemHoverStyle) + }, onmouseout: function () { + v(this, l) + }, onclick: function (b) { + b.stopPropagation(); + x(); + a.onclick && a.onclick.apply(d, arguments) + }, innerHTML: a.text || d.options.lang[a.textKey] + }, q({cursor: "pointer"}, l), w); + d.exportDivElements.push(b) + } + }), d.exportDivElements.push(w, i), d.exportMenuWidth = i.offsetWidth, d.exportMenuHeight = i.offsetHeight; + a = {display: "block"}; + e + d.exportMenuWidth > n ? a.right = n - e - f - u + "px" : a.left = e - u + "px"; + c + g + d.exportMenuHeight > + o && h.alignOptions.verticalAlign !== "top" ? a.bottom = o - c - u + "px" : a.top = c + g - u + "px"; + v(i, a); + d.openMenu = !0 + }, addButton: function (b) { + var a = this, e = a.renderer, c = l(a.options.navigation.buttonOptions, b), f = c.onclick, k = c.menuItems, h, d, m = { + stroke: c.symbolStroke, + fill: c.symbolFill + }, j = c.symbolSize || 12; + if (!a.btnCount)a.btnCount = 0; + if (!a.exportDivElements)a.exportDivElements = [], a.exportSVGElements = []; + if (c.enabled !== !1) { + var n = c.theme, o = n.states, p = o && o.hover, o = o && o.select, i; + delete n.states; + f ? i = function (b) { + b.stopPropagation(); + f.call(a, b) + } : k && (i = function () { + a.contextMenu(d.menuClassName, k, d.translateX, d.translateY, d.width, d.height, d); + d.setState(2) + }); + c.text && c.symbol ? n.paddingLeft = g.pick(n.paddingLeft, 25) : c.text || q(n, { + width: c.width, + height: c.height, + padding: 0 + }); + d = e.button(c.text, 0, 0, i, n, p, o).attr({ + title: a.options.lang[c._titleKey], + "stroke-linecap": "round" + }); + d.menuClassName = b.menuClassName || "highcharts-menu-" + a.btnCount++; + c.symbol && (h = e.symbol(c.symbol, c.symbolX - j / 2, c.symbolY - j / 2, j, j).attr(q(m, { + "stroke-width": c.symbolStrokeWidth || + 1, zIndex: 1 + })).add(d)); + d.add().align(q(c, {width: d.width, x: g.pick(c.x, y)}), !0, "spacingBox"); + y += (d.width + c.buttonSpacing) * (c.align === "right" ? -1 : 1); + a.exportSVGElements.push(d, h) + } + }, destroyExport: function (b) { + var b = b.target, a, e; + for (a = 0; a < b.exportSVGElements.length; a++)if (e = b.exportSVGElements[a])e.onclick = e.ontouchstart = null, b.exportSVGElements[a] = e.destroy(); + for (a = 0; a < b.exportDivElements.length; a++)e = b.exportDivElements[a], B(e, "mouseleave"), b.exportDivElements[a] = e.onmouseout = e.onmouseover = e.ontouchstart = + e.onclick = null, p(e) + } + }); + H.menu = function (b, a, e, c) { + return ["M", b, a + 2.5, "L", b + e, a + 2.5, "M", b, a + c / 2 + 0.5, "L", b + e, a + c / 2 + 0.5, "M", b, a + c - 1.5, "L", b + e, a + c - 1.5] + }; + A.prototype.callbacks.push(function (b) { + var a, e = b.options.exporting, c = e.buttons; + y = 0; + if (e.enabled !== !1) { + for (a in c)b.addButton(c[a]); + t(b, "destroy", b.destroyExport) + } + }) +})(Highcharts); \ No newline at end of file diff --git a/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/funnel.js b/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/funnel.js new file mode 100644 index 0000000..734038e --- /dev/null +++ b/src/main/resources/at/downdrown/vaadinaddons/highchartsapi/funnel.js @@ -0,0 +1,92 @@ +/* + + Highcharts funnel module + + (c) 2010-2014 Torstein Honsi + + License: www.highcharts.com/license + */ +(function (c) { + var q = c.getOptions(), w = q.plotOptions, r = c.seriesTypes, G = c.merge, F = function () { + }, C = c.each, x = c.pick; + w.funnel = G(w.pie, { + animation: !1, + center: ["50%", "50%"], + width: "90%", + neckWidth: "30%", + height: "100%", + neckHeight: "25%", + reversed: !1, + dataLabels: {connectorWidth: 1, connectorColor: "#606060"}, + size: !0, + states: {select: {color: "#C0C0C0", borderColor: "#000000", shadow: !1}} + }); + r.funnel = c.extendClass(r.pie, { + type: "funnel", animate: F, translate: function () { + var a = function (b, a) { + return /%$/.test(b) ? a * parseInt(b, 10) / 100 : parseInt(b, + 10) + }, D = 0, f = this.chart, d = this.options, c = d.reversed, n = d.ignoreHiddenPoint, g = f.plotWidth, h = f.plotHeight, q = 0, f = d.center, i = a(f[0], g), r = a(f[1], h), w = a(d.width, g), k, s, e = a(d.height, h), t = a(d.neckWidth, g), u = a(d.neckHeight, h), y = e - u, a = this.data, z, A, x = d.dataLabels.position === "left" ? 1 : 0, B, l, E, p, j, v, m; + this.getWidthAt = s = function (b) { + return b > e - u || e === u ? t : t + (w - t) * ((e - u - b) / (e - u)) + }; + this.getX = function (b, a) { + return i + (a ? -1 : 1) * (s(c ? h - b : b) / 2 + d.dataLabels.distance) + }; + this.center = [i, r, e]; + this.centerX = i; + C(a, function (b) { + if (!n || + b.visible !== !1)D += b.y + }); + C(a, function (b) { + m = null; + A = D ? b.y / D : 0; + l = r - e / 2 + q * e; + j = l + A * e; + k = s(l); + B = i - k / 2; + E = B + k; + k = s(j); + p = i - k / 2; + v = p + k; + l > y ? (B = p = i - t / 2, E = v = i + t / 2) : j > y && (m = j, k = s(y), p = i - k / 2, v = p + k, j = y); + c && (l = e - l, j = e - j, m = m ? e - m : null); + z = ["M", B, l, "L", E, l, v, j]; + m && z.push(v, m, p, m); + z.push(p, j, "Z"); + b.shapeType = "path"; + b.shapeArgs = {d: z}; + b.percentage = A * 100; + b.plotX = i; + b.plotY = (l + (m || j)) / 2; + b.tooltipPos = [i, b.plotY]; + b.slice = F; + b.half = x; + if (!n || b.visible !== !1)q += A + }) + }, drawPoints: function () { + var a = this, c = a.options, f = a.chart.renderer; + C(a.data, + function (d) { + var o = d.options, n = d.graphic, g = d.shapeArgs; + n ? n.animate(g) : d.graphic = f.path(g).attr({ + fill: d.color, + stroke: x(o.borderColor, c.borderColor), + "stroke-width": x(o.borderWidth, c.borderWidth) + }).add(a.group) + }) + }, sortByAngle: function (a) { + a.sort(function (a, c) { + return a.plotY - c.plotY + }) + }, drawDataLabels: function () { + var a = this.data, c = this.options.dataLabels.distance, f, d, o, n = a.length, g, h; + for (this.center[2] -= 2 * c; n--;)o = a[n], d = (f = o.half) ? 1 : -1, h = o.plotY, g = this.getX(h, f), o.labelPos = [0, h, g + (c - 5) * d, h, g + c * d, h, f ? "right" : + "left", 0]; + r.pie.prototype.drawDataLabels.call(this) + } + }); + q.plotOptions.pyramid = c.merge(q.plotOptions.funnel, {neckWidth: "0%", neckHeight: "0%", reversed: !0}); + c.seriesTypes.pyramid = c.extendClass(c.seriesTypes.funnel, {type: "pyramid"}) +})(Highcharts); diff --git a/src/test/at/downdrown/vaadinaddons/highchartsapi/test/SeriesScriptGenerationTest.java b/src/test/at/downdrown/vaadinaddons/highchartsapi/test/SeriesScriptGenerationTest.java index 840f9ab..20efaa8 100644 --- a/src/test/at/downdrown/vaadinaddons/highchartsapi/test/SeriesScriptGenerationTest.java +++ b/src/test/at/downdrown/vaadinaddons/highchartsapi/test/SeriesScriptGenerationTest.java @@ -1,6 +1,6 @@ package at.downdrown.vaadinaddons.highchartsapi.test; -import at.downdrown.vaadinaddons.highchartsapi.model.data.AreaRangeChartData; +import at.downdrown.vaadinaddons.highchartsapi.model.data.*; import at.downdrown.vaadinaddons.highchartsapi.model.data.base.*; import at.downdrown.vaadinaddons.highchartsapi.model.series.*; @@ -30,45 +30,6 @@ public static void main(String[] args) { System.out.println(areaChartSeries.getHighChartValue()); - BarChartSeries barChartSeries = new BarChartSeries("barScript"); - barChartSeries.addData(2); - barChartSeries.addData(2.3); - barChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); - barChartSeries.addData(new DoubleIntData(2.3, 45)); - barChartSeries.addData(new IntDoubleData(2, 45.2)); - barChartSeries.addData(new IntIntData(2, 45)); - barChartSeries.addData(new StringDoubleData("test", 45.2)); - barChartSeries.addData(new StringIntData("test", 45)); - - System.out.println(barChartSeries.getHighChartValue()); - - - ColumnChartSeries columnChartSeries = new ColumnChartSeries("columnScript"); - columnChartSeries.addData(2); - columnChartSeries.addData(2.3); - columnChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); - columnChartSeries.addData(new DoubleIntData(2.3, 45)); - columnChartSeries.addData(new IntDoubleData(2, 45.2)); - columnChartSeries.addData(new IntIntData(2, 45)); - columnChartSeries.addData(new StringDoubleData("test", 45.2)); - columnChartSeries.addData(new StringIntData("test", 45)); - - System.out.println(columnChartSeries.getHighChartValue()); - - - LineChartSeries lineChartSeries = new LineChartSeries("lineScript"); - lineChartSeries.addData(2); - lineChartSeries.addData(2.3); - lineChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); - lineChartSeries.addData(new DoubleIntData(2.3, 45)); - lineChartSeries.addData(new IntDoubleData(2, 45.2)); - lineChartSeries.addData(new IntIntData(2, 45)); - lineChartSeries.addData(new StringDoubleData("test", 45.2)); - lineChartSeries.addData(new StringIntData("test", 45)); - - System.out.println(lineChartSeries.getHighChartValue()); - - AreaRangeChartSeries areaRangeChartSeries = new AreaRangeChartSeries("areaRangeScript"); areaRangeChartSeries.addData(new AreaRangeChartData(124640640, 14.3, 27.7)); areaRangeChartSeries.addData(new AreaRangeChartData(124649280, 14.5, 27.8)); @@ -105,7 +66,7 @@ public static void main(String[] args) { System.out.println(areaRangeChartSeries.getHighChartValue()); - AreaSplineChartSeries areaSplineChartSeries = new AreaSplineChartSeries("areaSplineChartScript"); + AreaSplineChartSeries areaSplineChartSeries = new AreaSplineChartSeries("areaSplineScript"); areaSplineChartSeries.addData(3); areaSplineChartSeries.addData(5); areaSplineChartSeries.addData(1); @@ -113,11 +74,10 @@ public static void main(String[] args) { areaSplineChartSeries.addData(4); areaSplineChartSeries.addData(2); - System.out.println(areaSplineChartSeries.getHighChartValue()); - AreaSplineRangeChartSeries areaSplineRangeChartSeries = new AreaSplineRangeChartSeries("areaSplineRangeChartScript"); + AreaSplineRangeChartSeries areaSplineRangeChartSeries = new AreaSplineRangeChartSeries("areaSplineRangeScript"); areaSplineRangeChartSeries.addData(new AreaSplineRangeChartData(124640640, 14.3, 27.7)); areaSplineRangeChartSeries.addData(new AreaSplineRangeChartData(124649280, 14.5, 27.8)); areaSplineRangeChartSeries.addData(new AreaSplineRangeChartData(124657920, 15.5, 29.6)); @@ -152,5 +112,155 @@ public static void main(String[] args) { System.out.println(areaSplineRangeChartSeries.getHighChartValue()); + + BarChartSeries barChartSeries = new BarChartSeries("barScript"); + barChartSeries.addData(2); + barChartSeries.addData(2.3); + barChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); + barChartSeries.addData(new DoubleIntData(2.3, 45)); + barChartSeries.addData(new IntDoubleData(2, 45.2)); + barChartSeries.addData(new IntIntData(2, 45)); + barChartSeries.addData(new StringDoubleData("test", 45.2)); + barChartSeries.addData(new StringIntData("test", 45)); + + System.out.println(barChartSeries.getHighChartValue()); + + + BoxPlotChartSeries boxPlotChartSeries = new BoxPlotChartSeries("boxPlotScript"); + boxPlotChartSeries.addData(new BoxPlotChartData(760, 801, 848, 895, 965)); + boxPlotChartSeries.addData(new BoxPlotChartData(733, 853, 939, 980, 1080)); + boxPlotChartSeries.addData(new BoxPlotChartData(714, 762, 817, 870, 918)); + boxPlotChartSeries.addData(new BoxPlotChartData(724, 802, 806, 871, 950)); + boxPlotChartSeries.addData(new BoxPlotChartData(834, 836, 864, 882, 910)); + + System.out.println(boxPlotChartSeries.getHighChartValue()); + + + BubbleChartSeries bubbleChartSeries = new BubbleChartSeries("bubbleScript"); + bubbleChartSeries.addData(new BubbleChartData(9, 81, 63)); + bubbleChartSeries.addData(new BubbleChartData(98, 5, 89)); + bubbleChartSeries.addData(new BubbleChartData(51, 50, 73)); + bubbleChartSeries.addData(new BubbleChartData(41, 22, 14)); + bubbleChartSeries.addData(new BubbleChartData(58, 24, 20)); + bubbleChartSeries.addData(new BubbleChartData(78, 37, 34)); + bubbleChartSeries.addData(new BubbleChartData(55, 56, 53)); + bubbleChartSeries.addData(new BubbleChartData(18, 45, 70)); + bubbleChartSeries.addData(new BubbleChartData(42, 44, 28)); + bubbleChartSeries.addData(new BubbleChartData(3, 52, 59)); + bubbleChartSeries.addData(new BubbleChartData(31, 18, 97)); + bubbleChartSeries.addData(new BubbleChartData(79, 91, 63)); + bubbleChartSeries.addData(new BubbleChartData(93, 23, 23)); + bubbleChartSeries.addData(new BubbleChartData(44, 83, 22)); + + System.out.println(bubbleChartSeries.getHighChartValue()); + + + ColumnChartSeries columnChartSeries = new ColumnChartSeries("columnScript"); + columnChartSeries.addData(2); + columnChartSeries.addData(2.3); + columnChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); + columnChartSeries.addData(new DoubleIntData(2.3, 45)); + columnChartSeries.addData(new IntDoubleData(2, 45.2)); + columnChartSeries.addData(new IntIntData(2, 45)); + columnChartSeries.addData(new StringDoubleData("test", 45.2)); + columnChartSeries.addData(new StringIntData("test", 45)); + + System.out.println(columnChartSeries.getHighChartValue()); + + + ColumnRangeChartSeries columnRangeChartSeries = new ColumnRangeChartSeries("columnRange"); + columnRangeChartSeries.addData(new ColumnRangeChartData(124640640, 14.3, 27.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124649280, 14.5, 27.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124657920, 15.5, 29.6)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124666560, 16.7, 30.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124675200, 16.5, 25.0)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124683840, 17.8, 25.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124692480, 13.5, 24.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124701120, 10.5, 21.4)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124709760, 9.2, 23.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124718400, 11.6, 21.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124727040, 10.7, 23.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124735680, 11.0, 23.3)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124744320, 11.6, 23.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124752960, 11.8, 20.7)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124761600, 12.6, 22.4)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124770240, 13.6, 19.6)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124778880, 11.4, 22.6)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124787520, 13.2, 25.0)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124796160, 14.2, 21.6)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124804800, 13.1, 17.1)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124813440, 12.2, 15.5)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124822080, 12.0, 20.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124830720, 12.0, 17.1)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124839360, 12.7, 18.3)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124848000, 12.4, 19.4)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124856640, 12.6, 19.9)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124865280, 11.9, 20.2)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124873920, 11.0, 19.3)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124882560, 10.8, 17.8)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124891200, 11.8, 18.5)); + columnRangeChartSeries.addData(new ColumnRangeChartData(124899840, 10.8, 16.1)); + + System.out.println(columnRangeChartSeries.getHighChartValue()); + + + ErrorBarChartSeries errorBarChartSeries = new ErrorBarChartSeries("errorBar"); + errorBarChartSeries.addData(new ErrorBarChartData(124640640, 14.3, 27.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124649280, 14.5, 27.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124657920, 15.5, 29.6)); + errorBarChartSeries.addData(new ErrorBarChartData(124666560, 16.7, 30.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124675200, 16.5, 25.0)); + errorBarChartSeries.addData(new ErrorBarChartData(124683840, 17.8, 25.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124692480, 13.5, 24.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124701120, 10.5, 21.4)); + errorBarChartSeries.addData(new ErrorBarChartData(124709760, 9.2, 23.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124718400, 11.6, 21.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124727040, 10.7, 23.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124735680, 11.0, 23.3)); + errorBarChartSeries.addData(new ErrorBarChartData(124744320, 11.6, 23.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124752960, 11.8, 20.7)); + errorBarChartSeries.addData(new ErrorBarChartData(124761600, 12.6, 22.4)); + errorBarChartSeries.addData(new ErrorBarChartData(124770240, 13.6, 19.6)); + errorBarChartSeries.addData(new ErrorBarChartData(124778880, 11.4, 22.6)); + errorBarChartSeries.addData(new ErrorBarChartData(124787520, 13.2, 25.0)); + errorBarChartSeries.addData(new ErrorBarChartData(124796160, 14.2, 21.6)); + errorBarChartSeries.addData(new ErrorBarChartData(124804800, 13.1, 17.1)); + errorBarChartSeries.addData(new ErrorBarChartData(124813440, 12.2, 15.5)); + errorBarChartSeries.addData(new ErrorBarChartData(124822080, 12.0, 20.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124830720, 12.0, 17.1)); + errorBarChartSeries.addData(new ErrorBarChartData(124839360, 12.7, 18.3)); + errorBarChartSeries.addData(new ErrorBarChartData(124848000, 12.4, 19.4)); + errorBarChartSeries.addData(new ErrorBarChartData(124856640, 12.6, 19.9)); + errorBarChartSeries.addData(new ErrorBarChartData(124865280, 11.9, 20.2)); + errorBarChartSeries.addData(new ErrorBarChartData(124873920, 11.0, 19.3)); + errorBarChartSeries.addData(new ErrorBarChartData(124882560, 10.8, 17.8)); + errorBarChartSeries.addData(new ErrorBarChartData(124891200, 11.8, 18.5)); + errorBarChartSeries.addData(new ErrorBarChartData(124899840, 10.8, 16.1)); + + System.out.println(errorBarChartSeries.getHighChartValue()); + + + FunnelChartSeries funnelChartSeries = new FunnelChartSeries("funnelScript"); + funnelChartSeries.addData(new StringDoubleData("Testwert 1", 22.05)); + funnelChartSeries.addData(new StringDoubleData("Testwert 2", 43.12)); + funnelChartSeries.addData(new StringDoubleData("Testwert 3", 62.45)); + funnelChartSeries.addData(new IntData(3)); + funnelChartSeries.addData(new DoubleData(11.23)); + + System.out.println(funnelChartSeries.getHighChartValue()); + + + LineChartSeries lineChartSeries = new LineChartSeries("lineScript"); + lineChartSeries.addData(2); + lineChartSeries.addData(2.3); + lineChartSeries.addData(new DoubleDoubleData(2.3, 45.2)); + lineChartSeries.addData(new DoubleIntData(2.3, 45)); + lineChartSeries.addData(new IntDoubleData(2, 45.2)); + lineChartSeries.addData(new IntIntData(2, 45)); + lineChartSeries.addData(new StringDoubleData("test", 45.2)); + lineChartSeries.addData(new StringIntData("test", 45)); + + System.out.println(lineChartSeries.getHighChartValue()); + } }