diff --git a/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx b/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx index 4d4edb6c5f0549..8a7d4d79b8bb31 100644 --- a/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx +++ b/packages/charts/react-charting/src/components/DeclarativeChart/DeclarativeChart.tsx @@ -244,14 +244,7 @@ export const DeclarativeChart: React.FunctionComponent = /> ); case 'heatmap': - return ( - - ); + return ; case 'sankey': return ( { - this.props.sortOrder !== 'none' - ? yPoints[item] - .sort((a: IHeatMapChartDataPoint, b: IHeatMapChartDataPoint) => { - if (this._xAxisType === XAxisTypes.StringAxis) { - return this.props.sortOrder === 'none' - ? 0 - : (a.x as string).toLowerCase() > (b.x as string).toLowerCase() - ? 1 - : -1; - } else if (this._xAxisType === XAxisTypes.DateAxis) { - return (a.x as Date).getTime() - (b.x as Date).getTime(); - } else if (this._xAxisType === XAxisTypes.NumericAxis) { - return +(a.x as string) > +(b.x as string) ? 1 : -1; - } else { - return a.x > b.x ? 1 : -1; - } - }) - .forEach((datapoint: IHeatMapChartDataPoint) => { - if (this._xAxisType === XAxisTypes.DateAxis) { - datapoint.x = this._getStringFormattedDate(datapoint.x as string, xAxisDateFormatString); - } - if (this._xAxisType === XAxisTypes.NumericAxis) { - datapoint.x = this._getStringFormattedNumber(datapoint.x as string, xAxisNumberFormatString); - } - if (this._yAxisType === YAxisType.DateAxis) { - datapoint.y = this._getStringFormattedDate(datapoint.y as string, yAxisDateFormatString); - } - if (this._yAxisType === YAxisType.NumericAxis) { - datapoint.y = this._getStringFormattedNumber(datapoint.y as string, yAxisNumberFormatString); - } - if (this._yAxisType === YAxisType.StringAxis) { - datapoint.y = this._getFormattedLabelForYAxisDataPoint(datapoint.y as string); - } - }) - : yPoints[item].forEach((datapoint: IHeatMapChartDataPoint) => { - if (this._xAxisType === XAxisTypes.StringAxis) { - datapoint.x = this._getFormattedLabelForXAxisDataPoint(datapoint.x as string); - } - }); + yPoints[item] + .sort((a: IHeatMapChartDataPoint, b: IHeatMapChartDataPoint) => { + if (this._xAxisType === XAxisTypes.StringAxis) { + return this.props.sortOrder === 'none' + ? 0 + : (a.x as string).toLowerCase() > (b.x as string).toLowerCase() + ? 1 + : -1; + } else if (this._xAxisType === XAxisTypes.DateAxis) { + return (a.x as Date).getTime() - (b.x as Date).getTime(); + } else if (this._xAxisType === XAxisTypes.NumericAxis) { + return +(a.x as string) > +(b.x as string) ? 1 : -1; + } else { + return a.x > b.x ? 1 : -1; + } + }) + .forEach((datapoint: IHeatMapChartDataPoint) => { + if (this._xAxisType === XAxisTypes.DateAxis) { + datapoint.x = this._getStringFormattedDate(datapoint.x as string, xAxisDateFormatString); + } + if (this._xAxisType === XAxisTypes.NumericAxis) { + datapoint.x = this._getStringFormattedNumber(datapoint.x as string, xAxisNumberFormatString); + } + if (this._xAxisType === XAxisTypes.StringAxis) { + datapoint.x = this._getFormattedLabelForXAxisDataPoint(datapoint.x as string); + } + if (this._yAxisType === YAxisType.DateAxis) { + datapoint.y = this._getStringFormattedDate(datapoint.y as string, yAxisDateFormatString); + } + if (this._yAxisType === YAxisType.NumericAxis) { + datapoint.y = this._getStringFormattedNumber(datapoint.y as string, yAxisNumberFormatString); + } + if (this._yAxisType === YAxisType.StringAxis) { + datapoint.y = this._getFormattedLabelForYAxisDataPoint(datapoint.y as string); + } + }); }); /** * if y-axis data points are of type date or number or if we have string formatter, diff --git a/packages/charts/react-charting/src/components/HeatMapChart/HeatMapChart.types.ts b/packages/charts/react-charting/src/components/HeatMapChart/HeatMapChart.types.ts index 39c34f7cd6ed4d..2dcc3dbee94fd5 100644 --- a/packages/charts/react-charting/src/components/HeatMapChart/HeatMapChart.types.ts +++ b/packages/charts/react-charting/src/components/HeatMapChart/HeatMapChart.types.ts @@ -115,8 +115,8 @@ export interface IHeatMapChartProps extends Pick + + 25 + + + 100 + + + 75 + + + 50 +