mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-17 13:25:55 +08:00
fix: fix colors of graphs for lightMode and darkMode (#5192)
* fix: fix colors of graphs for lightMode and darkMode * fix: fix colors of graphs for lightMode and darkMode
This commit is contained in:
parent
dc294ff6d5
commit
a681f6f397
@ -78,6 +78,82 @@ const themeColors = {
|
|||||||
mediumVioletRed: '#C71585',
|
mediumVioletRed: '#C71585',
|
||||||
paleGreen: '#98FB98',
|
paleGreen: '#98FB98',
|
||||||
},
|
},
|
||||||
|
lightModeColor: {
|
||||||
|
robin: '#3F5ECC',
|
||||||
|
dodgerBlueDark: '#0C6EED',
|
||||||
|
steelgrey: '#2f4b7c',
|
||||||
|
steelpurple: '#665191',
|
||||||
|
steelindigo: '#a05195',
|
||||||
|
steelpink: '#d45087',
|
||||||
|
steelcoral: '#f95d6a',
|
||||||
|
steelorange: '#ff7c43',
|
||||||
|
steelgold: '#ffa600',
|
||||||
|
steelrust: '#de425b',
|
||||||
|
steelgreen: '#41967e',
|
||||||
|
mediumOrchidDark: '#C326FD',
|
||||||
|
seaBuckthornDark: '#E66E05',
|
||||||
|
seaGreen: '#219653',
|
||||||
|
turquoiseBlueDark: '#0099CC',
|
||||||
|
silverDark: '#757575',
|
||||||
|
outrageousOrangeDark: '#F9521A',
|
||||||
|
roseBudDark: '#EB6437',
|
||||||
|
deepSkyBlueDark: '#0595BD',
|
||||||
|
royalBlue: '#3366E6',
|
||||||
|
avocadoDark: '#8E8E29',
|
||||||
|
mintGreenDark: '#00C700',
|
||||||
|
chestnut: '#B34D4D',
|
||||||
|
limaDark: '#6E9900',
|
||||||
|
olive: '#809900',
|
||||||
|
beautyBushDark: '#E25555',
|
||||||
|
danube: '#6680B3',
|
||||||
|
oliveDrab: '#66991A',
|
||||||
|
lavenderRoseDark: '#F024BD',
|
||||||
|
electricLimeDark: '#84A800',
|
||||||
|
radicalRed: '#FF1A66',
|
||||||
|
harleyOrange: '#E6331A',
|
||||||
|
gladeGreen: '#66994D',
|
||||||
|
hemlock: '#66664D',
|
||||||
|
vidaLoca: '#4D8000',
|
||||||
|
rust: '#B33300',
|
||||||
|
red: '#FF0000', // Adding more colors, we need to get better colors from design team
|
||||||
|
blue: '#0000FF',
|
||||||
|
green: '#00FF00',
|
||||||
|
purple: '#800080',
|
||||||
|
magentaDark: '#EB00EB',
|
||||||
|
pinkDark: '#FF3D5E',
|
||||||
|
brown: '#A52A2A',
|
||||||
|
teal: '#008080',
|
||||||
|
limeDark: '#07A207',
|
||||||
|
maroon: '#800000',
|
||||||
|
navy: '#000080',
|
||||||
|
gray: '#808080',
|
||||||
|
skyBlueDark: '#0CA7E4',
|
||||||
|
indigo: '#4B0082',
|
||||||
|
slateGray: '#708090',
|
||||||
|
chocolate: '#D2691E',
|
||||||
|
tomato: '#FF6347',
|
||||||
|
steelBlue: '#4682B4',
|
||||||
|
peruDark: '#D16E0A',
|
||||||
|
darkOliveGreen: '#556B2F',
|
||||||
|
indianRed: '#CD5C5C',
|
||||||
|
mediumSlateBlue: '#7B68EE',
|
||||||
|
rosyBrownDark: '#CB4848',
|
||||||
|
darkSlateGray: '#2F4F4F',
|
||||||
|
fuchsia: '#FF0AFF',
|
||||||
|
salmonDark: '#FF432E',
|
||||||
|
darkSalmonDark: '#D26541',
|
||||||
|
paleVioletRedDark: '#E83089',
|
||||||
|
mediumPurple: '#9370DB',
|
||||||
|
darkOrchid: '#9932CC',
|
||||||
|
mediumSeaGreenDark: '#109E50',
|
||||||
|
lightCoralDark: '#F85959',
|
||||||
|
darkSeaGreenDark: '#509F50',
|
||||||
|
sandyBrownDark: '#D97117',
|
||||||
|
darkKhakiDark: '#99900A',
|
||||||
|
cornflowerBlueDark: '#3371E6',
|
||||||
|
mediumVioletRed: '#C71585',
|
||||||
|
paleGreenDark: '#0D910D',
|
||||||
|
},
|
||||||
errorColor: '#d32f2f',
|
errorColor: '#d32f2f',
|
||||||
royalGrey: '#888888',
|
royalGrey: '#888888',
|
||||||
matterhornGrey: '#555555',
|
matterhornGrey: '#555555',
|
||||||
|
@ -166,6 +166,7 @@ export function BillingUsageGraph(props: BillingUsageGraphProps): JSX.Element {
|
|||||||
),
|
),
|
||||||
yAxisUnit: '',
|
yAxisUnit: '',
|
||||||
isBillingUsageGraphs: true,
|
isBillingUsageGraphs: true,
|
||||||
|
isDarkMode,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
@ -60,7 +60,7 @@ function PiePanelWrapper({
|
|||||||
d.series?.length === 1
|
d.series?.length === 1
|
||||||
? getLabel(Object.values(s.labels)[0], widget.query, d.queryName)
|
? getLabel(Object.values(s.labels)[0], widget.query, d.queryName)
|
||||||
: getLabel(Object.values(s.labels)[0], {} as Query, d.queryName, true),
|
: getLabel(Object.values(s.labels)[0], {} as Query, d.queryName, true),
|
||||||
themeColors.chartcolors,
|
isDarkMode ? themeColors.chartcolors : themeColors.lightModeColor,
|
||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
|
@ -197,7 +197,7 @@ export const getUPlotChartOptions = ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
tooltipPlugin({ apiResponse, yAxisUnit, stackBarChart }),
|
tooltipPlugin({ apiResponse, yAxisUnit, stackBarChart, isDarkMode }),
|
||||||
onClickPlugin({
|
onClickPlugin({
|
||||||
onClick: onClickHandler,
|
onClick: onClickHandler,
|
||||||
}),
|
}),
|
||||||
@ -332,6 +332,7 @@ export const getUPlotChartOptions = ({
|
|||||||
currentQuery,
|
currentQuery,
|
||||||
stackBarChart,
|
stackBarChart,
|
||||||
hiddenGraph,
|
hiddenGraph,
|
||||||
|
isDarkMode,
|
||||||
}),
|
}),
|
||||||
axes: getAxes(isDarkMode, yAxisUnit),
|
axes: getAxes(isDarkMode, yAxisUnit),
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,7 @@ type GetHistogramSeriesProps = {
|
|||||||
widgetMetaData?: QueryData[];
|
widgetMetaData?: QueryData[];
|
||||||
graphsVisibilityStates?: boolean[];
|
graphsVisibilityStates?: boolean[];
|
||||||
isMergedSeries?: boolean;
|
isMergedSeries?: boolean;
|
||||||
|
isDarkMode: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { bars } = uPlot.paths;
|
const { bars } = uPlot.paths;
|
||||||
@ -56,6 +57,7 @@ const getHistogramSeries = ({
|
|||||||
widgetMetaData,
|
widgetMetaData,
|
||||||
graphsVisibilityStates,
|
graphsVisibilityStates,
|
||||||
isMergedSeries,
|
isMergedSeries,
|
||||||
|
isDarkMode,
|
||||||
}: GetHistogramSeriesProps): uPlot.Options['series'] => {
|
}: GetHistogramSeriesProps): uPlot.Options['series'] => {
|
||||||
const configurations: uPlot.Series[] = [
|
const configurations: uPlot.Series[] = [
|
||||||
{ label: 'Timestamp', stroke: 'purple' },
|
{ label: 'Timestamp', stroke: 'purple' },
|
||||||
@ -78,7 +80,10 @@ const getHistogramSeries = ({
|
|||||||
? ''
|
? ''
|
||||||
: getLabelName(metric, queryName || '', legend);
|
: getLabelName(metric, queryName || '', legend);
|
||||||
|
|
||||||
const color = generateColor(label, themeColors.chartcolors);
|
const color = generateColor(
|
||||||
|
label,
|
||||||
|
isDarkMode ? themeColors.chartcolors : themeColors.lightModeColor,
|
||||||
|
);
|
||||||
|
|
||||||
const pointSize = seriesList[i].values.length > 1 ? 5 : 10;
|
const pointSize = seriesList[i].values.length > 1 ? 5 : 10;
|
||||||
const showPoints = !(seriesList[i].values.length > 1);
|
const showPoints = !(seriesList[i].values.length > 1);
|
||||||
@ -133,6 +138,7 @@ export const getUplotHistogramChartOptions = ({
|
|||||||
apiResponse,
|
apiResponse,
|
||||||
isHistogramGraphs: true,
|
isHistogramGraphs: true,
|
||||||
isMergedSeries: mergeAllQueries,
|
isMergedSeries: mergeAllQueries,
|
||||||
|
isDarkMode,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
scales: {
|
scales: {
|
||||||
@ -157,6 +163,7 @@ export const getUplotHistogramChartOptions = ({
|
|||||||
currentQuery,
|
currentQuery,
|
||||||
graphsVisibilityStates,
|
graphsVisibilityStates,
|
||||||
isMergedSeries: mergeAllQueries,
|
isMergedSeries: mergeAllQueries,
|
||||||
|
isDarkMode,
|
||||||
}),
|
}),
|
||||||
hooks: {
|
hooks: {
|
||||||
ready: [
|
ready: [
|
||||||
|
@ -39,6 +39,7 @@ const generateTooltipContent = (
|
|||||||
seriesList: any[],
|
seriesList: any[],
|
||||||
data: any[],
|
data: any[],
|
||||||
idx: number,
|
idx: number,
|
||||||
|
isDarkMode: boolean,
|
||||||
yAxisUnit?: string,
|
yAxisUnit?: string,
|
||||||
series?: uPlot.Options['series'],
|
series?: uPlot.Options['series'],
|
||||||
isBillingUsageGraphs?: boolean,
|
isBillingUsageGraphs?: boolean,
|
||||||
@ -88,7 +89,10 @@ const generateTooltipContent = (
|
|||||||
? ''
|
? ''
|
||||||
: getLabelName(metric, queryName || '', legend || '');
|
: getLabelName(metric, queryName || '', legend || '');
|
||||||
|
|
||||||
let color = generateColor(label, themeColors.chartcolors);
|
let color = generateColor(
|
||||||
|
label,
|
||||||
|
isDarkMode ? themeColors.chartcolors : themeColors.lightModeColor,
|
||||||
|
);
|
||||||
|
|
||||||
// in case of billing graph pick colors from the series options
|
// in case of billing graph pick colors from the series options
|
||||||
if (isBillingUsageGraphs) {
|
if (isBillingUsageGraphs) {
|
||||||
@ -217,6 +221,7 @@ type ToolTipPluginProps = {
|
|||||||
isHistogramGraphs?: boolean;
|
isHistogramGraphs?: boolean;
|
||||||
isMergedSeries?: boolean;
|
isMergedSeries?: boolean;
|
||||||
stackBarChart?: boolean;
|
stackBarChart?: boolean;
|
||||||
|
isDarkMode: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const tooltipPlugin = ({
|
const tooltipPlugin = ({
|
||||||
@ -226,6 +231,7 @@ const tooltipPlugin = ({
|
|||||||
isHistogramGraphs,
|
isHistogramGraphs,
|
||||||
isMergedSeries,
|
isMergedSeries,
|
||||||
stackBarChart,
|
stackBarChart,
|
||||||
|
isDarkMode,
|
||||||
}: ToolTipPluginProps): any => {
|
}: ToolTipPluginProps): any => {
|
||||||
let over: HTMLElement;
|
let over: HTMLElement;
|
||||||
let bound: HTMLElement;
|
let bound: HTMLElement;
|
||||||
@ -284,6 +290,7 @@ const tooltipPlugin = ({
|
|||||||
apiResult,
|
apiResult,
|
||||||
u.data,
|
u.data,
|
||||||
idx,
|
idx,
|
||||||
|
isDarkMode,
|
||||||
yAxisUnit,
|
yAxisUnit,
|
||||||
u.series,
|
u.series,
|
||||||
isBillingUsageGraphs,
|
isBillingUsageGraphs,
|
||||||
|
@ -33,6 +33,7 @@ const getSeries = ({
|
|||||||
graphsVisibilityStates,
|
graphsVisibilityStates,
|
||||||
panelType,
|
panelType,
|
||||||
hiddenGraph,
|
hiddenGraph,
|
||||||
|
isDarkMode,
|
||||||
}: GetSeriesProps): uPlot.Options['series'] => {
|
}: GetSeriesProps): uPlot.Options['series'] => {
|
||||||
const configurations: uPlot.Series[] = [
|
const configurations: uPlot.Series[] = [
|
||||||
{ label: 'Timestamp', stroke: 'purple' },
|
{ label: 'Timestamp', stroke: 'purple' },
|
||||||
@ -51,7 +52,10 @@ const getSeries = ({
|
|||||||
legend || '',
|
legend || '',
|
||||||
);
|
);
|
||||||
|
|
||||||
const color = generateColor(label, themeColors.chartcolors);
|
const color = generateColor(
|
||||||
|
label,
|
||||||
|
isDarkMode ? themeColors.chartcolors : themeColors.lightModeColor,
|
||||||
|
);
|
||||||
|
|
||||||
const pointSize = seriesList[i].values.length > 1 ? 5 : 10;
|
const pointSize = seriesList[i].values.length > 1 ? 5 : 10;
|
||||||
const showPoints = !(seriesList[i].values.length > 1);
|
const showPoints = !(seriesList[i].values.length > 1);
|
||||||
@ -93,6 +97,7 @@ const getSeries = ({
|
|||||||
export type GetSeriesProps = {
|
export type GetSeriesProps = {
|
||||||
series?: QueryData[];
|
series?: QueryData[];
|
||||||
widgetMetaData: QueryData[];
|
widgetMetaData: QueryData[];
|
||||||
|
isDarkMode: boolean;
|
||||||
graphsVisibilityStates?: boolean[];
|
graphsVisibilityStates?: boolean[];
|
||||||
panelType?: PANEL_TYPES;
|
panelType?: PANEL_TYPES;
|
||||||
currentQuery?: Query;
|
currentQuery?: Query;
|
||||||
|
@ -174,6 +174,7 @@ export const seriesBarChartData = {
|
|||||||
],
|
],
|
||||||
graphsVisibilityStates: [true, true, true, true, true],
|
graphsVisibilityStates: [true, true, true, true, true],
|
||||||
panelType: PANEL_TYPES.BAR,
|
panelType: PANEL_TYPES.BAR,
|
||||||
|
isDarkMode: true,
|
||||||
} as GetSeriesProps;
|
} as GetSeriesProps;
|
||||||
|
|
||||||
export const seriesLineChartData = {
|
export const seriesLineChartData = {
|
||||||
@ -348,4 +349,5 @@ export const seriesLineChartData = {
|
|||||||
],
|
],
|
||||||
graphsVisibilityStates: [true, true, true, true, true],
|
graphsVisibilityStates: [true, true, true, true, true],
|
||||||
panelType: PANEL_TYPES.TIME_SERIES,
|
panelType: PANEL_TYPES.TIME_SERIES,
|
||||||
|
isDarkMode: false,
|
||||||
} as GetSeriesProps;
|
} as GetSeriesProps;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user