chore(storybook): consolidate storybook and enhance plugin stories (#37771)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2026-02-11 19:06:23 -05:00
committed by GitHub
parent b012b63e5b
commit 981b370fe9
173 changed files with 5307 additions and 18230 deletions

View File

@@ -0,0 +1,129 @@
/*
* 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.
*/
import { SuperChart, getChartTransformPropsRegistry } from '@superset-ui/core';
import {
EchartsTreeChartPlugin,
TreeTransformProps,
} from '@superset-ui/plugin-chart-echarts';
import data from './data';
import { withResizableChartDemo } from '@storybook-shared';
new EchartsTreeChartPlugin().configure({ key: 'echarts-tree' }).register();
getChartTransformPropsRegistry().registerValue(
'echarts-tree',
TreeTransformProps,
);
export default {
title: 'Chart Plugins/plugin-chart-echarts/Tree',
decorators: [withResizableChartDemo],
args: {
colorScheme: 'bnbColors',
layout: 'orthogonal',
orient: 'LR',
symbol: 'circle',
symbolSize: 7,
roam: true,
},
argTypes: {
colorScheme: {
control: 'select',
options: [
'supersetColors',
'd3Category10',
'bnbColors',
'googleCategory20c',
],
},
layout: {
control: 'select',
options: ['orthogonal', 'radial'],
description: 'Layout type: orthogonal (rectangular) or radial (circular)',
},
orient: {
control: 'select',
options: ['LR', 'RL', 'TB', 'BT'],
description:
'Orientation: Left-Right, Right-Left, Top-Bottom, Bottom-Top',
},
symbol: {
control: 'select',
options: [
'emptyCircle',
'circle',
'rect',
'triangle',
'diamond',
'pin',
'arrow',
],
},
symbolSize: {
control: { type: 'range', min: 5, max: 30, step: 1 },
},
roam: {
control: 'boolean',
description: 'Enable zoom and pan',
},
},
};
export const Tree = ({
colorScheme,
layout,
orient,
symbol,
symbolSize,
roam,
width,
height,
}: {
colorScheme: string;
layout: string;
orient: string;
symbol: string;
symbolSize: number;
roam: boolean;
width: number;
height: number;
}) => (
<SuperChart
chartType="echarts-tree"
width={width}
height={height}
queriesData={[{ data }]}
formData={{
color_scheme: colorScheme,
datasource: '3__table',
granularity_sqla: 'ds',
metric: 'count',
id: 'id_column',
root_node_id: '1',
parent: 'parent_column',
name: 'name_column',
layout,
orient,
symbol,
symbol_size: symbolSize,
roam,
}}
/>
);

View File

@@ -0,0 +1,123 @@
/*
* 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.
*/
export default [
{
id_column: '1',
parent_column: null,
name_column: 'root',
count: 10,
},
{
id_column: '2',
parent_column: '1',
name_column: 'software',
count: 10,
},
{
id_column: '3',
parent_column: '1',
name_column: 'hardware',
count: 10,
},
{
id_column: '4',
parent_column: '2',
name_column: 'freeware',
count: 10,
},
{
id_column: '5',
parent_column: '2',
name_column: 'shareware',
count: 10,
},
{
id_column: '6',
parent_column: '2',
name_column: 'opensource',
count: 10,
},
{
id_column: '7',
parent_column: '3',
name_column: 'computer',
count: 10,
},
{
id_column: '8',
parent_column: '3',
name_column: 'cpu',
count: 10,
},
{
id_column: '9',
parent_column: '3',
name_column: 'mouse',
count: 10,
},
{
id_column: '10',
parent_column: '3',
name_column: 'keyboard',
count: 10,
},
{
id_column: '11',
parent_column: '8',
name_column: 'intel',
count: 10,
},
{
id_column: '12',
parent_column: '8',
name_column: 'ryzen',
count: 10,
},
{
id_column: '13',
parent_column: '9',
name_column: 'razor',
count: 10,
},
{
id_column: '14',
parent_column: '10',
name_column: 'Wired',
count: 10,
},
{
id_column: '15',
parent_column: '10',
name_column: 'Wireless',
count: 10,
},
{
id_column: '16',
parent_column: '10',
name_column: 'Ergonomic',
count: 10,
},
{
id_column: '17',
parent_column: '10',
name_column: 'Cherry mx',
count: 10,
},
];