Skip to content

Commit

Permalink
feat(legacy-preset-chart-nvd3): add richtooltip in nvd3 bar chart (#1…
Browse files Browse the repository at this point in the history
…7615)

* feat(legacy-preset-chart-nvd3): add richtooltip in nvd3 bar chart

* add richtooltip in nvd3 bar chart
  • Loading branch information
stephenLYZ committed Dec 2, 2021
1 parent ce92fc1 commit 72f3215
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
yAxisLabel,
yAxisShowMinmax,
yAxisBounds,
richTooltip,
} from '../NVD3Controls';

const config: ControlPanelConfig = {
Expand Down Expand Up @@ -81,6 +82,7 @@ const config: ControlPanelConfig = {
['color_scheme'],
[showLegend],
[showBarValue],
[richTooltip],
[barStacked],
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -673,16 +673,20 @@ function nvd3Vis(element, props) {
chart.color(d => d.color || colorFn(cleanColorInput(d[colorKey])));
}

if (isVizTypes(['line', 'area']) && useRichTooltip) {
if (isVizTypes(['line', 'area', 'bar', 'dist_bar']) && useRichTooltip) {
chart.useInteractiveGuideline(true);
if (vizType === 'line') {
if (vizType === 'line' || vizType === 'bar') {
chart.interactiveLayer.tooltip.contentGenerator(d =>
generateRichLineTooltipContent(
d,
smartDateVerboseFormatter,
yAxisFormatter,
),
);
} else if (vizType === 'dist_bar') {
chart.interactiveLayer.tooltip.contentGenerator(d =>
generateCompareTooltipContent(d, yAxisFormatter),
);
} else {
// area chart
chart.interactiveLayer.tooltip.contentGenerator(d =>
Expand Down

0 comments on commit 72f3215

Please sign in to comment.