Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilly-coins-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@visactor/vseed': patch
---

Add token theme feature
9 changes: 4 additions & 5 deletions packages/vseed/src/builder/builder/buildSpec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { AdvancedVSeed, Spec, SpecPipelineContext, VChartSpecPipeline } from 'src/types'
import type { AdvancedVSeed, Pipe, Spec, SpecPipelineContext } from 'src/types'
import { Builder } from './builder'
import { execPipeline } from '../../pipeline'
import { intl } from 'src/i18n'
import type { ISpec } from '@visactor/vchart'

export const buildSpec = (builder: Builder, advancedVSeed: AdvancedVSeed): Spec => {
const start = typeof performance !== 'undefined' ? performance.now() : Date.now()
Expand All @@ -25,9 +24,9 @@ export const buildSpec = (builder: Builder, advancedVSeed: AdvancedVSeed): Spec
}

try {
const spec = execPipeline<ISpec, SpecPipelineContext>(pipeline as VChartSpecPipeline, context)
builder.spec = spec
return spec
const spec = execPipeline<Spec, SpecPipelineContext>(pipeline as Array<Pipe<Spec, SpecPipelineContext>>, context)
builder.spec = spec as Spec
return spec as Spec
} catch (e) {
// eslint-disable-next-line no-console
console.error(e)
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ import {
splitLine,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const area: VChartSpecPipeline = [
fontFamilyTheme,
initArea,
stackInverse,
colorAdapter(color, linearColor),
Expand Down Expand Up @@ -74,6 +76,7 @@ const pivotArea: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initArea,
colorAdapter(color, linearColor),
backgroundColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const areaPercent: VChartSpecPipeline = [
fontFamilyTheme,
initArea,
stackInverse,
colorAdapter(color, linearColor),
Expand Down Expand Up @@ -75,6 +77,7 @@ const pivotAreaPercent: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initArea,
stackInverse,
colorAdapter(color, linearColor),
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const bar: VChartSpecPipeline = [
fontFamilyTheme,
initBar,
stackCornerRadius,
barMaxWidth,
Expand Down Expand Up @@ -67,6 +69,7 @@ const pivotBar: PivotChartSpecPipeline = [
pivotIndicatorsAsCol,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initBar,
stackCornerRadius,
barMaxWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const barParallel: VChartSpecPipeline = [
fontFamilyTheme,
initBarParallel,
stackCornerRadius,
barMaxWidth,
Expand Down Expand Up @@ -68,6 +70,7 @@ const pivotBarParallel: PivotChartSpecPipeline = [
pivotIndicatorsAsCol,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initBarParallel,
stackCornerRadius,
barMaxWidth,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/barPercent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const barPercent: VChartSpecPipeline = [
fontFamilyTheme,
initBar,
stackCornerRadius,
barMaxWidth,
Expand Down Expand Up @@ -68,6 +70,7 @@ const pivotBarPercent: PivotChartSpecPipeline = [
pivotIndicatorsAsCol,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initBar,
stackCornerRadius,
barMaxWidth,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/boxplot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ import {
colorBoxPlotStyleFill,
outlierStyle,
discreteLegend,
fontFamilyTheme,
} from '../pipes'

const boxplot: VChartSpecPipeline = [
fontFamilyTheme,
initBoxplot,
stackCornerRadius,
boxMaxWidth,
Expand Down Expand Up @@ -66,6 +68,7 @@ const pivotBoxplot: PivotChartSpecPipeline = [
pivotGridStyle,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initBoxplot,
stackCornerRadius,
boxMaxWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import {
pivotHideIndicatorName,
datasetPivotHierarchy,
drill,
fontFamilyTheme,
} from '../pipes'

const circlePacking: VChartSpecPipeline = [
fontFamilyTheme,
initCirclePacking,
drill,
datasetHierarchy,
Expand All @@ -43,6 +45,7 @@ const pivotCirclePacking: PivotChartSpecPipeline = [
pivotHideIndicatorName,
datasetPivotHierarchy,
pivotIndicators([
fontFamilyTheme,
initCirclePacking,
datasetHierarchy,
colorAdapter(color, linearColor),
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const column: VChartSpecPipeline = [
fontFamilyTheme,
initColumn,
stackCornerRadius,
barMaxWidth,
Expand Down Expand Up @@ -70,6 +72,7 @@ const pivotColumn: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initColumn,
stackCornerRadius,
barMaxWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const columnParallel: VChartSpecPipeline = [
fontFamilyTheme,
initColumnParallel,
stackCornerRadius,
barMaxWidth,
Expand Down Expand Up @@ -68,6 +70,7 @@ const pivotColumnParallel: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initColumnParallel,
stackCornerRadius,
barMaxWidth,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ import {
pivotTitle,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const columnPercent: VChartSpecPipeline = [
fontFamilyTheme,
initColumn,
stackCornerRadius,
stackInverse,
Expand Down Expand Up @@ -70,6 +72,7 @@ const pivotColumnPercent: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initColumn,
stackCornerRadius,
stackInverse,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/donut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ import {
addRegionPadding,
brush,
dimensionLinkage,
fontFamilyTheme,
} from '../pipes'

const donut: VChartSpecPipeline = [
fontFamilyTheme,
initDonut,
colorAdapter(color, linearColor),
backgroundColor,
Expand All @@ -58,6 +60,7 @@ const pivotDonut: PivotChartSpecPipeline = [
pivotHideIndicatorName,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initDonut,
addRegionPadding,
colorAdapter(color, linearColor),
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/dualAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ import {
labelDualAxis,
tooltipOfDualAxisSeries,
adjustXField,
fontFamilyTheme,
} from '../pipes'

const dualAxis: VChartSpecPipeline = [
fontFamilyTheme,
seriesDualAxis(
[initDualAxis, dualChartType, datasetDualAxis, labelDualAxis, tooltipOfDualAxisSeries],

Expand Down Expand Up @@ -99,6 +101,7 @@ const pivotDualAxis: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
series(
[initDualAxis, dualChartType, datasetDualAxis, labelDualAxis, tooltipOfDualAxisSeries],

Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/funnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import {
funnelTransformStyle,
pivotTitle,
addRegionPadding,
fontFamilyTheme,
} from '../pipes'

const funnel: VChartSpecPipeline = [
fontFamilyTheme,
initFunnel,
backgroundColor,
datasetXY,
Expand All @@ -55,6 +57,7 @@ const pivotFunnel: PivotChartSpecPipeline = [
pivotHideIndicatorName,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initFunnel,
addRegionPadding,
backgroundColor,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ import {
pivotColorLegend,
heatmapColorDomain,
brush,
fontFamilyTheme,
} from '../pipes'
import { initHeatmap } from '../pipes/init/heatmap'

const heatmap: VChartSpecPipeline = [
fontFamilyTheme,
initHeatmap,
backgroundColor,
datasetXY,
Expand All @@ -55,6 +57,7 @@ const pivotHeatmap: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initHeatmap,
backgroundColor,
datasetXY,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ import {
dimensionLinkage,
histogramXLinear,
brush,
fontFamilyTheme,
} from '../pipes'

const histogram: VChartSpecPipeline = [
fontFamilyTheme,
initHistogram,
colorAdapter(color, linearColor),
backgroundColor,
Expand All @@ -64,6 +66,7 @@ const pivotHistogram: PivotChartSpecPipeline = [
pivotGridStyle,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initHistogram,
colorAdapter(color, linearColor),
backgroundColor,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ import {
splitLine,
dimensionLinkage,
brush,
fontFamilyTheme,
} from '../pipes'

const line: VChartSpecPipeline = [
fontFamilyTheme,
initLine,
colorAdapter(color, linearColor),
backgroundColor,
Expand Down Expand Up @@ -69,6 +71,7 @@ const pivotLine: PivotChartSpecPipeline = [
pivotIndicatorsAsRow,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initLine,
colorAdapter(color, linearColor),
backgroundColor,
Expand Down
3 changes: 3 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/pie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ import {
addRegionPadding,
brush,
dimensionLinkage,
fontFamilyTheme,
} from '../pipes'

const pie: VChartSpecPipeline = [
fontFamilyTheme,
initPie,
colorAdapter(color, linearColor),
backgroundColor,
Expand All @@ -58,6 +60,7 @@ const pivotPie: PivotChartSpecPipeline = [
pivotHideIndicatorName,
datasetPivot,
pivotIndicators([
fontFamilyTheme,
initPie,
colorAdapter(color, linearColor),
backgroundColor,
Expand Down
2 changes: 2 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/raceBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import {
yBand,
datasetYX,
isPlayer,
fontFamilyTheme,
} from '../pipes'

const raceBar: VChartSpecPipeline = [
fontFamilyTheme,
initBar,
stackCornerRadius,
barMaxWidth,
Expand Down
2 changes: 2 additions & 0 deletions packages/vseed/src/pipeline/spec/chart/pipeline/raceColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import {
yLinear,
datasetXY,
isPlayer,
fontFamilyTheme,
} from '../pipes'

const raceColumn: VChartSpecPipeline = [
fontFamilyTheme,
initColumn,
stackCornerRadius,
barMaxWidth,
Expand Down
Loading
Loading