An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
fix: remove initial primary color (#178)
islxyqwecfcafd8c080d
diff --git a/packages/graphic-walker/src/components/visualConfig/colorScheme.tsx b/packages/graphic-walker/src/components/visualConfig/colorScheme.tsxindex b8f71cff..cd1876ac 100644--- a/packages/graphic-walker/src/components/visualConfig/colorScheme.tsx+++ b/packages/graphic-walker/src/components/visualConfig/colorScheme.tsx@@ -98,7 +98,7 @@ export const ColorSchemes = [export const extractRGBA = (rgba?: string) => {if (!rgba) {- return { r: 0, g: 0, b: 0, a: 0 };+ return { r: 91, g: 143, b: 249, a: 1 };}const arr = rgba.match(/\d+/g) || [];diff --git a/packages/graphic-walker/src/components/visualConfig/index.tsx b/packages/graphic-walker/src/components/visualConfig/index.tsxindex 0abbdb63..633090af 100644--- a/packages/graphic-walker/src/components/visualConfig/index.tsx+++ b/packages/graphic-walker/src/components/visualConfig/index.tsx@@ -94,6 +94,7 @@ const VisualConfigPanel: React.FC = (props) => {const [scaleIncludeUnmatchedChoropleth, setScaleIncludeUnmatchedChoropleth] = useState<boolean>(visualConfig.scaleIncludeUnmatchedChoropleth ?? false);const [background, setBackground] = useState<string | undefined>(visualConfig.background);const [defaultColor, setDefaultColor] = useState({ r: 91, g: 143, b: 249, a: 1 });+ const [colorEdited, setColorEdited] = useState(false);const [displayColorPicker, setDisplayColorPicker] = useState(false);const [colorPalette, setColorPalette] = useState('');const opacityValue = useScale(0, 1, 0.3, 0.8);@@ -104,6 +105,7 @@ const VisualConfigPanel: React.FC = (props) => {setBackground(visualConfig.background);setResolve(toJS(visualConfig.resolve));setDefaultColor(extractRGBA(visualConfig.primaryColor));+ setColorEdited(false);setScaleIncludeUnmatchedChoropleth(visualConfig.scaleIncludeUnmatchedChoropleth ?? false);setFormat({numberFormat: visualConfig.format.numberFormat,@@ -149,12 +151,13 @@ const VisualConfigPanel: React.FC = (props) => {setDisplayColorPicker(true);}}></div>- <div className="absolute left-32 top-22 index-40">+ <div className="absolute left-32 top-22 z-40">{displayColorPicker && (<SketchPickerpresetColors={DEFAULT_COLOR_SCHEME}color={defaultColor}onChange={(color, event) => {+ setColorEdited(true);setDefaultColor({...color.rgb,a: color.rgb.a ?? 1,@@ -187,7 +190,10 @@ const VisualConfigPanel: React.FC = (props) => {</div></>),- }))}+ })).concat({+ value: '',+ label: <>{t('config.default_color_palette')}</>,+ })}/></div></div>@@ -310,7 +316,9 @@ const VisualConfigPanel: React.FC = (props) => {vizStore.setVisualConfig('scaleIncludeUnmatchedChoropleth', scaleIncludeUnmatchedChoropleth);vizStore.setVisualConfig('background', background);vizStore.setVisualConfig('resolve', resolve);- vizStore.setVisualConfig('primaryColor', `rgba(${defaultColor.r},${defaultColor.g},${defaultColor.b},${defaultColor.a})`);+ if (colorEdited) {+ vizStore.setVisualConfig('primaryColor', `rgba(${defaultColor.r},${defaultColor.g},${defaultColor.b},${defaultColor.a})`);+ }vizStore.setVisualConfig('colorPalette', colorPalette);vizStore.setVisualConfig('useSvg', svg);vizStore.setVisualConfig('scale', { opacity: opacityValue.value, size: sizeValue.value });diff --git a/packages/graphic-walker/src/locales/en-US.json b/packages/graphic-walker/src/locales/en-US.jsonindex 6340f9e4..791c290d 100644--- a/packages/graphic-walker/src/locales/en-US.json+++ b/packages/graphic-walker/src/locales/en-US.json@@ -4,6 +4,7 @@"primary_color": "Primary Color","color_palette": "Color Palette","opacity": "Opacity",+ "default_color_palette": "Default","size":"Size","min_domain": "Domain Min","max_domain": "Domain Max",diff --git a/packages/graphic-walker/src/locales/ja-JP.json b/packages/graphic-walker/src/locales/ja-JP.jsonindex c67422f1..29ca3c6d 100644--- a/packages/graphic-walker/src/locales/ja-JP.json+++ b/packages/graphic-walker/src/locales/ja-JP.json@@ -4,6 +4,7 @@"primary_color": "プライマリカラー","color_palette": "カラーパレット","opacity": "不透明度",+ "default_color_palette": "デフォルト","size": "サイズ","min_domain": "最小ドメイン","max_domain": "最大ドメイン",diff --git a/packages/graphic-walker/src/locales/zh-CN.json b/packages/graphic-walker/src/locales/zh-CN.jsonindex 6eb62ad9..ea007a23 100644--- a/packages/graphic-walker/src/locales/zh-CN.json+++ b/packages/graphic-walker/src/locales/zh-CN.json@@ -4,6 +4,7 @@"primary_color": "主要颜色","color_palette": "调色板","opacity": "不透明度",+ "default_color_palette": "默认","size": "尺寸","min_domain": "最小域值","max_domain": "最大域值",diff --git a/packages/graphic-walker/src/utils/save.ts b/packages/graphic-walker/src/utils/save.tsindex 7c480ee2..63107294 100644--- a/packages/graphic-walker/src/utils/save.ts+++ b/packages/graphic-walker/src/utils/save.ts@@ -44,7 +44,6 @@ export function initVisualConfig(): IVisualConfig {interactiveScale: false,sorted: 'none',zeroScale: true,- primaryColor: 'rgba(91, 143, 249,1)',scaleIncludeUnmatchedChoropleth: false,background: undefined,size: {