Geomap: Fix fixed edge text for network layer (#72863)

Geomap: Fix fixed edge text
This commit is contained in:
Drew Slobodnjak 2023-08-04 08:21:13 -07:00 committed by GitHub
parent c344b0e427
commit 92e7829e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,7 @@ import {
Field,
PluginState,
} from '@grafana/data';
import { TextDimensionMode } from '@grafana/schema';
import { FrameVectorSource } from 'app/features/geo/utils/frameVectorSource';
import { getGeometryField, getLocationMatchers } from 'app/features/geo/utils/location';
import { GraphFrame } from 'app/plugins/panel/nodeGraph/types';
@ -159,11 +160,11 @@ export const networkLayer: MapLayerRegistryItem<NetworkConfig> = {
flowStyle.setGeometry(LS);
const fontFamily = theme.typography.fontFamily;
if (edgeDims.text) {
if (edgeDims.text || edgeStyle.config.text?.mode === TextDimensionMode.Fixed) {
const labelStyle = new Style({
zIndex: 10,
text: new Text({
text: edgeDims.text.get(edgeId),
text: edgeDims.text?.get(edgeId) ?? edgeStyle.config.text?.fixed,
font: `normal ${edgeTextConfig?.fontSize}px ${fontFamily}`,
fill: new Fill({ color: color1 ?? defaultStyleConfig.color.fixed }),
stroke: new Stroke({
@ -210,15 +211,15 @@ export const networkLayer: MapLayerRegistryItem<NetworkConfig> = {
return; // ignore empty
}
// Post updates to the legend component
if (legend) {
legendProps.next({
styleConfig: style,
size: style.dims?.size,
layerName: options.name,
layer: vectorLayer,
});
}
// Post updates to the legend component
if (legend) {
legendProps.next({
styleConfig: style,
size: style.dims?.size,
layerName: options.name,
layer: vectorLayer,
});
}
const graphFrames = getGraphFrame(data.series);
for (const frame of data.series) {