From 29385bbb41111716a7d42826b2a9fc3e8656eec1 Mon Sep 17 00:00:00 2001 From: Jovan Cvetkovic Date: Wed, 11 Jan 2023 21:40:21 +0100 Subject: [PATCH] Chart tooltips delay fix (#348) * [FEATURE] Detector must have at least one alert set #288 Signed-off-by: Jovan Cvetkovic * [FEATURE] Decrease chart tooltips show delay #346 Signed-off-by: Jovan Cvetkovic Signed-off-by: Jovan Cvetkovic --- public/utils/helpers.tsx | 3 +++ 1 file changed, 3 insertions(+) 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(); } }