Skip to content

Commit

Permalink
docs: add randomness toggle on fit stacked series story (#892)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme committed Nov 6, 2020
1 parent 9cd3459 commit 3734537
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stories/mixed/6_fitting_stacked.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

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

Expand All @@ -26,6 +26,7 @@ import { getRandomNumberGenerator } from '../../src/mocks/utils';
import { SB_KNOBS_PANEL } from '../utils/storybook';

export const Example = () => {
const randomizeBoundingData = process.env.RNG_SEED !== null ? false : boolean('randomize bounding data', false);
const dataTypes: Record<string, Array<{ x: number | string; y: number | null }>> = {
isolated: [
{ x: 0, y: 3 },
Expand Down Expand Up @@ -158,7 +159,8 @@ export const Example = () => {
const parsedEndValue: number | 'nearest' = Number.isNaN(Number(endValue)) ? 'nearest' : Number(endValue);
const value = number('Explicit value (using Fit.Explicit)', 5);
const xScaleType = dataKey === 'ordinal' ? ScaleType.Ordinal : ScaleType.Linear;
const rng = getRandomNumberGenerator();
const rngSeed = randomizeBoundingData ? undefined : process.env.RNG_SEED ?? '__seed__';
const rng = getRandomNumberGenerator(rngSeed);
const tickFormat = stackMode === 'percentage' ? (d: any) => numeral(d).format('0[.]00%') : undefined;
return (
<Chart className="story-chart">
Expand Down

0 comments on commit 3734537

Please sign in to comment.