forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: custom domain error with fallback ordinal scale (opensearch-proj…
…ect#757) Ignores `xDomain` prop when using a fallback ordinal scale. fixes opensearch-project#756
- Loading branch information
1 parent
87e5578
commit a78fb4f
Showing
5 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
Binary file added
BIN
+10.3 KB
...tests-for-all-stories-scales-x-scale-fallback-visually-looks-correct-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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 } from '@storybook/addon-knobs'; | ||
import React from 'react'; | ||
|
||
import { Axis, Chart, BarSeries, Position, ScaleType, Settings } from '../../src'; | ||
|
||
export const Example = () => { | ||
const includeString = boolean('include string is x data', true); | ||
return ( | ||
<Chart className="story-chart"> | ||
<Settings xDomain={{ min: 0, max: 10 }} /> | ||
<Axis id="y" title="count" position={Position.Left} /> | ||
<Axis id="x" title={includeString ? 'ordinal fallback scale' : 'linear scale'} position={Position.Bottom} /> | ||
<BarSeries | ||
id="bars" | ||
name="amount" | ||
xScaleType={ScaleType.Linear} | ||
xAccessor="x" | ||
yAccessors={['y']} | ||
data={[ | ||
{ x: 1, y: 390, val: 1222 }, | ||
{ x: 2, y: 23, val: 1222 }, | ||
{ x: includeString ? '3' : 3, y: 750, val: 1222 }, | ||
{ x: 4, y: 854, val: 1222 }, | ||
]} | ||
/> | ||
</Chart> | ||
); | ||
}; | ||
|
||
Example.story = { | ||
parameters: { | ||
info: { | ||
text: 'Using string values with a `Linear` scale will attempt to fallback to an `Ordinal` scale. Notice how the custom `xDomain` is ignored when the scale falls back to `Ordinal`.', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters