From 98afc190e883fa56e684c36bce98fbe20b6d6e00 Mon Sep 17 00:00:00 2001 From: MiniPear Date: Tue, 29 Aug 2023 19:41:55 +0800 Subject: [PATCH] feat(lib): change graphlib and plotlib --- __tests__/unit/lib/graph.spec.ts | 8 +++++++- __tests__/unit/lib/plot.spec.ts | 16 ++-------------- src/lib/graph.ts | 8 +++++++- src/lib/plot.ts | 9 ++------- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/__tests__/unit/lib/graph.spec.ts b/__tests__/unit/lib/graph.spec.ts index 84bd68c441..576f9ffaa2 100644 --- a/__tests__/unit/lib/graph.spec.ts +++ b/__tests__/unit/lib/graph.spec.ts @@ -1,11 +1,17 @@ import { graphlib } from '../../../src/lib'; -import { ForceGraph, Tree } from '../../../src/mark'; +import { ForceGraph, Tree, Sankey, Treemap, Pack } from '../../../src/mark'; +import { Cluster, Arc } from '../../../src/data'; describe('graphlib', () => { it('graphlib() should returns expected graph components.', () => { expect(graphlib()).toEqual({ + 'data.cluster': Cluster, + 'data.arc': Arc, 'mark.forceGraph': ForceGraph, 'mark.tree': Tree, + 'mark.sankey': Sankey, + 'mark.treemap': Treemap, + 'mark.pack': Pack, }); }); }); diff --git a/__tests__/unit/lib/plot.spec.ts b/__tests__/unit/lib/plot.spec.ts index 51a9a69c2f..8674c3111d 100644 --- a/__tests__/unit/lib/plot.spec.ts +++ b/__tests__/unit/lib/plot.spec.ts @@ -1,23 +1,11 @@ import { plotlib } from '../../../src/lib'; -import { - Sankey, - Treemap, - Pack, - Boxplot, - WordCloud, - Gauge, -} from '../../../src/mark'; -import { Venn, Cluster, Arc } from '../../../src/data'; +import { Boxplot, WordCloud, Gauge } from '../../../src/mark'; +import { Venn } from '../../../src/data'; describe('plotlib', () => { it('plotlib() should returns expected plot components.', () => { expect(plotlib()).toEqual({ 'data.venn': Venn, - 'data.cluster': Cluster, - 'data.arc': Arc, - 'mark.sankey': Sankey, - 'mark.treemap': Treemap, - 'mark.pack': Pack, 'mark.boxplot': Boxplot, 'mark.wordCloud': WordCloud, 'mark.gauge': Gauge, diff --git a/src/lib/graph.ts b/src/lib/graph.ts index d56c98fa1f..e388235221 100644 --- a/src/lib/graph.ts +++ b/src/lib/graph.ts @@ -1,8 +1,14 @@ -import { ForceGraph, Tree } from '../mark'; +import { Sankey, Treemap, Pack, ForceGraph, Tree } from '../mark'; +import { Arc, Cluster } from '../data'; export function graphlib() { return { + 'data.arc': Arc, + 'data.cluster': Cluster, 'mark.forceGraph': ForceGraph, 'mark.tree': Tree, + 'mark.pack': Pack, + 'mark.sankey': Sankey, + 'mark.treemap': Treemap, } as const; } diff --git a/src/lib/plot.ts b/src/lib/plot.ts index e252f48cac..1f8087041f 100644 --- a/src/lib/plot.ts +++ b/src/lib/plot.ts @@ -1,15 +1,10 @@ -import { Sankey, Treemap, Pack, Boxplot, WordCloud, Gauge } from '../mark'; -import { Arc, Cluster, Venn } from '../data'; +import { Boxplot, WordCloud, Gauge } from '../mark'; +import { Venn } from '../data'; export function plotlib() { return { 'data.venn': Venn, - 'data.arc': Arc, - 'data.cluster': Cluster, - 'mark.sankey': Sankey, - 'mark.treemap': Treemap, 'mark.boxplot': Boxplot, - 'mark.pack': Pack, 'mark.gauge': Gauge, 'mark.wordCloud': WordCloud, } as const;