forked from github/dataease
Merge pull request #10710 from dataease/pr@dev-v2@refactor_chart_plugin
refactor(图表): 插件类型调整
This commit is contained in:
commit
19b516a341
@ -1,39 +1,13 @@
|
||||
package io.dataease.extensions.view.plugin;
|
||||
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.extensions.datasource.provider.Provider;
|
||||
import io.dataease.extensions.view.dto.*;
|
||||
import io.dataease.extensions.view.factory.PluginsChartFactory;
|
||||
import io.dataease.extensions.view.model.SQLMeta;
|
||||
import io.dataease.extensions.view.vo.XpackPluginsViewVO;
|
||||
import io.dataease.license.utils.JsonUtil;
|
||||
import io.dataease.plugins.template.DataEasePlugin;
|
||||
import io.dataease.plugins.vo.DataEasePluginVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AbstractChartPlugin implements DataEasePlugin {
|
||||
|
||||
@Override
|
||||
public void loadPlugin() {
|
||||
XpackPluginsViewVO viewConfig = getConfig();
|
||||
PluginsChartFactory.loadPlugin(viewConfig.getRender(), viewConfig.getChartValue(), this);
|
||||
}
|
||||
|
||||
|
||||
public XpackPluginsViewVO getConfig() {
|
||||
DataEasePluginVO pluginInfo = null;
|
||||
try {
|
||||
pluginInfo = getPluginInfo();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e);
|
||||
}
|
||||
String config = pluginInfo.getConfig();
|
||||
XpackPluginsViewVO vo = JsonUtil.parseObject(config, XpackPluginsViewVO.class);
|
||||
vo.setIcon(pluginInfo.getIcon());
|
||||
return vo;
|
||||
}
|
||||
public abstract class AbstractChartPlugin {
|
||||
|
||||
/**
|
||||
* 处理视图需要用到的轴字段,大部分图表都聚合成两个字段,X 和 Y。
|
||||
@ -72,8 +46,9 @@ public abstract class AbstractChartPlugin implements DataEasePlugin {
|
||||
|
||||
/**
|
||||
* 构建视图,将计算结果处理成最终视图。
|
||||
* @param view 原视图对象
|
||||
* @param calcResult 计算结果
|
||||
*
|
||||
* @param view 原视图对象
|
||||
* @param calcResult 计算结果
|
||||
* @param formatResult 轴字段处理结果
|
||||
* @param filterResult 过滤条件处理结果
|
||||
* @return 返回前端的视图,建议数据放在 data 中,过滤条件放在 filter 中,其他字段可自行添加,可参考主工程。
|
||||
|
@ -0,0 +1,30 @@
|
||||
package io.dataease.extensions.view.plugin;
|
||||
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.extensions.view.factory.PluginsChartFactory;
|
||||
import io.dataease.extensions.view.vo.XpackPluginsViewVO;
|
||||
import io.dataease.license.utils.JsonUtil;
|
||||
import io.dataease.plugins.template.DataEasePlugin;
|
||||
import io.dataease.plugins.vo.DataEasePluginVO;
|
||||
|
||||
public abstract class DataEaseChartPlugin extends AbstractChartPlugin implements DataEasePlugin {
|
||||
|
||||
@Override
|
||||
public void loadPlugin() {
|
||||
XpackPluginsViewVO viewConfig = getConfig();
|
||||
PluginsChartFactory.loadPlugin(viewConfig.getRender(), viewConfig.getChartValue(), this);
|
||||
}
|
||||
|
||||
public XpackPluginsViewVO getConfig() {
|
||||
DataEasePluginVO pluginInfo = null;
|
||||
try {
|
||||
pluginInfo = getPluginInfo();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e);
|
||||
}
|
||||
String config = pluginInfo.getConfig();
|
||||
XpackPluginsViewVO vo = JsonUtil.parseObject(config, XpackPluginsViewVO.class);
|
||||
vo.setIcon(pluginInfo.getIcon());
|
||||
return vo;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user