-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(partition): linked label on a larger than 180 degree slice (#726)
This commit fix an issue arose when a single large (>180 degrees) slice is forced to have a linked label, eg. via a large or infinite `maximumSection` value (the default is, fill text) The root cause was that the preexisting calculation simply took the midpoint of the start and end angle, and if it was shorter to go along the other arc of the circle, then that's what it did. So it always resulted in an exact overlap with two slices where one was over 180 degrees and linked labels were forced. fix #699
- Loading branch information
Showing
6 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
Binary file modified
BIN
+7 Bytes
(100%)
...ts-for-all-stories-sunburst-single-small-sice-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
+9 Bytes
(100%)
...ts-for-all-stories-sunburst-single-very-small-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 added
BIN
+14.4 KB
...-all-stories-sunburst-with-linked-text-labels-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* 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 React from 'react'; | ||
|
||
import { Chart, Datum, Partition, PartitionLayout } from '../../src'; | ||
import { config } from '../../src/chart_types/partition_chart/layout/config/config'; | ||
import { indexInterpolatedFillColor, interpolatorCET2s } from '../utils/utils'; | ||
|
||
export const Example = () => ( | ||
<Chart className="story-chart"> | ||
<Partition | ||
id="spec_1" | ||
data={[ | ||
{ sitc1: 'Machinery and transport equipment', exportVal: 5 }, | ||
{ sitc1: 'Mineral fuels, lubricants and related materials', exportVal: 4 }, | ||
]} | ||
valueAccessor={(d: Datum) => d.exportVal as number} | ||
valueFormatter={(d: number) => `$${config.fillLabel.valueFormatter(Math.round(d))}`} | ||
layers={[ | ||
{ | ||
groupByRollup: (d: Datum) => d.sitc1, | ||
// nodeLabel: (d: Datum) => d, | ||
fillLabel: { textInvertible: true }, | ||
shape: { | ||
fillColor: indexInterpolatedFillColor(interpolatorCET2s), | ||
}, | ||
}, | ||
]} | ||
config={{ partitionLayout: PartitionLayout.sunburst, linkLabel: { maximumSection: 10000 } }} | ||
/> | ||
</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