-
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.
fix(axis): ticks generation for linear scale on bar charts (#1645)
Reduce the number of ticks generated when rendering bar charts using a linear scale. It will render only a set of ticks at nicer rounded intervals
- Loading branch information
Showing
21 changed files
with
69 additions
and
20 deletions.
There are no files selected for viewing
Binary file modified
BIN
-951 Bytes
(93%)
...tests-for-all-stories-bar-chart-test-discover-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
-1.06 KB
(93%)
...-test-min-height-positive-and-negative-values-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
-3.65 KB
(93%)
...r-all-stories-bar-chart-with-high-data-volume-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
-2.76 KB
(84%)
...r-chart-with-linear-x-axis-no-linear-interval-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
-3.03 KB
(95%)
...sts-for-all-stories-debug-options-debug-state-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
-209 Bytes
(99%)
...or-all-stories-interactions-png-export-action-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
-1.66 KB
(92%)
...-stories-small-multiples-alpha-histogram-bars-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
-3.82 KB
(93%)
...ual-tests-for-all-stories-stylings-dark-theme-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
-3.11 KB
(91%)
...ories-stylings-multiple-custom-partial-themes-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
-3.14 KB
(92%)
...for-all-stories-stylings-partial-custom-theme-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
-3.14 KB
(92%)
...stylings-partial-custom-theme-with-base-theme-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
-3.61 KB
(93%)
...-tests-for-all-stories-stylings-theme-styling-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
-4.98 KB
(72%)
...ons-with-histogram-bar-series-should-render-correct-axis-rotation-90-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
-5.05 KB
(72%)
...histogram-bar-series-should-render-correct-axis-rotation-negative-90-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
-951 Bytes
(93%)
...est-ts-bar-series-stories-test-discover-using-no-custom-min-interval-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
-4 KB
(94%)
...ts-interactions-tooltips-should-render-current-tooltip-in-dark-theme-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,26 @@ | ||
/* | ||
* 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 { getLinearTicks } from '../chart_types/xy_chart/utils/get_linear_ticks'; | ||
|
||
/** @internal */ | ||
export function getLinearNonDenserTicks( | ||
start: number, | ||
stop: number, | ||
count: number, | ||
base: number = 2, | ||
minInterval: number, | ||
): number[] { | ||
let currentCount = count; | ||
let ticks = getLinearTicks(start, stop, count, base); | ||
while (ticks.length > 2 && currentCount > 0 && ticks[1] - ticks[0] < minInterval) { | ||
currentCount--; | ||
ticks = getLinearTicks(start, stop, currentCount, base); | ||
} | ||
return ticks; | ||
} |
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