Skip to content

Commit 8ac9d50

Browse files
committed
Apply liquid glass theme to all relay dashboard charts - Added gradient fills, enhanced tooltips, and removed visible data points (appear on hover only)
1 parent 19a9813 commit 8ac9d50

1 file changed

Lines changed: 214 additions & 25 deletions

File tree

src/components/charts/LineRaceChart/LineRaceChart.tsx

Lines changed: 214 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import React from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { BaseCard } from '@app/components/common/BaseCard/BaseCard';
4-
import { BaseChart } from '@app/components/common/charts/BaseChart';
4+
import { BaseChart, getDefaultTooltipStyles } from '@app/components/common/charts/BaseChart';
55
import { useAppSelector } from '@app/hooks/reduxHooks';
66
import { liquidBlueTheme } from '@app/styles/themes/liquidBlue/liquidBlueTheme';
7+
import { themeObject } from '@app/styles/themes/themeVariables';
78
import useLineChartData from '@app/hooks/useLineChartData';
9+
import { graphic } from 'echarts';
810

911
export const LineRaceChart: React.FC = () => {
1012
const { data, isLoading } = useLineChartData();
1113
const { t } = useTranslation();
14+
const theme = useAppSelector((state) => state.theme.theme);
1215

1316
if (isLoading) {
1417
return (
@@ -33,27 +36,68 @@ export const LineRaceChart: React.FC = () => {
3336
type: 'line',
3437
data: noData ? [] : data.map((item) => [item.month, item.profiles]),
3538
showSymbol: false,
39+
symbol: 'circle',
40+
symbolSize: 8,
41+
smooth: 0.4,
3642
lineStyle: {
37-
color: liquidBlueTheme.chartColor1, // Use liquid blue theme colors
43+
color: new graphic.LinearGradient(0, 0, 1, 0, [
44+
{
45+
offset: 0,
46+
color: 'rgba(51, 156, 253, 0.9)',
47+
},
48+
{
49+
offset: 1,
50+
color: 'rgba(51, 156, 253, 0.6)',
51+
},
52+
]),
3853
width: 3,
54+
shadowColor: 'rgba(51, 156, 253, 0.3)',
55+
shadowBlur: 10,
56+
shadowOffsetY: 3,
57+
},
58+
itemStyle: {
59+
color: 'rgba(51, 156, 253, 0.9)',
60+
borderColor: 'rgba(255, 255, 255, 0.9)',
61+
borderWidth: 2,
62+
},
63+
areaStyle: {
64+
opacity: 0.15,
65+
color: new graphic.LinearGradient(0, 0, 0, 1, [
66+
{
67+
offset: 0,
68+
color: 'rgba(51, 156, 253, 0.3)',
69+
},
70+
{
71+
offset: 1,
72+
color: 'rgba(51, 156, 253, 0.05)',
73+
},
74+
]),
3975
},
4076
endLabel: {
4177
show: !noData,
4278
formatter: (params: { value: string[] }) => `${t('categories.npubs')}: ${params.value[1]}`,
4379
color: liquidBlueTheme.textMain,
4480
fontSize: 12,
4581
fontWeight: 'bold',
82+
textShadowBlur: 2,
83+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
4684
},
4785
labelLayout: {
4886
moveOverlap: 'shiftY',
4987
},
5088
emphasis: {
5189
focus: 'series',
90+
showSymbol: true,
5291
lineStyle: {
53-
color: liquidBlueTheme.chartColor1,
5492
width: 4,
55-
shadowColor: liquidBlueTheme.chartColor1,
56-
shadowBlur: 8,
93+
shadowColor: 'rgba(51, 156, 253, 0.6)',
94+
shadowBlur: 15,
95+
},
96+
itemStyle: {
97+
borderColor: '#fff',
98+
borderWidth: 3,
99+
shadowColor: 'rgba(51, 156, 253, 0.5)',
100+
shadowBlur: 10,
57101
},
58102
},
59103
encode: {
@@ -69,27 +113,68 @@ export const LineRaceChart: React.FC = () => {
69113
type: 'line',
70114
data: noData ? [] : data.map((item) => [item.month, item.lightning_addr]),
71115
showSymbol: false,
116+
symbol: 'circle',
117+
symbolSize: 8,
118+
smooth: 0.4,
72119
lineStyle: {
73-
color: liquidBlueTheme.chartColor2, // Use liquid blue theme colors
120+
color: new graphic.LinearGradient(0, 0, 1, 0, [
121+
{
122+
offset: 0,
123+
color: 'rgba(253, 156, 51, 0.9)',
124+
},
125+
{
126+
offset: 1,
127+
color: 'rgba(253, 156, 51, 0.6)',
128+
},
129+
]),
74130
width: 3,
131+
shadowColor: 'rgba(253, 156, 51, 0.3)',
132+
shadowBlur: 10,
133+
shadowOffsetY: 3,
134+
},
135+
itemStyle: {
136+
color: 'rgba(253, 156, 51, 0.9)',
137+
borderColor: 'rgba(255, 255, 255, 0.9)',
138+
borderWidth: 2,
139+
},
140+
areaStyle: {
141+
opacity: 0.15,
142+
color: new graphic.LinearGradient(0, 0, 0, 1, [
143+
{
144+
offset: 0,
145+
color: 'rgba(253, 156, 51, 0.3)',
146+
},
147+
{
148+
offset: 1,
149+
color: 'rgba(253, 156, 51, 0.05)',
150+
},
151+
]),
75152
},
76153
endLabel: {
77154
show: !noData,
78155
formatter: (params: { value: string[] }) => `${t('categories.lightningABV')}: ${params.value[1]}`,
79156
color: liquidBlueTheme.textMain,
80157
fontSize: 12,
81158
fontWeight: 'bold',
159+
textShadowBlur: 2,
160+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
82161
},
83162
labelLayout: {
84163
moveOverlap: 'shiftY',
85164
},
86165
emphasis: {
87166
focus: 'series',
167+
showSymbol: true,
88168
lineStyle: {
89-
color: liquidBlueTheme.chartColor2,
90169
width: 4,
91-
shadowColor: liquidBlueTheme.chartColor2,
92-
shadowBlur: 8,
170+
shadowColor: 'rgba(253, 156, 51, 0.6)',
171+
shadowBlur: 15,
172+
},
173+
itemStyle: {
174+
borderColor: '#fff',
175+
borderWidth: 3,
176+
shadowColor: 'rgba(253, 156, 51, 0.5)',
177+
shadowBlur: 10,
93178
},
94179
},
95180
encode: {
@@ -105,27 +190,68 @@ export const LineRaceChart: React.FC = () => {
105190
type: 'line',
106191
data: noData ? [] : data.map((item) => [item.month, item.dht_key]),
107192
showSymbol: false,
193+
symbol: 'circle',
194+
symbolSize: 8,
195+
smooth: 0.4,
108196
lineStyle: {
109-
color: liquidBlueTheme.chartColor3, // Use liquid blue theme colors
197+
color: new graphic.LinearGradient(0, 0, 1, 0, [
198+
{
199+
offset: 0,
200+
color: 'rgba(25, 230, 141, 0.9)',
201+
},
202+
{
203+
offset: 1,
204+
color: 'rgba(25, 230, 141, 0.6)',
205+
},
206+
]),
110207
width: 3,
208+
shadowColor: 'rgba(25, 230, 141, 0.3)',
209+
shadowBlur: 10,
210+
shadowOffsetY: 3,
211+
},
212+
itemStyle: {
213+
color: 'rgba(25, 230, 141, 0.9)',
214+
borderColor: 'rgba(255, 255, 255, 0.9)',
215+
borderWidth: 2,
216+
},
217+
areaStyle: {
218+
opacity: 0.15,
219+
color: new graphic.LinearGradient(0, 0, 0, 1, [
220+
{
221+
offset: 0,
222+
color: 'rgba(25, 230, 141, 0.3)',
223+
},
224+
{
225+
offset: 1,
226+
color: 'rgba(25, 230, 141, 0.05)',
227+
},
228+
]),
111229
},
112230
endLabel: {
113231
show: !noData,
114232
formatter: (params: { value: string[] }) => `${t('categories.bolt')}: ${params.value[1]}`,
115233
color: liquidBlueTheme.textMain,
116234
fontSize: 12,
117235
fontWeight: 'bold',
236+
textShadowBlur: 2,
237+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
118238
},
119239
labelLayout: {
120240
moveOverlap: 'shiftY',
121241
},
122242
emphasis: {
123243
focus: 'series',
244+
showSymbol: true,
124245
lineStyle: {
125-
color: liquidBlueTheme.chartColor3,
126246
width: 4,
127-
shadowColor: liquidBlueTheme.chartColor3,
128-
shadowBlur: 8,
247+
shadowColor: 'rgba(25, 230, 141, 0.6)',
248+
shadowBlur: 15,
249+
},
250+
itemStyle: {
251+
borderColor: '#fff',
252+
borderWidth: 3,
253+
shadowColor: 'rgba(25, 230, 141, 0.5)',
254+
shadowBlur: 10,
129255
},
130256
},
131257
encode: {
@@ -141,27 +267,68 @@ export const LineRaceChart: React.FC = () => {
141267
type: 'line',
142268
data: noData ? [] : data.map((item) => [item.month, item.lightning_and_dht]),
143269
showSymbol: false,
270+
symbol: 'circle',
271+
symbolSize: 8,
272+
smooth: 0.4,
144273
lineStyle: {
145-
color: liquidBlueTheme.chartColor4, // Use liquid blue theme colors
274+
color: new graphic.LinearGradient(0, 0, 1, 0, [
275+
{
276+
offset: 0,
277+
color: 'rgba(142, 48, 235, 0.9)',
278+
},
279+
{
280+
offset: 1,
281+
color: 'rgba(142, 48, 235, 0.6)',
282+
},
283+
]),
146284
width: 3,
285+
shadowColor: 'rgba(142, 48, 235, 0.3)',
286+
shadowBlur: 10,
287+
shadowOffsetY: 3,
288+
},
289+
itemStyle: {
290+
color: 'rgba(142, 48, 235, 0.9)',
291+
borderColor: 'rgba(255, 255, 255, 0.9)',
292+
borderWidth: 2,
293+
},
294+
areaStyle: {
295+
opacity: 0.15,
296+
color: new graphic.LinearGradient(0, 0, 0, 1, [
297+
{
298+
offset: 0,
299+
color: 'rgba(142, 48, 235, 0.3)',
300+
},
301+
{
302+
offset: 1,
303+
color: 'rgba(142, 48, 235, 0.05)',
304+
},
305+
]),
147306
},
148307
endLabel: {
149308
show: !noData,
150309
formatter: (params: { value: string[] }) => `${t('categories.lightningAndDHT')}: ${params.value[1]}`,
151310
color: liquidBlueTheme.textMain,
152311
fontSize: 12,
153312
fontWeight: 'bold',
313+
textShadowBlur: 2,
314+
textShadowColor: 'rgba(0, 0, 0, 0.5)',
154315
},
155316
labelLayout: {
156317
moveOverlap: 'shiftY',
157318
},
158319
emphasis: {
159320
focus: 'series',
321+
showSymbol: true,
160322
lineStyle: {
161-
color: liquidBlueTheme.chartColor4,
162323
width: 4,
163-
shadowColor: liquidBlueTheme.chartColor4,
164-
shadowBlur: 8,
324+
shadowColor: 'rgba(142, 48, 235, 0.6)',
325+
shadowBlur: 15,
326+
},
327+
itemStyle: {
328+
borderColor: '#fff',
329+
borderWidth: 3,
330+
shadowColor: 'rgba(142, 48, 235, 0.5)',
331+
shadowBlur: 10,
165332
},
166333
},
167334
encode: {
@@ -184,15 +351,29 @@ export const LineRaceChart: React.FC = () => {
184351
},
185352
],
186353
tooltip: {
354+
...getDefaultTooltipStyles(themeObject[theme]),
187355
order: 'valueDesc',
188356
trigger: 'axis',
189-
backgroundColor: 'rgba(0, 0, 0, 0.8)',
190-
borderColor: liquidBlueTheme.primary,
357+
backgroundColor: 'rgba(0, 0, 0, 0.9)',
358+
borderColor: 'rgba(0, 255, 255, 0.5)',
359+
borderWidth: 1,
360+
padding: 10,
191361
textStyle: {
192362
color: liquidBlueTheme.textMain,
363+
fontSize: 12,
364+
},
365+
shadowColor: 'rgba(0, 255, 255, 0.3)',
366+
shadowBlur: 10,
367+
axisPointer: {
368+
type: 'cross',
369+
crossStyle: {
370+
color: 'rgba(0, 255, 255, 0.3)',
371+
},
372+
lineStyle: {
373+
color: 'rgba(0, 255, 255, 0.3)',
374+
width: 1,
375+
},
193376
},
194-
shadowColor: liquidBlueTheme.shadow,
195-
shadowBlur: 8,
196377
},
197378
xAxis: {
198379
type: 'category',
@@ -207,9 +388,12 @@ export const LineRaceChart: React.FC = () => {
207388
},
208389
axisLine: {
209390
lineStyle: {
210-
color: liquidBlueTheme.border,
391+
color: 'rgba(0, 255, 255, 0.3)',
211392
},
212393
},
394+
splitLine: {
395+
show: false,
396+
},
213397
},
214398
yAxis: {
215399
type: 'value',
@@ -221,13 +405,13 @@ export const LineRaceChart: React.FC = () => {
221405
},
222406
axisLine: {
223407
lineStyle: {
224-
color: liquidBlueTheme.border,
408+
color: 'rgba(0, 255, 255, 0.3)',
225409
},
226410
},
227411
splitLine: {
228412
lineStyle: {
229-
color: liquidBlueTheme.borderBase,
230-
opacity: 0.3,
413+
color: 'rgba(0, 255, 255, 0.15)',
414+
type: 'dashed',
231415
},
232416
},
233417
},
@@ -236,6 +420,11 @@ export const LineRaceChart: React.FC = () => {
236420
right: 78,
237421
top: 20,
238422
bottom: 60,
423+
backgroundColor: 'transparent',
424+
borderColor: 'rgba(0, 255, 255, 0.1)',
425+
borderWidth: 1,
426+
shadowColor: 'rgba(0, 255, 255, 0.1)',
427+
shadowBlur: 10,
239428
},
240429
series: seriesList,
241430
graphic: noData

0 commit comments

Comments
 (0)