mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
1) Keep the selected columns for the X and Y-axis.
2) Lighten the color of the stacked line chart.
This commit is contained in:
@@ -222,3 +222,37 @@ export function ConvertHexToRGBA(hex, opacity) {
|
||||
|
||||
return `rgba(${r},${g},${b},${opacity / 100})`;
|
||||
}
|
||||
|
||||
// This function is used to Lighten/Darken color.
|
||||
export function LightenDarkenColor(color, amount) {
|
||||
let usePound = false;
|
||||
if (color[0] == '#') {
|
||||
color = color.slice(1);
|
||||
usePound = true;
|
||||
}
|
||||
|
||||
let num = parseInt(color, 16);
|
||||
|
||||
let r = (num >> 16) + amount;
|
||||
if (r > 255) {
|
||||
r = 255;
|
||||
} else if (r < 0) {
|
||||
r = 0;
|
||||
}
|
||||
|
||||
let b = ((num >> 8) & 0x00FF) + amount;
|
||||
if (b > 255) {
|
||||
b = 255;
|
||||
} else if (b < 0) {
|
||||
b = 0;
|
||||
}
|
||||
|
||||
let g = (num & 0x0000FF) + amount;
|
||||
if (g > 255) {
|
||||
g = 255;
|
||||
} else if (g < 0) {
|
||||
g = 0;
|
||||
}
|
||||
|
||||
return (usePound?'#':'') + (g | (b << 8) | (r << 16)).toString(16);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user