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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Minimum height of non zero positive values set to 1% of Max barHeight",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -536,11 +536,16 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
shouldHighlight: shouldHighlight,
});
const barHeight: number = Math.max(yBarScale(point.y), 0);
if (barHeight < 1) {
let adjustedBarHeight = 0;
if (barHeight <= 0) {
return <React.Fragment key={point.x}> </React.Fragment>;
} else if (barHeight <= Math.ceil(yBarScale(this._yMax) / 100.0)) {
adjustedBarHeight = Math.ceil(yBarScale(this._yMax) / 100.0);
} else {
adjustedBarHeight = barHeight;
}
const xPoint = xBarScale(point.x as number);
const yPoint = containerHeight - this.margins.bottom! - yBarScale(point.y);
const yPoint = containerHeight - this.margins.bottom! - adjustedBarHeight;
return (
<g key={point.x}>
<rect
Expand All @@ -550,7 +555,7 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
y={yPoint}
width={this._barWidth}
data-is-focusable={!this.props.hideTooltip}
height={barHeight}
height={adjustedBarHeight}
ref={(e: SVGRectElement) => {
this._refCallback(e, point.legend!);
}}
Expand Down Expand Up @@ -596,19 +601,24 @@ export class VerticalBarChartBase extends React.Component<IVerticalBarChartProps
const colorScale = this._createColors();
const bars = this._points.map((point: IVerticalBarChartDataPoint, index: number) => {
const barHeight: number = Math.max(yBarScale(point.y), 0);
if (barHeight < 1) {
let adjustedBarHeight = 0;
if (barHeight <= 0) {
return <React.Fragment key={point.x}> </React.Fragment>;
} else if (barHeight <= Math.ceil(yBarScale(this._yMax) / 100.0)) {
adjustedBarHeight = Math.ceil(yBarScale(this._yMax) / 100.0);
} else {
adjustedBarHeight = barHeight;
}
const xPoint = xBarScale(point.x);
const yPoint = containerHeight - this.margins.bottom! - yBarScale(point.y);
const yPoint = containerHeight - this.margins.bottom! - adjustedBarHeight;
return (
<g key={point.x} transform={`translate(${0.5 * (xBarScale.bandwidth() - this._barWidth)}, 0)`}>
<rect
id={getId('_VBC_bar_')}
x={xPoint}
y={yPoint}
width={this._barWidth}
height={barHeight}
height={adjustedBarHeight}
aria-label={this._getAriaLabel(point)}
role="img"
ref={(e: SVGRectElement) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ export class VerticalStackedBarChartBase extends React.Component<
};

let barHeight = heightValueScale * point.data;
if (barHeight < barMinimumHeight) {
barHeight = barMinimumHeight;
if (barHeight < Math.max(Math.ceil(this._yMax / 100.0), barMinimumHeight)) {
barHeight = Math.max(Math.ceil(this._yMax / 100.0), barMinimumHeight);
}
yPoint = yPoint - barHeight - (index ? gapHeight : 0);
barTotalValue += point.data;
Expand All @@ -810,7 +810,7 @@ export class VerticalStackedBarChartBase extends React.Component<
/>
);
}
if (barHeight < 1) {
if (barHeight < 0) {
return <React.Fragment key={index + indexNumber}> </React.Fragment>;
}
return (
Expand Down