mirror of
https://github.com/apache/superset.git
synced 2026-05-30 04:39:20 +00:00
Replaces four scattered dispatch locations (schema_validator, dataset_validator, chart_utils, runtime validator) with a central ChartTypePlugin registry. Each of the 7 supported chart types (xy, table, pie, pivot_table, mixed_timeseries, handlebars, big_number) now owns its pre-validation, column extraction, form_data mapping, post-map validation, column normalization, and runtime warnings in a single plugin class. Key changes: - Add ChartTypePlugin protocol and BaseChartPlugin base class (plugin.py) - Add ChartTypeRegistry with register/get/all_types helpers (registry.py) - Add 7 chart type plugins under chart/plugins/ with full coverage - Fix 5-type column validation gap: pie, pivot_table, mixed_timeseries, handlebars, and big_number now participate in dataset column validation (previously silently skipped) - Move BigNumber trendline temporal check to BigNumberChartPlugin.post_map_validate() - Add get_runtime_warnings() to plugin protocol; XYChartPlugin implements format/cardinality checks, removing isinstance(config, XYChartConfig) from RuntimeValidator - Fix stale generate_chart.py docstring listing only 'xy' and 'table' chart types - Add missing pie, pivot_table, mixed_timeseries handlers to _enhance_validation_error; refactor into a data-driven lookup table to stay within complexity limits - Fix empty details fallback in Pydantic error handler
59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
"""
|
|
Chart type plugins package.
|
|
|
|
Importing this module registers all built-in chart type plugins in the global
|
|
registry. This module is imported by app.py at startup.
|
|
|
|
To add a new chart type:
|
|
1. Create ``superset/mcp_service/chart/plugins/{chart_type}.py``
|
|
2. Implement a class extending ``BaseChartPlugin``
|
|
3. Import and register it here
|
|
"""
|
|
|
|
from superset.mcp_service.chart.plugins.big_number import BigNumberChartPlugin
|
|
from superset.mcp_service.chart.plugins.handlebars import HandlebarsChartPlugin
|
|
from superset.mcp_service.chart.plugins.mixed_timeseries import (
|
|
MixedTimeseriesChartPlugin,
|
|
)
|
|
from superset.mcp_service.chart.plugins.pie import PieChartPlugin
|
|
from superset.mcp_service.chart.plugins.pivot_table import PivotTableChartPlugin
|
|
from superset.mcp_service.chart.plugins.table import TableChartPlugin
|
|
from superset.mcp_service.chart.plugins.xy import XYChartPlugin
|
|
from superset.mcp_service.chart.registry import register
|
|
|
|
# Register all built-in chart type plugins
|
|
register(XYChartPlugin())
|
|
register(TableChartPlugin())
|
|
register(PieChartPlugin())
|
|
register(PivotTableChartPlugin())
|
|
register(MixedTimeseriesChartPlugin())
|
|
register(HandlebarsChartPlugin())
|
|
register(BigNumberChartPlugin())
|
|
|
|
__all__ = [
|
|
"BigNumberChartPlugin",
|
|
"HandlebarsChartPlugin",
|
|
"MixedTimeseriesChartPlugin",
|
|
"PieChartPlugin",
|
|
"PivotTableChartPlugin",
|
|
"TableChartPlugin",
|
|
"XYChartPlugin",
|
|
]
|