Ver código fonte

修复SQL中条件部分有日期参数时会预览时分秒的BUG

master
jacky6024 7 anos atrás
pai
commit
34c961a146
  1. 3
      ureport2-core/src/main/java/com/bstek/ureport/build/DataCompute.java
  2. 48
      ureport2-core/src/main/java/com/bstek/ureport/build/compute/ChartValueCompute.java
  3. 32
      ureport2-core/src/main/java/com/bstek/ureport/chart/Chart.java
  4. 10
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/BaseDataset.java
  5. 29
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/BubbleData.java
  6. 14
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/Dataset.java
  7. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/DatasetType.java
  8. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/PointStyle.java
  9. 22
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/ScatterData.java
  10. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/Source.java
  11. 89
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/BubbleDataset.java
  12. 12
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/DoughnutDataset.java
  13. 51
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/MixDataset.java
  14. 99
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/PieDataset.java
  15. 99
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/PolarDataset.java
  16. 182
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/RadarDataset.java
  17. 146
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/ScatterDataset.java
  18. 20
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/AreaDataset.java
  19. 82
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/BarDataset.java
  20. 24
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/CategoryData.java
  21. 118
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/CategoryDataset.java
  22. 20
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/HorizontalBarDataset.java
  23. 159
      ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/LineDataset.java
  24. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/Easing.java
  25. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/FontStyle.java
  26. 50
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/Labels.java
  27. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/Option.java
  28. 36
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/Padding.java
  29. 9
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/Position.java
  30. 29
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/AnimationsOption.java
  31. 23
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/LayoutOption.java
  32. 37
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/LegendOption.java
  33. 72
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/TitleOption.java
  34. 98
      ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/TooltipOption.java
  35. 4
      ureport2-core/src/main/java/com/bstek/ureport/definition/datasource/DataType.java
  36. 12
      ureport2-core/src/main/java/com/bstek/ureport/definition/value/ChartValue.java

3
ureport2-core/src/main/java/com/bstek/ureport/build/DataCompute.java

@ -19,6 +19,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bstek.ureport.build.compute.ChartValueCompute;
import com.bstek.ureport.build.compute.DatasetValueCompute;
import com.bstek.ureport.build.compute.ExpressionValueCompute;
import com.bstek.ureport.build.compute.ImageValueCompute;
@ -50,6 +51,8 @@ public class DataCompute {
valueComputesMap.put(slashValueCompute.type().name(), slashValueCompute);
ZxingValueCompute zxingValueCompute=new ZxingValueCompute();
valueComputesMap.put(zxingValueCompute.type().name(), zxingValueCompute);
ChartValueCompute chartValueCompute=new ChartValueCompute();
valueComputesMap.put(chartValueCompute.type().name(), chartValueCompute);
}

48
ureport2-core/src/main/java/com/bstek/ureport/build/compute/ChartValueCompute.java

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright 2017 Bstek
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
******************************************************************************/
package com.bstek.ureport.build.compute;
import java.util.ArrayList;
import java.util.List;
import com.bstek.ureport.build.BindData;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.Chart;
import com.bstek.ureport.definition.value.ChartValue;
import com.bstek.ureport.definition.value.ValueType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public class ChartValueCompute implements ValueCompute {
@Override
public List<BindData> compute(Cell cell, Context context) {
ChartValue chartValue=(ChartValue)cell.getValue();
Chart chart=chartValue.getChart();
String data=chart.doCompute(cell, context);
List<BindData> list=new ArrayList<BindData>();
list.add(new BindData(data));
return list;
}
@Override
public ValueType type() {
return ValueType.chart;
}
}

32
ureport2-core/src/main/java/com/bstek/ureport/chart/Chart.java

@ -0,0 +1,32 @@
package com.bstek.ureport.chart;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.option.Option;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class Chart {
private Option option;
private Dataset dataset;
public String doCompute(Cell cell, Context context){
StringBuilder sb=new StringBuilder();
return sb.toString();
}
public Option getOption() {
return option;
}
public void setOption(Option option) {
this.option = option;
}
public Dataset getDataset() {
return dataset;
}
public void setDataset(Dataset dataset) {
this.dataset = dataset;
}
}

10
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/BaseDataset.java

@ -0,0 +1,10 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public abstract class BaseDataset implements Dataset {
}

29
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/BubbleData.java

@ -0,0 +1,29 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class BubbleData {
private int x;
private int y;
private int r;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getR() {
return r;
}
public void setR(int r) {
this.r = r;
}
}

14
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/Dataset.java

@ -0,0 +1,14 @@
package com.bstek.ureport.chart.dataset;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public interface Dataset {
String buildConfiguration(Context context,Cell cell);
DatasetType getDatasetType();
String type();
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/DatasetType.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public enum DatasetType {
Line,Bar,HorizontalBar,Radar,Pie,Polar,Bubble,Scatter,Area,Mix
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/PointStyle.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public enum PointStyle {
circle,cross,crossRot,dash,rect,rectRounded,rectRot,star,triangle
}

22
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/ScatterData.java

@ -0,0 +1,22 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class ScatterData {
private int x;
private int y;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/Source.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.dataset;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public enum Source {
dataset,expression;
}

89
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/BubbleDataset.java

@ -0,0 +1,89 @@
package com.bstek.ureport.chart.dataset.impl;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.BubbleData;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class BubbleDataset implements Dataset {
private BubbleData data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private String hoverBackgroundColor;
private String hoverBorderColor;
private int hoverBorderWidth;
private int hoverRadius;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Bubble;
}
@Override
public String type() {
return "bubble";
}
public BubbleData getData() {
return data;
}
public void setData(BubbleData data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public String getHoverBackgroundColor() {
return hoverBackgroundColor;
}
public void setHoverBackgroundColor(String hoverBackgroundColor) {
this.hoverBackgroundColor = hoverBackgroundColor;
}
public String getHoverBorderColor() {
return hoverBorderColor;
}
public void setHoverBorderColor(String hoverBorderColor) {
this.hoverBorderColor = hoverBorderColor;
}
public int getHoverBorderWidth() {
return hoverBorderWidth;
}
public void setHoverBorderWidth(int hoverBorderWidth) {
this.hoverBorderWidth = hoverBorderWidth;
}
public int getHoverRadius() {
return hoverRadius;
}
public void setHoverRadius(int hoverRadius) {
this.hoverRadius = hoverRadius;
}
}

12
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/DoughnutDataset.java

@ -0,0 +1,12 @@
package com.bstek.ureport.chart.dataset.impl;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public class DoughnutDataset extends PieDataset {
@Override
public String type() {
return "doughnut";
}
}

51
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/MixDataset.java

@ -0,0 +1,51 @@
package com.bstek.ureport.chart.dataset.impl;
import java.util.ArrayList;
import java.util.List;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.chart.dataset.impl.category.BarDataset;
import com.bstek.ureport.chart.dataset.impl.category.LineDataset;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class MixDataset implements Dataset {
private List<BarDataset> barDatasets=new ArrayList<BarDataset>();
private List<LineDataset> lineDatasets=new ArrayList<LineDataset>();
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Mix;
}
@Override
public String type() {
return "bar";
}
public List<BarDataset> getBarDatasets() {
return barDatasets;
}
public void setBarDatasets(List<BarDataset> barDatasets) {
this.barDatasets = barDatasets;
}
public List<LineDataset> getLineDatasets() {
return lineDatasets;
}
public void setLineDatasets(List<LineDataset> lineDatasets) {
this.lineDatasets = lineDatasets;
}
}

99
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/PieDataset.java

@ -0,0 +1,99 @@
package com.bstek.ureport.chart.dataset.impl;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class PieDataset implements Dataset {
private double[] data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private String hoverBackgroundColor;
private String hoverBorderColor;
private int hoverBorderWidth;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Pie;
}
@Override
public String type() {
return "pie";
}
public double[] getData() {
return data;
}
public void setData(double[] data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public String getHoverBackgroundColor() {
return hoverBackgroundColor;
}
public void setHoverBackgroundColor(String hoverBackgroundColor) {
this.hoverBackgroundColor = hoverBackgroundColor;
}
public String getHoverBorderColor() {
return hoverBorderColor;
}
public void setHoverBorderColor(String hoverBorderColor) {
this.hoverBorderColor = hoverBorderColor;
}
public int getHoverBorderWidth() {
return hoverBorderWidth;
}
public void setHoverBorderWidth(int hoverBorderWidth) {
this.hoverBorderWidth = hoverBorderWidth;
}
}

99
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/PolarDataset.java

@ -0,0 +1,99 @@
package com.bstek.ureport.chart.dataset.impl;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class PolarDataset implements Dataset {
private double[] data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private String hoverBackgroundColor;
private String hoverBorderColor;
private int hoverBorderWidth;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Polar;
}
@Override
public String type() {
return "polarArea";
}
public double[] getData() {
return data;
}
public void setData(double[] data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public String getHoverBackgroundColor() {
return hoverBackgroundColor;
}
public void setHoverBackgroundColor(String hoverBackgroundColor) {
this.hoverBackgroundColor = hoverBackgroundColor;
}
public String getHoverBorderColor() {
return hoverBorderColor;
}
public void setHoverBorderColor(String hoverBorderColor) {
this.hoverBorderColor = hoverBorderColor;
}
public int getHoverBorderWidth() {
return hoverBorderWidth;
}
public void setHoverBorderWidth(int hoverBorderWidth) {
this.hoverBorderWidth = hoverBorderWidth;
}
}

182
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/RadarDataset.java

@ -0,0 +1,182 @@
package com.bstek.ureport.chart.dataset.impl;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.chart.dataset.PointStyle;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class RadarDataset implements Dataset {
private double[] data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private boolean fill;
private double lineTension=0.1;
private String pointBackgroundColor;
private String pointBorderColor;
private int pointBorderWidth;
private int pointRadius;
private PointStyle pointStyle;
private int pointHitRadius;
private String pointHoverBackgroundColor;
private String pointHoverBorderColor;
private int pointHoverBorderWidth;
private int pointHoverRadius;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Radar;
}
@Override
public String type() {
return "radar";
}
public double[] getData() {
return data;
}
public void setData(double[] data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public boolean isFill() {
return fill;
}
public void setFill(boolean fill) {
this.fill = fill;
}
public double getLineTension() {
return lineTension;
}
public void setLineTension(double lineTension) {
this.lineTension = lineTension;
}
public String getPointBackgroundColor() {
return pointBackgroundColor;
}
public void setPointBackgroundColor(String pointBackgroundColor) {
this.pointBackgroundColor = pointBackgroundColor;
}
public String getPointBorderColor() {
return pointBorderColor;
}
public void setPointBorderColor(String pointBorderColor) {
this.pointBorderColor = pointBorderColor;
}
public int getPointBorderWidth() {
return pointBorderWidth;
}
public void setPointBorderWidth(int pointBorderWidth) {
this.pointBorderWidth = pointBorderWidth;
}
public int getPointRadius() {
return pointRadius;
}
public void setPointRadius(int pointRadius) {
this.pointRadius = pointRadius;
}
public PointStyle getPointStyle() {
return pointStyle;
}
public void setPointStyle(PointStyle pointStyle) {
this.pointStyle = pointStyle;
}
public int getPointHitRadius() {
return pointHitRadius;
}
public void setPointHitRadius(int pointHitRadius) {
this.pointHitRadius = pointHitRadius;
}
public String getPointHoverBackgroundColor() {
return pointHoverBackgroundColor;
}
public void setPointHoverBackgroundColor(String pointHoverBackgroundColor) {
this.pointHoverBackgroundColor = pointHoverBackgroundColor;
}
public String getPointHoverBorderColor() {
return pointHoverBorderColor;
}
public void setPointHoverBorderColor(String pointHoverBorderColor) {
this.pointHoverBorderColor = pointHoverBorderColor;
}
public int getPointHoverBorderWidth() {
return pointHoverBorderWidth;
}
public void setPointHoverBorderWidth(int pointHoverBorderWidth) {
this.pointHoverBorderWidth = pointHoverBorderWidth;
}
public int getPointHoverRadius() {
return pointHoverRadius;
}
public void setPointHoverRadius(int pointHoverRadius) {
this.pointHoverRadius = pointHoverRadius;
}
}

146
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/ScatterDataset.java

@ -0,0 +1,146 @@
package com.bstek.ureport.chart.dataset.impl;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.chart.dataset.PointStyle;
import com.bstek.ureport.chart.dataset.ScatterData;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class ScatterDataset implements Dataset {
private ScatterData data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private boolean fill;
private double lineTension=0.2;
private String pointBackgroundColor;
private String pointBorderColor;
private int pointBorderWidth;
private int pointRadius;
private PointStyle pointStyle;
private int pointHitRadius;
private String pointHoverBackgroundColor;
private String pointHoverBorderColor;
private int pointHoverBorderWidth;
private int pointHoverRadius;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Scatter;
}
@Override
public String type() {
return "scatter";
}
public ScatterData getData() {
return data;
}
public void setData(ScatterData data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public boolean isFill() {
return fill;
}
public void setFill(boolean fill) {
this.fill = fill;
}
public double getLineTension() {
return lineTension;
}
public void setLineTension(double lineTension) {
this.lineTension = lineTension;
}
public String getPointBackgroundColor() {
return pointBackgroundColor;
}
public void setPointBackgroundColor(String pointBackgroundColor) {
this.pointBackgroundColor = pointBackgroundColor;
}
public String getPointBorderColor() {
return pointBorderColor;
}
public void setPointBorderColor(String pointBorderColor) {
this.pointBorderColor = pointBorderColor;
}
public int getPointBorderWidth() {
return pointBorderWidth;
}
public void setPointBorderWidth(int pointBorderWidth) {
this.pointBorderWidth = pointBorderWidth;
}
public int getPointRadius() {
return pointRadius;
}
public void setPointRadius(int pointRadius) {
this.pointRadius = pointRadius;
}
public PointStyle getPointStyle() {
return pointStyle;
}
public void setPointStyle(PointStyle pointStyle) {
this.pointStyle = pointStyle;
}
public int getPointHitRadius() {
return pointHitRadius;
}
public void setPointHitRadius(int pointHitRadius) {
this.pointHitRadius = pointHitRadius;
}
public String getPointHoverBackgroundColor() {
return pointHoverBackgroundColor;
}
public void setPointHoverBackgroundColor(String pointHoverBackgroundColor) {
this.pointHoverBackgroundColor = pointHoverBackgroundColor;
}
public String getPointHoverBorderColor() {
return pointHoverBorderColor;
}
public void setPointHoverBorderColor(String pointHoverBorderColor) {
this.pointHoverBorderColor = pointHoverBorderColor;
}
public int getPointHoverBorderWidth() {
return pointHoverBorderWidth;
}
public void setPointHoverBorderWidth(int pointHoverBorderWidth) {
this.pointHoverBorderWidth = pointHoverBorderWidth;
}
public int getPointHoverRadius() {
return pointHoverRadius;
}
public void setPointHoverRadius(int pointHoverRadius) {
this.pointHoverRadius = pointHoverRadius;
}
}

20
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/AreaDataset.java

@ -0,0 +1,20 @@
package com.bstek.ureport.chart.dataset.impl.category;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class AreaDataset extends LineDataset {
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Area;
}
}

82
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/BarDataset.java

@ -0,0 +1,82 @@
package com.bstek.ureport.chart.dataset.impl.category;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.Dataset;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class BarDataset implements Dataset{
private double[] data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private String hoverBackgroundColor;
private String hoverBorderColor;
private String hoverBorderWidth;
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Bar;
}
@Override
public String type() {
return "bar";
}
public double[] getData() {
return data;
}
public void setData(double[] data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public String getHoverBackgroundColor() {
return hoverBackgroundColor;
}
public void setHoverBackgroundColor(String hoverBackgroundColor) {
this.hoverBackgroundColor = hoverBackgroundColor;
}
public String getHoverBorderColor() {
return hoverBorderColor;
}
public void setHoverBorderColor(String hoverBorderColor) {
this.hoverBorderColor = hoverBorderColor;
}
public String getHoverBorderWidth() {
return hoverBorderWidth;
}
public void setHoverBorderWidth(String hoverBorderWidth) {
this.hoverBorderWidth = hoverBorderWidth;
}
}

24
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/CategoryData.java

@ -0,0 +1,24 @@
package com.bstek.ureport.chart.dataset.impl.category;
import java.util.List;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public class CategoryData {
private String label;
private List<Double> data;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<Double> getData() {
return data;
}
public void setData(List<Double> data) {
this.data = data;
}
}

118
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/CategoryDataset.java

@ -0,0 +1,118 @@
package com.bstek.ureport.chart.dataset.impl.category;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.bstek.ureport.Utils;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.BaseDataset;
import com.bstek.ureport.chart.dataset.Source;
import com.bstek.ureport.definition.value.AggregateType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月9日
*/
public abstract class CategoryDataset extends BaseDataset {
private Source source=Source.dataset;
private AggregateType aggregateType=AggregateType.select;
private String datasetName;
private String categoryProperty;
private String seriesProperty;
private String valueProperty;
private String categoryExpression;
private String seriesExpression;
private String valueExpression;
protected List<CategoryData> buildCategoryDatas(Context context,Cell cell){
List<CategoryData> list=new ArrayList<CategoryData>();
List<?> data=context.getDatasetData(datasetName);
List<Object> categoryList=new ArrayList<Object>();
Map<Object,List<Object>> seriesMap=new HashMap<Object,List<Object>>();
for(Object obj:data){
Object category=Utils.getProperty(obj, categoryProperty);
if(category!=null){
if(!categoryList.contains(category)){
categoryList.add(category);
}
}
Object series=Utils.getProperty(obj, seriesProperty);
if(series!=null){
List<Object> valueList;
if(seriesMap.containsKey(series)){
valueList=seriesMap.get(series);
}else{
valueList=new ArrayList<Object>();
seriesMap.put(series, valueList);
}
Object value=Utils.getProperty(obj, valueProperty);
valueList.add(value);
}
}
return list;
}
public AggregateType getAggregateType() {
return aggregateType;
}
public void setAggregateType(AggregateType aggregateType) {
this.aggregateType = aggregateType;
}
public Source getSource() {
return source;
}
public void setSource(Source source) {
this.source = source;
}
public String getDatasetName() {
return datasetName;
}
public void setDatasetName(String datasetName) {
this.datasetName = datasetName;
}
public String getCategoryProperty() {
return categoryProperty;
}
public void setCategoryProperty(String categoryProperty) {
this.categoryProperty = categoryProperty;
}
public String getSeriesProperty() {
return seriesProperty;
}
public void setSeriesProperty(String seriesProperty) {
this.seriesProperty = seriesProperty;
}
public String getValueProperty() {
return valueProperty;
}
public void setValueProperty(String valueProperty) {
this.valueProperty = valueProperty;
}
public String getCategoryExpression() {
return categoryExpression;
}
public void setCategoryExpression(String categoryExpression) {
this.categoryExpression = categoryExpression;
}
public String getSeriesExpression() {
return seriesExpression;
}
public void setSeriesExpression(String seriesExpression) {
this.seriesExpression = seriesExpression;
}
public String getValueExpression() {
return valueExpression;
}
public void setValueExpression(String valueExpression) {
this.valueExpression = valueExpression;
}
}

20
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/HorizontalBarDataset.java

@ -0,0 +1,20 @@
package com.bstek.ureport.chart.dataset.impl.category;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class HorizontalBarDataset extends BarDataset {
@Override
public String buildConfiguration(Context context,Cell cell) {
return null;
}
@Override
public DatasetType getDatasetType() {
return DatasetType.HorizontalBar;
}
}

159
ureport2-core/src/main/java/com/bstek/ureport/chart/dataset/impl/category/LineDataset.java

@ -0,0 +1,159 @@
package com.bstek.ureport.chart.dataset.impl.category;
import com.bstek.ureport.build.Context;
import com.bstek.ureport.chart.dataset.DatasetType;
import com.bstek.ureport.chart.dataset.PointStyle;
import com.bstek.ureport.model.Cell;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class LineDataset extends CategoryDataset{
private double[] data;
private String label;
private String backgroundColor;
private String borderColor;
private int borderWidth;
private boolean fill;
private double lineTension=0.2;
private String pointBackgroundColor;
private String pointBorderColor;
private int pointBorderWidth;
private int pointRadius;
private PointStyle pointStyle;
private int pointHitRadius;
private String pointHoverBackgroundColor;
private String pointHoverBorderColor;
private int pointHoverBorderWidth;
private int pointHoverRadius;
@Override
public String buildConfiguration(Context context,Cell cell) {
StringBuilder sb=new StringBuilder();
sb.append("{");
if(label!=null){
sb.append("label:\""+label+"\"");
}
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("}");
return sb.toString();
}
@Override
public DatasetType getDatasetType() {
return DatasetType.Line;
}
@Override
public String type() {
return "line";
}
public double[] getData() {
return data;
}
public void setData(double[] data) {
this.data = data;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public String getBorderColor() {
return borderColor;
}
public void setBorderColor(String borderColor) {
this.borderColor = borderColor;
}
public int getBorderWidth() {
return borderWidth;
}
public void setBorderWidth(int borderWidth) {
this.borderWidth = borderWidth;
}
public boolean isFill() {
return fill;
}
public void setFill(boolean fill) {
this.fill = fill;
}
public double getLineTension() {
return lineTension;
}
public void setLineTension(double lineTension) {
this.lineTension = lineTension;
}
public String getPointBackgroundColor() {
return pointBackgroundColor;
}
public void setPointBackgroundColor(String pointBackgroundColor) {
this.pointBackgroundColor = pointBackgroundColor;
}
public String getPointBorderColor() {
return pointBorderColor;
}
public void setPointBorderColor(String pointBorderColor) {
this.pointBorderColor = pointBorderColor;
}
public int getPointBorderWidth() {
return pointBorderWidth;
}
public void setPointBorderWidth(int pointBorderWidth) {
this.pointBorderWidth = pointBorderWidth;
}
public int getPointRadius() {
return pointRadius;
}
public void setPointRadius(int pointRadius) {
this.pointRadius = pointRadius;
}
public PointStyle getPointStyle() {
return pointStyle;
}
public void setPointStyle(PointStyle pointStyle) {
this.pointStyle = pointStyle;
}
public int getPointHitRadius() {
return pointHitRadius;
}
public void setPointHitRadius(int pointHitRadius) {
this.pointHitRadius = pointHitRadius;
}
public String getPointHoverBackgroundColor() {
return pointHoverBackgroundColor;
}
public void setPointHoverBackgroundColor(String pointHoverBackgroundColor) {
this.pointHoverBackgroundColor = pointHoverBackgroundColor;
}
public String getPointHoverBorderColor() {
return pointHoverBorderColor;
}
public void setPointHoverBorderColor(String pointHoverBorderColor) {
this.pointHoverBorderColor = pointHoverBorderColor;
}
public int getPointHoverBorderWidth() {
return pointHoverBorderWidth;
}
public void setPointHoverBorderWidth(int pointHoverBorderWidth) {
this.pointHoverBorderWidth = pointHoverBorderWidth;
}
public int getPointHoverRadius() {
return pointHoverRadius;
}
public void setPointHoverRadius(int pointHoverRadius) {
this.pointHoverRadius = pointHoverRadius;
}
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/option/Easing.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public enum Easing {
linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, easeInElastic, easeOutElastic, easeInOutElastic, easeInBack, easeOutBack, easeInOutBack, easeInBounce, easeOutBounce, easeInOutBounce
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/option/FontStyle.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public enum FontStyle {
normal,italic,bold;
}

50
ureport2-core/src/main/java/com/bstek/ureport/chart/option/Labels.java

@ -0,0 +1,50 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class Labels {
private int boxWidth=40;
private int fontSize=12;
private FontStyle fontStyle=FontStyle.normal;
private String fontColor="#666";
private String fontFamily="'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
private int padding=10;
public int getBoxWidth() {
return boxWidth;
}
public void setBoxWidth(int boxWidth) {
this.boxWidth = boxWidth;
}
public int getFontSize() {
return fontSize;
}
public void setFontSize(int fontSize) {
this.fontSize = fontSize;
}
public FontStyle getFontStyle() {
return fontStyle;
}
public void setFontStyle(FontStyle fontStyle) {
this.fontStyle = fontStyle;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public String getFontFamily() {
return fontFamily;
}
public void setFontFamily(String fontFamily) {
this.fontFamily = fontFamily;
}
public int getPadding() {
return padding;
}
public void setPadding(int padding) {
this.padding = padding;
}
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/option/Option.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public interface Option {
String getConfiguration();
}

36
ureport2-core/src/main/java/com/bstek/ureport/chart/option/Padding.java

@ -0,0 +1,36 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class Padding {
private int left;
private int right;
private int top;
private int bottom;
public int getLeft() {
return left;
}
public void setLeft(int left) {
this.left = left;
}
public int getRight() {
return right;
}
public void setRight(int right) {
this.right = right;
}
public int getTop() {
return top;
}
public void setTop(int top) {
this.top = top;
}
public int getBottom() {
return bottom;
}
public void setBottom(int bottom) {
this.bottom = bottom;
}
}

9
ureport2-core/src/main/java/com/bstek/ureport/chart/option/Position.java

@ -0,0 +1,9 @@
package com.bstek.ureport.chart.option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public enum Position {
left,right,top,bottom;
}

29
ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/AnimationsOption.java

@ -0,0 +1,29 @@
package com.bstek.ureport.chart.option.impl;
import com.bstek.ureport.chart.option.Easing;
import com.bstek.ureport.chart.option.Option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class AnimationsOption implements Option {
private int duration=1000;
private Easing easing=Easing.easeOutQuart;
@Override
public String getConfiguration() {
return null;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public Easing getEasing() {
return easing;
}
public void setEasing(Easing easing) {
this.easing = easing;
}
}

23
ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/LayoutOption.java

@ -0,0 +1,23 @@
package com.bstek.ureport.chart.option.impl;
import com.bstek.ureport.chart.option.Option;
import com.bstek.ureport.chart.option.Padding;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class LayoutOption implements Option {
private Padding padding;
@Override
public String getConfiguration() {
return null;
}
public Padding getPadding() {
return padding;
}
public void setPadding(Padding padding) {
this.padding = padding;
}
}

37
ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/LegendOption.java

@ -0,0 +1,37 @@
package com.bstek.ureport.chart.option.impl;
import com.bstek.ureport.chart.option.Labels;
import com.bstek.ureport.chart.option.Option;
import com.bstek.ureport.chart.option.Position;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class LegendOption implements Option {
private boolean display=true;
private Position position=Position.top;
private Labels labels;
@Override
public String getConfiguration() {
return null;
}
public boolean isDisplay() {
return display;
}
public void setDisplay(boolean display) {
this.display = display;
}
public Position getPosition() {
return position;
}
public void setPosition(Position position) {
this.position = position;
}
public Labels getLabels() {
return labels;
}
public void setLabels(Labels labels) {
this.labels = labels;
}
}

72
ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/TitleOption.java

@ -0,0 +1,72 @@
package com.bstek.ureport.chart.option.impl;
import com.bstek.ureport.chart.option.FontStyle;
import com.bstek.ureport.chart.option.Option;
import com.bstek.ureport.chart.option.Position;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class TitleOption implements Option {
private boolean display;
private Position position=Position.top;
private int fontSize=12;
private String fontFamily="'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
private String fontColor="#666";
private FontStyle fontStyle=FontStyle.bold;
private int padding=10;
private String text;
@Override
public String getConfiguration() {
return null;
}
public boolean isDisplay() {
return display;
}
public void setDisplay(boolean display) {
this.display = display;
}
public Position getPosition() {
return position;
}
public void setPosition(Position position) {
this.position = position;
}
public int getFontSize() {
return fontSize;
}
public void setFontSize(int fontSize) {
this.fontSize = fontSize;
}
public String getFontFamily() {
return fontFamily;
}
public void setFontFamily(String fontFamily) {
this.fontFamily = fontFamily;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public FontStyle getFontStyle() {
return fontStyle;
}
public void setFontStyle(FontStyle fontStyle) {
this.fontStyle = fontStyle;
}
public int getPadding() {
return padding;
}
public void setPadding(int padding) {
this.padding = padding;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

98
ureport2-core/src/main/java/com/bstek/ureport/chart/option/impl/TooltipOption.java

@ -0,0 +1,98 @@
package com.bstek.ureport.chart.option.impl;
import com.bstek.ureport.chart.option.FontStyle;
import com.bstek.ureport.chart.option.Option;
/**
* @author Jacky.gao
* @since 2017年6月8日
*/
public class TooltipOption implements Option {
private boolean enabled=true;
private String titleFontFamily="'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
private int titleFontSize=12;
private FontStyle titleFontStyle=FontStyle.bold;
private String titleFontColor="#fff";
private String bodyFontFamily="'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
private int bodyFontSize=12;
private FontStyle bodyFontStyle=FontStyle.normal;
private String bodyFontColor="#fff";
@Override
public String getConfiguration() {
return null;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public String getTitleFontFamily() {
return titleFontFamily;
}
public void setTitleFontFamily(String titleFontFamily) {
this.titleFontFamily = titleFontFamily;
}
public int getTitleFontSize() {
return titleFontSize;
}
public void setTitleFontSize(int titleFontSize) {
this.titleFontSize = titleFontSize;
}
public FontStyle getTitleFontStyle() {
return titleFontStyle;
}
public void setTitleFontStyle(FontStyle titleFontStyle) {
this.titleFontStyle = titleFontStyle;
}
public String getTitleFontColor() {
return titleFontColor;
}
public void setTitleFontColor(String titleFontColor) {
this.titleFontColor = titleFontColor;
}
public String getBodyFontFamily() {
return bodyFontFamily;
}
public void setBodyFontFamily(String bodyFontFamily) {
this.bodyFontFamily = bodyFontFamily;
}
public int getBodyFontSize() {
return bodyFontSize;
}
public void setBodyFontSize(int bodyFontSize) {
this.bodyFontSize = bodyFontSize;
}
public FontStyle getBodyFontStyle() {
return bodyFontStyle;
}
public void setBodyFontStyle(FontStyle bodyFontStyle) {
this.bodyFontStyle = bodyFontStyle;
}
public String getBodyFontColor() {
return bodyFontColor;
}
public void setBodyFontColor(String bodyFontColor) {
this.bodyFontColor = bodyFontColor;
}
}

4
ureport2-core/src/main/java/com/bstek/ureport/definition/datasource/DataType.java

@ -73,11 +73,11 @@ public enum DataType {
return (Date)obj;
}else{
Date date=null;
SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sd=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try{
date=sd.parse(obj.toString());
}catch(ParseException e){
sd=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sd=new SimpleDateFormat("yyyy-MM-dd");
try{
date=sd.parse(obj.toString());
}catch(ParseException ex){

12
ureport2-core/src/main/java/com/bstek/ureport/definition/value/ChartValue.java

@ -15,12 +15,14 @@
******************************************************************************/
package com.bstek.ureport.definition.value;
import com.bstek.ureport.chart.Chart;
/**
* 图标类型的值
* @author Jacky.gao
* @since 2016年12月6
* @since 2017年6月9
*/
public class ChartValue implements Value {
private Chart chart;
@Override
public String getValue() {
return null;
@ -29,4 +31,10 @@ public class ChartValue implements Value {
public ValueType getType() {
return ValueType.chart;
}
public void setChart(Chart chart) {
this.chart = chart;
}
public Chart getChart() {
return chart;
}
}

Carregando…
Cancelar
Salvar