mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +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,86 @@
|
||||
/*
|
||||
* 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 } from '@superset-ui/core';
|
||||
import ParallelCoordinatesChartPlugin from '@superset-ui/legacy-plugin-chart-parallel-coordinates';
|
||||
import { withResizableChartDemo } from '@storybook-shared';
|
||||
import data from './data';
|
||||
|
||||
new ParallelCoordinatesChartPlugin()
|
||||
.configure({ key: 'parallel-coordinates' })
|
||||
.register();
|
||||
|
||||
export default {
|
||||
title: 'Legacy Chart Plugins/legacy-plugin-chart-parallel-coordinates',
|
||||
decorators: [withResizableChartDemo],
|
||||
args: {
|
||||
includeSeries: false,
|
||||
linearColorScheme: 'schemeRdYlBu',
|
||||
showDatatable: false,
|
||||
},
|
||||
argTypes: {
|
||||
includeSeries: {
|
||||
control: 'boolean',
|
||||
description: 'Include series name in the chart',
|
||||
},
|
||||
linearColorScheme: {
|
||||
control: 'select',
|
||||
options: [
|
||||
'schemeRdYlBu',
|
||||
'schemeBlues',
|
||||
'schemeGreens',
|
||||
'schemeOranges',
|
||||
'schemePurples',
|
||||
],
|
||||
},
|
||||
showDatatable: {
|
||||
control: 'boolean',
|
||||
description: 'Show data table below chart',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const Basic = ({
|
||||
includeSeries,
|
||||
linearColorScheme,
|
||||
showDatatable,
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
includeSeries: boolean;
|
||||
linearColorScheme: string;
|
||||
showDatatable: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
}) => (
|
||||
<SuperChart
|
||||
chartType="parallel-coordinates"
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
include_series: includeSeries,
|
||||
linear_color_scheme: linearColorScheme,
|
||||
metrics: ['sum__SP_POP_TOTL', 'sum__SP_RUR_TOTL_ZS', 'sum__SH_DYN_AIDS'],
|
||||
secondary_metric: 'sum__SP_POP_TOTL',
|
||||
series: 'country_name',
|
||||
show_datatable: showDatatable,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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 [
|
||||
{
|
||||
country_name: 'China',
|
||||
sum__SP_POP_TOTL: 1344130000.0,
|
||||
sum__SP_RUR_TOTL_ZS: 49.427,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
{
|
||||
country_name: 'India',
|
||||
sum__SP_POP_TOTL: 1247446011.0,
|
||||
sum__SP_RUR_TOTL_ZS: 68.724,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
{
|
||||
country_name: 'United States',
|
||||
sum__SP_POP_TOTL: 311721632.0,
|
||||
sum__SP_RUR_TOTL_ZS: 19.06,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Indonesia',
|
||||
sum__SP_POP_TOTL: 244808254.0,
|
||||
sum__SP_RUR_TOTL_ZS: 49.288,
|
||||
sum__SH_DYN_AIDS: 540000.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Brazil',
|
||||
sum__SP_POP_TOTL: 200517584.0,
|
||||
sum__SP_RUR_TOTL_ZS: 15.377,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Pakistan',
|
||||
sum__SP_POP_TOTL: 173669648.0,
|
||||
sum__SP_RUR_TOTL_ZS: 62.993,
|
||||
sum__SH_DYN_AIDS: 52000.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Nigeria',
|
||||
sum__SP_POP_TOTL: 163770669.0,
|
||||
sum__SP_RUR_TOTL_ZS: 55.638,
|
||||
sum__SH_DYN_AIDS: 3000000.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Bangladesh',
|
||||
sum__SP_POP_TOTL: 153405612.0,
|
||||
sum__SP_RUR_TOTL_ZS: 68.775,
|
||||
sum__SH_DYN_AIDS: 7800.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Russian Federation',
|
||||
sum__SP_POP_TOTL: 142960868.0,
|
||||
sum__SP_RUR_TOTL_ZS: 26.268,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
{
|
||||
country_name: 'Japan',
|
||||
sum__SP_POP_TOTL: 127817277.0,
|
||||
sum__SP_RUR_TOTL_ZS: 8.752,
|
||||
sum__SH_DYN_AIDS: 0.0,
|
||||
},
|
||||
];
|
||||
@@ -16,8 +16,7 @@
|
||||
"src/**/*.js",
|
||||
"src/**/*.jsx",
|
||||
"src/**/*.test.*",
|
||||
"src/**/*.stories.*"
|
||||
],
|
||||
"src/**/*.stories.*"],
|
||||
"references": [
|
||||
{ "path": "../../packages/superset-core" },
|
||||
{ "path": "../../packages/superset-ui-core" },
|
||||
|
||||
Reference in New Issue
Block a user