-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(partition): stroke configuration and linked label value font format #602
Merged
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
28c02d0
feat: configurable stroke color
monfera 2c513aa
fix: tapered border must not protrude
monfera 9923e20
test: improved storybook ht Marco
monfera c355470
Merge branch 'master' into partition-stroke
monfera 3447038
chore: minor story improvement
monfera 2cc2dfa
fix: outerSizeRatio be sectorLineWidth aware
monfera 29c142a
chore: update for subtle border color change in story
monfera 06f75b5
chore: don't use colon
monfera a0eb47c
feat: linked label value font configuration
monfera 9a36269
chore: measure/render uniformity; better story
monfera 84bb9d8
chore: story pic update
monfera 3e48dbf
Merge branch 'master' into partition-stroke
monfera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+82.7 KB
...-tests-for-all-stories-sunburst-custom-stroke-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
+80 Bytes
(100%)
...or-all-stories-sunburst-high-number-of-slices-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
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,50 @@ | ||
/* | ||
* 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 { Chart, Datum, Partition, PartitionLayout } from '../../src'; | ||
import { mocks } from '../../src/mocks/hierarchical/index'; | ||
import { config } from '../../src/chart_types/partition_chart/layout/config/config'; | ||
import React from 'react'; | ||
import { countryLookup, indexInterpolatedFillColor, interpolatorCET2s } from '../utils/utils'; | ||
|
||
export const example = () => ( | ||
<Chart className="story-chart"> | ||
<Partition | ||
id="spec_1" | ||
data={mocks.manyPie} | ||
valueAccessor={(d: Datum) => d.exportVal as number} | ||
valueFormatter={(d: number) => `$${config.fillLabel.valueFormatter(Math.round(d / 1000000000))}\xa0Bn`} | ||
layers={[ | ||
{ | ||
groupByRollup: (d: Datum) => d.origin, | ||
nodeLabel: (d: Datum) => countryLookup[d].name, | ||
fillLabel: { textInvertible: true }, | ||
shape: { | ||
fillColor: indexInterpolatedFillColor(interpolatorCET2s), | ||
}, | ||
}, | ||
]} | ||
config={{ | ||
partitionLayout: PartitionLayout.sunburst, | ||
linkLabel: { maxCount: 15 }, | ||
sectorLineStroke: 'blanchedalmond', | ||
markov00 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sectorLineWidth: 1.2, | ||
}} | ||
/> | ||
</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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@monfera Sorry for looking at this late, but I'm confused by the name of this property and it's value. Does the stroke allow for more than just color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cchaos at the moment it's just flat color; Canvas2d would allow pattern and gradient colors too, but it doesn't look super useful so it's not exposed. You're right, the name is not super specific, it's patterned after the CSS property https://css-tricks.com/almanac/properties/s/stroke/ and the current TypeScript is:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K, thanks for the explanation!