Skip to content
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

Add gradient palette & rounded corners to Charting #32008

Merged

Conversation

t-shawngrant
Copy link
Contributor

@t-shawngrant t-shawngrant commented Jul 15, 2024

Overview

Implemented Viva gradient color palette and rounded corners in charting

New color tokens

export const DataVizGradientPalette = {
  gradient1: 'default.1',
  gradient2: 'default.2',
  gradient3: 'default.3',
  gradient4: 'default.4',
  gradient5: 'default.5',
  gradient6: 'default.6',
  gradient7: 'default.7',
  gradient8: 'default.8',
  gradient9: 'default.9',
  gradient10: 'default.10',
  // status gradients
  success: 'semantic.success',
  highSuccess: 'semantic.highSuccess',
  warning: 'semantic.warning',
  error: 'semantic.error',
  highError: 'semantic.highError',
  disabled: 'semantic.disabled',
};

New chart props

export interface ChartProps{
  // ... existing props
  /* Used to enable gradient fill for the chart.  */
  enableGradient?: boolean;
  /* Used to enable rounded corners for the chart. */
  roundCorners?: boolean;
}

Example Usage

const data: IChartProps = {
  chartTitle: 'Donut chart basic example',
  chartData: [
    {
      legend: 'first',
      data: 20000,
      // new `gradient` prop for chart data interfaces
      // use instead of `color` prop, when `enableGradient` is true for the chart
      gradient: getGradientFromToken(DataVizGradientPalette.gradient1),
      xAxisCalloutData: '2020/04/30',
    },
    {
      legend: 'second',
      data: 39000,
      gradient: getGradientFromToken(DataVizGradientPalette.gradient2),
      xAxisCalloutData: '2020/04/20',
    },
  ],
};

// ... in render method
<DonutChart
  data={data}
  valueInsideDonut={39000}
  enableGradient={true} // new prop
  roundCorners={true} // new prop
  // ... other props
/>

New Behavior

charts will accept enableGradient and roundCorners boolean flags in their props.

Donut Chart
donutchart
Gauge Chart
gaugechart
Horizontal Bar Chart
hbarchart
Horizontal Bar Chart With Axis
hbarchartwaxis
Stacked Horizontal Bar Chart
stackedhbarchart
Multi Stacked Bar Chart
multistackedbarchart
Vertical Bar Chart
vbarchart
Vertical Stacked Bar Chart
vstackedbarchart
Grouped Vertical Bar Chart
groupedverticalchart

TODO

  • Remove border radius from interior edges of stacked bar charts

@t-shawngrant
Copy link
Contributor Author

@t-shawngrant please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="Microsoft"

@AtishayMsft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@fabricteam
Copy link
Collaborator

fabricteam commented Jul 18, 2024

📊 Bundle size report

✅ No changes found

@fabricteam
Copy link
Collaborator

🕵 fluentui-web-components-v3 No visual regressions between this PR and main

@fabricteam
Copy link
Collaborator

🕵 fluentuiv9 No visual regressions between this PR and main

@fabricteam
Copy link
Collaborator

🕵 FluentUIV0 No visual regressions between this PR and main

Copy link

Commenter does not have sufficient privileges for PR 32008 in repo microsoft/fluentui

@t-shawngrant
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 32008 in repo microsoft/fluentui

@AtishayMsft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@fabricteam
Copy link
Collaborator

🕵 fluentuiv8 No visual regressions between this PR and main

@AtishayMsft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@AtishayMsft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@fabricteam
Copy link
Collaborator

🕵 fluentuiv8 No visual regressions between this PR and main

@Hotell Hotell requested review from Hotell and removed request for Hotell August 15, 2024 15:03
@AtishayMsft
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@AtishayMsft AtishayMsft merged commit 2eac169 into microsoft:master Aug 15, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants