Skip to content

Commit

Permalink
introducing new feature in vertical bar chart. added line (#15505)
Browse files Browse the repository at this point in the history
* introducing the new feature in vertical bar chart

* put check box true

* Change files

* added prop usesingle color, which makes sure that all the bars are of same color

Co-authored-by: v-sivsar <v-sivsar@microsoft.com>
  • Loading branch information
shivasai09 and v-sivsar authored Oct 22, 2020
1 parent b7f8877 commit 0239b7d
Show file tree
Hide file tree
Showing 11 changed files with 440 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "added some example code for new feature",
"packageName": "@fluentui/react-examples",
"email": "v-sivsar@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-10-14T07:05:26.323Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "added line to the vertical bar chart",
"packageName": "@uifabric/charting",
"email": "v-sivsar@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-10-14T07:04:59.025Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ export interface IYValueHover {
y?: number;
color?: string;
data?: string | number;
yAxisCalloutData?: string | { [id: string]: number };
}

export interface IChildProps {
Expand Down
4 changes: 4 additions & 0 deletions packages/charting/src/components/Legends/Legends.base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface ILegendItem extends React.ButtonHTMLAttributes<HTMLButtonElement> {
key: number;
opacity?: number;
stripePattern?: boolean;
isLineLegendInBarChart?: boolean;
}

export interface ILegendState {
Expand Down Expand Up @@ -105,6 +106,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
color: legend.color,
shape: legend.shape,
stripePattern: legend.stripePattern,
isLineLegendInBarChart: legend.isLineLegendInBarChart,
opacity: legend.opacity,
key: index,
};
Expand Down Expand Up @@ -343,6 +345,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
hoverAction: data.hoverAction,
onMouseOutAction: data.onMouseOutAction,
stripePattern: data.stripePattern,
isLineLegendInBarChart: data.isLineLegendInBarChart,
opacity: data.opacity,
};
const color = this._getColor(legend.title, legend.color);
Expand All @@ -354,6 +357,7 @@ export class LegendsBase extends React.Component<ILegendsProps, ILegendState> {
borderColor: legend.color,
overflow: overflow,
stripePattern: legend.stripePattern,
isLineLegendInBarChart: legend.isLineLegendInBarChart,
opacity: legend.opacity,
});
const onClickHandler = () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/charting/src/components/Legends/Legends.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from 'office-ui-fabric-react/lib/Styling';

export const getStyles = (props: ILegendStyleProps): ILegendsStyles => {
const { className, theme } = props;
const { className, theme, isLineLegendInBarChart = false } = props;
const { palette, fonts } = theme!;
const options: IGetFocusStylesOptions = {
inset: undefined,
Expand Down Expand Up @@ -47,7 +47,7 @@ export const getStyles = (props: ILegendStyleProps): ILegendsStyles => {
},
},
width: '12px',
height: '12px',
height: isLineLegendInBarChart ? '4px' : '12px',
backgroundColor: props.stripePattern ? '' : props.colorOnSelectedState,
marginRight: '8px',
border: '1px solid',
Expand Down
5 changes: 5 additions & 0 deletions packages/charting/src/components/Legends/Legends.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export interface ILegend {
*/
stripePattern?: boolean;

/**
* Indicates if the legend belongs to a line in the Bar Chart
*/
isLineLegendInBarChart?: boolean;
/*
* native button props for the legend button
*/
Expand All @@ -117,6 +121,7 @@ export interface ILegendStyleProps {
opacity?: number;
overflow?: boolean;
stripePattern?: boolean;
isLineLegendInBarChart?: boolean;
}

export interface ILegendsProps {
Expand Down
Loading

0 comments on commit 0239b7d

Please sign in to comment.