An open source alternative to Tableau. Embeddable visual analytic
TypeScript bidatadata-analysisdata-miningdata-visualizationedak6skanarieslow-codepivot-tablereacttableautableau-alternativetypescriptvegavega-litevisualization
fix: add importStoInfo api
ObservedObserver189ea4f63800
diff --git a/packages/graphic-walker/src/store/visualSpecStore.ts b/packages/graphic-walker/src/store/visualSpecStore.tsindex 44f1b0d5..481e7c12 100644--- a/packages/graphic-walker/src/store/visualSpecStore.ts+++ b/packages/graphic-walker/src/store/visualSpecStore.ts@@ -6,7 +6,7 @@ import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisSpec, IVisuaimport { CHANNEL_LIMIT, GEMO_TYPES, MetaFieldKeys } from "../config";import { makeBinField, makeLogField } from "../utils/normalization";import { VisSpecWithHistory } from "../models/visSpecHistory";-import { dumpsGWPureSpec, parseGWContent, parseGWPureSpec, stringifyGWContent } from "../utils/save";+import { IStoInfo, dumpsGWPureSpec, parseGWContent, parseGWPureSpec, stringifyGWContent } from "../utils/save";import { CommonStore } from "./commonStore";function getChannelSizeLimit(channel: string): number {@@ -707,12 +707,15 @@ export class VizSpecStore {specList: pureVisList,};}+ public importStoInfo (stoInfo: IStoInfo) {+ this.commonStore.datasets = stoInfo.datasets;+ this.commonStore.dataSources = stoInfo.dataSources;+ this.commonStore.dsIndex = Math.max(stoInfo.datasets.length - 1, 0);+ this.visList = parseGWPureSpec(forwardVisualConfigs(stoInfo.specList));+ this.visIndex = 0;+ }public importRaw(raw: string) {const content = parseGWContent(raw);- this.commonStore.datasets = content.datasets;- this.commonStore.dataSources = content.dataSources;- this.commonStore.dsIndex = Math.max(content.datasets.length - 1, 0);- this.visList = parseGWPureSpec(forwardVisualConfigs(content.specList));- this.visIndex = 0;+ this.importStoInfo(content);}}diff --git a/packages/graphic-walker/src/utils/save.ts b/packages/graphic-walker/src/utils/save.tsindex 1f43b2e3..9f3e08a5 100644--- a/packages/graphic-walker/src/utils/save.ts+++ b/packages/graphic-walker/src/utils/save.ts@@ -9,10 +9,9 @@ export function parseGWPureSpec(list: IVisSpec[]): VisSpecWithHistory[] {return list.map((l) => new VisSpecWithHistory(l));}-interface IStoInfo {+export interface IStoInfo {datasets: IDataSet[];specList: {- /** 由于 gw 内部实现暂时未锁版本,这里获取到的信息可能会与当前实例内容有偏差,需要用初始值合入 */[K in keyof IVisSpec]: K extends "config" ? Partial<IVisSpec[K]> : IVisSpec[K];}[];dataSources: IDataSource[];