diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-small-multiples-alpha-histogram-bars-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-small-multiples-alpha-histogram-bars-visually-looks-correct-1-snap.png new file mode 100644 index 0000000000..1777c2d4ea Binary files /dev/null and b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-small-multiples-alpha-histogram-bars-visually-looks-correct-1-snap.png differ diff --git a/stories/small_multiples/5_histogram_bars.tsx b/stories/small_multiples/5_histogram_bars.tsx new file mode 100644 index 0000000000..d03e2f3f86 --- /dev/null +++ b/stories/small_multiples/5_histogram_bars.tsx @@ -0,0 +1,85 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { boolean, number } from '@storybook/addon-knobs'; +import { NumberTypeKnobOptions } from '@storybook/addon-knobs/dist/components/types'; +import React from 'react'; + +import { ScaleType, Position, Chart, Axis, GroupBy, SmallMultiples, Settings, BarSeries } from '../../src'; +import { SB_SOURCE_PANEL } from '../utils/storybook'; + +const data = [ + { x: 30, split: 'Cloudy', y: 9 }, + { x: 45, split: 'Sunny', y: 8 }, + { x: 60, split: 'Rain', y: 5 }, + { x: 75, split: 'Sunny', y: 7 }, + { x: 90, split: 'Rain', y: 6 }, + { x: 105, split: 'Rain', y: 7 }, + { x: 120, split: 'Clear', y: 7 }, + { x: 135, split: 'Cloudy', y: 8 }, + { x: 150, split: 'Cloudy', y: 8 }, + { x: 165, split: 'Rain', y: 8 }, + { x: 180, split: 'Rain', y: 10 }, + { x: 195, split: 'Rain', y: 10 }, + { x: 210, split: 'Sunny', y: 9 }, + { x: 225, split: 'Rain', y: 10 }, + { x: 240, split: 'Clear', y: 12 }, + { x: 255, split: 'Cloudy', y: 9 }, + { x: 270, split: 'Clear', y: 12 }, + { x: 285, split: 'Cloudy', y: 5 }, + { x: 300, split: 'Rain', y: 7 }, + { x: 315, split: 'Sunny', y: 8 }, + { x: 330, split: 'Cloudy', y: 8 }, + { x: 345, split: 'Sunny', y: 8 }, + { x: 360, split: 'Sunny', y: 10 }, +]; +const numberOptions: NumberTypeKnobOptions = { + min: 0, + max: 1, + step: 0.01, +}; + +export const Example = () => { + const enableHistogramMode = boolean('EnableHistogramMode', true); + const barsPadding = number('barsPadding', 0, numberOptions); + const histogramPadding = number('histogramPadding', 0, numberOptions); + + return ( + + + + + + datum.split} sort="dataIndex" /> + + + + + ); +}; +Example.story = { + parameters: { + options: { selectedPanel: SB_SOURCE_PANEL }, + }, +}; diff --git a/stories/small_multiples/small_multiples.stories.tsx b/stories/small_multiples/small_multiples.stories.tsx index de4b73c45f..40b3c66aff 100644 --- a/stories/small_multiples/small_multiples.stories.tsx +++ b/stories/small_multiples/small_multiples.stories.tsx @@ -29,3 +29,4 @@ export default { export { Example as verticalAreas } from './2_vertical_areas'; export { Example as horizontalBars } from './4_horizontal_bars'; export { Example as gridLines } from './3_grid_lines'; +export { Example as histogramBars } from './5_histogram_bars';