Skip to content

Commit

Permalink
fix: nvd3 tooltip bolding/non-linebreak on ONLY header row (#291)
Browse files Browse the repository at this point in the history
* fix: adds class to header row, now used in css

* fix: legend-header is now tooltip-header

* style: prettier
  • Loading branch information
rusackas authored and zhaoyongjie committed Nov 26, 2021
1 parent 6e731be commit 7a9d72f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@
}
},
"babel": {
"plugins": [["@babel/plugin-transform-runtime", { "corejs": 3 }]]
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 3
}
]
]
},
"jest": {
"timers": "real",
Expand Down Expand Up @@ -153,7 +160,12 @@
"rules": {
"react/jsx-no-literals": "off",
"prefer-exponentiation-operator": "off",
"@typescript-eslint/no-explicit-any": ["warn", { "fixToUnknown": false }]
"@typescript-eslint/no-explicit-any": [
"warn",
{
"fixToUnknown": false
}
]
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@
}

/* START tooltip styles - these prevent long column names from overflowing the tooltip */
.nvtooltip tbody tr:first-child td {
.nvtooltip .tooltip-header {
white-space: nowrap;
font-weight: bold;
}
.nvtooltip tbody tr:not(:first-child) td:nth-child(2) {
.nvtooltip tbody tr:not(.tooltip-header) td:nth-child(2) {
word-break: break-word;
}
/* END tooltip styles */
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export function generateAreaChartTooltipContent(d, timeFormatter, valueFormatter
"<table><thead><tr><td colspan='4'>" +
`<strong class='x-value'>${timeFormatter(d.value)}</strong>` +
'</td></tr></thead><tbody>' +
'<tr><td></td><td>Category</td><td>Value</td><td>% to total</td></tr>';
'<tr class="tooltip-header"><td></td><td>Category</td><td>Value</td><td>% to total</td></tr>';
d.series.forEach(series => {
const key = getFormattedKey(series.key, true);
let trClass = '';
Expand Down

0 comments on commit 7a9d72f

Please sign in to comment.