Skip to content

Commit dd9d4d7

Browse files
Fix and Chips (#406)
* v1 * Fix and chips --------- Co-authored-by: Niels de Jong <[email protected]>
1 parent eff321e commit dd9d4d7

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/card/view/CardView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react';
22
import { ReportItemContainer } from '../CardStyle';
33
import NeoCardViewHeader from './CardViewHeader';
44
import NeoCardViewFooter from './CardViewFooter';
5-
import NeoReport from '../../report/Report';
65
import { CardContent, IconButton } from '@material-ui/core';
76
import NeoCodeEditorComponent from '../../component/editor/CodeEditorComponent';
87
import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled';

src/card/view/CardViewFooter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ const NeoCardViewFooter = ({
3737
if (selectableFields[selectable].type == SELECTION_TYPES.NODE_PROPERTIES) {
3838
// Only show optional selections if we explicitly allow it.
3939
if (showOptionalSelections || selectionIsMandatory) {
40+
const totalColors = categoricalColorSchemes[nodeColorScheme]
41+
? categoricalColorSchemes[nodeColorScheme].length
42+
: 0;
4043
const fieldSelections = fields.map((field, i) => {
4144
// TODO logically, it should be the last element in the field (node labels) array, as that is typically
4245
// the most specific node label when we have multi-labels
@@ -49,9 +52,6 @@ const NeoCardViewFooter = ({
4952
'(id)',
5053
'(no label)',
5154
]);
52-
const totalColors = categoricalColorSchemes[nodeColorScheme]
53-
? categoricalColorSchemes[nodeColorScheme].length
54-
: 0;
5555
const color =
5656
totalColors > 0 && !ignoreLabelColors
5757
? categoricalColorSchemes[nodeColorScheme][i % totalColors]

src/chart/graph/GraphChart.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const NeoGraphChart = (props: ChartProps) => {
9898
nodeLabels,
9999
linkTypes,
100100
colorScheme,
101+
props.fields,
101102
settings.nodeColorProp,
102103
settings.defaultNodeColor,
103104
settings.nodeSizeProp,

src/chart/graph/util/RecordUtils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export function buildGraphVisualizationObjectFromRecords(
129129
nodeLabels: Record<string, any>,
130130
linkTypes: Record<string, any>,
131131
colorScheme: any,
132+
fields: any,
132133
nodeColorProperty: any,
133134
defaultNodeColor: any,
134135
nodeSizeProperty: any,
@@ -172,7 +173,7 @@ export function buildGraphVisualizationObjectFromRecords(
172173

173174
// Assign proper colors to nodes.
174175
const totalColors = colorScheme ? colorScheme.length : 0;
175-
const nodeLabelsList = Object.keys(nodeLabels);
176+
const nodeLabelsList = fields.map((e) => e[0]);
176177
const nodesList = Object.values(nodes).map((node) => {
177178
// First try to assign a node a color if it has a property specifying the color.
178179
let assignedColor = node.properties[nodeColorProperty]
@@ -222,6 +223,7 @@ export function injectNewRecordsIntoGraphVisualization(
222223
props.data.nodeLabels,
223224
props.data.linkTypes,
224225
props.style.colorScheme,
226+
props.engine.fields,
225227
props.style.nodeColorProp,
226228
props.style.defaultNodeColor,
227229
props.style.nodeSizeProp,

0 commit comments

Comments
 (0)