Skip to content
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
8 changes: 1 addition & 7 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
"label": "Typescript (oufr) watch",
"type": "process",
"command": "node",
"args": [
"./scripts/node_modules/typescript/bin/tsc",
"-p",
"packages/office-ui-fabric-react/tsconfig.json",
"-w",
"--noEmit"
],
"args": ["./scripts/node_modules/typescript/bin/tsc", "-p", "packages/office-ui-fabric-react/tsconfig.json", "-w", "--noEmit"],
"problemMatcher": "$tsc",
"group": {
"kind": "build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
],
"packageName": "@uifabric/utilities",
"email": "benw@microsoft.com"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment":
"Fixed FocusTrapZone bug: If first child in the FTZ is a FocusZone and that FZ's last focused child is not the first focusable child, shift-tab would break out of the FTZ.",
"comment": "Fixed FocusTrapZone bug: If first child in the FTZ is a FocusZone and that FZ's last focused child is not the first focusable child, shift-tab would break out of the FTZ.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "benw@microsoft.com"
}
}
36 changes: 18 additions & 18 deletions common/config/rush/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"definitionName": "individualVersion",
"lockedMajor": 6
}
]
]
2 changes: 1 addition & 1 deletion packages/charting/src/Utilities.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'office-ui-fabric-react/lib/Utilities';
export * from 'office-ui-fabric-react/lib/Utilities';
2 changes: 1 addition & 1 deletion packages/charting/src/common/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ global.requestAnimationFrame = (callback: () => void) => {
};

// Configure enzyme.
configure({ adapter: new Adapter() });
configure({ adapter: new Adapter() });
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import { axisLeft as d3AxisLeft, axisBottom as d3AxisBottom, Axis as D3Axis } fr
import { scaleBand as d3ScaleBand, scaleLinear as d3ScaleLinear, ScaleLinear as D3ScaleLinear } from 'd3-scale';
import { select as d3Select } from 'd3-selection';
import { classNamesFunction, customizable, IClassNames } from '../../Utilities';
import {
IVerticalBarChartProps,
IVerticalBarChartStyleProps,
IVerticalBarChartStyles,
IDataPoint
} from './VerticalBarChart.types';
import { IVerticalBarChartProps, IVerticalBarChartStyleProps, IVerticalBarChartStyles, IDataPoint } from './VerticalBarChart.types';

const getClassNames = classNamesFunction<IVerticalBarChartStyleProps, IVerticalBarChartStyles>();
type numericAxis = D3Axis<number | { valueOf(): number }>;
Expand Down Expand Up @@ -56,12 +51,14 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
});

return (
<div className={this._classNames.root}>
{this.props.chartLabel && <p className={this._classNames.chartLabel}>{this.props.chartLabel}</p>}
<svg className={this._classNames.chart}>
<g ref={(node: SVGGElement | null) => this._setXAxis(node, xAxis)} className={this._classNames.xAxis} />
<g ref={(node: SVGGElement | null) => this._setYAxis(node, yAxis)} className={this._classNames.yAxis} />
<g className={this._classNames.bars}>{bars}</g>
<div className={ this._classNames.root }>
{ this.props.chartLabel && <p className={ this._classNames.chartLabel }>{ this.props.chartLabel }</p> }
<svg className={ this._classNames.chart }>
<g ref={ (node: SVGGElement | null) => this._setXAxis(node, xAxis) } className={ this._classNames.xAxis } />
<g ref={ (node: SVGGElement | null) => this._setYAxis(node, yAxis) } className={ this._classNames.yAxis } />
<g className={ this._classNames.bars }>
{ bars }
</g>
</svg>
</div>
);
Expand All @@ -88,53 +85,43 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
}

private _createNumericXAxis(): numericAxis {
const xMax = d3Max(this._points, (point: IDataPoint) => point.x as number)!;
const xAxisScale = d3ScaleLinear()
.domain([0, xMax])
.range([0, this._width]);
const xMax = (d3Max(this._points, (point: IDataPoint) => point.x as number))!;
const xAxisScale = d3ScaleLinear().domain([0, xMax]).range([0, this._width]);
const xAxis = d3AxisBottom(xAxisScale).ticks(10);
return xAxis;
}

private _createStringXAxis(): stringAxis {
const xAxisScale = d3ScaleBand()
.domain(this._points.map((point: IDataPoint) => point.x as string))
.range([0, this._width]);
const xAxisScale = d3ScaleBand().domain(this._points.map((point: IDataPoint) => point.x as string)).range([0, this._width]);
const xAxis = d3AxisBottom(xAxisScale).tickFormat((x: string, index: number) => this._points[index].x as string);
return xAxis;
}

private _createYAxis(): numericAxis {
const yMax = d3Max(this._points, (point: IDataPoint) => point.y)!;
const yAxisScale = d3ScaleLinear()
.domain([0, yMax])
.range([this._height, 0]);
const yMax = (d3Max(this._points, (point: IDataPoint) => point.y))!;
const yAxisScale = d3ScaleLinear().domain([0, yMax]).range([this._height, 0]);
const yAxis = d3AxisLeft(yAxisScale).ticks(this._yAxisTickCount);
return yAxis;
}

private _createNumericBars(): JSX.Element[] {
const xMax = d3Max(this._points, (point: IDataPoint) => point.x as number)!;
const yMax = d3Max(this._points, (point: IDataPoint) => point.y)!;
const xMax = (d3Max(this._points, (point: IDataPoint) => point.x as number))!;
const yMax = (d3Max(this._points, (point: IDataPoint) => point.y))!;

const xBarScale = d3ScaleLinear()
.domain([0, xMax])
.range([0, this._width - this._barWidth]);
const yBarScale = d3ScaleLinear()
.domain([0, yMax])
.range([0, this._height]);
const xBarScale = d3ScaleLinear().domain([0, xMax]).range([0, this._width - this._barWidth]);
const yBarScale = d3ScaleLinear().domain([0, yMax]).range([0, this._height]);

const colorScale = this._createColors(yMax);

const bars = this._points.map((point: IDataPoint, index: number) => {
return (
<rect
key={point.x}
x={xBarScale(point.x as number)}
y={this._height - yBarScale(point.y)}
width={this._barWidth}
height={yBarScale(point.y)}
fill={colorScale(point.y)}
key={ point.x }
x={ xBarScale(point.x as number) }
y={ this._height - yBarScale(point.y) }
width={ this._barWidth }
height={ yBarScale(point.y) }
fill={ colorScale(point.y) }
/>
);
});
Expand All @@ -143,27 +130,25 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
}

private _createStringBars(): JSX.Element[] {
const yMax = d3Max(this._points, (point: IDataPoint) => point.y)!;
const yMax = (d3Max(this._points, (point: IDataPoint) => point.y))!;

const endpointDistance = 0.5 * (this._width / this._points.length);
const xBarScale = d3ScaleLinear()
.domain([0, this._points.length - 1])
.range([endpointDistance - 0.5 * this._barWidth, this._width - endpointDistance - 0.5 * this._barWidth]);
const yBarScale = d3ScaleLinear()
.domain([0, yMax])
.range([0, this._height]);
const yBarScale = d3ScaleLinear().domain([0, yMax]).range([0, this._height]);

const colorScale = this._createColors(yMax);

const bars = this._points.map((point: IDataPoint, index: number) => {
return (
<rect
key={point.x}
x={xBarScale(index)}
y={this._height - yBarScale(point.y)}
width={this._barWidth}
height={yBarScale(point.y)}
fill={colorScale(point.y)}
key={ point.x }
x={ xBarScale(index) }
y={ this._height - yBarScale(point.y) }
width={ this._barWidth }
height={ yBarScale(point.y) }
fill={ colorScale(point.y) }
/>
);
});
Expand All @@ -177,9 +162,7 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
for (let i = 0; i < this._colors.length; i++) {
domainValues.push(increment * i * yMax);
}
const colorScale = d3ScaleLinear<string>()
.domain(domainValues)
.range(this._colors);
const colorScale = d3ScaleLinear<string>().domain(domainValues).range(this._colors);
return colorScale;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getStyles = (props: IVerticalBarChartStyleProps): IVerticalBarChart
const xOffset = 30;
const yOffset = 20;

return {
return ({
root: [
'ms-VerticalBarChart',
className,
Expand All @@ -32,10 +32,11 @@ export const getStyles = (props: IVerticalBarChartStyleProps): IVerticalBarChart
],
xAxis: [
{
transform: `translate(${xOffset}px, ${height}px)`
transform: `translate(${xOffset}px, ${height}px)`,
}
],
xAxisTicks: [],
xAxisTicks: [
],
yAxis: [
{
transform: `translate(${yOffset}px, 0px)`
Expand All @@ -56,5 +57,5 @@ export const getStyles = (props: IVerticalBarChartStyleProps): IVerticalBarChart
transform: `translate(${xOffset}px, 0px)`
}
]
};
};
});
};
Loading