mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
chore(storybook): consolidate storybook and enhance plugin stories (#37771)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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 {
|
||||
EchartsSunburstChartPlugin,
|
||||
SunburstTransformProps,
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
import { withResizableChartDemo } from '@storybook-shared';
|
||||
import data from './data';
|
||||
|
||||
new EchartsSunburstChartPlugin()
|
||||
.configure({ key: 'echarts-sunburst' })
|
||||
.register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-sunburst',
|
||||
SunburstTransformProps,
|
||||
);
|
||||
|
||||
export default {
|
||||
title: 'Chart Plugins/plugin-chart-echarts/Sunburst',
|
||||
decorators: [withResizableChartDemo],
|
||||
};
|
||||
|
||||
export const Sunburst = ({
|
||||
showLabels,
|
||||
showTotal,
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
showLabels: boolean;
|
||||
showTotal: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
}) => (
|
||||
<SuperChart
|
||||
chartType="echarts-sunburst"
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
columns: ['genre', 'platform'],
|
||||
metric: 'count',
|
||||
showLabels,
|
||||
showTotal,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
Sunburst.args = {
|
||||
showLabels: true,
|
||||
showTotal: true,
|
||||
};
|
||||
Sunburst.argTypes = {
|
||||
showLabels: { control: 'boolean' },
|
||||
showTotal: { control: 'boolean' },
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 [
|
||||
{ genre: 'Adventure', platform: 'Wii', count: 84 },
|
||||
{ genre: 'Adventure', platform: 'N64', count: 14 },
|
||||
{ genre: 'Adventure', platform: 'XOne', count: 12 },
|
||||
{ genre: 'Adventure', platform: 'PS4', count: 19 },
|
||||
{ genre: 'Strategy', platform: 'Wii', count: 25 },
|
||||
{ genre: 'Strategy', platform: 'PS4', count: 15 },
|
||||
{ genre: 'Strategy', platform: 'N64', count: 29 },
|
||||
{ genre: 'Strategy', platform: 'XOne', count: 23 },
|
||||
{ genre: 'Simulation', platform: 'PS4', count: 15 },
|
||||
{ genre: 'Simulation', platform: 'XOne', count: 36 },
|
||||
{ genre: 'Simulation', platform: 'N64', count: 20 },
|
||||
{ genre: 'Simulation', platform: 'Wii', count: 50 },
|
||||
];
|
||||
Reference in New Issue
Block a user