diff --git a/public/utils/helpers.tsx b/public/utils/helpers.tsx index a4f0cbdfc..b45c94660 100644 --- a/public/utils/helpers.tsx +++ b/public/utils/helpers.tsx @@ -27,6 +27,7 @@ import { expressionInterpreter as vegaExpressionInterpreter } from 'vega-interpr import { RuleInfo } from '../../server/models/interfaces'; import { NotificationsStart } from 'opensearch-dashboards/public'; import { OpenSearchService } from '../services'; +import { Handler } from 'vega-tooltip'; export const parseStringsToOptions = (strings: string[]) => { return strings.map((str) => ({ id: str, label: str })); @@ -164,11 +165,13 @@ export function renderVisualization(spec: TopLevelSpec, containerId: string) { } function renderVegaSpec(spec: {}) { + const handler = new Handler(); view = new View(parse(spec, null, { expr: vegaExpressionInterpreter }), { renderer: 'canvas', // renderer (canvas or svg) container: `#${containerId}`, // parent DOM container hover: true, // enable hover processing }); + view.tooltip(handler.call); return view.runAsync(); } }