An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
fix: add null check & visConfig forward (#137)
islxyqwe63c3b65c963a
diff --git a/packages/graphic-walker/src/components/askViz/index.tsx b/packages/graphic-walker/src/components/askViz/index.tsxindex f09ebbe2..b5e307a4 100644--- a/packages/graphic-walker/src/components/askViz/index.tsx+++ b/packages/graphic-walker/src/components/askViz/index.tsx@@ -3,9 +3,9 @@ import React, { useCallback, useState } from 'react';import { useGlobalStore } from '../../store';import { PaperAirplaneIcon } from '@heroicons/react/24/outline';import Spinner from '../spinner';-import { IViewField, IVisSpec } from '../../interfaces';+import { IViewField } from '../../interfaces';import { VisSpecWithHistory } from '../../models/visSpecHistory';-import { visSpecDecoder } from '../../utils/save';+import { visSpecDecoder, forwardVisualConfigs } from '../../utils/save';type VEGALite = any;@@ -52,7 +52,7 @@ const AskViz: React.FC<{api?: string; headers?: Record<string, string>}> = (propsetLoading(true);vizQuery(props.api ?? api, allFields, query, props.headers ?? {}).then((data) => {- vizStore.visList.push(new VisSpecWithHistory(visSpecDecoder([data])[0]));+ vizStore.visList.push(new VisSpecWithHistory(visSpecDecoder(forwardVisualConfigs([data]))[0]));vizStore.selectVisualization(vizStore.visList.length - 1);// const liteGW = parseGW(spec);// vizStore.renderSpec(liteGW);diff --git a/packages/graphic-walker/src/computation/serverComputation.ts b/packages/graphic-walker/src/computation/serverComputation.tsindex a2d396a7..5698a6ed 100644--- a/packages/graphic-walker/src/computation/serverComputation.ts+++ b/packages/graphic-walker/src/computation/serverComputation.ts@@ -29,7 +29,7 @@ export const datasetStatsServer = async (service: IComputationFunction): Promise],})) as [{ count: number }];return {- rowCount: res[0].count,+ rowCount: res[0]?.count ?? 0,};};@@ -72,7 +72,7 @@ export const dataQueryServer = async (}const res = await service({workflow,- limit+ limit,});return res;};@@ -132,7 +132,12 @@ export const fieldStatServer = async (},],};- const [rangeRes] = range+ const [+ rangeRes = {+ [MIN_ID]: 0,+ [MAX_ID]: 0,+ },+ ] = range? await service(rangeQueryPayload): [{diff --git a/packages/graphic-walker/src/dataSource/config.ts b/packages/graphic-walker/src/dataSource/config.tsindex f9308159..41c23070 100644--- a/packages/graphic-walker/src/dataSource/config.ts+++ b/packages/graphic-walker/src/dataSource/config.ts@@ -1,4 +1,4 @@-export const DemoDataAssets = true ? {+export const DemoDataAssets = process.env.NODE_ENV === 'production' ? {CARS: "https://chspace.oss-cn-hongkong.aliyuncs.com/api/ds-cars-service.json",STUDENTS: "https://chspace.oss-cn-hongkong.aliyuncs.com/api/ds-students-service.json",BTC_GOLD: "https://chspace.oss-cn-hongkong.aliyuncs.com/api/ds_btc_gold_service.json",