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

Color Fill Bars Feature for Line Chart Component #14597

Merged
merged 25 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d1ebfc1
Added overlays and updated legend
mergmiller Aug 17, 2020
47443b1
Updated variable names
mergmiller Aug 17, 2020
559a523
Updated overlay name to color fill bars
mergmiller Aug 18, 2020
aa4f51c
Change files
mergmiller Aug 18, 2020
0dc796b
Merge branch 'master' into ColorFillBarFeature
mergmiller Aug 18, 2020
8564d2e
Merge branch 'master' of https://github.com/microsoft/fluentui into C…
mergmiller Aug 24, 2020
833f16b
Merge branch 'master' of https://github.com/microsoft/fluentui into C…
mergmiller Aug 26, 2020
7b06a4b
Removed eslint comment
mergmiller Aug 31, 2020
77bb0f6
Merge branch 'master' into ColorFillBarFeature
mergmiller Aug 31, 2020
49934fc
Updated snapshot
mergmiller Sep 1, 2020
b1a94f9
Merge branch 'master' of https://github.com/microsoft/fluentui into C…
mergmiller Sep 1, 2020
d713bef
Merge branch
mergmiller Sep 1, 2020
4df5299
Change files
mergmiller Sep 2, 2020
56b38ff
Merge branch 'master' of https://github.com/microsoft/fluentui into C…
mergmiller Sep 8, 2020
8553b9a
Implemented multiple legend selections
mergmiller Sep 10, 2020
5156835
Removed IStyle
mergmiller Sep 10, 2020
fa2ccc2
Updated examples
mergmiller Sep 15, 2020
d1921dd
Merge branch 'master' of https://github.com/microsoft/fluentui into C…
mergmiller Sep 24, 2020
39dbaf3
Merge branch
mergmiller Oct 1, 2020
e5816cf
Updated import
mergmiller Oct 1, 2020
8c3de7c
Merge branch '7.0' into ColorFillBarFeature
mergmiller Oct 5, 2020
34363f4
Change files
mergmiller Oct 5, 2020
cf36277
updated snapshots
mergmiller Oct 5, 2020
566f9d4
Merge branch '7.0' of https://github.com/microsoft/fluentui into Colo…
mergmiller Oct 7, 2020
952ac8d
Updated snapshot
mergmiller Oct 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Removed whitespace",
"packageName": "@fluentui/react-next",
"email": "[email protected]",
"dependentChangeType": "none",
"date": "2020-09-02T23:50:17.310Z"
}
8 changes: 8 additions & 0 deletions change/@uifabric-charting-2020-08-18-13-59-25-master.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "Added color fill bar feature to line chart component",
"packageName": "@uifabric/charting",
"email": "email not defined",
"dependentChangeType": "patch",
"date": "2020-08-18T20:59:25.017Z"
}
12 changes: 11 additions & 1 deletion packages/charting/src/components/Legends/Legends.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ interface ILegendItem extends React.ButtonHTMLAttributes<HTMLButtonElement> {
color: string;
shape?: LegendShape;
key: number;
opacity?: number;
stripePattern?: boolean;
}

export interface ILegendState {
Expand Down Expand Up @@ -102,6 +104,8 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
onMouseOutAction: legend.onMouseOutAction!,
color: legend.color,
shape: legend.shape,
stripePattern: legend.stripePattern,
opacity: legend.opacity,
key: index,
};
});
Expand Down Expand Up @@ -297,6 +301,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
>
<div
className={classNames.overflowIndicationTextStyle}
// eslint-disable-next-line react/jsx-no-bind
ref={(rootElem: HTMLDivElement) => (this._hoverCardRef = rootElem)}
{...(allowFocusOnLegends && {
'aria-expanded': this.state.isHoverCardVisible,
Expand Down Expand Up @@ -341,6 +346,8 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
action: data.action,
hoverAction: data.hoverAction,
onMouseOutAction: data.onMouseOutAction,
stripePattern: data.stripePattern,
opacity: data.opacity,
};
const color = this._getColor(legend.title, legend.color);
const { theme, className, styles } = this.props;
Expand All @@ -350,8 +357,9 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
colorOnSelectedState: color,
borderColor: legend.color,
overflow: overflow,
stripePattern: legend.stripePattern,
opacity: legend.opacity,
});

const onClickHandler = () => {
this._onClick(legend);
};
Expand All @@ -373,12 +381,14 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
{...(data.nativeButtonProps && { ...data.nativeButtonProps })}
key={index}
className={classNames.legend}
/* eslint-disable react/jsx-no-bind */
onClick={onClickHandler}
onMouseOver={onHoverHandler}
onMouseOut={onMouseOut}
onFocus={onHoverHandler}
onBlur={onMouseOut}
data-is-focusable={allowFocusOnLegends}
/* eslint-enable react/jsx-no-bind */
>
<div className={this._getShapeClass(classNames, legend)} />
<div className={classNames.text}>{legend.title}</div>
Expand Down
9 changes: 7 additions & 2 deletions packages/charting/src/components/Legends/Legends.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ export const getStyles = (props: ILegendStyleProps): ILegendsStyles => {
},
width: '12px',
height: '12px',
backgroundColor: props.colorOnSelectedState,
backgroundColor: props.stripePattern ? '' : props.colorOnSelectedState,
marginRight: '8px',
border: '1px solid',
borderColor: props.borderColor ? props.borderColor : theme?.semanticColors.buttonBorder,
opacity: props.colorOnSelectedState === palette.white ? '0.6' : '',
opacity: props.colorOnSelectedState === palette.white ? '0.6' : props.opacity ? props.opacity : '',
backgroundImage: props.stripePattern
? // eslint-disable-next-line @fluentui/max-len
`repeating-linear-gradient(135deg, transparent, transparent 3px, ${props.colorOnSelectedState} 1px, ${props.colorOnSelectedState} 4px)`
: '',
},
triangle: {
width: '0',
Expand All @@ -62,6 +66,7 @@ export const getStyles = (props: ILegendStyleProps): ILegendsStyles => {
borderTop: '10.4px solid',
borderTopColor: props.colorOnSelectedState,
marginRight: '8px',
opacity: props.colorOnSelectedState === palette.white ? '0.6' : props.opacity ? props.opacity : '',
selectors: {
[HighContrastSelector]: {
border: '0px',
Expand Down
12 changes: 12 additions & 0 deletions packages/charting/src/components/Legends/Legends.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,22 @@ export interface ILegend {
*/
color: string;

/**
* The opacity of the legend color
*/
opacity?: number;

/**
* The shape for the legend
*/
shape?: LegendShape;

/**
* Indicated whether of not to apply stripe pattern
*/
stripePattern?: boolean;

/*
* native button props for the legend button
*/
nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
Expand All @@ -99,7 +109,9 @@ export interface ILegendStyleProps {
className?: string;
colorOnSelectedState?: string;
borderColor?: string;
opacity?: number;
overflow?: boolean;
stripePattern?: boolean;
}

export interface ILegendsProps {
Expand Down
Loading