kibana/x-pack/plugins/lens/public/metric_visualization/index.ts
Brandon Kobel 4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00

37 lines
1.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CoreSetup } from 'kibana/public';
import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public';
import { EditorFrameSetup, FormatFactory } from '../types';
export interface MetricVisualizationPluginSetupPlugins {
expressions: ExpressionsSetup;
formatFactory: Promise<FormatFactory>;
editorFrame: EditorFrameSetup;
}
export class MetricVisualization {
constructor() {}
setup(
_core: CoreSetup | null,
{ expressions, formatFactory, editorFrame }: MetricVisualizationPluginSetupPlugins
) {
editorFrame.registerVisualization(async () => {
const { metricVisualization, metricChart, getMetricChartRenderer } = await import(
'../async_services'
);
expressions.registerFunction(() => metricChart);
expressions.registerRenderer(() => getMetricChartRenderer(formatFactory));
return metricVisualization;
});
}
}