-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: apply the data value formatter
- Loading branch information
Showing
23 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
Binary file added
BIN
+15.7 KB
...al-tests-for-all-stories-bar-chart-data-value-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.
Binary file modified
BIN
+14.3 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.8 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.3 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.8 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.5 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.3 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.5 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.9 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+15.1 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.9 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.9 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.5 KB
(150%)
...rizontal-alignment-center-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...horizontal-alignment-left-place-the-value-labels-on-the-correct-area-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.
Binary file modified
BIN
+14.7 KB
(150%)
...orizontal-alignment-right-place-the-value-labels-on-the-correct-area-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,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { boolean, select } from '@storybook/addon-knobs'; | ||
import React from 'react'; | ||
|
||
import { Axis, BarSeries, Chart, ScaleType, Settings } from '@elastic/charts'; | ||
|
||
import { GITHUB_DATASET_HIGH_VALUES } from '../../../packages/charts/src/utils/data_samples/test_dataset_github'; | ||
import { useBaseTheme } from '../../use_base_theme'; | ||
|
||
export const Example = () => { | ||
const noTickFormat = boolean('turn off special tickFormat', false); | ||
const rotation = select( | ||
'Rotation degree', | ||
{ | ||
'0 deg(default)': 0, | ||
'90 deg': 90, | ||
'-90 deg': -90, | ||
'180 deg': 180, | ||
}, | ||
0, | ||
); | ||
return ( | ||
<Chart> | ||
<Settings theme={[useBaseTheme()]} rotation={rotation} /> | ||
<BarSeries | ||
id="issues" | ||
name="Issues" | ||
data={GITHUB_DATASET_HIGH_VALUES} | ||
xAccessor="vizType" | ||
yAccessors={['count']} | ||
xScaleType={ScaleType.Ordinal} | ||
displayValueSettings={{ showValueLabel: true }} | ||
/> | ||
<Axis | ||
id="bottom-axis" | ||
position="bottom" | ||
tickFormat={ | ||
(!noTickFormat && rotation === 90) || (!noTickFormat && rotation === -90) | ||
? (d: string) => `${Math.round(Number(d) / 1000)}k` | ||
: undefined | ||
} | ||
/> | ||
<Axis | ||
id="left-axis" | ||
position="left" | ||
tickFormat={ | ||
(!noTickFormat && rotation === 0) || (!noTickFormat && rotation === 180) | ||
? (d: string) => `${Math.round(Number(d) / 1000)}k` | ||
: undefined | ||
} | ||
/> | ||
</Chart> | ||
); | ||
}; |
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