From a439aec6c10fe267588755b0e2fbf493ae7d72e4 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 14 Nov 2023 16:45:02 +0800 Subject: [PATCH] * Add method to get waterpolo option. --- module/chart/model.php | 1 + module/screen/model.php | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/module/chart/model.php b/module/chart/model.php index 1d08b21623..0194ed7364 100644 --- a/module/chart/model.php +++ b/module/chart/model.php @@ -605,6 +605,7 @@ class chartModel extends model $denominatorWheres = array(); foreach($settings['conditions'] as $condition) { + $condition = (array)$condition; $where = "{$condition['field']} {$this->lang->chart->conditionList[$condition['condition']]} '{$condition['value']}'"; $moleculeWheres[] = $where; } diff --git a/module/screen/model.php b/module/screen/model.php index 8afa2417b0..d3dd5714ba 100644 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -342,7 +342,7 @@ class screenModel extends model case 'card': return $this->buildCardChart($component, $chart); case 'waterpolo': - return $this->buildWaterPolo($component, $chart); + return $this->getWaterPoloOption($component, $chart); default: return ''; } @@ -1495,6 +1495,36 @@ class screenModel extends model } } + /** + * Get waterpolo option. + * + * @param object $component + * @param object $chart + * @access public + * @return object + */ + public function getWaterPoloOption($component, $chart) + { + if(!$chart->settings) + { + $component->request = json_decode('{"requestDataType":0,"requestHttpType":"get","requestUrl":"","requestIntervalUnit":"second","requestContentType":0,"requestParamsBodyType":"none","requestSQLContent":{"sql":"select * from where"},"requestParams":{"Body":{"form-data":{},"x-www-form-urlencoded":{},"json":"","xml":""},"Header":{},"Params":{}}}'); + $component->events = json_decode('{"baseEvent":{},"advancedEvents":{}}'); + $component->key = "PieCircle"; + $component->chartConfig = json_decode('{"key":"WaterPolo","chartKey":"VWaterPolo","conKey":"VCWaterPolo","title":"水球图","category":"Mores","categoryName":"更多","package":"Charts","chartFrame":"common","image":"water_WaterPolo.png"}'); + $component->option = json_decode('{"type":"nomal","series":[{"type":"liquidFill","radius":"90%","roseType":false}],"backgroundColor":"rgba(0,0,0,0)"}'); + + return $this->setComponentDefaults($component); + } + else + { + $setting = (array)(json_decode($chart->settings)[0]); + $options = $this->loadModel('chart')->genWaterPolo(json_decode($chart->fields), $setting, $chart->sql, json_decode($chart->filters)); + + $component->option->dataset = $options['series'][0]['data'][0]; + return $this->setComponentDefaults($component); + } + } + /** * Build radar chart. *