diff --git a/plugin.xml b/plugin.xml index aa1ad87..3d8d185 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,13 +3,14 @@ com.finebi.plugin.tptj.ivan.chart.demo.amap yes - 0.0.1 + 0.0.2 11.0~11.0 2021-08-30 DEMO + 0.0.2: 图表DEMO_EK 数据处理接口
]]>
6.0~ com.finebi.plugin.tptj.ivan.chart.demo.amap diff --git a/src/main/java/com/finebi/plugin/tptj/ivan/chart/demo/amap/MapHotComponentProvider.java b/src/main/java/com/finebi/plugin/tptj/ivan/chart/demo/amap/MapHotComponentProvider.java index 3c3927d..a6b83b8 100644 --- a/src/main/java/com/finebi/plugin/tptj/ivan/chart/demo/amap/MapHotComponentProvider.java +++ b/src/main/java/com/finebi/plugin/tptj/ivan/chart/demo/amap/MapHotComponentProvider.java @@ -4,6 +4,9 @@ import com.finebi.common.context.OperationContext; import com.finebi.plugin.tptj.ivan.chart.demo.amap.component.MapHotComponent; import com.finebi.plugin.tptj.ivan.chart.demo.amap.constant.PluginConstantsEK; import com.finebi.provider.api.component.AbstractCustomComponentProvider; +import com.finebi.provider.api.component.CustomComponentContext; +import com.finebi.provider.api.component.data.DataModel; +import com.finebi.provider.api.component.data.Dimension; import com.fr.base.TemplateUtils; import com.fr.general.IOUtils; import com.fr.intelli.record.Focus; @@ -11,6 +14,11 @@ import com.fr.intelli.record.Original; import com.fr.record.analyzer.EnableMetrics; import com.fr.web.struct.AssembleComponent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + @EnableMetrics public class MapHotComponentProvider extends AbstractCustomComponentProvider { /** @@ -68,4 +76,37 @@ public class MapHotComponentProvider extends AbstractCustomComponentProvider { public String config() { return IOUtils.readResourceAsString("com/finebi/plugin/tptj/ivan/chart/demo/amap/config/config.json"); } + + /** + * 是否需要进行数据处理 + * true:需要 + * false:不需要 + * CustomComponentContext: 自定义图表相关配置 + */ + @Override + public boolean needDataProcess(CustomComponentContext customComponentContext) { + return true; + } + + /** + * 数据处理逻辑 + * needDataProcess返回true时才会生效 + * CustomComponentContext: 自定义图表相关配置 + */ + @Override + public List process(List dataModels, CustomComponentContext customComponentContext) { + return dataModels.stream().map(dataModel -> new DataModel() { + @Override + public List getFields() { + return dataModel.getFields(); + } + + @Override + public List> getColData() { + List> colData = new ArrayList<>(dataModel.getFields().size()); + dataModel.getColData().forEach(d -> colData.add(Collections.singletonList(d.get((int) (Math.random() * d.size()))))); + return colData; + } + }).collect(Collectors.toList()); + } } diff --git a/说明/0.0.2/0.0.2.zip b/说明/0.0.2/0.0.2.zip new file mode 100644 index 0000000..e134a1e Binary files /dev/null and b/说明/0.0.2/0.0.2.zip differ diff --git a/说明/0.0.2/fine-plugin-com.finebi.plugin.tptj.ivan.chart.demo.amap-0.0.2.zip b/说明/0.0.2/fine-plugin-com.finebi.plugin.tptj.ivan.chart.demo.amap-0.0.2.zip new file mode 100644 index 0000000..eabfeae Binary files /dev/null and b/说明/0.0.2/fine-plugin-com.finebi.plugin.tptj.ivan.chart.demo.amap-0.0.2.zip differ