* Remove chart option config.
This commit is contained in:
@@ -18,17 +18,6 @@ $config->screen->chartConfig['card'] = '{"category" : "Texts", "categoryN
|
||||
$config->screen->chartConfig['waterpolo'] = '{"category" : "Mores", "categoryName" : "更多", "chartFrame" : "common", "chartKey" : "VWaterPolo", "conKey" : "VCWaterPolo", "image" : "water_WaterPolo.png", "key" : "WaterPolo", "package" : "Charts", "title" : "水球图", "dataset" : {}}';
|
||||
$config->screen->chartConfig['metric'] = '{"category" : "Metrics", "categoryName" : "度量项", "chartFrame" : "common", "chartKey" : "VMetrics", "conKey" : "VCMetrics", "image" : "bar_x.png", "key" : "Metrics", "package" : "Metrics", "title" : "度量项", "dataset" : {}}';
|
||||
|
||||
$config->screen->chartOption['cluBarX'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"grid":{"show":false,"left":"10%","top":90,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"show":true,"type":"shadow"}},"dataset":{},"series":[{"type":"bar","barWidth":15,"label":{"show":true,"position":"top","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":2}}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['cluBarY'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"grid":{"show":false,"left":"10%","top":70,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"show":true,"type":"shadow"}},"dataset":{},"series":[{"type":"bar","barWidth":null,"label":{"show":true,"position":"right","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":0}}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['stackedBar'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"grid":{"show":false,"left":"10%","top":90,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"show":true,"type":"shadow"}},"series":[{"type":"bar","stack":"total","barWidth":null,"label":{"show":true,"position":"top","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":0}}],"backgroundColor":"rgba(0,0,0,0)","dataset":{}}';
|
||||
$config->screen->chartOption['stackedBarY'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"grid":{"show":false,"left":"10%","top":70,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"show":true,"type":"shadow"}},"dataset":{},"series":[{"type":"bar","stack":"total","barWidth":null,"label":{"show":true,"position":"right","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":0}},{"type":"bar","stack":"total","barWidth":null,"label":{"show":true,"position":"right","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":0}}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['pie'] = '{"legend":{"show":true,"top":30,"textStyle":{"color":"#B9B8CE"},"left":"center"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"type":"nomal","tooltip":{"show":true,"trigger":"item"},"grid":{"top":70},"dataset":{},"series":[{"type":"pie","radius":["40%","65%"],"center":["50%","60%"],"label":{"show":true,"formatter":"{b} {d}%","fontSize":12}}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['radar'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"data":[],"left":"center"},"title":{"text":"\u6298\u7ebf\u56fe","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true},"grid":{"top":90},"dataset":{},"radar":{"shape":"polygon","radius":["0%","60%"],"center":["50%","55%"],"splitArea":{"show":true},"splitLine":{"show":true},"axisName":{"show":true,"color":"#eee","fontSize":12},"axisLine":{"show":true},"axisTick":{"show":true},"indicator":[]},"series":[{"name":"radar","type":"radar","areaStyle":{"opacity":0.1},"data":[]}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['line'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"grid":{"show":false,"left":"10%","top":90,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"type":"line"}},"dataset":{},"series":[{"type":"line","label":{"show":true,"position":"top","color":"#fff","fontSize":12},"symbolSize":5,"itemStyle":{"color":null,"borderRadius":0},"lineStyle":{"type":"solid","width":3,"color":null}},{"type":"line","label":{"show":true,"position":"top","color":"#fff","fontSize":12},"symbolSize":5,"itemStyle":{"color":null,"borderRadius":0},"lineStyle":{"type":"solid","width":3,"color":null}}],"backgroundColor":"rgba(0,0,0,0)"}';
|
||||
$config->screen->chartOption['table'] = '{}';
|
||||
$config->screen->chartOption['waterpolo'] = '{}';
|
||||
$config->screen->chartOption['metric'] = '{"legend":{"show":true,"top":40,"textStyle":{"color":"#B9B8CE"},"left":"center"},"xAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"bottom","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":false,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"category"},"yAxis":{"show":true,"name":"","nameGap":15,"nameTextStyle":{"color":"#B9B8CE","fontSize":12},"inverse":false,"axisLabel":{"show":true,"fontSize":12,"color":"#B9B8CE","rotate":0},"position":"left","axisLine":{"show":true,"lineStyle":{"color":"#B9B8CE","width":1},"onZero":true},"axisTick":{"show":true,"length":5},"splitLine":{"show":true,"lineStyle":{"color":"#484753","width":1,"type":"solid"}},"type":"value"},"grid":{"show":false,"left":"10%","top":90,"right":"10%","bottom":"60"},"title":{"text":"","show":true,"textStyle":{"color":"#BFBFBF","fontSize":18},"subtextStyle":{"color":"#A2A2A2","fontSize":14},"top":10,"x":"center"},"tooltip":{"show":true,"trigger":"axis","axisPointer":{"show":true,"type":"shadow"}},"dataset":{},"series":[{"type":"bar","barWidth":15,"label":{"show":true,"position":"top","color":"#fff","fontSize":12},"itemStyle":{"color":null,"borderRadius":2}}],"backgroundColor":"#0B1727FF"}';
|
||||
|
||||
$config->screen->fieldConfig = new stdclass();
|
||||
$config->screen->fieldConfig->bug = new stdclass();
|
||||
$config->screen->fieldConfig->execution = new stdclass();
|
||||
|
||||
+18
-24
@@ -331,11 +331,18 @@ class screenModel extends model
|
||||
{
|
||||
list($component, $typeChanged) = $this->initMetricComponent($metric, $component);
|
||||
|
||||
$this->loadModel('metric');
|
||||
|
||||
$result = $this->metric->getResultByCode($metric->code, array(), 'cron');
|
||||
|
||||
$resultHeader = $this->metric->getViewTableHeader($metric);
|
||||
$resultData = $this->metric->getViewTableData($metric, $result);
|
||||
|
||||
$component->chartConfig->title = $metric->name;
|
||||
$component->chartConfig->sourceID = $metric->id;
|
||||
$component->chartConfig->chartOption = $this->getMetricChartOption($metric);
|
||||
$component->chartConfig->tableOption = $this->getMetricTableOption($metric, $filterParams);
|
||||
$component->chartConfig->card = $this->getMetricCardOption($metric);
|
||||
$component->chartConfig->chartOption = $this->getMetricChartOption($metric, $resultHeader, $resultData);
|
||||
$component->chartConfig->tableOption = $this->getMetricTableOption($metric, $resultHeader, $resultData, $filterParams);
|
||||
$component->chartConfig->card = $this->getMetricCardOption($metric, $resultData);
|
||||
$component->chartConfig->filters = $this->buildMetricFilters($metric);
|
||||
|
||||
$component->option->chartOption = $component->chartConfig->chartOption;
|
||||
@@ -1656,18 +1663,9 @@ class screenModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getMetricChartOption($metric)
|
||||
public function getMetricChartOption($metric, $resultHeader, $resultData)
|
||||
{
|
||||
$this->loadModel('metric');
|
||||
|
||||
$result = $this->metric->getResultByCode($metric->code, array(), 'cron', $pager);
|
||||
$allResult = $this->metric->getResultByCode($metric->code, array(), 'cron');
|
||||
|
||||
$resultHeader = $this->metric->getViewTableHeader($metric);
|
||||
$resultData = $this->metric->getViewTableData($metric, $result);
|
||||
$allResultData = $this->metric->getViewTableData($metric, $allResult);
|
||||
|
||||
$chartOption = $this->metric->getEchartsOptions($resultHeader, $allResultData);
|
||||
$chartOption = $this->metric->getEchartsOptions($resultHeader, $resultData);
|
||||
|
||||
if(!isset($chartOption['title'])) $chartOption['title'] = array('text' => $metric->name, 'show' => false, 'titleShow' => false, 'textStyle' => array('color' => '#BFBFBF', 'fontSize' => 16));
|
||||
$chartOption['title']['text'] = $metric->name;
|
||||
@@ -1684,16 +1682,13 @@ class screenModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getMetricTableOption($metric, $filterParams = null)
|
||||
public function getMetricTableOption($metric, $resultHeader, $resultData, $filterParams = null)
|
||||
{
|
||||
$this->loadModel('metric');
|
||||
|
||||
$resultHeader = $this->metric->getViewTableHeader($metric);
|
||||
$isObjectMetric = $this->metric->isObjectMetric($resultHeader);
|
||||
$dateType = $this->metric->getDateTypeByCode($metric->code);
|
||||
|
||||
$result = $this->metric->getResultByCode($metric->code, array(), 'cron');
|
||||
$resultData = $this->metric->getViewTableData($metric, $result);
|
||||
list($groupHeader, $groupData) = $this->metric->getGroupTable($resultHeader, $resultData, false);
|
||||
|
||||
$tableOption = new stdclass();
|
||||
@@ -1743,12 +1738,11 @@ class screenModel extends model
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getMetricCardOption(object $metric): object
|
||||
public function getMetricCardOption(object $metric, $resultData): object
|
||||
{
|
||||
$this->loadModel('metric');
|
||||
|
||||
$dateType = $this->metric->getDateTypeByCode($metric->code);
|
||||
$result = $this->metric->getResultByCode($metric->code, array(), 'cron');
|
||||
|
||||
$option = new stdclass();
|
||||
$option->displayType = 'normal';
|
||||
@@ -1758,12 +1752,12 @@ class screenModel extends model
|
||||
$option->border = array('color' => '#515458FF', 'width' => 1, 'radius' => 2);
|
||||
$option->scope = $metric->scope;
|
||||
$option->objectPairs = array();
|
||||
$option->data = $this->metric->getViewTableData($metric, $result);
|
||||
$option->data = $resultData;
|
||||
$option->filterValue = (is_array($option->data) && !empty($option->data)) ? current($option->data) : array();
|
||||
|
||||
if($metric->scope != 'system')
|
||||
{
|
||||
$objectPairs = $this->loadModel('metric')->getPairsByScope($metric->scope);
|
||||
$objectPairs = $this->metric->getPairsByScope($metric->scope);
|
||||
foreach($objectPairs as $value => $label)
|
||||
{
|
||||
$option->objectPairs[] = array('label' => $label, 'value' => "$value");
|
||||
@@ -1991,7 +1985,7 @@ class screenModel extends model
|
||||
if(!isset($component->title)) $component->title = $metric->name;
|
||||
if(!isset($component->type)) $component->type = 'metric';
|
||||
if(!isset($component->chartConfig)) $component->chartConfig = json_decode($this->config->screen->chartConfig['metric']);
|
||||
if(!isset($component->option)) $component->option = json_decode($this->config->screen->chartOption['metric']);
|
||||
if(!isset($component->option)) $component->option = new stdclass();
|
||||
|
||||
return array($component, false);
|
||||
}
|
||||
@@ -2039,7 +2033,7 @@ class screenModel extends model
|
||||
|
||||
if(!isset($component->option) or $typeChanged)
|
||||
{
|
||||
$component->option = json_decode(zget($this->config->screen->chartOption, $component->type));
|
||||
$component->option = new stdclass();
|
||||
$component->option->dataset = new stdclass();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user