feat(legacy-preset-chart-nvd3): add richtooltip in nvd3 bar chart (#17615)
* feat(legacy-preset-chart-nvd3): add richtooltip in nvd3 bar chart * add richtooltip in nvd3 bar chart
This commit is contained in:
parent
ce92fc152b
commit
72f3215ffc
|
|
@ -35,6 +35,7 @@ import {
|
||||||
yAxisLabel,
|
yAxisLabel,
|
||||||
yAxisShowMinmax,
|
yAxisShowMinmax,
|
||||||
yAxisBounds,
|
yAxisBounds,
|
||||||
|
richTooltip,
|
||||||
} from '../NVD3Controls';
|
} from '../NVD3Controls';
|
||||||
|
|
||||||
const config: ControlPanelConfig = {
|
const config: ControlPanelConfig = {
|
||||||
|
|
@ -81,6 +82,7 @@ const config: ControlPanelConfig = {
|
||||||
['color_scheme'],
|
['color_scheme'],
|
||||||
[showLegend],
|
[showLegend],
|
||||||
[showBarValue],
|
[showBarValue],
|
||||||
|
[richTooltip],
|
||||||
[barStacked],
|
[barStacked],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -673,9 +673,9 @@ function nvd3Vis(element, props) {
|
||||||
chart.color(d => d.color || colorFn(cleanColorInput(d[colorKey])));
|
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);
|
chart.useInteractiveGuideline(true);
|
||||||
if (vizType === 'line') {
|
if (vizType === 'line' || vizType === 'bar') {
|
||||||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||||
generateRichLineTooltipContent(
|
generateRichLineTooltipContent(
|
||||||
d,
|
d,
|
||||||
|
|
@ -683,6 +683,10 @@ function nvd3Vis(element, props) {
|
||||||
yAxisFormatter,
|
yAxisFormatter,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (vizType === 'dist_bar') {
|
||||||
|
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||||
|
generateCompareTooltipContent(d, yAxisFormatter),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
// area chart
|
// area chart
|
||||||
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
chart.interactiveLayer.tooltip.contentGenerator(d =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue