{
    "$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
    "data": {
        "type": "object",
        "properties": {
            "chartType": {
                "title": "图形类型",
                "type": "string",
                "default": "pie",
                "x-component": "radio",
                "x-index": 10,
                "enum": [
                    {
                        "label": "饼形",
                        "value": "pie"
                    },
                    {
                        "label": "环形",
                        "value": "ring"
                    }
                ],
                "description": "支持饼形和环形，本文以饼形为例"
            },
            "isTitle": {
                "title": "显示标题",
                "type": "boolean",
                "default": true,
                "x-index": 20,
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(title)",
                        "condition": "{{ $self.value }}"
                    }
                ]
            },
            "title": {
                "title": "图表标题",
                "default": "饼图标题",
                "type": "string",
                "x-index": 30
            },
            "dataSource": {
                "type": "object",
                "title": "数据源",
                "x-index": 40,
                "x-component": "chart-datasource-select",
                "display": false,
                "x-props": {
                    "data-hidebind": true
                },
                "x-component-props": {
                    "postChange": {
                        "addOrUpdateComponentDataBinds": {
                            "dataBind": {
                                "propertyPath": "filterData",
                                "bindDataPath": "[]",
                                "type": "expression",
                                "extra": {}
                            }
                        }
                    }
                },
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(filterData)",
                        "condition": "{{ ($self.value && $self.value.type ==='database') ||  ($self.value && $self.value.type ==='cloud-integration') }}"
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ $self.value && !!$self.value.name }}",
                        "target": "filterData",
                        "schema": {
                            "x-component-props": "{{{selectedDataSourceName: $self.value.name}}}"
                        }
                    },
                    {
                        "type": "value:visible",
                        "target": "*(xFieldShow,xField,xStatistics,xIsCountEmpty,yField)",
                        "condition": "{{ $self.value && $self.value.type ==='database' }}"
                    }
                ],
                "description": "已废弃数据源配置"
            },
            "dataSourceType": {
                "x-index": 42,
                "title": "数据源",
                "x-category": "基础属性",
                "type": "string",
                "default": "data-model",
                "enum": [
                    {
                        "label": "数据模型",
                        "value": "data-model"
                    },
                    {
                        "label": "APIs",
                        "value": "custom-connector"
                    },
                    {
                        "label": "变量",
                        "value": "variable"
                    }
                ],
                "x-linkages": [
                    {
                        "_comment": "数据模型才显示的",
                        "type": "value:state",
                        "condition": "{{$self.value === 'data-model'}}",
                        "target": "*(dataModel,filterData,xFieldShow,xField,xStatistics,xIsCountEmpty,yFieldSubTitle,yField,groupKey)",
                        "state": {
                            "display": true
                        }
                    },
                    {
                        "_comment": "数据模型不显示的",
                        "type": "value:state",
                        "condition": "{{$self.value === 'data-model'}}",
                        "target": "*(connector,connectorMethod,connectorParams,datasourceVariable)",
                        "state": {
                            "display": false
                        }
                    },
                    {
                        "_comment": "APIs才显示的",
                        "type": "value:state",
                        "target": "*(connector,connectorMethod,connectorParams)",
                        "condition": "{{$self.value === 'custom-connector'}}",
                        "state": {
                            "display": true
                        }
                    },
                    {
                        "_comment": "APIs隐藏的",
                        "type": "value:state",
                        "target": "*(groupKey,filterData,xFieldShow,xField,yFieldSubTitle,yField,datasourceVariable,dataModel,xStatistics)",
                        "condition": "{{$self.value === 'custom-connector'}}",
                        "state": {
                            "display": false
                        }
                    },
                    {
                        "_comment": "变量时才显示",
                        "type": "value:state",
                        "target": "*(datasourceVariable)",
                        "condition": "{{$self.value === 'variable'}}",
                        "state": {
                            "display": true
                        }
                    },
                    {
                        "_comment": "变量时不显示",
                        "type": "value:state",
                        "target": "*(connector,dataModel,xStatistics,groupKey,filterData,xFieldShow,xField,yFieldSubTitle,yField,connectorMethod,connectorParams)",
                        "condition": "{{$self.value === 'variable'}}",
                        "state": {
                            "display": false
                        }
                    },
                    {
                        "_comment": "给 connector-selector 设value属性",
                        "type": "value:schema",
                        "target": "connector",
                        "schema": {
                            "x-component-props": "{{{value:$value}}}"
                        }
                    }
                ],
                "x-props": {
                    "data-hidebind": true
                },
                "description": "数据源类型选择"
            },
            "dataModel": {
                "x-index": 43,
                "title": "数据模型",
                "type": "object",
                "required": true,
                "x-category": "基础属性",
                "properties": {
                    "name": {
                        "title": "数据模型名",
                        "type": "string"
                    },
                    "extra": {
                        "title": "数据模型属性",
                        "type": "object",
                        "properties": {
                            "viewId": {
                                "title": "数据模型视图id",
                                "type": "string"
                            },
                            "methodName": {
                                "title": "数据模型方法名",
                                "type": "object"
                            }
                        }
                    }
                },
                "x-component": "datasource-selector",
                "x-component-props": {
                    "methodName": "wedaAggregateData"
                },
                "x-props": {
                    "data-hidebind": true
                },
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(filterData)",
                        "condition": "{{ Boolean($self.value && $self.value.extra)}}"
                    },
                    {
                        "type": "value:schema",
                        "condition": "{{ $self.value && !!$self.value.name }}",
                        "target": "filterData",
                        "schema": {
                            "x-component-props": "{{{selectedDataSourceName: $self.value.name}}}"
                        }
                    },
                    {
                        "type": "value:visible",
                        "target": "*(xFieldShow,xField,xStatistics,xIsCountEmpty,yField)",
                        "condition": "{{ (Boolean($self.value && $self.value.extra)) }}"
                    }
                ],
                "description": "展示模型数据的数据来源"
            },
            "datasourceVariable": {
                "type": "array",
                "x-index": 44,
                "title": "数据源变量",
                "x-category": "基础属性",
                "description": "数据源变量",
                "display": false,
                "required": true,
                "x-component": "variable-expression"
            },
            "connector": {
                "title": "APIs",
                "type": "object",
                "x-component": "connector-select",
                "required": true,
                "x-props": {
                    "data-hidebind": true
                },
                "x-index": 45,
                "x-category": "基础属性",
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "target": "connectorMethod",
                        "schema": {
                            "x-component-props": {
                                "value": "{{$self.value}}"
                            }
                        }
                    }
                ],
                "description": "展示数据的APIs来源选择",
                "properties": {
                    "datasource": {
                        "type": "object",
                        "properties": {
                            "title": {
                                "type": "string",
                                "title": "API名"
                            },
                            "id": {
                                "type": "string",
                                "title": "ID"
                            },
                            "name": {
                                "type": "string",
                                "title": "数据源标识"
                            }
                        }
                    }
                }
            },
            "connectorMethod": {
                "title": "调用方法",
                "type": "object",
                "required": true,
                "x-component": "connector-method-select",
                "x-index": 46,
                "x-category": "基础属性",
                "x-component-props": {
                    "docUrl": "https://cloud.tencent.com/document/product/1301/71197#.E6.9F.B1.E7.8A.B6.E5.9B.BE.E3.80.81.E6.8A.98.E7.BA.BF.E5.9B.BE.E3.80.81.E9.A5.BC.E5.9B.BE",
                    "paramsSchema": {
                        "type": "object",
                        "properties": {
                            "outParams": {
                                "type": "object",
                                "properties": {
                                    "properties": {
                                        "type": "object",
                                        "properties": {
                                            "result": {
                                                "type": "object",
                                                "properties": {
                                                    "type": {
                                                        "const": "array"
                                                    },
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "type": {
                                                                "const": "object"
                                                            },
                                                            "properties": {
                                                                "type": "object",
                                                                "properties": {
                                                                    "XLabel": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "type": {
                                                                                "const": "object"
                                                                            },
                                                                            "properties": {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "Value": {
                                                                                        "type": "object",
                                                                                        "properties": {
                                                                                            "type": {
                                                                                                "const": "string"
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                },
                                                                                "required": ["Value"]
                                                                            }
                                                                        }
                                                                    },
                                                                    "YLabels": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                            "type": {
                                                                                "const": "array"
                                                                            },
                                                                            "items": {
                                                                                "type": "object",
                                                                                "properties": {
                                                                                    "type": {
                                                                                        "const": "object"
                                                                                    },
                                                                                    "properties": {
                                                                                        "type": "object",
                                                                                        "properties": {
                                                                                            "Name": {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "type": {
                                                                                                        "const": "string"
                                                                                                    }
                                                                                                }
                                                                                            },
                                                                                            "Value": {
                                                                                                "type": "object",
                                                                                                "properties": {
                                                                                                    "type": {
                                                                                                        "const": "number"
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        },
                                                                                        "required": ["Name", "Value"]
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                },
                                                                "required": ["XLabel", "YLabels"]
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "required": ["result"]
                                    }
                                }
                            }
                        }
                    }
                },
                "x-helper-text": "方法的出入参需满足组件要求，[查看文档](https://cloud.tencent.com/document/product/1301/71197#.E6.9F.B1.E7.8A.B6.E5.9B.BE.E3.80.81.E6.8A.98.E7.BA.BF.E5.9B.BE.E3.80.81.E9.A5.BC.E5.9B.BE)",
                "x-helper-text-color": "#E37318",
                "description": "展示数据的APIs调用方法选择"
            },
            "connectorParams": {
                "title": "查询入参",
                "type": "string",
                "x-component": "property-object-params-field",
                "x-component-props": {
                    "dataSourceKeyName": "connector",
                    "dataSourceValuePath": "datasource.name",
                    "methodNameKeyName": "connectorMethod",
                    "methodValuePath": "name",
                    "paramsKeyName": "connectorParams"
                },
                "x-index": 47,
                "x-category": "基础属性",
                "description": "对APIs调用方法获取的数据进行筛选过滤。支持对象类型，例如 {name:'',value:''}"
            },
            "filterData": {
                "title": "数据筛选",
                "x-index": 50,
                "x-component": "condition-select",
                "x-component-props": {
                    "dataSourceNamePropKey": "dataModel",
                    "customRelOptions": {
                        "string": [
                            {
                                "value": "eq",
                                "text": "等于"
                            },
                            {
                                "value": "neq",
                                "text": "不等于"
                            },
                            {
                                "value": "in",
                                "text": "包含"
                            },
                            {
                                "value": "nin",
                                "text": "不包含"
                            }
                        ],
                        "boolean": [
                            {
                                "value": "eq",
                                "text": "等于"
                            }
                        ],
                        "number": [
                            {
                                "value": "eq",
                                "text": "等于",
                                "type": "equal"
                            },
                            {
                                "value": "neq",
                                "text": "不等于",
                                "type": "unequal"
                            },
                            {
                                "value": "gt",
                                "text": "大于",
                                "type": "greater"
                            },
                            {
                                "value": "gte",
                                "text": "大于等于",
                                "type": "greater_or_equal"
                            },
                            {
                                "value": "lt",
                                "text": "小于",
                                "type": "less"
                            },
                            {
                                "value": "lte",
                                "text": "小于等于",
                                "type": "less_or_equal"
                            }
                        ],
                        "array": [
                            {
                                "value": "eq",
                                "text": "等于"
                            },
                            {
                                "value": "in",
                                "text": "包含"
                            }
                        ],
                        "object": [
                            {
                                "value": "eq",
                                "text": "等于"
                            },
                            {
                                "value": "in",
                                "text": "包含"
                            }
                        ],
                        "keyVarType": [
                            {
                                "value": "eq",
                                "text": "等于"
                            },
                            {
                                "value": "neq",
                                "text": "不等于"
                            },
                            {
                                "value": "gt",
                                "text": "大于"
                            },
                            {
                                "value": "lt",
                                "text": "小于"
                            }
                        ]
                    }
                },
                "x-props": {
                    "data-hidebind": true,
                    "data-hideBindValue": true,
                    "data-withBindMeta": true
                },
                "description": "可配置数据取值范围，可参见 数据筛选配置"
            },
            "setColor": {
                "type": "array",
                "title": "配色",
                "x-index": 60,
                "default": [
                    "#2A70E2",
                    "#46B690",
                    "#EDB539",
                    "#E46961",
                    "#4FB3D2",
                    "#805FDC"
                ],
                "x-component": "color-plate",
                "description": "当有多个数值字段或维度字段分组时，不同类别将按照不同配色展示，支持自定义色卡"
            },
            "dimensionalityShow": {
                "x-index": 70,
                "x-category": "基础属性",
                "x-component": "sub-category-title",
                "x-component-props": {
                    "text": "维度"
                }
            },
            "xField": {
                "type": "object",
                "title": "字段选择",
                "x-index": 80,
                "x-category": "基础属性",
                "x-component": "data-source-field-select",
                "x-component-props": {
                    "dataSourceNamePropKey": "dataModel",
                    "isMethod": true
                },
                "x-linkages": [
                    {
                        "type": "value:schema",
                        "condition": "{{ !!$self.value }}",
                        "target": "xStatistics",
                        "schema": {
                            "enum": "{{$self.value.format ==='datetime' ? [{'label':'年','value':'y'},{'label':'月','value':'m'},{'label':'周','value':'w'},{'label':'日','value':'d'},{'label':'时','value':'h'},{'label':'分','value':'min'}] : ($self.value.format ==='date'? [{'label':'年','value':'y'},{'label':'月','value':'m'},{'label':'周','value':'w'},{'label':'日','value':'d'}] : []) }}"
                        }
                    },
                    {
                        "type": "value:visible",
                        "target": "*(xStatistics)",
                        "condition": "{{ $self.value && ($self.value.format ==='datetime' || $self.value.format ==='date') }}"
                    },
                    {
                        "type": "value:visible",
                        "target": "*(xIsCountEmpty)",
                        "condition": "{{ $self.value && ($self.value.format !=='datetime' && $self.value.format !=='date') }}"
                    }
                ],
                "description": "X轴数值字段选择"
            },
            "xStatistics": {
                "title": "统计维度",
                "type": "string",
                "x-category": "基础属性",
                "x-index": 90,
                "enum": []
            },
            "xIsCountEmpty": {
                "title": "显示空值坐标",
                "type": "boolean",
                "default": false,
                "x-index": 100
            },
            "yFieldSubTitle": {
                "x-index": 105,
                "x-component": "sub-category-title",
                "x-component-props": {
                    "text": "数值"
                }
            },
            "yField": {
                "type": "object",
                "title": "字段选择",
                "x-index": 110,
                "x-category": "基础属性",
                "x-component": "chart-y-field-select",
                "x-component-props": {
                    "text": "编辑Y轴字段",
                    "isMethod": true,
                    "dataSourceNamePropKey": "dataModel",
                    "maxFieldCount": 1
                },
                "description": "Y轴数值字段选择"
            },
            "legendShow": {
                "x-index": 120,
                "x-category": "基础属性",
                "x-component": "sub-category-title",
                "x-component-props": {
                    "text": "图例"
                }
            },
            "isLegend": {
                "title": "显示图例",
                "type": "boolean",
                "default": true,
                "x-category": "基础属性",
                "x-index": 130,
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(legend)",
                        "condition": "{{ $self.value }}"
                    }
                ]
            },
            "legend": {
                "title": "图例位置",
                "type": "string",
                "default": "bottom",
                "x-category": "基础属性",
                "x-index": 150,
                "enum": [
                    {
                        "value": "top",
                        "label": "上方"
                    },
                    {
                        "value": "bottom",
                        "label": "下方"
                    }
                ]
            },
            "dataTagShow": {
                "x-index": 160,
                "x-category": "高级属性",
                "x-component": "sub-category-title",
                "x-component-props": {
                    "text": "数据标签"
                }
            },
            "isSeriesShowSymbol": {
                "title": "显示数值",
                "type": "boolean",
                "x-index": 170,
                "default": true,
                "x-category": "高级属性",
                "description": "数据标签字段选择"
            },
            "isPercent": {
                "title": "显示百分比",
                "type": "boolean",
                "x-index": 180,
                "default": false,
                "x-category": "高级属性"
            },
            "unitShow": {
                "x-index": 190,
                "x-category": "高级属性",
                "x-component": "sub-category-title",
                "x-component-props": {
                    "text": "显示单位"
                }
            },
            "isUnit": {
                "title": "显示单位",
                "type": "boolean",
                "x-index": 200,
                "default": false,
                "x-category": "高级属性",
                "x-linkages": [
                    {
                        "type": "value:visible",
                        "target": "*(unit,decimalDigits,suffix)",
                        "condition": "{{ $self.value }}"
                    }
                ]
            },
            "unit": {
                "type": "number",
                "title": "数值量级",
                "default": 1,
                "x-category": "高级属性",
                "x-index": 210,
                "enum": [
                    {
                        "label": "个",
                        "value": 1
                    },
                    {
                        "label": "十",
                        "value": 10
                    },
                    {
                        "label": "百",
                        "value": 100
                    },
                    {
                        "label": "千",
                        "value": 1000
                    },
                    {
                        "label": "万",
                        "value": 10000
                    },
                    {
                        "label": "十万",
                        "value": 100000
                    },
                    {
                        "label": "百万",
                        "value": 1000000
                    },
                    {
                        "label": "千万",
                        "value": 10000000
                    },
                    {
                        "label": "亿",
                        "value": 100000000
                    }
                ],
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "suffix",
                        "condition": "{{  $self.inputed && $self.value!==1 }}",
                        "state": {
                            "value": "{{$self.props.enum.find(s=>s.value===$self.value) ? $self.props.enum.find(s=>s.value===$self.value).label: '' }}"
                        }
                    },
                    {
                        "type": "value:state",
                        "target": "suffix",
                        "condition": "{{  $self.inputed && $self.value===1 }}",
                        "state": {
                            "value": ""
                        }
                    }
                ]
            },
            "decimalDigits": {
                "title": "小数位数",
                "type": "number",
                "default": 0,
                "x-props": {
                    "max": 10,
                    "min": 0
                },
                "x-index": 220,
                "x-category": "高级属性",
                "x-linkages": [
                    {
                        "type": "value:state",
                        "target": "decimalDigits",
                        "condition": "{{ $self.value == '' || isNaN($self.value) || $self.value < 0 }}",
                        "state": {
                            "value": 0
                        }
                    }
                ]
            },
            "suffix": {
                "title": "后缀",
                "type": "string",
                "default": "",
                "x-index": 230,
                "x-category": "高级属性"
            }
        }
    },
    "events": [],
    "meta": {
        "title": "饼图",
        "description": "用于报表场景下表示数据在总体中的占比。",
        "icon": "../../icons/Pie.svg",
        "category": "图表",
        "categoryOrder": 600,
        "componentOrder": 560,
        "visible": ["APP"]
    },
    "configMeta": {
        "docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/chart/Pie"
    }
}
