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

fix(table chart): Show Cell Bars correctly #25625

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ messages.mo
docker/requirements-local.txt

cache/
.aider*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.aider*

6 changes: 6 additions & 0 deletions package-lock.json

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

18 changes: 9 additions & 9 deletions superset-frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
"@types/jquery": "^3.5.8",
"@types/js-levenshtein": "^1.1.0",
"@types/json-bigint": "^1.0.1",
"@types/mousetrap": "^1.6.11",
"@types/mousetrap": "^1.6.12",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good practice to have a separate PR for bumping a package unless it's related to the fix. This practice facilitates reverting only the package bump if needed.

Suggested change
"@types/mousetrap": "^1.6.12",

"@types/react": "^16.9.43",
"@types/react-dom": "^16.9.8",
"@types/react-gravatar": "^2.6.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
onContextMenu,
emitCrossFilters,
} = props;

const timestampFormatter = useCallback(
value => getTimeFormatterForGranularity(timeGrain)(value),
[timeGrain],
Expand Down Expand Up @@ -410,6 +411,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
const getColumnConfigs = useCallback(
(column: DataColumnMeta, i: number): ColumnWithLooseAccessor<D> => {
const { key, label, isNumeric, dataType, isMetric, config = {} } = column;

const columnWidth = Number.isNaN(Number(config.columnWidth))
? config.columnWidth
: Number(config.columnWidth);
Expand Down Expand Up @@ -438,7 +440,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
(config.showCellBars === undefined
? showCellBars
: config.showCellBars) &&
(isMetric || isRawRecords) &&
(isMetric || isRawRecords || key[0] === '%') &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataColumnMeta has a isPercentMetric property.

Suggested change
(isMetric || isRawRecords || key[0] === '%') &&
(isMetric || isRawRecords || isPercentMetric) &&

getValueRange(key, alignPositiveNegative);

let className = '';
Expand Down Expand Up @@ -550,6 +552,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
}
// If cellProps renders textContent already, then we don't have to
// render `Cell`. This saves some time for large tables.

return (
<StyledCell {...cellProps}>
{valueRange && (
Expand Down
Loading