Skip to content

Commit e12e49c

Browse files
committed
First step nivo theme
1 parent 83bc940 commit e12e49c

File tree

10 files changed

+26
-1
lines changed

10 files changed

+26
-1
lines changed

src/chart/Utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { QueryResult, Record as Neo4jRecord } from 'neo4j-driver';
2-
2+
import { tokens } from '@neo4j-ndl/base';
33
export function recordToNative(input: any): any {
44
if (!input && input !== false) {
55
return null;
@@ -116,3 +116,10 @@ export enum EntityType {
116116
Node,
117117
Relationship,
118118
}
119+
120+
export const themeNivo = {
121+
text: { fill: 'inherit' },
122+
axis: {
123+
ticks: { text: { fill: 'rgb(var(--palette-neutral-text-weak))' } },
124+
},
125+
};

src/chart/bar/BarChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { extensionEnabled } from '../../extensions/ExtensionUtils';
66
import { evaluateRulesOnDict, useStyleRules } from '../../extensions/styling/StyleRuleEvaluator';
77
import { ChartProps } from '../Chart';
88
import { convertRecordObjectToString, recordToNative } from '../ChartUtils';
9+
import { themeNivo } from '../Utils';
910

1011
/**
1112
* Embeds a BarReport (from Nivo) into NeoDash.
@@ -210,6 +211,7 @@ const NeoBarChart = (props: ChartProps) => {
210211
const BarChartComponent = data.length > 30 ? ResponsiveBarCanvas : ResponsiveBar;
211212
const chart = (
212213
<BarChartComponent
214+
theme={themeNivo}
213215
data={data}
214216
key={`${selection.index}___${selection.value}`}
215217
layout={layout}

src/chart/line/LineChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
toNumber,
1212
} from '../ChartUtils';
1313
import { extensionEnabled } from '../../extensions/ExtensionUtils';
14+
import { themeNivo } from '../Utils';
1415

1516
interface LineChartData {
1617
id: string;
@@ -192,6 +193,7 @@ const NeoLineChart = (props: ChartProps) => {
192193
const lineViz = (
193194
<div className='n-h-full n-w-full overflow-hidden'>
194195
<ResponsiveLine
196+
theme={themeNivo}
195197
data={data}
196198
xScale={
197199
isTimeChart

src/chart/pie/PieChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { evaluateRulesOnDict, useStyleRules } from '../../extensions/styling/Sty
66
import { ChartProps } from '../Chart';
77
import { convertRecordObjectToString, recordToNative } from '../ChartUtils';
88
import { extensionEnabled } from '../../extensions/ExtensionUtils';
9+
import { themeNivo } from '../Utils';
910

1011
/**
1112
* Embeds a PieChart (from Nivo) into NeoDash.
@@ -132,6 +133,7 @@ const NeoPieChart = (props: ChartProps) => {
132133

133134
return (
134135
<ResponsivePie
136+
theme={themeNivo}
135137
data={data}
136138
sortByValue={sortByValue}
137139
enableArcLabels={enableArcLabels}

src/chart/scatter/ScatterPlotChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { recordToNative } from '../ChartUtils';
55
import { ResponsiveScatterPlot, ResponsiveScatterPlotCanvas } from '@nivo/scatterplot';
66
import { animated } from '@react-spring/web';
77
import chroma from 'chroma-js';
8+
import { themeNivo } from '../Utils';
89

910
/**
1011
* Embeds a Nivo ResponsiveScatterPlot and a ResponsiveScatterPlotCanvas into NeoDash.
@@ -281,6 +282,7 @@ const NeoScatterPlot = (props: ChartProps) => {
281282
}}
282283
>
283284
<ComponentType
285+
theme={themeNivo}
284286
data={[data]}
285287
key={`${selection.value}`}
286288
xScale={

src/extensions/advancedcharts/chart/circlepacking/CirclePackingChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Refresh from '@mui/icons-material/Refresh';
66
import { ChartProps } from '../../../../chart/Chart';
77
import { NoDrawableDataErrorMessage } from '../../../../component/editor/CodeViewerComponent';
88
import { mutateName, processHierarchyFromRecords, findObject, flatten } from '../../../../chart/ChartUtils';
9+
import { themeNivo } from '../../../../chart/Utils';
910

1011
/**
1112
* Embeds a CirclePackaging (from Charts) into NeoDash.
@@ -94,6 +95,7 @@ const NeoCirclePackingChart = (props: ChartProps) => {
9495
)}
9596
<ResponsiveCirclePacking
9697
{...commonProperties}
98+
theme={themeNivo}
9799
id='name'
98100
value='loc'
99101
data={data}

src/extensions/advancedcharts/chart/radar/RadarChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ResponsiveRadar } from '@nivo/radar';
44
import { evaluateRulesOnDict, useStyleRules } from '../../../styling/StyleRuleEvaluator';
55
import { NoDrawableDataErrorMessage } from '../../../../component/editor/CodeViewerComponent';
66
import { extensionEnabled } from '../../../ExtensionUtils';
7+
import { themeNivo } from '../../../../chart/Utils';
78

89
/**
910
* Embeds a RadarChart (from Charts) into NeoDash.
@@ -80,6 +81,7 @@ const NeoRadarChart = (props: ChartProps) => {
8081
}
8182
return (
8283
<ResponsiveRadar
84+
theme={themeNivo}
8385
data={data}
8486
isInteractive={interactive}
8587
animate={animate}

src/extensions/advancedcharts/chart/sankey/SankeyChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { evaluateRulesOnDict, evaluateRulesOnNode, useStyleRules } from '../../.
77
import NeoCodeViewerComponent from '../../../../component/editor/CodeViewerComponent';
88
import { isCyclic } from '../../Utils';
99
import { extensionEnabled } from '../../../ExtensionUtils';
10+
import { themeNivo } from '../../../../chart/Utils';
1011

1112
const UNWEIGHTED_SANKEY_PROPERTY = 'SANKEY_UNWEIGHTED';
1213

@@ -190,6 +191,7 @@ const NeoSankeyChart = (props: ChartProps) => {
190191

191192
return (
192193
<ResponsiveSankey
194+
theme={themeNivo}
193195
data={data}
194196
margin={{
195197
top: marginTop,

src/extensions/advancedcharts/chart/sunburst/SunburstChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Tooltip } from '@mui/material';
1111
import { Refresh } from '@mui/icons-material';
1212
import { ChartProps } from '../../../../chart/Chart';
1313
import { NoDrawableDataErrorMessage } from '../../../../component/editor/CodeViewerComponent';
14+
import { themeNivo } from '../../../../chart/Utils';
1415
/**
1516
* Embeds a SunburstChart (from Charts) into NeoDash.
1617
*/
@@ -92,6 +93,7 @@ const NeoSunburstChart = (props: ChartProps) => {
9293
)}
9394
<ResponsiveSunburst
9495
{...commonProperties}
96+
theme={themeNivo}
9597
id='name'
9698
value='loc'
9799
data={data}

src/extensions/advancedcharts/chart/treemap/TreeMapChart.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Tooltip } from '@mui/material';
66
import { Refresh } from '@mui/icons-material';
77
import { ChartProps } from '../../../../chart/Chart';
88
import { NoDrawableDataErrorMessage } from '../../../../component/editor/CodeViewerComponent';
9+
import { themeNivo } from '../../../../chart/Utils';
910

1011
/**
1112
* Embeds a TreeMap (from Charts) into NeoDash.
@@ -94,6 +95,7 @@ const NeoTreeMapChart = (props: ChartProps) => {
9495
)}
9596
<ResponsiveTreeMap
9697
{...commonProperties}
98+
theme={themeNivo}
9799
identity='name'
98100
value='loc'
99101
data={data}

0 commit comments

Comments
 (0)