@visactor/vchart 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es5/index.js +1 -1
- package/build/index.js +655 -504
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base-chart.d.ts +4 -6
- package/cjs/chart/base-chart.js +44 -45
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/gauge/gauge.js +3 -2
- package/cjs/chart/gauge/gauge.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +3 -3
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/sequence/sequence.js +0 -1
- package/cjs/chart/sequence/sequence.js.map +1 -1
- package/cjs/chart/stack.js +1 -2
- package/cjs/component/axis/cartesian/linear-axis.js.map +1 -1
- package/cjs/component/axis/polar/interface/common.d.ts +1 -0
- package/cjs/component/axis/polar/interface/common.js.map +1 -1
- package/cjs/component/axis/util.d.ts +3 -3
- package/cjs/component/axis/util.js +14 -10
- package/cjs/component/axis/util.js.map +1 -1
- package/cjs/component/base/base-component.d.ts +1 -2
- package/cjs/component/base/base-component.js +2 -39
- package/cjs/component/base/base-component.js.map +1 -1
- package/cjs/component/base/util.d.ts +2 -3
- package/cjs/component/base/util.js +16 -19
- package/cjs/component/base/util.js.map +1 -1
- package/cjs/component/brush/brush.js +1 -1
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/common/trigger/config.d.ts +19 -49
- package/cjs/component/common/trigger/config.js +9 -37
- package/cjs/component/common/trigger/config.js.map +1 -1
- package/cjs/component/crosshair/base.js +14 -11
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/crosshair/config.d.ts +11 -31
- package/cjs/component/crosshair/config.js +9 -26
- package/cjs/component/crosshair/config.js.map +1 -1
- package/cjs/component/crosshair/util.d.ts +3 -3
- package/cjs/component/crosshair/util.js +7 -5
- package/cjs/component/crosshair/util.js.map +1 -1
- package/cjs/component/index.js +2 -1
- package/cjs/component/tooltip/handler/base.js +6 -6
- package/cjs/component/tooltip/handler/base.js.map +1 -1
- package/cjs/component/tooltip/handler/utils/attribute.d.ts +3 -3
- package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
- package/cjs/component/util.d.ts +4 -0
- package/cjs/component/util.js +14 -0
- package/cjs/component/util.js.map +1 -0
- package/cjs/constant/waterfall.js +1 -2
- package/cjs/constant/word-cloud.js +2 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/interface.d.ts +7 -1
- package/cjs/core/interface.js.map +1 -1
- package/cjs/core/vchart.d.ts +3 -2
- package/cjs/core/vchart.js +52 -47
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/sankey.d.ts +1 -0
- package/cjs/data/transforms/sankey.js +16 -3
- package/cjs/data/transforms/sankey.js.map +1 -1
- package/cjs/interaction/config.d.ts +17 -52
- package/cjs/interaction/config.js +9 -42
- package/cjs/interaction/config.js.map +1 -1
- package/cjs/interaction/dimension-trigger.js +2 -1
- package/cjs/interaction/drill/drillable.js +1 -1
- package/cjs/interaction/drill/drillable.js.map +1 -1
- package/cjs/interaction/trigger.js +1 -1
- package/cjs/interaction/trigger.js.map +1 -1
- package/cjs/interaction/zoom/zoomable.js +8 -8
- package/cjs/interaction/zoom/zoomable.js.map +1 -1
- package/cjs/layout/base-layout.js +1 -1
- package/cjs/layout/index.js +1 -1
- package/cjs/layout/interface.js +1 -1
- package/cjs/mark/arc-3d.js +1 -1
- package/cjs/mark/arc.js +1 -1
- package/cjs/mark/area.js +1 -1
- package/cjs/mark/base/base-mark.js +4 -5
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/box-plot.js +1 -1
- package/cjs/model/base-model.d.ts +4 -2
- package/cjs/model/base-model.js +51 -11
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +10 -3
- package/cjs/model/interface.js.map +1 -1
- package/cjs/series/area/area.d.ts +1 -1
- package/cjs/series/area/area.js +1 -1
- package/cjs/series/area/area.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +1 -1
- package/cjs/series/bar/bar.js +1 -1
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +4 -3
- package/cjs/series/base/base-series.js +12 -46
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/cartesian/cartesian.d.ts +3 -0
- package/cjs/series/cartesian/cartesian.js +5 -2
- package/cjs/series/cartesian/cartesian.js.map +1 -1
- package/cjs/series/dot/dot.js +3 -4
- package/cjs/series/dot/dot.js.map +1 -1
- package/cjs/series/gauge/gauge-pointer.d.ts +1 -0
- package/cjs/series/gauge/gauge-pointer.js +1 -1
- package/cjs/series/gauge/gauge-pointer.js.map +1 -1
- package/cjs/series/heatmap/heatmap.js +1 -1
- package/cjs/series/heatmap/heatmap.js.map +1 -1
- package/cjs/series/interface/theme.d.ts +2 -0
- package/cjs/series/interface/theme.js +3 -2
- package/cjs/series/interface/theme.js.map +1 -1
- package/cjs/series/link/link.js +1 -1
- package/cjs/series/link/link.js.map +1 -1
- package/cjs/series/map/map.js +1 -1
- package/cjs/series/map/map.js.map +1 -1
- package/cjs/series/polar/polar.d.ts +1 -0
- package/cjs/series/polar/polar.js +3 -1
- package/cjs/series/polar/polar.js.map +1 -1
- package/cjs/series/polar/progress-like/progress-like.d.ts +1 -1
- package/cjs/series/polar/progress-like/progress-like.js +2 -3
- package/cjs/series/polar/progress-like/progress-like.js.map +1 -1
- package/cjs/series/progress/circular/circular.js +4 -4
- package/cjs/series/progress/circular/circular.js.map +1 -1
- package/cjs/series/range-area/interface.d.ts +2 -1
- package/cjs/series/range-area/interface.js.map +1 -1
- package/cjs/series/rose/rose.d.ts +1 -1
- package/cjs/series/rose/rose.js +2 -2
- package/cjs/series/rose/rose.js.map +1 -1
- package/cjs/series/sankey/sankey.js +20 -17
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/series/scatter/scatter.d.ts +1 -2
- package/cjs/series/scatter/scatter.js +1 -3
- package/cjs/series/scatter/scatter.js.map +1 -1
- package/cjs/series/waterfall/waterfall.d.ts +1 -1
- package/cjs/series/waterfall/waterfall.js +3 -3
- package/cjs/series/waterfall/waterfall.js.map +1 -1
- package/cjs/series/word-cloud/base.js +34 -35
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/cjs/series/word-cloud/word-cloud-3d.js +32 -32
- package/cjs/series/word-cloud/word-cloud-3d.js.map +1 -1
- package/cjs/theme/builtin/index.d.ts +4 -1
- package/cjs/theme/builtin/index.js +13 -8
- package/cjs/theme/builtin/index.js.map +1 -1
- package/cjs/theme/color-scheme/util.js +2 -1
- package/cjs/theme/color-scheme/util.js.map +1 -1
- package/cjs/theme/theme-manager.js +4 -3
- package/cjs/theme/theme-manager.js.map +1 -1
- package/cjs/theme/util.d.ts +5 -0
- package/cjs/theme/util.js +34 -0
- package/cjs/theme/util.js.map +1 -0
- package/cjs/util/spec/merge-theme.d.ts +4 -1
- package/cjs/util/spec/merge-theme.js +22 -13
- package/cjs/util/spec/merge-theme.js.map +1 -1
- package/cjs/util/spec/preprocess.js +1 -0
- package/cjs/util/spec/preprocess.js.map +1 -1
- package/esm/chart/base-chart.d.ts +4 -6
- package/esm/chart/base-chart.js +42 -42
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/gauge/gauge.js +3 -2
- package/esm/chart/gauge/gauge.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +3 -3
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/sequence/sequence.js +0 -1
- package/esm/chart/sequence/sequence.js.map +1 -1
- package/esm/chart/stack.js +1 -2
- package/esm/component/axis/cartesian/linear-axis.js.map +1 -1
- package/esm/component/axis/polar/interface/common.d.ts +1 -0
- package/esm/component/axis/polar/interface/common.js.map +1 -1
- package/esm/component/axis/util.d.ts +3 -3
- package/esm/component/axis/util.js +10 -8
- package/esm/component/axis/util.js.map +1 -1
- package/esm/component/base/base-component.d.ts +1 -2
- package/esm/component/base/base-component.js +3 -40
- package/esm/component/base/base-component.js.map +1 -1
- package/esm/component/base/util.d.ts +2 -3
- package/esm/component/base/util.js +19 -16
- package/esm/component/base/util.js.map +1 -1
- package/esm/component/brush/brush.js +1 -1
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/common/trigger/config.d.ts +19 -49
- package/esm/component/common/trigger/config.js +7 -35
- package/esm/component/common/trigger/config.js.map +1 -1
- package/esm/component/crosshair/base.js +14 -12
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/crosshair/config.d.ts +11 -31
- package/esm/component/crosshair/config.js +8 -25
- package/esm/component/crosshair/config.js.map +1 -1
- package/esm/component/crosshair/util.d.ts +3 -3
- package/esm/component/crosshair/util.js +8 -4
- package/esm/component/crosshair/util.js.map +1 -1
- package/esm/component/index.js +2 -1
- package/esm/component/tooltip/handler/base.js +7 -5
- package/esm/component/tooltip/handler/base.js.map +1 -1
- package/esm/component/tooltip/handler/utils/attribute.d.ts +3 -3
- package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
- package/esm/component/util.d.ts +4 -0
- package/esm/component/util.js +6 -0
- package/esm/component/util.js.map +1 -0
- package/esm/constant/waterfall.js +1 -2
- package/esm/constant/word-cloud.js +2 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/interface.d.ts +7 -1
- package/esm/core/interface.js.map +1 -1
- package/esm/core/vchart.d.ts +3 -2
- package/esm/core/vchart.js +53 -42
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/sankey.d.ts +1 -0
- package/esm/data/transforms/sankey.js +17 -4
- package/esm/data/transforms/sankey.js.map +1 -1
- package/esm/interaction/config.d.ts +17 -52
- package/esm/interaction/config.js +7 -40
- package/esm/interaction/config.js.map +1 -1
- package/esm/interaction/dimension-trigger.js +2 -1
- package/esm/interaction/drill/drillable.js +2 -2
- package/esm/interaction/drill/drillable.js.map +1 -1
- package/esm/interaction/trigger.js +2 -2
- package/esm/interaction/trigger.js.map +1 -1
- package/esm/interaction/zoom/zoomable.js +9 -9
- package/esm/interaction/zoom/zoomable.js.map +1 -1
- package/esm/layout/base-layout.js +1 -1
- package/esm/layout/index.js +1 -1
- package/esm/layout/interface.js +1 -1
- package/esm/mark/arc-3d.js +1 -1
- package/esm/mark/arc.js +1 -1
- package/esm/mark/area.js +1 -1
- package/esm/mark/base/base-mark.js +4 -5
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/box-plot.js +1 -1
- package/esm/model/base-model.d.ts +4 -2
- package/esm/model/base-model.js +53 -10
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +10 -3
- package/esm/model/interface.js.map +1 -1
- package/esm/series/area/area.d.ts +1 -1
- package/esm/series/area/area.js +1 -1
- package/esm/series/area/area.js.map +1 -1
- package/esm/series/bar/bar.d.ts +1 -1
- package/esm/series/bar/bar.js +1 -1
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +4 -3
- package/esm/series/base/base-series.js +14 -46
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/cartesian/cartesian.d.ts +3 -0
- package/esm/series/cartesian/cartesian.js +4 -3
- package/esm/series/cartesian/cartesian.js.map +1 -1
- package/esm/series/dot/dot.js +2 -4
- package/esm/series/dot/dot.js.map +1 -1
- package/esm/series/gauge/gauge-pointer.d.ts +1 -0
- package/esm/series/gauge/gauge-pointer.js +1 -1
- package/esm/series/gauge/gauge-pointer.js.map +1 -1
- package/esm/series/heatmap/heatmap.js +1 -1
- package/esm/series/heatmap/heatmap.js.map +1 -1
- package/esm/series/interface/theme.d.ts +2 -0
- package/esm/series/interface/theme.js +4 -1
- package/esm/series/interface/theme.js.map +1 -1
- package/esm/series/link/link.js +1 -1
- package/esm/series/link/link.js.map +1 -1
- package/esm/series/map/map.js +1 -1
- package/esm/series/map/map.js.map +1 -1
- package/esm/series/polar/polar.d.ts +1 -0
- package/esm/series/polar/polar.js +3 -2
- package/esm/series/polar/polar.js.map +1 -1
- package/esm/series/polar/progress-like/progress-like.d.ts +1 -1
- package/esm/series/polar/progress-like/progress-like.js +2 -3
- package/esm/series/polar/progress-like/progress-like.js.map +1 -1
- package/esm/series/progress/circular/circular.js +4 -4
- package/esm/series/progress/circular/circular.js.map +1 -1
- package/esm/series/range-area/interface.d.ts +2 -1
- package/esm/series/range-area/interface.js.map +1 -1
- package/esm/series/rose/rose.d.ts +1 -1
- package/esm/series/rose/rose.js +1 -1
- package/esm/series/rose/rose.js.map +1 -1
- package/esm/series/sankey/sankey.js +12 -9
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/series/scatter/scatter.d.ts +1 -2
- package/esm/series/scatter/scatter.js +2 -3
- package/esm/series/scatter/scatter.js.map +1 -1
- package/esm/series/waterfall/waterfall.d.ts +1 -1
- package/esm/series/waterfall/waterfall.js +3 -3
- package/esm/series/waterfall/waterfall.js.map +1 -1
- package/esm/series/word-cloud/base.js +33 -35
- package/esm/series/word-cloud/base.js.map +1 -1
- package/esm/series/word-cloud/word-cloud-3d.js +32 -32
- package/esm/series/word-cloud/word-cloud-3d.js.map +1 -1
- package/esm/theme/builtin/index.d.ts +4 -1
- package/esm/theme/builtin/index.js +15 -6
- package/esm/theme/builtin/index.js.map +1 -1
- package/esm/theme/color-scheme/util.js +1 -1
- package/esm/theme/color-scheme/util.js.map +1 -1
- package/esm/theme/theme-manager.js +5 -4
- package/esm/theme/theme-manager.js.map +1 -1
- package/esm/theme/util.d.ts +5 -0
- package/esm/theme/util.js +34 -0
- package/esm/theme/util.js.map +1 -0
- package/esm/util/spec/merge-theme.d.ts +4 -1
- package/esm/util/spec/merge-theme.js +18 -10
- package/esm/util/spec/merge-theme.js.map +1 -1
- package/esm/util/spec/preprocess.js +2 -1
- package/esm/util/spec/preprocess.js.map +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/util/spec/preprocess.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/util/spec/preprocess.ts"],"names":[],"mappings":"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","file":"preprocess.js","sourcesContent":["import { isArray, isFunction, isNil, isObject, isString, isValid, isValidNumber } from '@visactor/vutils';\nimport { seriesMarkNameSet, type SeriesTypeEnum } from '../../series/interface';\nimport type { IThemeColorScheme } from '../../theme/color-scheme/interface';\nimport { isDataView, isHTMLElement } from './common';\nimport { getActualColor, isColorKey } from '../../theme/color-scheme/util';\nimport { normalizeLayoutPaddingSpec } from '../space';\n\n/**\n * 对 spec 或者类 spec 配置(如 theme)进行预处理,如进行语义化颜色的转换等\n * @param type 需要转换的对象类型(spec 或者 theme)\n * @param obj 需要转换的对象\n * @param colorScheme 主题色板\n * @param seriesType 当前系列类型\n * @returns\n */\nexport function preprocessSpecOrTheme(\n type: 'spec' | 'theme' | 'mark-spec' | 'mark-theme',\n obj: any,\n colorScheme?: IThemeColorScheme,\n seriesType?: SeriesTypeEnum\n): any {\n if (isNil(obj)) {\n return obj;\n }\n if (isArray(obj)) {\n return obj.map(element => {\n if (isObject(element) && !isFunction(element)) {\n return preprocessSpecOrTheme(type, element, colorScheme, seriesType);\n }\n return element;\n });\n }\n\n const newObj = {};\n Object.keys(obj).forEach(key => {\n const value = obj[key];\n // 绕过数据\n if (key.includes('data')) {\n newObj[key] = value;\n return;\n }\n if (isObject(value)) {\n // 绕过不可深拷贝的对象\n if (isFunction(value) || isDataView(value) || isHTMLElement(value)) {\n newObj[key] = value;\n return;\n }\n if (isColorKey(value)) {\n // 查询、替换语义化颜色\n newObj[key] = getActualColor(value, colorScheme, seriesType);\n } else {\n newObj[key] = preprocessSpecOrTheme(\n seriesMarkNameSet.has(key) ? (type.includes('spec') ? 'mark-spec' : 'mark-theme') : type,\n value,\n colorScheme,\n seriesType\n );\n }\n } else if (!type.includes('mark') && key === 'padding') {\n // 标准化 padding\n newObj[key] = normalizeLayoutPaddingSpec(value);\n } else if (!type.includes('theme') && key === 'lineHeight' && isString(value) && value[value.length - 1] === '%') {\n if (isValid(obj.fontSize)) {\n // 处理 lineHeight 的比例值\n // FIXME: vrender 支持行高字符串后删掉这段逻辑\n const scale = Number.parseFloat(value.substring(0, value.length - 1)) / 100;\n const newValue = obj.fontSize * scale;\n if (isValidNumber(newValue)) {\n newObj[key] = newValue;\n }\n }\n // 如果 spec 同级里没有 fontSize 配置,lineHeight 比例值失效\n } else {\n newObj[key] = value;\n }\n });\n\n return newObj;\n}\n"]}
|
|
@@ -11,7 +11,6 @@ import type { IEvent } from '../event/interface';
|
|
|
11
11
|
import type { DataView } from '@visactor/vdataset';
|
|
12
12
|
import type { DataSet } from '@visactor/vdataset/es/data-set';
|
|
13
13
|
import { Stack } from './stack';
|
|
14
|
-
import type { ITheme } from '../theme/interface';
|
|
15
14
|
import type { IParserOptions } from '@visactor/vdataset/es/parser';
|
|
16
15
|
import type { IBoundsLike } from '@visactor/vutils';
|
|
17
16
|
import type { IRunningConfig as IMorphConfig, IMark as IVGrammarMark, IView } from '@visactor/vgrammar-core';
|
|
@@ -25,7 +24,6 @@ export declare class BaseChart extends CompilableBase implements IChart {
|
|
|
25
24
|
getSpec(): any;
|
|
26
25
|
setSpec(s: any): void;
|
|
27
26
|
getOption(): IChartOption;
|
|
28
|
-
protected _theme: ITheme;
|
|
29
27
|
protected _regions: IRegion[];
|
|
30
28
|
protected _series: ISeries[];
|
|
31
29
|
protected _components: IComponent[];
|
|
@@ -129,11 +127,10 @@ export declare class BaseChart extends CompilableBase implements IChart {
|
|
|
129
127
|
protected isValidSeries(seriesType: string): boolean;
|
|
130
128
|
protected _getDefaultSeriesSpec(spec: any): any;
|
|
131
129
|
private _updateLayoutRect;
|
|
132
|
-
|
|
133
|
-
setCurrentTheme(theme: ITheme, reInit?: boolean): void;
|
|
130
|
+
setCurrentTheme(reInit?: boolean): void;
|
|
134
131
|
protected setRegionTheme(reInit?: boolean): void;
|
|
135
|
-
protected setComponentTheme(
|
|
136
|
-
protected setSeriesTheme(
|
|
132
|
+
protected setComponentTheme(reInit?: boolean): void;
|
|
133
|
+
protected setSeriesTheme(reInit?: boolean): void;
|
|
137
134
|
clear(): void;
|
|
138
135
|
compile(): void;
|
|
139
136
|
afterCompile(): void;
|
|
@@ -153,4 +150,5 @@ export declare class BaseChart extends CompilableBase implements IChart {
|
|
|
153
150
|
protected _disableMarkAnimation(states: string | string[]): void;
|
|
154
151
|
protected _setStateInDatum(stateKey: string, checkReverse: boolean, datum: MaybeArray<Datum> | null, filter?: (series: ISeries, mark: IMark) => boolean, region?: IRegionQuerier): void;
|
|
155
152
|
setDimensionIndex(value: StringOrNumber, opt: DimensionIndexOption): void;
|
|
153
|
+
getColorScheme(): import("../theme/color-scheme/interface").IThemeColorScheme;
|
|
156
154
|
}
|
package/esm/chart/base-chart.js
CHANGED
|
@@ -64,6 +64,10 @@ import { isDiscrete } from "@visactor/vscale";
|
|
|
64
64
|
|
|
65
65
|
import { updateDataViewInData } from "../data/initialize";
|
|
66
66
|
|
|
67
|
+
import { getThemeFromOption } from "../theme/util";
|
|
68
|
+
|
|
69
|
+
import { defaultChartLevelTheme } from "../theme";
|
|
70
|
+
|
|
67
71
|
export class BaseChart extends CompilableBase {
|
|
68
72
|
getSpec() {
|
|
69
73
|
return this._spec;
|
|
@@ -95,7 +99,7 @@ export class BaseChart extends CompilableBase {
|
|
|
95
99
|
return this._chartData;
|
|
96
100
|
}
|
|
97
101
|
constructor(spec, option) {
|
|
98
|
-
var _a, _b, _c
|
|
102
|
+
var _a, _b, _c;
|
|
99
103
|
super(option), this.type = "chart", this.id = createID(), this._regions = [], this._series = [],
|
|
100
104
|
this._components = [], this._layoutRect = {
|
|
101
105
|
x: 0,
|
|
@@ -138,9 +142,9 @@ export class BaseChart extends CompilableBase {
|
|
|
138
142
|
this.getComponentByUserId = userId => {
|
|
139
143
|
const component = this._components.find((s => s.userId === userId));
|
|
140
144
|
if (component) return component;
|
|
141
|
-
}, this.
|
|
145
|
+
}, this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = spec.padding) && void 0 !== _a ? _a : getThemeFromOption("padding", this._option)),
|
|
142
146
|
this._event = new Event(option.eventDispatcher, option.mode), this._dataSet = option.dataSet,
|
|
143
|
-
this._chartData = new ChartData(this._dataSet, null === (
|
|
147
|
+
this._chartData = new ChartData(this._dataSet, null === (_b = this._option) || void 0 === _b ? void 0 : _b.onError),
|
|
144
148
|
this._modelOption = Object.assign(Object.assign({}, option), {
|
|
145
149
|
mode: this._option.mode,
|
|
146
150
|
map: this._idMap,
|
|
@@ -148,7 +152,7 @@ export class BaseChart extends CompilableBase {
|
|
|
148
152
|
getChartViewRect: () => this._viewRect,
|
|
149
153
|
getChart: () => this,
|
|
150
154
|
globalScale: this._globalScale,
|
|
151
|
-
onError: null === (
|
|
155
|
+
onError: null === (_c = this._option) || void 0 === _c ? void 0 : _c.onError
|
|
152
156
|
}), this._stack = new Stack(this), this._spec = spec;
|
|
153
157
|
}
|
|
154
158
|
created() {
|
|
@@ -216,7 +220,6 @@ export class BaseChart extends CompilableBase {
|
|
|
216
220
|
region: region,
|
|
217
221
|
specIndex: index,
|
|
218
222
|
specKey: "series",
|
|
219
|
-
getTheme: () => this._theme,
|
|
220
223
|
globalScale: this._globalScale,
|
|
221
224
|
getSeriesData: this._chartData.getSeriesData.bind(this._chartData),
|
|
222
225
|
sourceDataList: this._chartData.dataList
|
|
@@ -236,7 +239,6 @@ export class BaseChart extends CompilableBase {
|
|
|
236
239
|
getRegionsInIndex: this.getRegionsInIndex,
|
|
237
240
|
getRegionsInIds: this.getRegionsInIds,
|
|
238
241
|
getRegionsInUserIdOrIndex: this.getRegionsInUserIdOrIndex,
|
|
239
|
-
getTheme: () => this._theme,
|
|
240
242
|
getAllSeries: this.getAllSeries,
|
|
241
243
|
getSeriesInIndex: this.getSeriesInIndex,
|
|
242
244
|
getSeriesInIds: this.getSeriesInIds,
|
|
@@ -297,10 +299,13 @@ export class BaseChart extends CompilableBase {
|
|
|
297
299
|
if (this._layoutFunc = this._option.layout, !this._layoutFunc) {
|
|
298
300
|
let use3dLayout = !1;
|
|
299
301
|
(this._spec.zField || this._spec.series && this._spec.series.some((s => s.zField))) && (use3dLayout = !0);
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
const constructor = Factory.getLayoutInKey(null !== (_b = null === (_a = this._spec.layout) || void 0 === _a ? void 0 : _a.type) && void 0 !== _b ? _b : use3dLayout ? "layout3d" : "base");
|
|
303
|
+
if (constructor) {
|
|
304
|
+
const layout = new constructor(this._spec.layout, {
|
|
305
|
+
onError: null === (_c = this._option) || void 0 === _c ? void 0 : _c.onError
|
|
306
|
+
});
|
|
307
|
+
this._layoutFunc = layout.layoutItems.bind(layout);
|
|
308
|
+
}
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
layout(params) {
|
|
@@ -379,9 +384,10 @@ export class BaseChart extends CompilableBase {
|
|
|
379
384
|
return this._chartData.getSeriesData(id, index);
|
|
380
385
|
}
|
|
381
386
|
_transformSpecScale() {
|
|
382
|
-
var _a, _b
|
|
387
|
+
var _a, _b;
|
|
383
388
|
const scales = null !== (_a = this._spec.scales) && void 0 !== _a ? _a : [];
|
|
384
389
|
let colorScaleSpec = scales.find((s => "color" === s.id));
|
|
390
|
+
const colorScheme = this.getColorScheme();
|
|
385
391
|
if (!colorScaleSpec && (colorScaleSpec = {
|
|
386
392
|
type: "ordinal",
|
|
387
393
|
id: "color",
|
|
@@ -389,21 +395,16 @@ export class BaseChart extends CompilableBase {
|
|
|
389
395
|
range: null
|
|
390
396
|
}, scales.push(colorScaleSpec), this._spec.color)) {
|
|
391
397
|
const colorSpec = this._spec.color;
|
|
392
|
-
if (isArray(colorSpec)) colorScaleSpec.range = colorSpec.map((color => {
|
|
393
|
-
var _a;
|
|
394
|
-
return getActualColor(color, null === (_a = this._theme) || void 0 === _a ? void 0 : _a.colorScheme);
|
|
395
|
-
})); else {
|
|
398
|
+
if (isArray(colorSpec)) colorScaleSpec.range = colorSpec.map((color => getActualColor(color, colorScheme))); else {
|
|
396
399
|
const tempSpec = colorSpec;
|
|
397
|
-
tempSpec.range && (tempSpec.range = tempSpec.range.map((color =>
|
|
398
|
-
|
|
399
|
-
return getActualColor(color, null === (_a = this._theme) || void 0 === _a ? void 0 : _a.colorScheme);
|
|
400
|
-
}))), Object.prototype.hasOwnProperty.call(tempSpec, "type") && (colorScaleSpec.type = tempSpec.type),
|
|
400
|
+
tempSpec.range && (tempSpec.range = tempSpec.range.map((color => getActualColor(color, colorScheme)))),
|
|
401
|
+
Object.prototype.hasOwnProperty.call(tempSpec, "type") && (colorScaleSpec.type = tempSpec.type),
|
|
401
402
|
Object.prototype.hasOwnProperty.call(tempSpec, "domain") && (colorScaleSpec.domain = tempSpec.domain),
|
|
402
403
|
Object.prototype.hasOwnProperty.call(tempSpec, "range") && (colorScaleSpec.range = tempSpec.range),
|
|
403
404
|
Object.prototype.hasOwnProperty.call(tempSpec, "specified") && (colorScaleSpec.specified = tempSpec.specified);
|
|
404
405
|
}
|
|
405
406
|
}
|
|
406
|
-
return (null === (_b = colorScaleSpec.range) || void 0 === _b ? void 0 : _b.length) || (colorScaleSpec.range = getDataScheme(
|
|
407
|
+
return (null === (_b = colorScaleSpec.range) || void 0 === _b ? void 0 : _b.length) || (colorScaleSpec.range = getDataScheme(colorScheme),
|
|
407
408
|
colorScaleSpec.rangeTheme = !0), scales;
|
|
408
409
|
}
|
|
409
410
|
createGlobalScale() {
|
|
@@ -422,10 +423,8 @@ export class BaseChart extends CompilableBase {
|
|
|
422
423
|
mergeUpdateResult(result, this._globalScale.updateSpec(this._transformSpecScale()));
|
|
423
424
|
}
|
|
424
425
|
updateGlobalScaleTheme() {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
colorSpec.rangeTheme && (colorSpec.range = getDataScheme(null === (_a = this._theme) || void 0 === _a ? void 0 : _a.colorScheme),
|
|
428
|
-
this._globalScale.getScale("color").range(colorSpec.range));
|
|
426
|
+
const colorSpec = this._globalScale.getScaleSpec("color"), colorScheme = this.getColorScheme();
|
|
427
|
+
colorSpec.rangeTheme && (colorSpec.range = getDataScheme(colorScheme), this._globalScale.getScale("color").range(colorSpec.range));
|
|
429
428
|
}
|
|
430
429
|
updateSpec(spec, morphConfig) {
|
|
431
430
|
const result = {
|
|
@@ -448,8 +447,8 @@ export class BaseChart extends CompilableBase {
|
|
|
448
447
|
result.reMake || this.updateGlobalScaleDomain(), result)))));
|
|
449
448
|
}
|
|
450
449
|
updateChartConfig(result, oldSpec) {
|
|
451
|
-
var _a
|
|
452
|
-
this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = this._spec.padding) && void 0 !== _a ? _a :
|
|
450
|
+
var _a;
|
|
451
|
+
this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = this._spec.padding) && void 0 !== _a ? _a : getThemeFromOption("padding", this._option)),
|
|
453
452
|
this._updateLayoutRect(this._viewBox), isEqual(this._spec.background, oldSpec.background) || (result.reMake = !0);
|
|
454
453
|
}
|
|
455
454
|
updateDataSpec(result) {
|
|
@@ -498,7 +497,7 @@ export class BaseChart extends CompilableBase {
|
|
|
498
497
|
label: spec.label,
|
|
499
498
|
seriesStyle: spec.seriesStyle,
|
|
500
499
|
animation: spec.animation,
|
|
501
|
-
animationThreshold: null !== (_a = spec.animationThreshold) && void 0 !== _a ? _a : this.
|
|
500
|
+
animationThreshold: null !== (_a = spec.animationThreshold) && void 0 !== _a ? _a : getThemeFromOption("animationThreshold", this._option),
|
|
502
501
|
animationAppear: spec.animationAppear,
|
|
503
502
|
animationDisappear: spec.animationDisappear,
|
|
504
503
|
animationEnter: spec.animationEnter,
|
|
@@ -535,26 +534,23 @@ export class BaseChart extends CompilableBase {
|
|
|
535
534
|
this._layoutRect.height = viewRect.height - this.padding.top - this.padding.bottom,
|
|
536
535
|
this._layoutRect.x = this.padding.left, this._layoutRect.y = this.padding.top, this._event.emit(ChartEvent.layoutRectUpdate, {});
|
|
537
536
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
setCurrentTheme(theme, reInit = !0) {
|
|
542
|
-
this._theme = theme, this.setLayoutTag(!0), this.transformSpec(this._spec), this.updateGlobalScaleTheme(),
|
|
543
|
-
this.setRegionTheme(reInit), this.setComponentTheme(theme, reInit), this.setSeriesTheme(theme, reInit);
|
|
537
|
+
setCurrentTheme(reInit = !0) {
|
|
538
|
+
this.setLayoutTag(!0), this.transformSpec(this._spec), this.updateGlobalScaleTheme(),
|
|
539
|
+
this.setRegionTheme(reInit), this.setComponentTheme(reInit), this.setSeriesTheme(reInit);
|
|
544
540
|
}
|
|
545
541
|
setRegionTheme(reInit = !0) {
|
|
546
|
-
this._regions.forEach((r => {
|
|
547
|
-
|
|
548
|
-
}));
|
|
542
|
+
this._regions.forEach((r => __awaiter(this, void 0, void 0, (function*() {
|
|
543
|
+
yield r.setCurrentTheme(reInit);
|
|
544
|
+
}))));
|
|
549
545
|
}
|
|
550
|
-
setComponentTheme(
|
|
551
|
-
this._components.forEach((c => {
|
|
552
|
-
|
|
553
|
-
}));
|
|
546
|
+
setComponentTheme(reInit = !0) {
|
|
547
|
+
this._components.forEach((c => __awaiter(this, void 0, void 0, (function*() {
|
|
548
|
+
yield c.setCurrentTheme(reInit);
|
|
549
|
+
}))));
|
|
554
550
|
}
|
|
555
|
-
setSeriesTheme(
|
|
551
|
+
setSeriesTheme(reInit = !0) {
|
|
556
552
|
this._series.forEach((s => __awaiter(this, void 0, void 0, (function*() {
|
|
557
|
-
|
|
553
|
+
yield s.setCurrentTheme(reInit);
|
|
558
554
|
}))));
|
|
559
555
|
}
|
|
560
556
|
clear() {
|
|
@@ -745,5 +741,9 @@ export class BaseChart extends CompilableBase {
|
|
|
745
741
|
})));
|
|
746
742
|
}
|
|
747
743
|
}
|
|
744
|
+
getColorScheme() {
|
|
745
|
+
var _a, _b, _c;
|
|
746
|
+
return (null !== (_c = null === (_b = (_a = this._option).getThemeConfig) || void 0 === _b ? void 0 : _b.call(_a).chartLevelTheme) && void 0 !== _c ? _c : defaultChartLevelTheme).colorScheme;
|
|
747
|
+
}
|
|
748
748
|
}
|
|
749
749
|
//# sourceMappingURL=base-chart.js.map
|