From 285017730c073cf29cc325b37639d422cad76f0a Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Tue, 3 Jun 2025 11:35:34 +0800 Subject: [PATCH] * [misc] support sun burst chart for screen. --- module/screen/config.php | 2 ++ module/screen/model.php | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/module/screen/config.php b/module/screen/config.php index 75f6e17ff0..293c924f80 100644 --- a/module/screen/config.php +++ b/module/screen/config.php @@ -42,6 +42,7 @@ $config->screen->chartConfig['table'] = '{"category" : "Tables", "category $config->screen->chartConfig['card'] = '{"category" : "Texts", "categoryName" : "文本", "chartFrame" : "common", "chartKey" : "VTextCommon", "conKey" : "VCTextCommon", "image" : "text_static.png", "key" : "TextCommon", "package" : "Informations", "title" : "文字", "dataset" : {}}'; $config->screen->chartConfig['text'] = '{"category" : "Texts", "categoryName" : "文本", "chartFrame" : "common", "chartKey" : "VTextCommon", "conKey" : "VCTextCommon", "image" : "text_static.png", "key" : "TextCommon", "package" : "Informations", "title" : "文字", "dataset" : {}}'; $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['sunburst'] = '{"category" : "Mores", "categoryName" : "更多", "chartFrame" : "common", "chartKey" : "VSunBurst", "conKey" : "VCSunBurst", "image" : "pie.png", "key" : "SunBurst", "package" : "Charts", "title" : "旭日图", "dataset" : {}}'; $config->screen->chartConfig['box'] = '{"category" : "Mores", "categoryName" : "更多", "chartFrame" : "plotlys", "chartKey" : "VBox", "conKey" : "VCBox", "image" : "line.png", "key" : "Box", "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->chartConfig['help'] = '{"category" : "Informations", "categoryName" : "信息", "chartFrame" : "common", "chartKey" : "VHint", "conKey" : "VCHint", "image" : "./static/png/hint.png", "key" : "Hint", "package" : "Decorates", "title" : "提示"}'; @@ -56,6 +57,7 @@ $config->screen->chartOption['line'] = '{"legend":{"show":true,"top":40," $config->screen->chartOption['table'] = '{}'; $config->screen->chartOption['text'] = '{"fontSize":20,"fontColor":"#fff","textAlign":"center","fontWeight":"normal","borderWidth":0,"borderColor":"#fff","borderRadius":5}'; $config->screen->chartOption['waterpolo'] = '{"type":"nomal","series":[{"type":"liquidFill","radius":"90%","roseType":false}],"backgroundColor":"rgba(0,0,0,0)"}'; +$config->screen->chartOption['sunburst'] = '{"series":{"type":"sunburst","data": [], "radius": [0, "90%"], "label": {"rotate": "radial"}}}'; $config->screen->chartOption['box'] = '{"data": [], "layout": {"title": {"text": ""}}, "config": {}}'; $config->screen->chartOption['help'] = '{"text": "", "icon": "", "textSize": 30, "textColor": "#ffffff", "textWeight": "bold", "placement": "right-bottom", "distance": 8, "hint": "提示文本", "width": 0, "height": 0, "paddingX": 16, "paddingY": 8, "borderWidth": 1, "borderStyle": "solid", "borderColor": "#1a77a5", "borderRadius": 6, "color": "#ffffff", "textAlign": "left", "fontWeight": "normal", "backgroundColor": "rgba(89, 196, 230, .2)", "fontSize": 24}'; $config->screen->fieldConfig = new stdclass(); diff --git a/module/screen/model.php b/module/screen/model.php index 6a50aeee5b..fd2f426c52 100644 --- a/module/screen/model.php +++ b/module/screen/model.php @@ -446,6 +446,8 @@ class screenModel extends model return $this->prepareCardDataset($component, $data); case 'waterpolo': return $this->prepareWaterPoloDataset($component, $data); + case 'sunburst': + return $this->prepareSunburstDataset($component, $data); case 'group': return $this->prepareGroupDataset($component, $data); case 'text': @@ -1035,6 +1037,21 @@ class screenModel extends model return $this->setComponentDefaults($component); } + /** + * 准备旭日图数据集。 + * Prepare sunburst dataset. + * + * @param object $component + * @param array $data + * @access public + * @return object + */ + public function prepareSunburstDataset(object $component, array $data): object + { + $component->option->series->data = $data; + return $this->setComponentDefaults($component); + } + /** * Get bar chart option. *