mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +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,90 @@
|
||||
/*
|
||||
* 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 { WordCloudChartPlugin } from '@superset-ui/plugin-chart-word-cloud';
|
||||
import { withResizableChartDemo } from '@storybook-shared';
|
||||
import data from './data';
|
||||
|
||||
new WordCloudChartPlugin().configure({ key: 'word-cloud2' }).register();
|
||||
|
||||
export default {
|
||||
title: 'Chart Plugins/plugin-chart-word-cloud',
|
||||
decorators: [withResizableChartDemo],
|
||||
args: {
|
||||
rotation: 'flat',
|
||||
colorScheme: 'd3Category10',
|
||||
sizeFrom: 10,
|
||||
sizeTo: 70,
|
||||
},
|
||||
argTypes: {
|
||||
rotation: {
|
||||
control: 'select',
|
||||
options: ['square', 'flat', 'random'],
|
||||
},
|
||||
colorScheme: {
|
||||
control: 'select',
|
||||
options: [
|
||||
'supersetColors',
|
||||
'd3Category10',
|
||||
'bnbColors',
|
||||
'googleCategory20c',
|
||||
],
|
||||
},
|
||||
sizeFrom: {
|
||||
control: { type: 'range', min: 5, max: 50, step: 5 },
|
||||
description: 'Minimum font size',
|
||||
},
|
||||
sizeTo: {
|
||||
control: { type: 'range', min: 20, max: 150, step: 5 },
|
||||
description: 'Maximum font size',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const Basic = ({
|
||||
rotation,
|
||||
colorScheme,
|
||||
sizeFrom,
|
||||
sizeTo,
|
||||
width,
|
||||
height,
|
||||
}: {
|
||||
rotation: string;
|
||||
colorScheme: string;
|
||||
sizeFrom: number;
|
||||
sizeTo: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}) => (
|
||||
<SuperChart
|
||||
chartType="word-cloud2"
|
||||
width={width}
|
||||
height={height}
|
||||
queriesData={[{ data }]}
|
||||
formData={{
|
||||
color_scheme: colorScheme,
|
||||
metric: 'sum__num',
|
||||
series: 'name',
|
||||
rotation,
|
||||
size_from: sizeFrom,
|
||||
size_to: sizeTo,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@@ -0,0 +1,422 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
export default [
|
||||
{
|
||||
name: 'Michael',
|
||||
sum__num: 2467129,
|
||||
},
|
||||
{
|
||||
name: 'Christopher',
|
||||
sum__num: 1725328,
|
||||
},
|
||||
{
|
||||
name: 'David',
|
||||
sum__num: 1570516,
|
||||
},
|
||||
{
|
||||
name: 'James',
|
||||
sum__num: 1506095,
|
||||
},
|
||||
{
|
||||
name: 'John',
|
||||
sum__num: 1426074,
|
||||
},
|
||||
{
|
||||
name: 'Matthew',
|
||||
sum__num: 1355877,
|
||||
},
|
||||
{
|
||||
name: 'Jennifer',
|
||||
sum__num: 1335587,
|
||||
},
|
||||
{
|
||||
name: 'Robert',
|
||||
sum__num: 1314800,
|
||||
},
|
||||
{
|
||||
name: 'Daniel',
|
||||
sum__num: 1159354,
|
||||
},
|
||||
{
|
||||
name: 'Joseph',
|
||||
sum__num: 1114167,
|
||||
},
|
||||
{
|
||||
name: 'William',
|
||||
sum__num: 1113793,
|
||||
},
|
||||
{
|
||||
name: 'Joshua',
|
||||
sum__num: 1073440,
|
||||
},
|
||||
{
|
||||
name: 'Jessica',
|
||||
sum__num: 997179,
|
||||
},
|
||||
{
|
||||
name: 'Jason',
|
||||
sum__num: 955817,
|
||||
},
|
||||
{
|
||||
name: 'Andrew',
|
||||
sum__num: 926315,
|
||||
},
|
||||
{
|
||||
name: 'Anthony',
|
||||
sum__num: 878978,
|
||||
},
|
||||
{
|
||||
name: 'Brian',
|
||||
sum__num: 874868,
|
||||
},
|
||||
{
|
||||
name: 'Ryan',
|
||||
sum__num: 816288,
|
||||
},
|
||||
{
|
||||
name: 'Kevin',
|
||||
sum__num: 791084,
|
||||
},
|
||||
{
|
||||
name: 'Ashley',
|
||||
sum__num: 789363,
|
||||
},
|
||||
{
|
||||
name: 'Thomas',
|
||||
sum__num: 746589,
|
||||
},
|
||||
{
|
||||
name: 'Sarah',
|
||||
sum__num: 744956,
|
||||
},
|
||||
{
|
||||
name: 'Nicholas',
|
||||
sum__num: 728617,
|
||||
},
|
||||
{
|
||||
name: 'Amanda',
|
||||
sum__num: 719676,
|
||||
},
|
||||
{
|
||||
name: 'Elizabeth',
|
||||
sum__num: 712676,
|
||||
},
|
||||
{
|
||||
name: 'Justin',
|
||||
sum__num: 704646,
|
||||
},
|
||||
{
|
||||
name: 'Jacob',
|
||||
sum__num: 700755,
|
||||
},
|
||||
{
|
||||
name: 'Eric',
|
||||
sum__num: 700518,
|
||||
},
|
||||
{
|
||||
name: 'Jonathan',
|
||||
sum__num: 691938,
|
||||
},
|
||||
{
|
||||
name: 'Brandon',
|
||||
sum__num: 682546,
|
||||
},
|
||||
{
|
||||
name: 'Melissa',
|
||||
sum__num: 664648,
|
||||
},
|
||||
{
|
||||
name: 'Steven',
|
||||
sum__num: 659750,
|
||||
},
|
||||
{
|
||||
name: 'Michelle',
|
||||
sum__num: 659302,
|
||||
},
|
||||
{
|
||||
name: 'Richard',
|
||||
sum__num: 652854,
|
||||
},
|
||||
{
|
||||
name: 'Kimberly',
|
||||
sum__num: 647609,
|
||||
},
|
||||
{
|
||||
name: 'Timothy',
|
||||
sum__num: 632770,
|
||||
},
|
||||
{
|
||||
name: 'Stephanie',
|
||||
sum__num: 628138,
|
||||
},
|
||||
{
|
||||
name: 'Emily',
|
||||
sum__num: 614741,
|
||||
},
|
||||
{
|
||||
name: 'Lisa',
|
||||
sum__num: 606540,
|
||||
},
|
||||
{
|
||||
name: 'Mark',
|
||||
sum__num: 589103,
|
||||
},
|
||||
{
|
||||
name: 'Jeffrey',
|
||||
sum__num: 557562,
|
||||
},
|
||||
{
|
||||
name: 'Amy',
|
||||
sum__num: 556835,
|
||||
},
|
||||
{
|
||||
name: 'Charles',
|
||||
sum__num: 556124,
|
||||
},
|
||||
{
|
||||
name: 'Nicole',
|
||||
sum__num: 545099,
|
||||
},
|
||||
{
|
||||
name: 'Tyler',
|
||||
sum__num: 499814,
|
||||
},
|
||||
{
|
||||
name: 'Angela',
|
||||
sum__num: 496228,
|
||||
},
|
||||
{
|
||||
name: 'Samantha',
|
||||
sum__num: 484266,
|
||||
},
|
||||
{
|
||||
name: 'Benjamin',
|
||||
sum__num: 482709,
|
||||
},
|
||||
{
|
||||
name: 'Heather',
|
||||
sum__num: 481474,
|
||||
},
|
||||
{
|
||||
name: 'Scott',
|
||||
sum__num: 469933,
|
||||
},
|
||||
{
|
||||
name: 'Rebecca',
|
||||
sum__num: 466847,
|
||||
},
|
||||
{
|
||||
name: 'Adam',
|
||||
sum__num: 459794,
|
||||
},
|
||||
{
|
||||
name: 'Mary',
|
||||
sum__num: 459471,
|
||||
},
|
||||
{
|
||||
name: 'Zachary',
|
||||
sum__num: 459381,
|
||||
},
|
||||
{
|
||||
name: 'Aaron',
|
||||
sum__num: 453035,
|
||||
},
|
||||
{
|
||||
name: 'Rachel',
|
||||
sum__num: 444351,
|
||||
},
|
||||
{
|
||||
name: 'Alexander',
|
||||
sum__num: 438239,
|
||||
},
|
||||
{
|
||||
name: 'Paul',
|
||||
sum__num: 411513,
|
||||
},
|
||||
{
|
||||
name: 'Kyle',
|
||||
sum__num: 409644,
|
||||
},
|
||||
{
|
||||
name: 'Laura',
|
||||
sum__num: 408963,
|
||||
},
|
||||
{
|
||||
name: 'Lauren',
|
||||
sum__num: 403946,
|
||||
},
|
||||
{
|
||||
name: 'Megan',
|
||||
sum__num: 402100,
|
||||
},
|
||||
{
|
||||
name: 'Nathan',
|
||||
sum__num: 393793,
|
||||
},
|
||||
{
|
||||
name: 'Samuel',
|
||||
sum__num: 390363,
|
||||
},
|
||||
{
|
||||
name: 'Christina',
|
||||
sum__num: 387580,
|
||||
},
|
||||
{
|
||||
name: 'Kelly',
|
||||
sum__num: 384611,
|
||||
},
|
||||
{
|
||||
name: 'Jordan',
|
||||
sum__num: 382963,
|
||||
},
|
||||
{
|
||||
name: 'Patrick',
|
||||
sum__num: 382673,
|
||||
},
|
||||
{
|
||||
name: 'Jeremy',
|
||||
sum__num: 381171,
|
||||
},
|
||||
{
|
||||
name: 'Jose',
|
||||
sum__num: 377759,
|
||||
},
|
||||
{
|
||||
name: 'Stephen',
|
||||
sum__num: 374269,
|
||||
},
|
||||
{
|
||||
name: 'Sean',
|
||||
sum__num: 366228,
|
||||
},
|
||||
{
|
||||
name: 'Kenneth',
|
||||
sum__num: 361043,
|
||||
},
|
||||
{
|
||||
name: 'Gregory',
|
||||
sum__num: 334166,
|
||||
},
|
||||
{
|
||||
name: 'Brittany',
|
||||
sum__num: 333252,
|
||||
},
|
||||
{
|
||||
name: 'Amber',
|
||||
sum__num: 331563,
|
||||
},
|
||||
{
|
||||
name: 'Katherine',
|
||||
sum__num: 329873,
|
||||
},
|
||||
{
|
||||
name: 'Hannah',
|
||||
sum__num: 329227,
|
||||
},
|
||||
{
|
||||
name: 'Taylor',
|
||||
sum__num: 327602,
|
||||
},
|
||||
{
|
||||
name: 'Danielle',
|
||||
sum__num: 322578,
|
||||
},
|
||||
{
|
||||
name: 'Andrea',
|
||||
sum__num: 318796,
|
||||
},
|
||||
{
|
||||
name: 'Austin',
|
||||
sum__num: 314059,
|
||||
},
|
||||
{
|
||||
name: 'Tiffany',
|
||||
sum__num: 301753,
|
||||
},
|
||||
{
|
||||
name: 'Kayla',
|
||||
sum__num: 291858,
|
||||
},
|
||||
{
|
||||
name: 'Christian',
|
||||
sum__num: 288189,
|
||||
},
|
||||
{
|
||||
name: 'Maria',
|
||||
sum__num: 287870,
|
||||
},
|
||||
{
|
||||
name: 'Alexis',
|
||||
sum__num: 286496,
|
||||
},
|
||||
{
|
||||
name: 'Bryan',
|
||||
sum__num: 282841,
|
||||
},
|
||||
{
|
||||
name: 'Victoria',
|
||||
sum__num: 277371,
|
||||
},
|
||||
{
|
||||
name: 'Julie',
|
||||
sum__num: 270542,
|
||||
},
|
||||
{
|
||||
name: 'Shannon',
|
||||
sum__num: 266886,
|
||||
},
|
||||
{
|
||||
name: 'Christine',
|
||||
sum__num: 264122,
|
||||
},
|
||||
{
|
||||
name: 'Sara',
|
||||
sum__num: 263050,
|
||||
},
|
||||
{
|
||||
name: 'Erin',
|
||||
sum__num: 262817,
|
||||
},
|
||||
{
|
||||
name: 'Madison',
|
||||
sum__num: 262812,
|
||||
},
|
||||
{
|
||||
name: 'Crystal',
|
||||
sum__num: 262697,
|
||||
},
|
||||
{
|
||||
name: 'Karen',
|
||||
sum__num: 257961,
|
||||
},
|
||||
{
|
||||
name: 'Anna',
|
||||
sum__num: 256136,
|
||||
},
|
||||
{
|
||||
name: 'Dylan',
|
||||
sum__num: 250778,
|
||||
},
|
||||
{
|
||||
name: 'Edward',
|
||||
sum__num: 248689,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user