Skip to content

Commit

Permalink
test: knob for partition layout selector (opensearch-project#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
monfera authored Apr 14, 2021
1 parent a0020ba commit d0cf0d9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/osd-charts/stories/mosaic/10_mosaic_simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { boolean } from '@storybook/addon-knobs';
import { boolean, radios } from '@storybook/addon-knobs';
import React from 'react';

import {
Expand Down Expand Up @@ -62,6 +62,15 @@ const productToColor = new Map(
);

export const Example = () => {
const partitionLayout = radios(
'Partition layout',
{
[PartitionLayout.mosaic]: PartitionLayout.mosaic,
[PartitionLayout.treemap]: PartitionLayout.treemap,
[PartitionLayout.sunburst]: PartitionLayout.sunburst,
},
PartitionLayout.mosaic,
);
return (
<Chart className="story-chart">
<Settings showLegend={boolean('Show legend', true)} showLegendExtra={boolean('Show legend values', true)} />
Expand All @@ -78,7 +87,7 @@ export const Example = () => {
fontWeight: 400,
},
shape: {
fillColor: () => 'white',
fillColor: partitionLayout === PartitionLayout.sunburst ? 'lightgrey' : 'white',
},
},
{
Expand All @@ -103,7 +112,9 @@ export const Example = () => {
},
]}
config={{
partitionLayout: PartitionLayout.mosaic,
partitionLayout,
linkLabel: { maxCount: 0 }, // relevant for sunburst only
outerSizeRatio: 0.9, // relevant for sunburst only
}}
/>
</Chart>
Expand Down

0 comments on commit d0cf0d9

Please sign in to comment.