diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/commons/Helper.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/commons/Helper.java index be56dea..b6386cd 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/commons/Helper.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/commons/Helper.java @@ -2,10 +2,7 @@ import com.alibaba.fastjson.JSON; import com.google.common.io.Resources; -import com.jd.logistics.cloud.data.domain.BaseModel; -import com.jd.logistics.cloud.data.domain.ChartModel; -import com.jd.logistics.cloud.data.domain.CommonRes; -import com.jd.logistics.cloud.data.domain.ValueModel; +import com.jd.logistics.cloud.data.domain.*; import org.jetbrains.annotations.NotNull; import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.jdbc.support.rowset.SqlRowSetMetaData; @@ -47,20 +44,31 @@ public static String getStringFromResourcePath(String filePath) { return Helper.InputStream2String(in); } - public static Map getFuncSqlByType(String funcName, ShowType type) { + public static Map getDesc(String funcId) { String json = Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + - funcName + "/" + Constants.TEMPLATE_MODEL_FILE); + funcId + "/" + Constants.TEMPLATE_MODEL_FILE); + BaseModel bm = JSON.parseObject(json, BaseModel.class); + Map descList = new HashMap<>(); + for (Description desc: bm.getDescriptions()) { + descList.put(desc.getName(), desc.getText()); + } + return descList; + } + + public static Map getFuncSqlByType(String funcId, ShowType type) { + String json = Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + + funcId + "/" + Constants.TEMPLATE_MODEL_FILE); BaseModel bm = JSON.parseObject(json, BaseModel.class); Map sqlList = new HashMap<>(); if (type == ShowType.CHART) { for (ChartModel model : bm.getCharts()) { sqlList.put(model.getName(), Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + - funcName + "/" + model.getSql())); + funcId + "/" + model.getSql())); } } else if (type == ShowType.VALUE) { for (ValueModel model : bm.getValues()) { sqlList.put(model.getName(), Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + - funcName + "/" + model.getSql())); + funcId + "/" + model.getSql())); } } return sqlList; diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/BaseModel.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/BaseModel.java index d35001d..cd5ff98 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/BaseModel.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/BaseModel.java @@ -1,6 +1,7 @@ package com.jd.logistics.cloud.data.domain; import lombok.Data; +import org.apache.ibatis.javassist.runtime.Desc; import java.io.Serializable; import java.util.List; @@ -13,9 +14,15 @@ @Data public class BaseModel implements Serializable { private static final long serialVersionUID = 7593767886021869685L; + private String id; private String name; private List charts; private List values; + private List descriptions; + + public String getId() { + return id; + } public String getName() { return name; @@ -28,4 +35,8 @@ public List getCharts() { public List getValues() { return values; } + + public List getDescriptions() { + return descriptions; + } } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Description.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Description.java new file mode 100644 index 0000000..e496761 --- /dev/null +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Description.java @@ -0,0 +1,25 @@ +package com.jd.logistics.cloud.data.domain; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author hubin + * @Description: + * @Date 2017/11/10 10:10 + */ +@Data +public class Description implements Serializable { + private static final long serialVersionUID = -8617270101773389965L; + private String name; + private String text; + + public String getName() { + return name; + } + + public String getText() { + return text; + } +} diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Function.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Function.java index d44c707..eb6f7ca 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Function.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/domain/Function.java @@ -28,25 +28,25 @@ public class Function implements Serializable { // return FuncType.BOX; // } // } - private int id; + private String id; private String funcName; private int funcType; // BOX(0), CHART(1), FREE(2); private int seq; -// public String getFuncName() { -// return funcName; -// } -// -// public void setFuncName(String funcName) { -// this.funcName = funcName; -// } -// -// public int getFuncType() { -// return funcType; -// } -// -// public void setFuncType(int funcType) { -// this.funcType = funcType; -// } -// + public String getId() { + return id; + } + + public String getFuncName() { + return funcName; + } + + public int getFuncType() { + return funcType; + } + + public int getSeq() { + return seq; + } + } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ChartServiceImpl.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ChartServiceImpl.java index c72c880..5250ccd 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ChartServiceImpl.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ChartServiceImpl.java @@ -23,8 +23,8 @@ public class ChartServiceImpl implements ChartService { JdbcTemplate jdbcTemplate; @Override - public Map getFuncChart(String funcName) { - Map sqlList = Helper.getFuncSqlByType(funcName, ShowType.CHART); + public Map getFuncChart(String funcId) { + Map sqlList = Helper.getFuncSqlByType(funcId, ShowType.CHART); Map res = new HashMap<>(); for (Map.Entry e : sqlList.entrySet()) { String sql = e.getValue(); @@ -35,8 +35,8 @@ public Map getFuncChart(String funcName) { } @Override - public String getFuncChartOption(String funcName, String chartId) { + public String getFuncChartOption(String funcId, String chartId) { return Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + - funcName + "/" + chartId + Constants.CHART_OPTION_SUFFIX); + funcId + "/" + chartId + Constants.CHART_OPTION_SUFFIX); } } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/FuncServiceImpl.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/FuncServiceImpl.java index 8922a3b..aa7dd5a 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/FuncServiceImpl.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/FuncServiceImpl.java @@ -32,4 +32,9 @@ public List getAllFunc() { public void updateFuncType(Function func) { funcRepository.update(func); } + + @Override + public String getFuncNameById(String funcId) { + return funcRepository.getFuncNameById(funcId); + } } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ModelServiceImpl.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ModelServiceImpl.java index 97598bb..ef4ab42 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ModelServiceImpl.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ModelServiceImpl.java @@ -2,7 +2,9 @@ import com.jd.logistics.cloud.data.commons.Constants; import com.jd.logistics.cloud.data.commons.Helper; +import com.jd.logistics.cloud.data.service.FuncService; import com.jd.logistics.cloud.data.service.ModelService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -15,6 +17,8 @@ */ @Service public class ModelServiceImpl implements ModelService { + @Autowired + FuncService funcService; private String getFuncChartFormat(String funcName) { return Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + funcName + "/" + Constants.CHART_TEMPLATE_SUFFIX); @@ -26,13 +30,22 @@ private String getFuncValueFormat(String funcName) { } @Override - public Map getFuncModel(String funcName) { - String chartTemplate = getFuncChartFormat(funcName); - String numberTemplate = getFuncValueFormat(funcName); + public Map getFuncModel(String funcId) { + String chartTemplate = getFuncChartFormat(funcId); + String numberTemplate = getFuncValueFormat(funcId); Map res = new HashMap<>(); - res.put("name", funcName); + res.put("id", funcId); + res.put("name", funcService.getFuncNameById(funcId)); res.put("chartTemplate", chartTemplate); res.put("numberTemplate", numberTemplate); return res; } + + @Override + public Map getFuncDesc(String funcId) { + Map res = Helper.getDesc(funcId); + res.put("id", funcId); + res.put("name", funcService.getFuncNameById(funcId)); + return res; + } } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ValueServiceImpl.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ValueServiceImpl.java index b7a0444..82e831f 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ValueServiceImpl.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/implement/ValueServiceImpl.java @@ -22,8 +22,8 @@ public class ValueServiceImpl implements ValueService { JdbcTemplate jdbcTemplate; @Override - public Map getFuncValues(String funcName) { - Map sqlList = Helper.getFuncSqlByType(funcName, ShowType.VALUE); + public Map getFuncValues(String funcId) { + Map sqlList = Helper.getFuncSqlByType(funcId, ShowType.VALUE); Map res = new HashMap<>(); for (Map.Entry e : sqlList.entrySet()) { String sql = e.getValue(); diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/repository/FuncRepository.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/repository/FuncRepository.java index 5c1bcef..474eaed 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/repository/FuncRepository.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/repository/FuncRepository.java @@ -16,12 +16,15 @@ @Mapper public interface FuncRepository { - @Select("SELECT id, func_name as funcName, func_type_id as funcType, seq FROM T_FUNCTION where func_type_id=#{type} order by seq") + @Select("SELECT concat('sample',id) as id, func_name as funcName, func_type_id as funcType, seq FROM T_FUNCTION where func_type_id=#{type} order by seq") List getByType(@Param("type") int type); - @Select("SELECT id, func_name as funcName, func_type_id as funcType, seq FROM T_FUNCTION order by seq") + @Select("SELECT concat('sample',id) as id, func_name as funcName, func_type_id as funcType, seq FROM T_FUNCTION order by seq") List getAll(); @Update("UPDATE T_FUNCTION SET func_type_id=#{func.funcType}, seq=#{func.seq} WHERE func_name=#{func.funcName}") void update(@Param("func") Function func); + + @Select("SELECT func_name as funcName FROM T_FUNCTION where concat('sample',id)=#{funcId}") + String getFuncNameById(@Param("funcId") String funcId); } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartService.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartService.java index c6e420b..122270d 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartService.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartService.java @@ -8,7 +8,7 @@ * @Date 2017/11/7 9:22 */ public interface ChartService { - Map getFuncChart(String funcName); + Map getFuncChart(String funcId); - String getFuncChartOption(String funcName, String chartId); + String getFuncChartOption(String funcId, String chartId); } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartServiceImpl.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartServiceImpl.java deleted file mode 100644 index cdff051..0000000 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ChartServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.jd.logistics.cloud.data.service; - -import com.jd.logistics.cloud.data.commons.Constants; -import com.jd.logistics.cloud.data.commons.Helper; -import com.jd.logistics.cloud.data.commons.ShowType; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.support.rowset.SqlRowSet; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.Map; - -/** - * @Author hubin - * @Description: - * @Date 2017/11/7 9:26 - */ -@Service -public class ChartServiceImpl implements ChartService { - @Autowired - JdbcTemplate jdbcTemplate; - - @Override - public Map getFuncChart(String funcName) { - Map sqlList = Helper.getFuncSqlByType(funcName, ShowType.CHART); - Map res = new HashMap<>(); - for (Map.Entry e : sqlList.entrySet()) { - String sql = e.getValue(); - SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sql); - res.put(e.getKey(), Helper.RowSet2ArrayRes(rowSet)); - } - return res; - } - - @Override - public String getFuncChartOption(String funcName, String chartId) { - return Helper.getStringFromResourcePath(Constants.TEMPLATE_PARENT_FOLDER + "/" + - funcName + "/" + chartId + Constants.CHART_OPTION_SUFFIX); - } -} diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/FuncService.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/FuncService.java index 90c1be5..54a3873 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/FuncService.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/FuncService.java @@ -15,4 +15,6 @@ public interface FuncService { List getAllFunc(); void updateFuncType(Function func); + + String getFuncNameById(String funcId); } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ModelService.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ModelService.java index c487c7c..f92bb48 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ModelService.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ModelService.java @@ -8,5 +8,6 @@ * @Date 2017/11/7 9:35 */ public interface ModelService { - Map getFuncModel(String funcName); + Map getFuncModel(String funcId); + Map getFuncDesc(String funcId); } diff --git a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ValueService.java b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ValueService.java index efffc97..7d576b8 100644 --- a/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ValueService.java +++ b/dashboard-domain-service/src/main/java/com/jd/logistics/cloud/data/service/ValueService.java @@ -8,5 +8,5 @@ * @Date 2017/11/7 9:22 */ public interface ValueService { - Map getFuncValues(String funcName); + Map getFuncValues(String funcId); } diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ChartApi.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ChartApi.java index a2cbd0c..e4ba0fd 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ChartApi.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ChartApi.java @@ -13,13 +13,13 @@ */ @RequestMapping(value = "/api") public interface ChartApi { - @RequestMapping(value = "/chart/{funcName}", + @RequestMapping(value = "/chart/{funcId}", produces = {"application/json"}, method = RequestMethod.GET) - Map getFuncChart(@PathVariable("funcName") String funcName); + Map getFuncChart(@PathVariable("funcId") String funcId); - @RequestMapping(value = "/chartOption/{funcName}/{chartName}", + @RequestMapping(value = "/chartOption/{funcId}/{chartId}", produces = {"application/json"}, method = RequestMethod.GET) - String getFuncChartOption(@PathVariable("funcName") String funcName, @PathVariable("chartName") String chartName); + String getFuncChartOption(@PathVariable("funcId") String funcId, @PathVariable("chartId") String chartId); } \ No newline at end of file diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ModelApi.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ModelApi.java index 03341b4..cec8610 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ModelApi.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ModelApi.java @@ -14,13 +14,18 @@ */ @RequestMapping(value = "/api") public interface ModelApi { - @RequestMapping(value = "/model/{funcName}", + @RequestMapping(value = "/model/{funcId}", produces = {"application/json"}, method = RequestMethod.GET) - Map getFuncModel(@PathVariable("funcName") String funcName); + Map getFuncModel(@PathVariable("funcId") String funcId); @RequestMapping(value = "/models", produces = {"application/json"}, method = RequestMethod.GET) List getModels(); + + @RequestMapping(value = "/desc", + produces = {"application/json"}, + method = RequestMethod.GET) + List getDesc(); } diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ValueApi.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ValueApi.java index 6457194..12d27fd 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ValueApi.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/api/ValueApi.java @@ -13,8 +13,8 @@ */ @RequestMapping(value = "/api/value") public interface ValueApi { - @RequestMapping(value = "/{funcName}", + @RequestMapping(value = "/{funcId}", produces = {"application/json"}, method = RequestMethod.GET) - Map getFuncValues(@PathVariable("funcName") String funcName); + Map getFuncValues(@PathVariable("funcId") String funcId); } diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ChartRestController.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ChartRestController.java index f2ff0ab..30a899e 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ChartRestController.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ChartRestController.java @@ -19,12 +19,12 @@ public class ChartRestController implements ChartApi { ChartService chartService; @Override - public Map getFuncChart(@PathVariable("funcName") String funcName) { - return chartService.getFuncChart(funcName); + public Map getFuncChart(@PathVariable("funcId") String funcId) { + return chartService.getFuncChart(funcId); } @Override - public String getFuncChartOption(@PathVariable("funcName") String funcName, @PathVariable("chartName") String chartName) { - return chartService.getFuncChartOption(funcName, chartName); + public String getFuncChartOption(@PathVariable("funcId") String funcId, @PathVariable("chartId") String chartId) { + return chartService.getFuncChartOption(funcId, chartId); } } diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ModelRestController.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ModelRestController.java index 3116521..a0a2f83 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ModelRestController.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ModelRestController.java @@ -1,5 +1,7 @@ package com.jd.logistics.cloud.data.web.controller; +import com.jd.logistics.cloud.data.domain.Function; +import com.jd.logistics.cloud.data.service.FuncService; import com.jd.logistics.cloud.data.service.ModelService; import com.jd.logistics.cloud.data.web.api.ModelApi; import org.springframework.beans.factory.annotation.Autowired; @@ -19,16 +21,28 @@ public class ModelRestController implements ModelApi { @Autowired ModelService modelService; - + @Autowired + FuncService funcService; @Override - public Map getFuncModel(@PathVariable("funcName") String funcName) { - return modelService.getFuncModel(funcName); + public Map getFuncModel(@PathVariable("funcId") String funcId) { + return modelService.getFuncModel(funcId); } @Override public List getModels() { List res = new ArrayList<>(); - res.add(modelService.getFuncModel("sample1")); + for(Function function: funcService.getAllFunc()){ + res.add(modelService.getFuncModel(function.getId())); + } + return res; + } + + @Override + public List getDesc() { + List res = new ArrayList<>(); + for(Function function: funcService.getAllFunc()){ + res.add(modelService.getFuncDesc(function.getId())); + } return res; } } diff --git a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ValueRestController.java b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ValueRestController.java index 47f6185..e844a83 100644 --- a/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ValueRestController.java +++ b/dashboard-web/src/main/java/com/jd/logistics/cloud/data/web/controller/ValueRestController.java @@ -19,7 +19,7 @@ public class ValueRestController implements ValueApi { ValueService valueService; @Override - public Map getFuncValues(@PathVariable("funcName") String funcName) { - return valueService.getFuncValues(funcName); + public Map getFuncValues(@PathVariable("funcId") String funcId) { + return valueService.getFuncValues(funcId); } } diff --git a/dashboard-web/src/main/resources/metrics/sample1/b.sql b/dashboard-web/src/main/resources/metrics/sample1/b.sql deleted file mode 100644 index f6c5134..0000000 --- a/dashboard-web/src/main/resources/metrics/sample1/b.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT '124,300' as v1, 4.8 as v2, -1.3 as v3 \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample1/c.sql b/dashboard-web/src/main/resources/metrics/sample1/c.sql deleted file mode 100644 index c1db1d7..0000000 --- a/dashboard-web/src/main/resources/metrics/sample1/c.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT '624,300' as v1, 2.8 as v2, 1.3 as v3 \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample1/chart.html b/dashboard-web/src/main/resources/metrics/sample1/chart.html index 39e6f68..3682518 100644 --- a/dashboard-web/src/main/resources/metrics/sample1/chart.html +++ b/dashboard-web/src/main/resources/metrics/sample1/chart.html @@ -12,7 +12,7 @@ 2017/07/07 - more_horiz + more_horiz {{data.day.v1}} diff --git a/dashboard-web/src/main/resources/metrics/sample1/e.sql b/dashboard-web/src/main/resources/metrics/sample1/e.sql index b3b10b4..b846e31 100644 --- a/dashboard-web/src/main/resources/metrics/sample1/e.sql +++ b/dashboard-web/src/main/resources/metrics/sample1/e.sql @@ -1,4 +1,4 @@ select stat_date, cast(max(func_value)as signed) as func_value from T_RESULT -where func_name='接收订单量' and warehouse_name='全部仓库' and date_cycle='日维度' +where func_name='在库SKU' and warehouse_name='全部仓库' and date_cycle='日维度' group by stat_date order by stat_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample1/model.json b/dashboard-web/src/main/resources/metrics/sample1/model.json index 6db2309..6a36e63 100644 --- a/dashboard-web/src/main/resources/metrics/sample1/model.json +++ b/dashboard-web/src/main/resources/metrics/sample1/model.json @@ -31,19 +31,20 @@ ] } ], - "name": "sample1", - "description": [ + "id": "sample1", + "name": "在库SKU数", + "descriptions": [ { "name": "day", - "text": "just a test 日维度" + "text": "just a test 日维度1" }, { "name": "week", - "text": "just a test 周维度" + "text": "just a test 周维度1" }, { "name": "month", - "text": "just a test 月维度" + "text": "just a test 月维度1" } ], "values": [ diff --git a/dashboard-web/src/main/resources/metrics/sample2/a.sql b/dashboard-web/src/main/resources/metrics/sample2/a.sql new file mode 100644 index 0000000..af93a66 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/a.sql @@ -0,0 +1 @@ +SELECT '接收订单量'as f1, '124,342' as v1, '昨日环比'as f2, 2.8 as v2, '上周同比'as f3, 4.8 as v3 \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/chart.html b/dashboard-web/src/main/resources/metrics/sample2/chart.html new file mode 100644 index 0000000..4b85887 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/chart.html @@ -0,0 +1,37 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ + 2017/07/07 + + + more_horiz + + + {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ + 2017/07/14 + +
+
+ + + +
+
+
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/d.sql b/dashboard-web/src/main/resources/metrics/sample2/d.sql new file mode 100644 index 0000000..43e1677 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/d.sql @@ -0,0 +1,9 @@ +SELECT strftime('%Y/%m/%d',fact.date) AS r_date, + sum(metrics2) AS metrics_2, + sum(metrics3) AS metrics_3 +FROM fact +inner JOIN a ON a.id=fact.dim1 +where strftime('%Y/%m/%d',fact.date) between '2017/07/01' and '2017/07/14' +GROUP BY + strftime('%Y/%m/%d',fact.date) +ORDER BY r_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/day.option b/dashboard-web/src/main/resources/metrics/sample2/day.option new file mode 100644 index 0000000..daab121 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/day.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'line', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/e.sql b/dashboard-web/src/main/resources/metrics/sample2/e.sql new file mode 100644 index 0000000..b3b10b4 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/e.sql @@ -0,0 +1,4 @@ +select stat_date, cast(max(func_value)as signed) as func_value +from T_RESULT +where func_name='接收订单量' and warehouse_name='全部仓库' and date_cycle='日维度' +group by stat_date order by stat_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/model.json b/dashboard-web/src/main/resources/metrics/sample2/model.json new file mode 100644 index 0000000..823e807 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/model.json @@ -0,0 +1,56 @@ +{ + "charts": [ + { + "name": "day", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "天" + } + ] + }, + { + "name": "week", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "周" + } + ] + }, + { + "name": "month", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "月" + } + ] + } + ], + "id": "sample2", + "name": "接收订单量", + "descriptions": [ + { + "name": "day", + "text": "just a test 日维度2" + }, + { + "name": "week", + "text": "just a test 周维度2" + }, + { + "name": "month", + "text": "just a test 月维度2" + } + ], + "values": [ + { + "name": "day", + "sql": "a.sql" + } + ] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/month.option b/dashboard-web/src/main/resources/metrics/sample2/month.option new file mode 100644 index 0000000..9f8e23c --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/month.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'bar', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/number.html b/dashboard-web/src/main/resources/metrics/sample2/number.html new file mode 100644 index 0000000..878d739 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/number.html @@ -0,0 +1,21 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ +
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample2/week.option b/dashboard-web/src/main/resources/metrics/sample2/week.option new file mode 100644 index 0000000..22cb210 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample2/week.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/a.sql b/dashboard-web/src/main/resources/metrics/sample3/a.sql new file mode 100644 index 0000000..ff95eb8 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/a.sql @@ -0,0 +1 @@ +SELECT '成本效率'as f1, '88.50%' as v1, '昨日环比'as f2, 3.7 as v2, '上周同比'as f3, -1.4 as v3 \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/chart.html b/dashboard-web/src/main/resources/metrics/sample3/chart.html new file mode 100644 index 0000000..2d9362b --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/chart.html @@ -0,0 +1,37 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ + 2017/07/07 + + + more_horiz + + + {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ + 2017/07/14 + +
+
+ + + +
+
+
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/d.sql b/dashboard-web/src/main/resources/metrics/sample3/d.sql new file mode 100644 index 0000000..43e1677 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/d.sql @@ -0,0 +1,9 @@ +SELECT strftime('%Y/%m/%d',fact.date) AS r_date, + sum(metrics2) AS metrics_2, + sum(metrics3) AS metrics_3 +FROM fact +inner JOIN a ON a.id=fact.dim1 +where strftime('%Y/%m/%d',fact.date) between '2017/07/01' and '2017/07/14' +GROUP BY + strftime('%Y/%m/%d',fact.date) +ORDER BY r_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/day.option b/dashboard-web/src/main/resources/metrics/sample3/day.option new file mode 100644 index 0000000..daab121 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/day.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'line', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/e.sql b/dashboard-web/src/main/resources/metrics/sample3/e.sql new file mode 100644 index 0000000..5d6435d --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/e.sql @@ -0,0 +1,4 @@ +select stat_date, max(func_value) as func_value +from T_RESULT +where func_name='成本效率' and warehouse_name='全部仓库' and date_cycle='日维度' +group by stat_date order by stat_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/model.json b/dashboard-web/src/main/resources/metrics/sample3/model.json new file mode 100644 index 0000000..1f90549 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/model.json @@ -0,0 +1,56 @@ +{ + "charts": [ + { + "name": "day", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "天" + } + ] + }, + { + "name": "week", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "周" + } + ] + }, + { + "name": "month", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "月" + } + ] + } + ], + "id": "sample3", + "name": "成本效率", + "descriptions": [ + { + "name": "day", + "text": "just a test 日维度3" + }, + { + "name": "week", + "text": "just a test 周维度3" + }, + { + "name": "month", + "text": "just a test 月维度3" + } + ], + "values": [ + { + "name": "day", + "sql": "a.sql" + } + ] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/month.option b/dashboard-web/src/main/resources/metrics/sample3/month.option new file mode 100644 index 0000000..9f8e23c --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/month.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'bar', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/number.html b/dashboard-web/src/main/resources/metrics/sample3/number.html new file mode 100644 index 0000000..878d739 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/number.html @@ -0,0 +1,21 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ +
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample3/week.option b/dashboard-web/src/main/resources/metrics/sample3/week.option new file mode 100644 index 0000000..22cb210 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample3/week.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/a.sql b/dashboard-web/src/main/resources/metrics/sample4/a.sql new file mode 100644 index 0000000..2a0e738 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/a.sql @@ -0,0 +1 @@ +SELECT '发出订单量'as f1, '114,124' as v1, '昨日环比'as f2, 2.3 as v2, '上周同比'as f3, 4.7 as v3 \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/chart.html b/dashboard-web/src/main/resources/metrics/sample4/chart.html new file mode 100644 index 0000000..0693bb0 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/chart.html @@ -0,0 +1,37 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ + 2017/07/07 + + + more_horiz + + + {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ + 2017/07/14 + +
+
+ + + +
+
+
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/d.sql b/dashboard-web/src/main/resources/metrics/sample4/d.sql new file mode 100644 index 0000000..43e1677 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/d.sql @@ -0,0 +1,9 @@ +SELECT strftime('%Y/%m/%d',fact.date) AS r_date, + sum(metrics2) AS metrics_2, + sum(metrics3) AS metrics_3 +FROM fact +inner JOIN a ON a.id=fact.dim1 +where strftime('%Y/%m/%d',fact.date) between '2017/07/01' and '2017/07/14' +GROUP BY + strftime('%Y/%m/%d',fact.date) +ORDER BY r_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/day.option b/dashboard-web/src/main/resources/metrics/sample4/day.option new file mode 100644 index 0000000..daab121 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/day.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'line', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/e.sql b/dashboard-web/src/main/resources/metrics/sample4/e.sql new file mode 100644 index 0000000..ab11adc --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/e.sql @@ -0,0 +1,4 @@ +select stat_date, cast(max(func_value)as signed) as func_value +from T_RESULT +where func_name='发出订单量' and warehouse_name='全部仓库' and date_cycle='日维度' +group by stat_date order by stat_date \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/model.json b/dashboard-web/src/main/resources/metrics/sample4/model.json new file mode 100644 index 0000000..a9f1306 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/model.json @@ -0,0 +1,56 @@ +{ + "charts": [ + { + "name": "day", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "天" + } + ] + }, + { + "name": "week", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "周" + } + ] + }, + { + "name": "month", + "sql": "e.sql", + "params": [ + { + "name": "dateCycle", + "value": "月" + } + ] + } + ], + "id": "sample4", + "name": "发出订单量", + "descriptions": [ + { + "name": "day", + "text": "just a test 日维度4" + }, + { + "name": "week", + "text": "just a test 周维度4" + }, + { + "name": "month", + "text": "just a test 月维度4" + } + ], + "values": [ + { + "name": "day", + "sql": "a.sql" + } + ] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/month.option b/dashboard-web/src/main/resources/metrics/sample4/month.option new file mode 100644 index 0000000..9f8e23c --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/month.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'bar', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/number.html b/dashboard-web/src/main/resources/metrics/sample4/number.html new file mode 100644 index 0000000..878d739 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/number.html @@ -0,0 +1,21 @@ + + + + {{data.day.f1}} + + {{data.day.f2}}
{{data.day.v2}}% + + +
+
+ {{data.day.v1}} + + {{data.day.f3}}
{{data.day.v3}}% + + +
+
+ +
+
+
\ No newline at end of file diff --git a/dashboard-web/src/main/resources/metrics/sample4/week.option b/dashboard-web/src/main/resources/metrics/sample4/week.option new file mode 100644 index 0000000..22cb210 --- /dev/null +++ b/dashboard-web/src/main/resources/metrics/sample4/week.option @@ -0,0 +1,56 @@ +{ + tooltip: { + trigger: 'axis', + axisPointer: { + animation: false + }, + formatter:function(params) { + return '' + params[0].name + ' : ' + params[0].value + '
' + + '' + addDate(params[0].name, -7) + ' : ' + params[1].value + '' + } + }, + xAxis: { + type: 'category', + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + }, + data: res.stat_date.slice(-7) + }, + yAxis: { + type: 'value', + boundaryGap: [0, '100%'], + splitLine: { + show: false + }, + axisLine: { + lineStyle: { + color: '#6E88AC' + } + } + }, + series: [{ + type: 'line', + itemStyle: { + normal: { + color: '#00D7FB', + width: 1 + } + }, + data: res.func_value.slice(-7) + }, + { + type: 'bar', + itemStyle: { + normal: { + color: '#6E88AC', + width: 1 + } + }, + data: res.func_value.slice(0,7) + }] +} \ No newline at end of file