mirror of
https://github.com/apache/superset.git
synced 2026-05-31 05:09:20 +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,75 @@
|
||||
/*
|
||||
* 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 {
|
||||
EchartsBoxPlotChartPlugin,
|
||||
BoxPlotTransformProps,
|
||||
} from '@superset-ui/plugin-chart-echarts';
|
||||
import data from './data';
|
||||
import { withResizableChartDemo } from '@storybook-shared';
|
||||
|
||||
new EchartsBoxPlotChartPlugin()
|
||||
.configure({ key: 'echarts-boxplot' })
|
||||
.register();
|
||||
|
||||
getChartTransformPropsRegistry().registerValue(
|
||||
'echarts-boxplot',
|
||||
BoxPlotTransformProps,
|
||||
);
|
||||
|
||||
export default {
|
||||
title: 'Chart Plugins/plugin-chart-echarts/BoxPlot',
|
||||
decorators: [withResizableChartDemo],
|
||||
args: {
|
||||
xTicksLayout: '45°', // Initial value
|
||||
},
|
||||
argTypes: {
|
||||
xTicksLayout: {
|
||||
control: 'select',
|
||||
options: ['auto', 'flat', '45°', '90°', 'staggered'],
|
||||
defaultValue: '45°', // Default value here
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const BoxPlot = ({
|
||||
xTicksLayout,
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
xTicksLayout: string;
|
||||
width: number;
|
||||
height: number;
|
||||
}) => (
|
||||
<SuperChart
|
||||
chartType="echarts-boxplot"
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
columns: [],
|
||||
groupby: ['type', 'region'],
|
||||
metrics: ['AVG(averageprice)'],
|
||||
whiskerOptions: 'Tukey',
|
||||
xTicksLayout,
|
||||
yAxisFormat: 'SMART_NUMBER',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 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 [
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Charlotte',
|
||||
'AVG(averageprice)__mean': 1.9405512820512825,
|
||||
'AVG(averageprice)__median': 1.9025,
|
||||
'AVG(averageprice)__max': 2.505,
|
||||
'AVG(averageprice)__min': 1.4775,
|
||||
'AVG(averageprice)__q1': 1.73875,
|
||||
'AVG(averageprice)__q3': 2.105,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [2.735],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Hartford Springfield',
|
||||
'AVG(averageprice)__mean': 2.231141025641026,
|
||||
'AVG(averageprice)__median': 2.265,
|
||||
'AVG(averageprice)__max': 2.595,
|
||||
'AVG(averageprice)__min': 1.862,
|
||||
'AVG(averageprice)__q1': 2.1285,
|
||||
'AVG(averageprice)__q3': 2.32625,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Jacksonville',
|
||||
'AVG(averageprice)__mean': 1.829282051282052,
|
||||
'AVG(averageprice)__median': 1.808,
|
||||
'AVG(averageprice)__max': 2.255,
|
||||
'AVG(averageprice)__min': 1.455,
|
||||
'AVG(averageprice)__q1': 1.6945000000000001,
|
||||
'AVG(averageprice)__q3': 1.9475,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [2.48, 2.406, 1.3075, 1.274],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'NewYork',
|
||||
'AVG(averageprice)__mean': 2.0531923076923073,
|
||||
'AVG(averageprice)__median': 2.068,
|
||||
'AVG(averageprice)__max': 2.348,
|
||||
'AVG(averageprice)__min': 1.785,
|
||||
'AVG(averageprice)__q1': 1.9725000000000001,
|
||||
'AVG(averageprice)__q3': 2.125,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [2.3825, 2.38, 1.7075],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Northeast',
|
||||
'AVG(averageprice)__mean': 1.8608333333333336,
|
||||
'AVG(averageprice)__median': 1.868,
|
||||
'AVG(averageprice)__max': 2.145,
|
||||
'AVG(averageprice)__min': 1.5925,
|
||||
'AVG(averageprice)__q1': 1.76375,
|
||||
'AVG(averageprice)__q3': 1.96875,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Orlando',
|
||||
'AVG(averageprice)__mean': 1.7969999999999995,
|
||||
'AVG(averageprice)__median': 1.8075,
|
||||
'AVG(averageprice)__max': 2.1125,
|
||||
'AVG(averageprice)__min': 1.306,
|
||||
'AVG(averageprice)__q1': 1.6237499999999998,
|
||||
'AVG(averageprice)__q3': 1.8697499999999998,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [2.3825, 2.358, 2.252],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Philadelphia',
|
||||
'AVG(averageprice)__mean': 1.8673589743589747,
|
||||
'AVG(averageprice)__median': 1.85,
|
||||
'AVG(averageprice)__max': 2.2525,
|
||||
'AVG(averageprice)__min': 1.56,
|
||||
'AVG(averageprice)__q1': 1.7125,
|
||||
'AVG(averageprice)__q3': 1.99575,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Raleigh Greensboro',
|
||||
'AVG(averageprice)__mean': 1.8851410256410257,
|
||||
'AVG(averageprice)__median': 1.782,
|
||||
'AVG(averageprice)__max': 2.402,
|
||||
'AVG(averageprice)__min': 1.356,
|
||||
'AVG(averageprice)__q1': 1.7000000000000002,
|
||||
'AVG(averageprice)__q3': 2.0045,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [2.79, 2.6225, 2.5575, 2.5],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'Sacramento',
|
||||
'AVG(averageprice)__mean': 1.972871794871795,
|
||||
'AVG(averageprice)__median': 1.9875,
|
||||
'AVG(averageprice)__max': 2.655,
|
||||
'AVG(averageprice)__min': 1.2925,
|
||||
'AVG(averageprice)__q1': 1.74875,
|
||||
'AVG(averageprice)__q3': 2.1465,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [],
|
||||
},
|
||||
{
|
||||
type: 'organic',
|
||||
region: 'San Francisco',
|
||||
'AVG(averageprice)__mean': 2.213615384615385,
|
||||
'AVG(averageprice)__median': 2.275,
|
||||
'AVG(averageprice)__max': 2.9825,
|
||||
'AVG(averageprice)__min': 1.2275,
|
||||
'AVG(averageprice)__q1': 1.9675,
|
||||
'AVG(averageprice)__q3': 2.541,
|
||||
'AVG(averageprice)__count': 39,
|
||||
'AVG(averageprice)__outliers': [],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user