mirror of
https://github.com/grafana/grafana.git
synced 2025-01-24 15:27:01 -06:00
Canvas: Add datalink support to rectangle and ellipse elements (#83870)
This commit is contained in:
parent
38a0eab137
commit
5c27d28ba4
@ -127,7 +127,7 @@ The inline editing toggle lets you lock or unlock the canvas. When turned off th
|
||||
|
||||
### Data links
|
||||
|
||||
Canvases support [data links](https://grafana.com/docs/grafana/latest/panels-visualizations/configure-data-links/). You can create a data link for a metric-value element and display it for all elements that use the field name by following these steps:
|
||||
Canvases support [data links](https://grafana.com/docs/grafana/latest/panels-visualizations/configure-data-links/), but only for metric-value, text, rectangle, and ellipse elements. You can add a data link by following these steps:
|
||||
|
||||
1. Set an element to be tied to a field value.
|
||||
1. Turn off the inline editing toggle.
|
||||
|
@ -6,6 +6,7 @@ import { config } from 'app/core/config';
|
||||
import { DimensionContext } from 'app/features/dimensions/context';
|
||||
import { ColorDimensionEditor } from 'app/features/dimensions/editors/ColorDimensionEditor';
|
||||
import { TextDimensionEditor } from 'app/features/dimensions/editors/TextDimensionEditor';
|
||||
import { getDataLinks } from 'app/plugins/panel/canvas/utils';
|
||||
|
||||
import { CanvasElementItem, CanvasElementProps, defaultBgColor, defaultTextColor } from '../element';
|
||||
import { Align, VAlign, EllipseConfig, EllipseData } from '../types';
|
||||
@ -98,6 +99,8 @@ export const ellipseItem: CanvasElementItem<EllipseConfig, EllipseData> = {
|
||||
data.color = ctx.getColor(cfg.color).value();
|
||||
}
|
||||
|
||||
data.links = getDataLinks(ctx, cfg, data.text);
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
|
@ -7,6 +7,7 @@ import { config } from 'app/core/config';
|
||||
import { DimensionContext } from 'app/features/dimensions/context';
|
||||
import { ColorDimensionEditor } from 'app/features/dimensions/editors/ColorDimensionEditor';
|
||||
import { TextDimensionEditor } from 'app/features/dimensions/editors/TextDimensionEditor';
|
||||
import { getDataLinks } from 'app/plugins/panel/canvas/utils';
|
||||
|
||||
import { CanvasElementItem, CanvasElementProps, defaultBgColor, defaultTextColor } from '../element';
|
||||
import { Align, TextConfig, TextData, VAlign } from '../types';
|
||||
@ -81,6 +82,8 @@ export const rectangleItem: CanvasElementItem<TextConfig, TextData> = {
|
||||
data.color = ctx.getColor(cfg.color).value();
|
||||
}
|
||||
|
||||
data.links = getDataLinks(ctx, cfg, data.text);
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user