Skip to content

Commit

Permalink
do not update cell background if is label cell
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Mar 16, 2020
1 parent 6a64865 commit c89304a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface ColumnData {
error_count?: number;
}

export const ACTUAL_CLASS_ID = 'actual_class';

export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {
const colData: Partial<ColumnData[]> = [];

Expand Down Expand Up @@ -67,7 +69,7 @@ export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {

const columns: any = [
{
id: 'actual_class',
id: ACTUAL_CLASS_ID,
display: <span />,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
ANALYSIS_CONFIG_TYPE,
} from '../../../../common/analytics';
import { LoadingPanel } from '../loading_panel';
import { getColumnData } from './column_data';
import { getColumnData, ACTUAL_CLASS_ID } from './column_data';

const defaultPanelWidth = 500;

Expand Down Expand Up @@ -205,11 +205,13 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const cellValue = columnsData[rowIndex][columnId];
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
if (columnId !== ACTUAL_CLASS_ID) {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
}
}, [rowIndex, columnId, setCellProps]);
return (
<span>{typeof cellValue === 'number' ? `${Math.round(cellValue * 100)}%` : cellValue}</span>
Expand Down

0 comments on commit c89304a

Please sign in to comment.