A comprehensive word cloud chart plugin for Apache Superset that creates interactive visualizations from text frequency data
—
Configuration system for the word cloud chart control panel that defines user interface controls for chart customization within Superset's explore view.
Main configuration object that defines all user interface controls and sections for the word cloud chart.
/**
* Control panel configuration for word cloud chart
* Defines sections, controls, and validation rules for the UI
*/
interface ControlPanelConfig {
controlPanelSections: ControlPanelSection[];
controlOverrides?: Record<string, Partial<ControlConfig>>;
}
interface ControlPanelSection {
label: string;
expanded: boolean;
controlSetRows: (string | ControlSetRow)[][];
}
interface ControlSetRow {
name: string;
config: ControlConfig;
}Inherited time-based controls for temporal data filtering:
// Uses sections.legacyRegularTime from @superset-ui/chart-controls
const timeSection = sections.legacyRegularTime;Core data selection and querying controls:
interface QuerySection {
label: 'Query';
expanded: true;
controlSetRows: [
['series'], // Text field selection (required, non-empty)
['metric'], // Metric selection for sizing
['adhoc_filters'], // Dynamic filtering
['row_limit'], // Result count limit (default: 100)
['sort_by_metric'] // Checkbox for metric-based sorting
];
}Query Controls:
validateNonEmpty)Visual appearance and formatting controls:
interface OptionsSection {
label: 'Options';
expanded: true;
controlSetRows: [
['size_from', 'size_to'], // Font size range controls
['rotation'], // Word rotation pattern
['color_scheme'] // Color scheme selection
];
}Font Size Controls:
interface FontSizeControls {
size_from: {
type: 'TextControl';
isInt: true;
label: 'Minimum Font Size';
default: 10;
description: 'Font size for the smallest value in the list';
};
size_to: {
type: 'TextControl';
isInt: true;
label: 'Maximum Font Size';
default: 70;
description: 'Font size for the biggest value in the list';
};
}Rotation Control:
interface RotationControl {
type: 'SelectControl';
label: 'Word Rotation';
choices: [
['random', 'random'],
['flat', 'flat'],
['square', 'square']
];
default: 'square';
clearable: false;
description: 'Rotation to apply to words in the cloud';
}Color Scheme Control:
// Uses standard color_scheme control from @superset-ui/chart-controls
const colorSchemeControl = 'color_scheme';Custom validation and default value overrides for specific controls:
interface ControlOverrides {
series: {
validators: [typeof validateNonEmpty];
clearable: false;
};
row_limit: {
default: 100;
};
}Override Details:
Integer input controls for numeric values:
interface TextControl {
type: 'TextControl';
isInt: true;
label: string;
renderTrigger: boolean;
default: number;
description: string;
}Dropdown selection controls with predefined choices:
interface SelectControl {
type: 'SelectControl';
label: string;
choices: [string, string][];
renderTrigger: boolean;
default: string;
clearable: boolean;
description: string;
}Boolean toggle controls:
interface CheckboxControl {
type: 'CheckboxControl';
label: string;
description: string;
}/**
* Validates that a field has a non-empty value
* Prevents form submission with empty required fields
*/
function validateNonEmpty(value: any): string | false;Usage Example:
controlOverrides: {
series: {
validators: [validateNonEmpty],
clearable: false,
}
}import { t, validateNonEmpty } from '@superset-ui/core';
import { ControlPanelConfig, sections } from '@superset-ui/chart-controls';All user-facing strings use the t() function for internationalization:
label: t('Query'),
description: t('Font size for the smallest value in the list'),Leverages Superset's standard control library:
const config: ControlPanelConfig = {
controlPanelSections: [
sections.legacyRegularTime,
querySection,
optionsSection
],
controlOverrides: {
series: { validators: [validateNonEmpty], clearable: false },
row_limit: { default: 100 }
}
};
export default config;This configuration creates a comprehensive control panel that allows users to:
Install with Tessl CLI
npx tessl i tessl/npm-superset-ui--plugin-chart-word-cloud