|
|
@ -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.component.MapHotComponent; |
|
|
|
import com.finebi.plugin.tptj.ivan.chart.demo.amap.constant.PluginConstantsEK; |
|
|
|
import com.finebi.plugin.tptj.ivan.chart.demo.amap.constant.PluginConstantsEK; |
|
|
|
import com.finebi.provider.api.component.AbstractCustomComponentProvider; |
|
|
|
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.base.TemplateUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.general.IOUtils; |
|
|
|
import com.fr.intelli.record.Focus; |
|
|
|
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.record.analyzer.EnableMetrics; |
|
|
|
import com.fr.web.struct.AssembleComponent; |
|
|
|
import com.fr.web.struct.AssembleComponent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
@EnableMetrics |
|
|
|
@EnableMetrics |
|
|
|
public class MapHotComponentProvider extends AbstractCustomComponentProvider { |
|
|
|
public class MapHotComponentProvider extends AbstractCustomComponentProvider { |
|
|
|
/** |
|
|
|
/** |
|
|
@ -68,4 +76,37 @@ public class MapHotComponentProvider extends AbstractCustomComponentProvider { |
|
|
|
public String config() { |
|
|
|
public String config() { |
|
|
|
return IOUtils.readResourceAsString("com/finebi/plugin/tptj/ivan/chart/demo/amap/config/config.json"); |
|
|
|
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<DataModel> process(List<DataModel> dataModels, CustomComponentContext customComponentContext) { |
|
|
|
|
|
|
|
return dataModels.stream().map(dataModel -> new DataModel() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<Dimension> getFields() { |
|
|
|
|
|
|
|
return dataModel.getFields(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public List<List<Object>> getColData() { |
|
|
|
|
|
|
|
List<List<Object>> 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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|