-
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(waffle): fix strange 0 text in legend item extra when label is 0 (#…
- Loading branch information
Showing
6 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
Binary file added
BIN
+8.69 KB
...isual-tests-for-all-stories-waffle-alpha-test-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
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 @@ | ||
/* | ||
* 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 React from 'react'; | ||
|
||
import { Chart, Datum, Partition, PartitionLayout, Settings, ShapeTreeNode } from '@elastic/charts'; | ||
|
||
import { useBaseTheme } from '../../use_base_theme'; | ||
import { colorBrewerCategoricalStark9, discreteColor, productPriceLookup } from '../utils/utils'; | ||
|
||
export const Example = () => { | ||
return ( | ||
<Chart className="story-chart"> | ||
<Settings | ||
theme={{ | ||
chartMargins: { top: 0, left: 0, bottom: 0, right: 0 }, | ||
chartPaddings: { left: 170, right: 170, top: 70, bottom: 70 }, | ||
}} | ||
baseTheme={useBaseTheme()} | ||
showLegend | ||
flatLegend | ||
showLegendExtra | ||
/> | ||
<Partition | ||
id="spec_1" | ||
data={[ | ||
{ products_price: 0.0, median_day_of_week_i: 13 }, | ||
{ products_price: 50.0, median_day_of_week_i: 3 }, | ||
{ products_price: 100.0, median_day_of_week_i: 4 }, | ||
{ products_price: 150.0, median_day_of_week_i: 3 }, | ||
{ products_price: 200.0, median_day_of_week_i: 4 }, | ||
{ products_price: 350.0, median_day_of_week_i: 0 }, | ||
{ products_price: 400.0, median_day_of_week_i: 0 }, | ||
{ products_price: 1050.0, median_day_of_week_i: 0 }, | ||
]} | ||
layout={PartitionLayout.waffle} | ||
valueAccessor={(d: Datum) => d.median_day_of_week_i as number} | ||
layers={[ | ||
{ | ||
groupByRollup: (d: Datum) => d.products_price, | ||
nodeLabel: (d: Datum) => productPriceLookup[d].name, | ||
shape: { | ||
fillColor: (d: ShapeTreeNode) => discreteColor(colorBrewerCategoricalStark9.slice(1))(d.sortIndex), | ||
}, | ||
}, | ||
]} | ||
/> | ||
</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