From 874712af7393eb02ebd3d080bc822b5377a6b687 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 18 Mar 2024 11:21:45 +0800 Subject: [PATCH] * Add method to get waterpolo option. --- module/chart/lang/de.php | 2 +- module/chart/lang/en.php | 2 +- module/chart/lang/fr.php | 2 +- module/chart/lang/zh-cn.php | 2 +- module/chart/model.php | 1 + module/screen/model.php | 33 ++++++++++++++++++++++++++++++++- 6 files changed, 37 insertions(+), 5 deletions(-) diff --git a/module/chart/lang/de.php b/module/chart/lang/de.php index b8d7e1c8d0..f38fca8b3a 100644 --- a/module/chart/lang/de.php +++ b/module/chart/lang/de.php @@ -44,4 +44,4 @@ $lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; $lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; $lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; $lang->chart->typeList['stackedBar'] = 'Stacked Bar X'; -//$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; +$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; diff --git a/module/chart/lang/en.php b/module/chart/lang/en.php index b8d7e1c8d0..f38fca8b3a 100644 --- a/module/chart/lang/en.php +++ b/module/chart/lang/en.php @@ -44,4 +44,4 @@ $lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; $lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; $lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; $lang->chart->typeList['stackedBar'] = 'Stacked Bar X'; -//$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; +$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; diff --git a/module/chart/lang/fr.php b/module/chart/lang/fr.php index b8d7e1c8d0..f38fca8b3a 100644 --- a/module/chart/lang/fr.php +++ b/module/chart/lang/fr.php @@ -44,4 +44,4 @@ $lang->chart->typeList['cluBarY'] = 'Clustered Bar Y'; $lang->chart->typeList['stackedBarY'] = 'Stacked Bar Y'; $lang->chart->typeList['cluBarX'] = 'Clustered Bar X'; $lang->chart->typeList['stackedBar'] = 'Stacked Bar X'; -//$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; +$lang->chart->typeList['waterpolo'] = 'Liquid Fill'; diff --git a/module/chart/lang/zh-cn.php b/module/chart/lang/zh-cn.php index 644f6c7d1c..a15d6da60e 100644 --- a/module/chart/lang/zh-cn.php +++ b/module/chart/lang/zh-cn.php @@ -44,4 +44,4 @@ $lang->chart->typeList['cluBarY'] = '簇状条形图'; $lang->chart->typeList['stackedBarY'] = '堆积条形图'; $lang->chart->typeList['cluBarX'] = '簇状柱形图'; $lang->chart->typeList['stackedBar'] = '堆积柱形图'; -//$lang->chart->typeList['waterpolo'] = '水球图'; +$lang->chart->typeList['waterpolo'] = '水球图'; diff --git a/module/chart/model.php b/module/chart/model.php index 65930205b8..b7825be851 100644 --- a/module/chart/model.php +++ b/module/chart/model.php @@ -482,6 +482,7 @@ class chartModel extends model $denominatorWheres = array(); foreach($settings['conditions'] as $condition) { + $condition = (array)$condition; $where = "{$condition['field']} {$this->config->chart->conditionList[$condition['condition']]} '{$condition['value']}'"; $moleculeWheres[] = $where; } diff --git a/module/screen/model.php b/module/screen/model.php index bbf3c38c2a..65ce328482 100755 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -390,7 +390,7 @@ class screenModel extends model $this->buildCardChart($component, $chart); break; case 'waterpolo': - $this->buildWaterPolo($component, $chart); + $this->getWaterPoloOption($component, $chart); break; default: break; @@ -1534,6 +1534,37 @@ 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.