UNPKG

gov-gui

Version:

Gov UI Component Library Typscript Build

155 lines (154 loc) 6.53 kB
import { html } from "lit-html"; // Lit-html is used for rendering in Storybook, but Stencil doesn't require its reactivity model. import "../../global/animate.min.css"; /** A bubble chart is a variation of a scatter plot where the data points are replaced with bubbles. Each bubble represents an entity, and its size indicates a third variable in addition to the x and y coordinates.*/ export default { title: 'Components/Charts/Bubble', component: 'gov-chart', tags: ['autodocs'], argTypes: { type: { control: 'text', description: 'Type of the chart to display', table: { type: { summary: 'string' }, defaultValue: { summary: 'bubble' }, category: 'Attributes', }, }, data: { control: 'object', description: 'Data to be plotted on the chart. It includes labels and datasets.', table: { type: { summary: 'object' }, defaultValue: { summary: '{}' }, category: 'Attributes', }, }, options: { control: 'object', description: 'Chart.js options object to customize the chart’s appearance and behavior.', table: { type: { summary: 'object' }, defaultValue: { summary: '{}' }, category: 'Attributes', }, }, animation: { control: 'select', options: ["", "bounce", "flash", "pulse", "rubberBand", "shakeX", "shakeY", "headShake", "swing", "tada", "wobble", "jello", "heartBeat", "backInDown", "backInLeft", "backInRight", "backInUp", "backOutDown", "backOutLeft", "backOutRight", "backOutUp", "bounceIn", "bounceInDown", "bounceInLeft", "bounceInRight", "bounceInUp", "bounceOut", "bounceOutDown", "bounceOutLeft", "bounceOutRight", "bounceOutUp", "fadeIn", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "fadeInRightBig", "fadeInUp", "fadeInUpBig", "fadeInTopLeft", "fadeInTopRight", "fadeInBottomLeft", "fadeInBottomRight", "fadeOut", "fadeOutDown", "fadeOutDownBig", "fadeOutLeft", "fadeOutLeftBig", "fadeOutRight", "fadeOutRightBig", "fadeOutUp", "fadeOutUpBig", "fadeOutTopLeft", "fadeOutTopRight", "fadeOutBottomRight", "fadeOutBottomLeft", "flip", "flipInX", "flipInY", "flipOutX", "flipOutY", "lightSpeedInRight", "lightSpeedInLeft", "lightSpeedOutRight", "lightSpeedOutLeft", "rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpLeft", "rotateInUpRight", "rotateOut", "rotateOutDownLeft", "rotateOutDownRight", "rotateOutUpLeft", "rotateOutUpRight", "hinge", "jackInTheBox", "rollIn", "rollOut", "zoomIn", "zoomInDown", "zoomInLeft", "zoomInRight", "zoomInUp", "zoomOut", "zoomOutDown", "zoomOutLeft", "zoomOutRight", "zoomOutUp", "slideInDown", "slideInLeft", "slideInRight", "slideInUp", "slideOutDown", "slideOutLeft", "slideOutRight", "slideOutUp" ], description: 'Selects the animation effect to apply to the component.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Animations', }, }, animationDelay: { control: 'select', options: ["2s", "3s", "4s", "5s"], description: 'Sets the delay before the animation begins (in seconds).', table: { type: { summary: 'string' }, defaultValue: { summary: '2s' }, category: 'Animations', }, }, animationSpeed: { control: 'select', options: ["slow", "slower", "fast", "faster"], description: 'Controls how quickly the animation plays.', table: { type: { summary: 'string' }, defaultValue: { summary: '' }, category: 'Animations', }, }, }, }; const Template = (args) => html ` <gov-chart type="${args.type}" .data="${args.data}" .options="${args.options}" animation-delay="${args.animationDelay}" animation="${args.animation}" animation-speed="${args.animationSpeed}" ></gov-chart> `; const dataSet = { datasets: [{ label: 'Bubble Dataset', backgroundColor: ["rgba(54, 162, 235, 0.5)", "rgba(255, 99, 132, 0.5)", "rgba(75, 192, 192, 0.5)", "rgba(153, 102, 255, 0.5)", "rgba(255, 99, 132, 0.5)",], //rgba(54, 162, 235, 0.5)", borderColor: ["rgb(54, 162, 235)", "rgb(255, 99, 132)", "rgb(75, 192, 192)", "rgb(153, 102, 255)", "rgb(255, 99, 132)",], //"rgb(54, 162, 235)", data: [ { x: 1, y: 15000, r: 40 }, { x: 2, y: 20000, r: 15 }, { x: 3, y: 18000, r: 50 }, { x: 4, y: 22000, r: 18 }, { x: 2, y: 10000, r: 60 }, { x: 0.5, y: 10000, r: 10 }, { x: 1, y: 5000, r: 15 }, ], }] }; const optionSet = { responsive: true, plugins: { legend: { display: true, position: 'top', }, }, scales: { x: { type: 'linear', position: 'bottom', beginAtZero: true, }, y: { type: 'linear', beginAtZero: true, }, }, }; /** A bubble chart is a variation of a scatter plot where the data points are replaced with bubbles. Each bubble represents an entity, and its size indicates a third variable in addition to the x and y coordinates.*/ export const bubble = Template.bind({}); bubble.args = { type: 'bubble', data: dataSet, options: optionSet, animation: '', animationDelay: '', animationSpeed: '', }; bubble.parameters = { docs: { source: { code: `<gov-table type="${bubble.args.type}" data="${JSON.stringify(bubble.args.data)} " options="${JSON.stringify(bubble.args.options)}" animation-delay="${bubble.args.animationDelay}" animation="${bubble.args.animation}" animation-speed="${bubble.args.animationSpeed}"> </gov-table>`, }, }, }; //# sourceMappingURL=gov-chart-bubble.stories.js.map