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

introducing new feature in vertical bar chart. added line #15505

Merged
merged 4 commits into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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": "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 @@ -306,6 +306,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 @@ -344,6 +346,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 @@ -355,6 +358,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