-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(charts): Update V9 Charts to use DataVizGradientPalette #33323
Open
shawn-grant
wants to merge
43
commits into
microsoft:master
Choose a base branch
from
shawn-grant:chart-gradients
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
e5e79fc
add gradient declarations
shawn-grant b362372
replace color with gradient in ChartDataPoint and add gradient utilit…
shawn-grant 758f388
refactor: update test-data.ts dataPoints to use gradient property
shawn-grant 09b1252
feat: implement gradient support in DonutChart components
shawn-grant eef1cf2
test: update DonutChart tests to use gradient instead of color
shawn-grant 0c562b5
feat: add gradient support to HorizontalBarChart and update rendering…
shawn-grant 2eb7d67
refactor: replace color with gradient in HorizontalBarChart test cases
shawn-grant 942d9a3
build: update charts api readme
shawn-grant d3cc0db
add update-snapshots script to package.json
shawn-grant 5d90039
update tests and test snapshot
shawn-grant f64134a
Merge branch 'master' into chart-gradients
shawn-grant d9aa34d
refactor: update all DonutChart stories to use gradient pallete
shawn-grant 40f628c
refactor: update HorizontalBarChart stories to use gradient palette
shawn-grant 355faa6
Merge branch 'master' into chart-gradients
shawn-grant 18988c5
fix HBC test snapshots
shawn-grant 61e5ad7
update change files
shawn-grant fc6d1c4
update change files
shawn-grant e10f630
Merge branch 'chart-gradients' of https://github.com/shawn-grant/flue…
shawn-grant 8a3d7bf
update change type to patch
shawn-grant 751e2e0
Merge branch 'master' into chart-gradients
shawn-grant c58d7af
build: fix formatting issues
shawn-grant 0cc5413
build: fix ci fail (vr-tests-react-components)
shawn-grant f75812e
add change file
shawn-grant 78f2709
Merge branch 'master' into chart-gradients
shawn-grant 0138bed
pr-fix(HorizontalBarChart): use tokens.colorBackgroundOverlay
shawn-grant 610b397
feat(DonutChart): update gradient calculation and add custom gradient…
shawn-grant f01a57a
feat(HorizontalBarChart): add custom gradient story
shawn-grant 7961be6
pr-fix(DonutChart): check both gradient colors are defined before app…
shawn-grant 904d04f
update test snapshots
shawn-grant 8a6ce72
pr-fix(DonutChart): rename gradient prop to color for Arc
shawn-grant 969f516
pr-fix(DonutChart): rename gradient prop to color and update related …
shawn-grant dcf5e3d
pr-fix(HorizontalBarChart): rename gradient prop to color and update …
shawn-grant 026000b
revert changes in vr-tests-react-components
shawn-grant 25c7e0f
update tests
shawn-grant 1f7ca56
Merge branch 'master' into chart-gradients
shawn-grant 40ee893
pr-cleanup: revert changes in @fluentui/react-virtualizer
shawn-grant e15353b
fix tests
shawn-grant 6c15c0d
minor change
shawn-grant 6ecf234
pr-fix(charts): improve missing color handling
shawn-grant 3d9a7e2
Merge branch 'master' into chart-gradients
shawn-grant 81890dc
Merge branch 'master' into chart-gradients
shawn-grant 5057918
Merge branch 'master' into chart-gradients
shawn-grant 1168c3b
Merge branch 'master' into chart-gradients
shawn-grant 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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-charts-preview-4a4fc3a5-16b8-4e2c-9fea-5cb5888e977f.json
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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Introduce gradients and rounded corners to v9 charts", | ||
"packageName": "@fluentui/react-charts-preview", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/* eslint-disable react/jsx-no-bind */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import * as React from 'react'; | ||
import { pie as d3Pie } from 'd3-shape'; | ||
import { pie as d3Pie, PieArcDatum } from 'd3-shape'; | ||
import { PieProps } from './index'; | ||
import { Arc } from '../Arc/index'; | ||
import { ChartDataPoint } from '../index'; | ||
|
@@ -25,7 +25,6 @@ export const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivEl | |
const classes = usePieStyles_unstable(props); | ||
const pieForFocusRing = d3Pie() | ||
.sort(null) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was showing as an unused eslint directive |
||
.value((d: any) => d.data) | ||
.padAngle(0); | ||
|
||
|
@@ -45,17 +44,15 @@ export const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivEl | |
return totalValue; | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function arcGenerator(d: any, i: number, focusData: any, href?: string): JSX.Element { | ||
const color = d && d.data && d.data.color; | ||
function arcGenerator(d: PieArcDatum<ChartDataPoint>, i: number, focusData: any, href?: string): JSX.Element { | ||
return ( | ||
<Arc | ||
key={i} | ||
data={d} | ||
focusData={focusData} | ||
innerRadius={props.innerRadius} | ||
outerRadius={props.outerRadius} | ||
color={color!} | ||
color={d.data.color!} | ||
onFocusCallback={_focusCallback} | ||
hoverOnCallback={_hoverCallback} | ||
onBlurCallback={props.onBlurCallback} | ||
|
@@ -78,7 +75,6 @@ export const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivEl | |
|
||
const piechart = d3Pie<ChartDataPoint>() | ||
.sort(null) | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
.value((d: any) => d.data) | ||
.padAngle(0.02)(data); | ||
const translate = `translate(${props.width / 2}, ${props.height / 2})`; | ||
|
@@ -87,7 +83,7 @@ export const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivEl | |
|
||
return ( | ||
<g transform={translate}> | ||
{piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))} | ||
{piechart.map((d: PieArcDatum<ChartDataPoint>, i: number) => arcGenerator(d, i, focusData[i], props.href))} | ||
{props.valueInsideDonut && ( | ||
<text y={5} textAnchor="middle" dominantBaseline="middle" className={classes.insideDonutString}> | ||
{props.valueInsideDonut} | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
why removed the classname?
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.
Moved the classname to the
<div>
that renders the gradients. The<path>
element won't be visible, so the class and its styles aren't needed.Test also break if both elements have the class.