Skip to content

Commit 799ced9

Browse files
feat: Color Map pass the colorMapping object to giraffe (#3473)
1 parent 0787086 commit 799ced9

File tree

4 files changed

+577
-1
lines changed

4 files changed

+577
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"cy": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress open",
5353
"cy:dev": "source ../monitor-ci/.env && CYPRESS_dexUrl=CLOUD CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{cloud,shared}/**/*.*'",
5454
"cy:dev-oss": "source ../monitor-ci/.env && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{oss,shared}/**/*.*'",
55-
"generate": "export SHA=2da36d4beb7fc22dd8d037c3398c91c7ca2c346d && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
55+
"generate": "export SHA=1e7c6a915dd5ab74b3e72c86e0776fbf66f3d2c1 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5656
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5757
"generate-meta": "if [ -z \"${CLOUD_URL}\" ]; then yarn generate-meta-oss; else yarn generate-meta-cloud; fi",
5858
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn cloudPriv",

src/visualization/types/Graph/view.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
createGroupIDColumn,
1111
getDomainDataFromLines,
1212
lineTransform,
13+
LineLayerConfig,
1314
} from '@influxdata/giraffe'
1415

1516
// Components
@@ -50,6 +51,8 @@ import {
5051

5152
// Annotations
5253
import {addAnnotationLayer} from 'src/visualization/utils/annotationUtils'
54+
import {getColorMappingObjects} from 'src/visualization/utils/colorMappingUtils'
55+
import {isFlagEnabled} from '../../../shared/utils/featureFlag'
5356

5457
interface Props extends VisualizationProps {
5558
properties: XYViewProperties
@@ -179,6 +182,17 @@ const XYPlot: FC<Props> = ({
179182
return <EmptyGraphMessage message={INVALID_DATA_COPY} />
180183
}
181184

185+
let colorMapping = null
186+
187+
if (isFlagEnabled('graphColorMapping')) {
188+
const [, fillColumnMap] = createGroupIDColumn(result.table, groupKey)
189+
const {colorMappingForGiraffe} = getColorMappingObjects(
190+
fillColumnMap,
191+
properties
192+
)
193+
colorMapping = colorMappingForGiraffe
194+
}
195+
182196
const config: Config = {
183197
...currentTheme,
184198
table: result.table,
@@ -217,6 +231,14 @@ const XYPlot: FC<Props> = ({
217231
],
218232
}
219233

234+
if (isFlagEnabled('graphColorMapping')) {
235+
const layer = {...(config.layers[0] as LineLayerConfig)}
236+
237+
layer.colorMapping = colorMapping
238+
239+
config.layers[0] = layer
240+
}
241+
220242
addAnnotationLayer(
221243
config,
222244
inAnnotationMode,

0 commit comments

Comments
 (0)