From d1ebfc1f8582c35ced8fd24f6f1d08e36b680890 Mon Sep 17 00:00:00 2001 From: Mercedes Miller Date: Mon, 17 Aug 2020 14:16:26 -0700 Subject: [PATCH 01/14] Added overlays and updated legend --- .../src/components/Legends/Legends.base.tsx | 12 ++- .../src/components/Legends/Legends.styles.ts | 8 +- .../src/components/Legends/Legends.types.ts | 7 ++ .../components/LineChart/LineChart.base.tsx | 100 ++++++++++++++++-- .../components/LineChart/LineChart.types.ts | 20 ++++ .../examples/LineChart.Basic.Example.tsx | 27 +++++ 6 files changed, 165 insertions(+), 9 deletions(-) diff --git a/packages/charting/src/components/Legends/Legends.base.tsx b/packages/charting/src/components/Legends/Legends.base.tsx index 4baf446186f56..362bb4ee8551b 100644 --- a/packages/charting/src/components/Legends/Legends.base.tsx +++ b/packages/charting/src/components/Legends/Legends.base.tsx @@ -28,6 +28,8 @@ interface ILegendItem extends React.ButtonHTMLAttributes { color: string; shape?: LegendShape; key: number; + opacity?: number; + fill?: string; } export interface ILegendState { @@ -90,6 +92,8 @@ export class LegendsBase extends React.Component { onMouseOutAction: legend.onMouseOutAction!, color: legend.color, shape: legend.shape, + fill: legend.fill, + opacity: legend.opacity, key: index, }; }); @@ -245,6 +249,7 @@ export class LegendsBase extends React.Component { >
(this._hoverCardRef = rootElem)} data-is-focusable={false} > @@ -284,6 +289,8 @@ export class LegendsBase extends React.Component { action: data.action, hoverAction: data.hoverAction, onMouseOutAction: data.onMouseOutAction, + fill: data.fill, + opacity: data.opacity, }; const color = this._getColor(legend.title, legend.color); const { theme, className, styles } = this.props; @@ -293,8 +300,9 @@ export class LegendsBase extends React.Component { colorOnSelectedState: color, borderColor: legend.color, overflow: overflow, + fill: legend.fill, + opacity: legend.opacity, }); - const onClickHandler = () => { this._onClick(legend); }; @@ -308,12 +316,14 @@ export class LegendsBase extends React.Component {
diff --git a/packages/charting/src/components/LineChart/examples/LineChart.Multiple.Example.tsx b/packages/charting/src/components/LineChart/examples/LineChart.Multiple.Example.tsx index d3abae1c93351..e1e772b33ca12 100644 --- a/packages/charting/src/components/LineChart/examples/LineChart.Multiple.Example.tsx +++ b/packages/charting/src/components/LineChart/examples/LineChart.Multiple.Example.tsx @@ -236,6 +236,33 @@ export class LineChartMultipleExample extends React.Component<{}, ILineChartMult new Date('06-01-2018'), new Date('07-01-2018'), ]; + const colorFillBarData = [ + { + legend: 'Time range 1', + color: 'blue', + data: [ + { + startX: new Date('2018/01/06'), + endX: new Date('2018/01/25'), + }, + ], + }, + { + legend: 'Time range 2', + color: 'red', + data: [ + { + startX: new Date('2018/01/18'), + endX: new Date('2018/02/20'), + }, + { + startX: new Date('2018/04/17'), + endX: new Date('2018/05/10'), + }, + ], + applyPattern: true, + }, + ]; return (
); From e5816cfe5ad6b701738a5171cbeac6a4d2bdb640 Mon Sep 17 00:00:00 2001 From: Mercedes Miller Date: Thu, 1 Oct 2020 11:49:05 -0700 Subject: [PATCH 11/14] Updated import --- packages/charting/src/components/LineChart/LineChart.base.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/charting/src/components/LineChart/LineChart.base.tsx b/packages/charting/src/components/LineChart/LineChart.base.tsx index ad54fdb549467..11e5580bcb4dc 100644 --- a/packages/charting/src/components/LineChart/LineChart.base.tsx +++ b/packages/charting/src/components/LineChart/LineChart.base.tsx @@ -12,7 +12,7 @@ import { IMargins, IRefArrayData, IColorFillBarsProps, -} from '@uifabric/charting'; +} from '../../index'; import { DirectionalHint } from 'office-ui-fabric-react/lib/Callout'; import { EventsAnnotation } from './eventAnnotation/EventAnnotation'; import { calloutData, ChartTypes, getXAxisType, XAxisTypes } from '../../utilities/index'; From 34363f4c40c864605215eda059ab603b006a138e Mon Sep 17 00:00:00 2001 From: Mercedes Miller Date: Mon, 5 Oct 2020 14:03:44 -0700 Subject: [PATCH 12/14] Change files --- ...-examples-2020-10-05-14-03-43-ColorFillBarFeature.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 change/@fluentui-react-examples-2020-10-05-14-03-43-ColorFillBarFeature.json diff --git a/change/@fluentui-react-examples-2020-10-05-14-03-43-ColorFillBarFeature.json b/change/@fluentui-react-examples-2020-10-05-14-03-43-ColorFillBarFeature.json new file mode 100644 index 0000000000000..61b69a279e8dc --- /dev/null +++ b/change/@fluentui-react-examples-2020-10-05-14-03-43-ColorFillBarFeature.json @@ -0,0 +1,8 @@ +{ + "type": "minor", + "comment": "Made color fill bars compatible with multi select legends", + "packageName": "@fluentui/react-examples", + "email": "memille@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-10-05T21:03:43.761Z" +} From cf36277d1f4b7364cb5e4128a8c15c4b4a2bc964 Mon Sep 17 00:00:00 2001 From: Mercedes Miller Date: Mon, 5 Oct 2020 15:55:48 -0700 Subject: [PATCH 13/14] updated snapshots --- .../__snapshots__/VerticalBarChart.test.tsx.snap | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap b/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap index f466a1ac63ace..986ba5f643abf 100644 --- a/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap +++ b/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap @@ -16,7 +16,7 @@ exports[`VerticalBarChart renders VerticalBarChart correctly 1`] = ` overflow: hidden; width: 100%; } - id="chart_1" + id="chart_2" role="presentation" >
@@ -187,7 +187,7 @@ exports[`VerticalBarChart renders VerticalBarChart correctly 1`] = ` justify-content: unset; position: relative; } - data-focuszone-id="FocusZone3" + data-focuszone-id="FocusZone4" onFocus={[Function]} onKeyDown={[Function]} onMouseDownCapture={[Function]} From 952ac8d7e540b15db065d015c55713fb28708409 Mon Sep 17 00:00:00 2001 From: Mercedes Miller Date: Wed, 7 Oct 2020 11:16:20 -0700 Subject: [PATCH 14/14] Updated snapshot --- .../__snapshots__/VerticalBarChart.test.tsx.snap | 14 +++++++------- .../LineChart/LineChart.Styled.Example.tsx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap b/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap index 986ba5f643abf..ee99e5cdd8750 100644 --- a/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap +++ b/packages/charting/src/components/VerticalBarChart/__snapshots__/VerticalBarChart.test.tsx.snap @@ -16,7 +16,7 @@ exports[`VerticalBarChart renders VerticalBarChart correctly 1`] = ` overflow: hidden; width: 100%; } - id="chart_2" + id="chart_1" role="presentation" >