Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add randomness toggle on fit stacked series story #892

Merged
merged 2 commits into from
Nov 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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