From 68bfa4912fe9886f31455dd1a132afb3980beba0 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:05:55 -0800 Subject: [PATCH] Chart tooltips delay fix (#348) (#359) * [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 (cherry picked from commit 29385bbb41111716a7d42826b2a9fc3e8656eec1) Co-authored-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(); } }