@visactor/vgrammar-core 0.8.0 → 0.8.2
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/cjs/component/axis.js +9 -9
- package/cjs/component/axis.js.map +1 -1
- package/cjs/component/datazoom.js +9 -9
- package/cjs/component/datazoom.js.map +1 -1
- package/cjs/component/grid.js +18 -18
- package/cjs/component/grid.js.map +1 -1
- package/cjs/component/label.js +27 -22
- package/cjs/component/label.js.map +1 -1
- package/cjs/component/legend.js +13 -13
- package/cjs/component/legend.js.map +1 -1
- package/cjs/component/scrollbar.js +7 -7
- package/cjs/component/scrollbar.js.map +1 -1
- package/cjs/component/slider.js +5 -5
- package/cjs/component/slider.js.map +1 -1
- package/cjs/component/title.js +5 -5
- package/cjs/component/title.js.map +1 -1
- package/cjs/core/factory.d.ts +5 -1
- package/cjs/core/factory.js +13 -3
- package/cjs/core/factory.js.map +1 -1
- package/cjs/graph/animation/animate.d.ts +1 -0
- package/cjs/graph/animation/animate.js +4 -0
- package/cjs/graph/animation/animate.js.map +1 -1
- package/cjs/graph/animation/animation/move.js +10 -8
- package/cjs/graph/animation/animation/move.js.map +1 -1
- package/cjs/graph/attributes/common.js +2 -10
- package/cjs/graph/attributes/common.js.map +1 -1
- package/cjs/graph/attributes/helpers.d.ts +2 -2
- package/cjs/graph/attributes/helpers.js +50 -17
- package/cjs/graph/attributes/helpers.js.map +1 -1
- package/cjs/graph/attributes/index.d.ts +4 -10
- package/cjs/graph/attributes/index.js +16 -251
- package/cjs/graph/attributes/index.js.map +1 -1
- package/cjs/graph/attributes/line.d.ts +3 -0
- package/cjs/graph/attributes/line.js +46 -0
- package/cjs/graph/attributes/line.js.map +1 -0
- package/cjs/graph/attributes/transform.d.ts +5 -0
- package/cjs/graph/attributes/transform.js +167 -0
- package/cjs/graph/attributes/transform.js.map +1 -0
- package/cjs/graph/canvas-renderer.js +1 -1
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/constants.d.ts +0 -1
- package/cjs/graph/constants.js +2 -3
- package/cjs/graph/constants.js.map +1 -1
- package/cjs/graph/element.js +12 -14
- package/cjs/graph/element.js.map +1 -1
- package/cjs/graph/glyph-element.js +6 -7
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/graph/layout/relative.js.map +1 -1
- package/cjs/graph/mark/encode.js +4 -4
- package/cjs/graph/mark/encode.js.map +1 -1
- package/cjs/index.d.ts +3 -1
- package/cjs/index.js +3 -2
- package/cjs/index.js.map +1 -1
- package/cjs/interactions/base.js.map +1 -1
- package/cjs/interactions/brush-base.js +2 -2
- package/cjs/interactions/brush-base.js.map +1 -1
- package/cjs/interactions/brush-filter.js +2 -2
- package/cjs/interactions/brush-filter.js.map +1 -1
- package/cjs/interactions/crosshair.d.ts +1 -1
- package/cjs/interactions/crosshair.js +15 -15
- package/cjs/interactions/crosshair.js.map +1 -1
- package/cjs/interactions/datazoom-filter.js +3 -3
- package/cjs/interactions/datazoom-filter.js.map +1 -1
- package/cjs/interactions/drill-down.js +2 -2
- package/cjs/interactions/drill-down.js.map +1 -1
- package/cjs/interactions/legend-filter.js +3 -3
- package/cjs/interactions/legend-filter.js.map +1 -1
- package/cjs/interactions/player-filter.js +3 -3
- package/cjs/interactions/player-filter.js.map +1 -1
- package/cjs/interactions/roll-up.js +2 -2
- package/cjs/interactions/roll-up.js.map +1 -1
- package/cjs/interactions/scrollbar-filter.js +3 -3
- package/cjs/interactions/scrollbar-filter.js.map +1 -1
- package/cjs/interactions/slider-filter.js +3 -3
- package/cjs/interactions/slider-filter.js.map +1 -1
- package/cjs/parse/view.js +1 -1
- package/cjs/parse/view.js.map +1 -1
- package/cjs/semantic-marks/cell.d.ts +3 -1
- package/cjs/semantic-marks/cell.js +10 -4
- package/cjs/semantic-marks/cell.js.map +1 -1
- package/cjs/semantic-marks/interval.d.ts +2 -0
- package/cjs/semantic-marks/interval.js +10 -4
- package/cjs/semantic-marks/interval.js.map +1 -1
- package/cjs/semantic-marks/text.d.ts +1 -0
- package/cjs/semantic-marks/text.js +3 -3
- package/cjs/semantic-marks/text.js.map +1 -1
- package/cjs/theme/common/component.d.ts +2 -1
- package/cjs/theme/common/component.js +13 -1
- package/cjs/theme/common/component.js.map +1 -1
- package/cjs/theme/dark.js.map +1 -1
- package/cjs/transforms/data/sampling.d.ts +2 -0
- package/cjs/transforms/data/sampling.js +111 -0
- package/cjs/transforms/data/sampling.js.map +1 -0
- package/cjs/transforms/index.d.ts +1 -1
- package/cjs/transforms/index.js +6 -6
- package/cjs/transforms/index.js.map +1 -1
- package/cjs/transforms/util/util.d.ts +4 -0
- package/cjs/transforms/util/util.js +20 -2
- package/cjs/transforms/util/util.js.map +1 -1
- package/cjs/types/animate.d.ts +6 -1
- package/cjs/types/animate.js.map +1 -1
- package/cjs/types/grammar.d.ts +1 -1
- package/cjs/types/grammar.js.map +1 -1
- package/cjs/types/mark.d.ts +5 -1
- package/cjs/types/mark.js.map +1 -1
- package/cjs/types/theme.d.ts +2 -1
- package/cjs/types/theme.js.map +1 -1
- package/cjs/types/transform.d.ts +5 -5
- package/cjs/types/transform.js.map +1 -1
- package/cjs/types/view.d.ts +2 -0
- package/cjs/types/view.js.map +1 -1
- package/cjs/view/View.d.ts +0 -1
- package/cjs/view/View.js +18 -27
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/animate.d.ts +1 -0
- package/cjs/view/animate.js +12 -12
- package/cjs/view/animate.js.map +1 -1
- package/cjs/view/constants.d.ts +0 -3
- package/cjs/view/constants.js +2 -3
- package/cjs/view/constants.js.map +1 -1
- package/cjs/view/dataflow.d.ts +1 -0
- package/cjs/view/dataflow.js +9 -4
- package/cjs/view/dataflow.js.map +1 -1
- package/cjs/view/grammar-record.js +5 -5
- package/cjs/view/grammar-record.js.map +1 -1
- package/cjs/view/mark.js +1 -1
- package/cjs/view/mark.js.map +1 -1
- package/es/component/axis.js +1 -1
- package/es/component/axis.js.map +1 -1
- package/es/component/datazoom.js +5 -5
- package/es/component/datazoom.js.map +1 -1
- package/es/component/grid.js +1 -1
- package/es/component/grid.js.map +1 -1
- package/es/component/label.js +13 -8
- package/es/component/label.js.map +1 -1
- package/es/component/legend.js +1 -1
- package/es/component/legend.js.map +1 -1
- package/es/component/scrollbar.js +1 -1
- package/es/component/scrollbar.js.map +1 -1
- package/es/component/slider.js +1 -1
- package/es/component/slider.js.map +1 -1
- package/es/component/title.js +1 -1
- package/es/component/title.js.map +1 -1
- package/es/core/factory.d.ts +5 -1
- package/es/core/factory.js +11 -1
- package/es/core/factory.js.map +1 -1
- package/es/graph/animation/animate.d.ts +1 -0
- package/es/graph/animation/animate.js +4 -0
- package/es/graph/animation/animate.js.map +1 -1
- package/es/graph/animation/animation/move.js +5 -5
- package/es/graph/animation/animation/move.js.map +1 -1
- package/es/graph/attributes/common.js +2 -7
- package/es/graph/attributes/common.js.map +1 -1
- package/es/graph/attributes/helpers.d.ts +2 -2
- package/es/graph/attributes/helpers.js +46 -12
- package/es/graph/attributes/helpers.js.map +1 -1
- package/es/graph/attributes/index.d.ts +4 -10
- package/es/graph/attributes/index.js +4 -227
- package/es/graph/attributes/index.js.map +1 -1
- package/es/graph/attributes/line.d.ts +3 -0
- package/es/graph/attributes/line.js +42 -0
- package/es/graph/attributes/line.js.map +1 -0
- package/es/graph/attributes/transform.d.ts +5 -0
- package/es/graph/attributes/transform.js +153 -0
- package/es/graph/attributes/transform.js.map +1 -0
- package/es/graph/canvas-renderer.js +1 -1
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/constants.d.ts +0 -1
- package/es/graph/constants.js +0 -2
- package/es/graph/constants.js.map +1 -1
- package/es/graph/element.js +11 -11
- package/es/graph/element.js.map +1 -1
- package/es/graph/glyph-element.js +3 -4
- package/es/graph/glyph-element.js.map +1 -1
- package/es/graph/layout/relative.js.map +1 -1
- package/es/graph/mark/encode.js +1 -1
- package/es/graph/mark/encode.js.map +1 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +5 -1
- package/es/index.js.map +1 -1
- package/es/interactions/base.js.map +1 -1
- package/es/interactions/brush-base.js +1 -1
- package/es/interactions/brush-base.js.map +1 -1
- package/es/interactions/brush-filter.js +2 -3
- package/es/interactions/brush-filter.js.map +1 -1
- package/es/interactions/crosshair.d.ts +1 -1
- package/es/interactions/crosshair.js +1 -1
- package/es/interactions/crosshair.js.map +1 -1
- package/es/interactions/datazoom-filter.js +1 -1
- package/es/interactions/datazoom-filter.js.map +1 -1
- package/es/interactions/drill-down.js +1 -1
- package/es/interactions/drill-down.js.map +1 -1
- package/es/interactions/element-highlight-by-group.js +2 -1
- package/es/interactions/index.js +1 -2
- package/es/interactions/legend-filter.js +2 -2
- package/es/interactions/legend-filter.js.map +1 -1
- package/es/interactions/player-filter.js +2 -2
- package/es/interactions/player-filter.js.map +1 -1
- package/es/interactions/roll-up.js +2 -2
- package/es/interactions/roll-up.js.map +1 -1
- package/es/interactions/scrollbar-filter.js +2 -2
- package/es/interactions/scrollbar-filter.js.map +1 -1
- package/es/interactions/slider-filter.js +2 -2
- package/es/interactions/slider-filter.js.map +1 -1
- package/es/interactions/tooltip.js +1 -1
- package/es/interactions/view-drag-mixin.js +1 -1
- package/es/parse/coordinate.js +1 -1
- package/es/parse/event.js +1 -1
- package/es/parse/mark.js +1 -1
- package/es/parse/option.js +1 -1
- package/es/parse/scale.js +2 -1
- package/es/parse/transform.js +1 -1
- package/es/parse/util.js +1 -1
- package/es/parse/view.js +2 -2
- package/es/parse/view.js.map +1 -1
- package/es/semantic-marks/cell.d.ts +3 -1
- package/es/semantic-marks/cell.js +11 -1
- package/es/semantic-marks/cell.js.map +1 -1
- package/es/semantic-marks/interval.d.ts +2 -0
- package/es/semantic-marks/interval.js +9 -1
- package/es/semantic-marks/interval.js.map +1 -1
- package/es/semantic-marks/text.d.ts +1 -0
- package/es/semantic-marks/text.js +3 -1
- package/es/semantic-marks/text.js.map +1 -1
- package/es/theme/common/component.d.ts +2 -1
- package/es/theme/common/component.js +14 -0
- package/es/theme/common/component.js.map +1 -1
- package/es/theme/dark.js.map +1 -1
- package/es/transforms/data/sampling.d.ts +2 -0
- package/es/transforms/data/sampling.js +105 -0
- package/es/transforms/data/sampling.js.map +1 -0
- package/es/transforms/index.d.ts +1 -1
- package/es/transforms/index.js +4 -4
- package/es/transforms/index.js.map +1 -1
- package/es/transforms/util/util.d.ts +4 -0
- package/es/transforms/util/util.js +17 -0
- package/es/transforms/util/util.js.map +1 -1
- package/es/types/animate.d.ts +6 -1
- package/es/types/animate.js.map +1 -1
- package/es/types/grammar.d.ts +1 -1
- package/es/types/grammar.js.map +1 -1
- package/es/types/mark.d.ts +5 -1
- package/es/types/mark.js.map +1 -1
- package/es/types/theme.d.ts +2 -1
- package/es/types/theme.js.map +1 -1
- package/es/types/transform.d.ts +5 -5
- package/es/types/transform.js.map +1 -1
- package/es/types/view.d.ts +2 -0
- package/es/types/view.js.map +1 -1
- package/es/view/View.d.ts +0 -1
- package/es/view/View.js +15 -29
- package/es/view/View.js.map +1 -1
- package/es/view/animate.d.ts +1 -0
- package/es/view/animate.js +6 -6
- package/es/view/animate.js.map +1 -1
- package/es/view/constants.d.ts +0 -3
- package/es/view/constants.js +0 -6
- package/es/view/constants.js.map +1 -1
- package/es/view/dataflow.d.ts +1 -0
- package/es/view/dataflow.js +9 -4
- package/es/view/dataflow.js.map +1 -1
- package/es/view/grammar-record.js +1 -1
- package/es/view/grammar-record.js.map +1 -1
- package/es/view/mark.js +1 -1
- package/es/view/mark.js.map +1 -1
- package/package.json +9 -9
- package/cjs/transforms/mark/lttb-sample.d.ts +0 -2
- package/cjs/transforms/mark/lttb-sample.js +0 -68
- package/cjs/transforms/mark/lttb-sample.js.map +0 -1
- package/es/transforms/mark/lttb-sample.d.ts +0 -2
- package/es/transforms/mark/lttb-sample.js +0 -60
- package/es/transforms/mark/lttb-sample.js.map +0 -1
package/cjs/parse/view.js
CHANGED
|
@@ -20,7 +20,7 @@ const builtInSignals = (option, config, theme) => {
|
|
|
20
20
|
value: null !== (_b = option[constants_2.SIGNAL_HEIGHT]) && void 0 !== _b ? _b : 0
|
|
21
21
|
}, {
|
|
22
22
|
id: constants_2.SIGNAL_PADDING,
|
|
23
|
-
value: (0, exports.normalizePadding)(null !== (_d = null !== (_c = option[constants_2.SIGNAL_PADDING]) && void 0 !== _c ? _c : config[constants_2.SIGNAL_PADDING]) && void 0 !== _d ? _d : theme.padding)
|
|
23
|
+
value: (0, exports.normalizePadding)(null !== (_d = null !== (_c = option[constants_2.SIGNAL_PADDING]) && void 0 !== _c ? _c : config[constants_2.SIGNAL_PADDING]) && void 0 !== _d ? _d : null == theme ? void 0 : theme.padding)
|
|
24
24
|
}, {
|
|
25
25
|
id: constants_2.SIGNAL_VIEW_WIDTH,
|
|
26
26
|
update: {
|
package/cjs/parse/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parse/view.ts"],"names":[],"mappings":";;;AACA,6CAAoD;AACpD,kDAU4B;AAG5B,iDAQ2B;AAE3B,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;AAEP,QAAA,eAAe,GAAG;IAC7B,wBAAY;IACZ,yBAAa;IACb,0BAAc;IACd,6BAAiB;IACjB,8BAAkB;IAClB,2BAAe;IACf,0BAAc;CACf,CAAC;AAEK,MAAM,cAAc,GAAG,CAAC,MAAoB,EAAE,MAAwB,EAAE,KAAa,EAAqB,EAAE;;IACjH,OAAO;QACL,EAAE,EAAE,EAAE,wBAAY,EAAE,KAAK,EAAE,MAAA,MAAM,CAAC,wBAAY,CAAC,mCAAI,CAAC,EAAE;QACtD,EAAE,EAAE,EAAE,yBAAa,EAAE,KAAK,EAAE,MAAA,MAAM,CAAC,yBAAa,CAAC,mCAAI,CAAC,EAAE;QACxD,EAAE,EAAE,EAAE,0BAAc,EAAE,KAAK,EAAE,IAAA,wBAAgB,EAAC,MAAA,MAAA,MAAM,CAAC,0BAAc,CAAC,mCAAI,MAAM,CAAC,0BAAc,CAAC,mCAAI,KAAK,
|
|
1
|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AK,mCAAI,wBAAY;QAC3C,QAAQ,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,QAAQ,mCAAI,2BAAe;QACpD,SAAS,EAAE;YACT,MAAM,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,MAAM,mCAAI,kCAAsB;YAClE,KAAK,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,KAAK,mCAAI,iCAAqB;YAC/D,QAAQ,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,QAAQ,mCAAI,oCAAwB;YACxE,QAAQ,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,QAAQ,mCAAI,oCAAwB;YACxE,SAAS,EAAE,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,SAAS,0CAAE,SAAS,mCAAI,4BAAgB;SACnE;QACD,mBAAmB,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,mBAAmB,mCAAI,sCAA0B;KACtF,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,sBAAsB,0BAcjC","file":"view.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport { isNumber, Bounds } from '@visactor/vutils';\nimport {\n DefaultAnimationDelay,\n DefaultAnimationDuration,\n DefaultAnimationEasing,\n DefaultAnimationOneByOne,\n DefaultEnableExitAnimation,\n DefaultMorph,\n DefaultMorphAll,\n DefaultReuse,\n DefaultSplitPath\n} from '../graph/constants';\nimport type { GroupMarkSpec, IRunningConfig, ITheme, MarkSpec, SignalSpec } from '../types';\nimport type { IViewOptions, IViewThemeConfig, ViewSpec } from '../types/view';\nimport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from '../view/constants';\n\nlet markBaseId = -1;\n\nexport const BuiltInSignalID = [\n SIGNAL_WIDTH,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_BOX,\n SIGNAL_AUTOFIT\n];\n\nexport const builtInSignals = (option: IViewOptions, config: IViewThemeConfig, theme: ITheme): SignalSpec<any>[] => {\n return [\n { id: SIGNAL_WIDTH, value: option[SIGNAL_WIDTH] ?? 0 },\n { id: SIGNAL_HEIGHT, value: option[SIGNAL_HEIGHT] ?? 0 },\n { id: SIGNAL_PADDING, value: normalizePadding(option[SIGNAL_PADDING] ?? config[SIGNAL_PADDING] ?? theme?.padding) },\n {\n id: SIGNAL_VIEW_WIDTH,\n update: {\n callback: (signal: number, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return params[SIGNAL_WIDTH] - padding.left - padding.right;\n },\n dependency: [SIGNAL_WIDTH, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_VIEW_HEIGHT,\n update: {\n callback: (signal: number, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return params[SIGNAL_HEIGHT] - padding.top - padding.bottom;\n },\n dependency: [SIGNAL_HEIGHT, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_VIEW_BOX,\n update: {\n callback: (signal: IBounds, params: any) => {\n const padding = normalizePadding(params[SIGNAL_PADDING]);\n return (signal ? signal : new Bounds()).setValue(\n padding.left,\n padding.top,\n padding.left + params[SIGNAL_VIEW_WIDTH],\n padding.top + params[SIGNAL_VIEW_HEIGHT]\n );\n },\n dependency: [SIGNAL_VIEW_WIDTH, SIGNAL_VIEW_HEIGHT, SIGNAL_PADDING]\n }\n },\n {\n id: SIGNAL_AUTOFIT,\n value: option[SIGNAL_AUTOFIT] ?? config[SIGNAL_AUTOFIT]\n }\n ];\n};\n\nexport const normalizePadding = (\n value: number | { top?: number; left?: number; right?: number; bottom?: number }\n): { top: number; left: number; right: number; bottom: number } => {\n if (isNumber(value)) {\n return { top: value, bottom: value, left: value, right: value };\n }\n return { top: value?.top ?? 0, bottom: value?.bottom ?? 0, left: value?.left ?? 0, right: value?.right ?? 0 };\n};\n\nexport const normalizeMarkTree = (spec: ViewSpec) => {\n const traverse = (spec: MarkSpec, group: string) => {\n spec.group = group;\n const id = spec.id ?? `VGRAMMAR_MARK_${++markBaseId}`;\n spec.id = id;\n ((spec as GroupMarkSpec).marks ?? []).forEach(child => traverse(child, id));\n };\n (spec.marks ?? []).forEach(mark => traverse(mark, 'root'));\n return spec;\n};\n\nexport const normalizeRunningConfig = (runningConfig: IRunningConfig): IRunningConfig => {\n return {\n reuse: runningConfig?.reuse ?? DefaultReuse,\n morph: runningConfig?.morph ?? DefaultMorph,\n morphAll: runningConfig?.morphAll ?? DefaultMorphAll,\n animation: {\n easing: runningConfig?.animation?.easing ?? DefaultAnimationEasing,\n delay: runningConfig?.animation?.delay ?? DefaultAnimationDelay,\n duration: runningConfig?.animation?.duration ?? DefaultAnimationDuration,\n oneByOne: runningConfig?.animation?.oneByOne ?? DefaultAnimationOneByOne,\n splitPath: runningConfig?.animation?.splitPath ?? DefaultSplitPath\n },\n enableExitAnimation: runningConfig?.enableExitAnimation ?? DefaultEnableExitAnimation\n };\n};\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GrammarMarkType } from '../graph/enums';
|
|
2
2
|
import type { StateEncodeSpec, MarkSpec, MarkFunctionType, AttributeTransform, BaseSignleEncodeSpec } from '../types';
|
|
3
3
|
import { Mark } from '../view/mark';
|
|
4
4
|
export declare class Cell extends Mark {
|
|
5
|
+
static markType: GrammarMarkType;
|
|
5
6
|
markType: GrammarMarkType.cell;
|
|
6
7
|
protected spec: MarkSpec;
|
|
7
8
|
protected _encoders: StateEncodeSpec | null;
|
|
@@ -11,3 +12,4 @@ export declare class Cell extends Mark {
|
|
|
11
12
|
getAttributeTransforms(): AttributeTransform[];
|
|
12
13
|
release(): void;
|
|
13
14
|
}
|
|
15
|
+
export declare const registerCellMark: () => void;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.Cell = void 0;
|
|
5
|
+
}), exports.registerCellMark = exports.Cell = void 0;
|
|
6
6
|
|
|
7
|
-
const encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"),
|
|
7
|
+
const enums_1 = require("../graph/enums"), encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"), transform_1 = require("../graph/attributes/transform"), scale_1 = require("../util/scale"), factory_1 = require("../core/factory");
|
|
8
8
|
|
|
9
9
|
class Cell extends mark_2.Mark {
|
|
10
10
|
encodeState(state, channel, value) {
|
|
@@ -50,12 +50,18 @@ class Cell extends mark_2.Mark {
|
|
|
50
50
|
} else graphicAttributes.size = storedAttrs.size;
|
|
51
51
|
},
|
|
52
52
|
storedAttrs: "paddingAttrs"
|
|
53
|
-
} ].concat(
|
|
53
|
+
} ].concat(transform_1.transformsByType.symbol);
|
|
54
54
|
}
|
|
55
55
|
release() {
|
|
56
56
|
super.release(), this._encoders = null;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
exports.Cell = Cell;
|
|
60
|
+
exports.Cell = Cell, Cell.markType = enums_1.GrammarMarkType.cell;
|
|
61
|
+
|
|
62
|
+
const registerCellMark = () => {
|
|
63
|
+
factory_1.Factory.registerMark(enums_1.GrammarMarkType.cell, Cell);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
exports.registerCellMark = registerCellMark;
|
|
61
67
|
//# sourceMappingURL=cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/semantic-marks/cell.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/cell.ts"],"names":[],"mappings":";;;AACA,0CAAiD;AACjD,iDAAqD;AACrD,wCAA8C;AAC9C,wCAAiE;AAUjE,uCAAoC;AACpC,6CAA4D;AAC5D,6DAAiE;AACjE,yCAAoD;AACpD,6CAA0C;AAE1C,MAAa,IAAK,SAAQ,WAAI;IAO5B,WAAW,CAAC,KAAa,EAAE,OAAsC,EAAE,KAA6B;QAC9F,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAES,wBAAwB,CAAC,KAAa;QAC9C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACnB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;SACrB;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAsC,CAAC;QAEjF,IAAI,WAAW,IAAI,KAAK,KAAK,QAAQ,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YACjC,MAAM,MAAM,GAA+B,IAAA,qBAAc,EAAC,WAAW,CAAC;gBACpE,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;oBAC/C,IAAI,IAAA,oBAAa,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE;wBACvC,GAAG,CAAC,OAAO,CAAC,GAAG,IAAA,uBAAgB,EAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;qBACrE;oBACD,OAAO,GAAG,CAAC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AO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;yBACnD,CAAC;qBACH;yBAAM;wBACL,iBAAiB,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;qBAC3C;gBACH,CAAC;gBACD,WAAW,EAAE,cAAc;aAC5B;SAEJ,CAAC,MAAM,CAAC,4BAAgB,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;;AAlGH,oBAmGC;AAlGQ,aAAQ,GAAG,uBAAe,CAAC,IAAI,CAAC;AAoGlC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,iBAAO,CAAC,YAAY,CAAC,uBAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B","file":"cell.js","sourcesContent":["import type { IBaseScale } from '@visactor/vscale';\nimport { GrammarMarkType } from '../graph/enums';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { isScaleEncode } from '../parse/mark';\nimport { getGrammarOutput, isFunctionType } from '../parse/util';\nimport type {\n StateEncodeSpec,\n MarkSpec,\n IElement,\n MarkFunctionType,\n AttributeTransform,\n GetSignleEncodeSpecByType,\n BaseSignleEncodeSpec\n} from '../types';\nimport { Mark } from '../view/mark';\nimport { isArray, isNil, isNumber } from '@visactor/vutils';\nimport { transformsByType } from '../graph/attributes/transform';\nimport { getBandWidthOfScale } from '../util/scale';\nimport { Factory } from '../core/factory';\n\nexport class Cell extends Mark {\n static markType = GrammarMarkType.cell;\n declare markType: GrammarMarkType.cell;\n protected declare spec: MarkSpec;\n\n protected _encoders: StateEncodeSpec | null;\n\n encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>) {\n super.encodeState(state, channel, value);\n\n this._updateComponentEncoders(state);\n\n return this;\n }\n\n protected _updateComponentEncoders(state: string) {\n if (!this._encoders) {\n this._encoders = {};\n }\n\n const userEncoder = this.spec.encode[state] as GetSignleEncodeSpecByType<'cell'>;\n\n if (userEncoder && state === 'update') {\n const params = this.parameters();\n const scales: Record<string, IBaseScale> = isFunctionType(userEncoder)\n ? null\n : Object.keys(userEncoder).reduce((res, channel) => {\n if (isScaleEncode(userEncoder[channel])) {\n res[channel] = getGrammarOutput(userEncoder[channel].scale, params);\n }\n return res;\n }, {});\n\n this._encoders[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const userEncodeRes = invokeEncoder(userEncoder, datum, element, parameters);\n\n if (isNil(userEncodeRes.size)) {\n const sizeX = scales.x ? getBandWidthOfScale(scales.x) : undefined;\n const sizeY = scales.y ? getBandWidthOfScale(scales.y) : undefined;\n\n if (isNil(sizeX) && isNil(sizeY)) {\n userEncodeRes.size = 10;\n } else if (isNil(sizeX)) {\n userEncodeRes.size = sizeY;\n } else if (isNil(sizeY)) {\n userEncodeRes.size = sizeX;\n }\n\n userEncodeRes.size = [sizeX, sizeY];\n }\n\n if (isNil(userEncodeRes.shape)) {\n userEncodeRes.shape = 'rect';\n }\n\n return userEncodeRes;\n }\n } as GetSignleEncodeSpecByType<'cell'>;\n } else {\n this._encoders[state] = userEncoder;\n }\n }\n\n protected _getEncoders() {\n return this._encoders ?? {};\n }\n\n getAttributeTransforms() {\n return (\n [\n {\n channels: ['size', 'padding'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n if (isNumber(storedAttrs.padding) && storedAttrs.padding > 0) {\n graphicAttributes.size = isArray(storedAttrs.size)\n ? storedAttrs.size.map((entry: number) => Math.max(entry - storedAttrs.padding, 1))\n : Math.max(storedAttrs.size - storedAttrs.padding, 1);\n } else if (isArray(storedAttrs.padding) && storedAttrs.padding.length === 2) {\n const arraySize = isArray(storedAttrs.size) ? storedAttrs.size : [storedAttrs.size, storedAttrs.size];\n\n graphicAttributes.size = [\n Math.max(arraySize[0] - storedAttrs.padding[0], 1),\n Math.max(arraySize[1] - storedAttrs.padding[1], 1)\n ];\n } else {\n graphicAttributes.size = storedAttrs.size;\n }\n },\n storedAttrs: 'paddingAttrs'\n }\n ] as AttributeTransform[]\n ).concat(transformsByType.symbol);\n }\n\n release(): void {\n super.release();\n this._encoders = null;\n }\n}\n\nexport const registerCellMark = () => {\n Factory.registerMark(GrammarMarkType.cell, Cell);\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import { GrammarMarkType } from '../graph/enums';
|
|
|
2
2
|
import type { StateEncodeSpec, MarkSpec, MarkFunctionType, AttributeTransform, BaseSignleEncodeSpec } from '../types';
|
|
3
3
|
import { Mark } from '../view/mark';
|
|
4
4
|
export declare class Interval extends Mark {
|
|
5
|
+
static markType: GrammarMarkType;
|
|
5
6
|
markType: GrammarMarkType.interval;
|
|
6
7
|
protected spec: MarkSpec;
|
|
7
8
|
protected _encoders: StateEncodeSpec;
|
|
@@ -12,3 +13,4 @@ export declare class Interval extends Mark {
|
|
|
12
13
|
addGraphicItem(attrs: any, groupKey?: string): any;
|
|
13
14
|
release(): void;
|
|
14
15
|
}
|
|
16
|
+
export declare const registerIntervalMark: () => void;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.Interval = void 0;
|
|
5
|
+
}), exports.registerIntervalMark = exports.Interval = void 0;
|
|
6
6
|
|
|
7
|
-
const vscale_1 = require("@visactor/vscale"), enums_1 = require("../graph/enums"), encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"), graphic_1 = require("../graph/util/graphic"),
|
|
7
|
+
const vscale_1 = require("@visactor/vscale"), enums_1 = require("../graph/enums"), encode_1 = require("../graph/mark/encode"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), mark_2 = require("../view/mark"), vutils_1 = require("@visactor/vutils"), graphic_1 = require("../graph/util/graphic"), transform_1 = require("../graph/attributes/transform"), factory_1 = require("../core/factory");
|
|
8
8
|
|
|
9
9
|
class Interval extends mark_2.Mark {
|
|
10
10
|
encodeState(state, channel, value) {
|
|
@@ -65,7 +65,7 @@ class Interval extends mark_2.Mark {
|
|
|
65
65
|
graphicAttributes.outerRadius = storedAttrs.y1);
|
|
66
66
|
},
|
|
67
67
|
storedAttrs: "sizeAttrs"
|
|
68
|
-
} ] :
|
|
68
|
+
} ] : transform_1.transformsByType.rect;
|
|
69
69
|
}
|
|
70
70
|
addGraphicItem(attrs, groupKey) {
|
|
71
71
|
const graphicItem = (0, graphic_1.createGraphicItem)(this, this.coord && "polar" === this.coord.output().type ? enums_1.GrammarMarkType.arc : enums_1.GrammarMarkType.rect, attrs);
|
|
@@ -76,5 +76,11 @@ class Interval extends mark_2.Mark {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
exports.Interval = Interval;
|
|
79
|
+
exports.Interval = Interval, Interval.markType = enums_1.GrammarMarkType.interval;
|
|
80
|
+
|
|
81
|
+
const registerIntervalMark = () => {
|
|
82
|
+
factory_1.Factory.registerMark(enums_1.GrammarMarkType.interval, Interval);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.registerIntervalMark = registerIntervalMark;
|
|
80
86
|
//# sourceMappingURL=interval.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/semantic-marks/interval.ts"],"names":[],"mappings":";;;AAEA,6CAA6C;AAC7C,0CAAiD;AACjD,iDAAqD;AACrD,wCAA8C;AAC9C,wCAAiE;AAUjE,uCAAoC;AACpC,6CAAyC;AACzC,mDAA0D;AAE1D,oDAAuD;AAEvD,MAAa,QAAS,SAAQ,WAAI;IAMhC,WAAW,CAAC,KAAa,EAAE,OAAsC,EAAE,KAA6B;QAC9F,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzC,IAAI,CAAC,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AC,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,uBAAe,CAAC,GAAG,CAAC,CAAC,CAAC,uBAAe,CAAC,IAAI,EAC/F,KAAK,CACN,CAAC;QAEF,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAvID,4BAuIC","file":"interval.js","sourcesContent":["import type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { ScaleEnum } from '@visactor/vscale';\nimport { GrammarMarkType } from '../graph/enums';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { isScaleEncode } from '../parse/mark';\nimport { getGrammarOutput, isFunctionType } from '../parse/util';\nimport type {\n StateEncodeSpec,\n MarkSpec,\n IElement,\n MarkFunctionType,\n AttributeTransform,\n GetSignleEncodeSpecByType,\n BaseSignleEncodeSpec\n} from '../types';\nimport { Mark } from '../view/mark';\nimport { isNil } from '@visactor/vutils';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport type { IPolarCoordinate } from '@visactor/vgrammar-coordinate';\nimport { transformsByType } from '../graph/attributes';\n\nexport class Interval extends Mark {\n declare markType: GrammarMarkType.interval;\n protected declare spec: MarkSpec;\n\n protected _encoders: StateEncodeSpec;\n\n encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>) {\n super.encodeState(state, channel, value);\n\n this._updateComponentEncoders(state);\n\n return this;\n }\n\n protected _updateComponentEncoders(state: string) {\n if (!this._encoders) {\n this._encoders = {};\n }\n\n const userEncoder = this.spec.encode[state] as GetSignleEncodeSpecByType<'interval'>;\n\n if (userEncoder && state === 'update') {\n const params = this.parameters();\n const scales: Record<string, IBaseScale> = isFunctionType(userEncoder)\n ? null\n : Object.keys(userEncoder).reduce((res, channel) => {\n if (isScaleEncode(userEncoder[channel])) {\n res[channel] = getGrammarOutput(userEncoder[channel].scale, params);\n }\n return res;\n }, {});\n\n this._encoders[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const userEncodeRes = invokeEncoder(userEncoder, datum, element, parameters);\n\n this.disableCoordinateTransform = false;\n if (scales && scales.x && scales.x.type === ScaleEnum.Band) {\n if (!isNil(scales.y)) {\n const domain = scales.y.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.y1 = scales.y.scale(baseValue);\n }\n const bandWidth = (scales.x as IBandLikeScale).bandwidth();\n\n // TODO: handle bandWidth dynamically\n userEncodeRes.x = userEncodeRes.x + bandWidth / 4;\n userEncodeRes.x1 = userEncodeRes.x + bandWidth / 2;\n } else if (scales && scales.y && scales.y.type === ScaleEnum.Band) {\n if (!isNil(scales.x)) {\n const domain = scales.x.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.x1 = scales.x.scale(baseValue);\n }\n const bandWidth = (scales.y as IBandLikeScale).bandwidth();\n\n userEncodeRes.y = userEncodeRes.y + bandWidth / 4;\n userEncodeRes.y1 = userEncodeRes.y + bandWidth / 2;\n }\n\n if (scales) {\n const scaleGrammar =\n this.view.getScaleById((userEncoder as any).x?.scale) ??\n this.view.getScaleById((userEncoder as any).y?.scale);\n const coord = scaleGrammar.getCoordinate();\n\n if (coord && coord.type === 'polar') {\n this.disableCoordinateTransform = true;\n const origin = (coord as IPolarCoordinate).origin();\n userEncodeRes.cx = origin.x;\n userEncodeRes.cy = origin.y;\n }\n }\n\n return userEncodeRes;\n }\n } as GetSignleEncodeSpecByType<'interval'>;\n } else {\n this._encoders[state] = userEncoder;\n }\n }\n\n protected _getEncoders() {\n return this._encoders ?? {};\n }\n\n getAttributeTransforms() {\n if (this.coord && this.coord.output().type === 'polar') {\n return [\n {\n channels: ['x', 'y', 'x1', 'y1', 'cx', 'cy'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = storedAttrs.cx;\n graphicAttributes.y = storedAttrs.cy;\n if (this.coord.output().isTransposed()) {\n graphicAttributes.startAngle = storedAttrs.y;\n graphicAttributes.endAngle = storedAttrs.y1;\n graphicAttributes.innerRadius = storedAttrs.x;\n graphicAttributes.outerRadius = storedAttrs.x1;\n } else {\n //\n graphicAttributes.startAngle = storedAttrs.x;\n graphicAttributes.endAngle = storedAttrs.x1;\n graphicAttributes.innerRadius = storedAttrs.y;\n graphicAttributes.outerRadius = storedAttrs.y1;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ] as AttributeTransform[];\n }\n\n return transformsByType.rect;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const graphicItem = createGraphicItem(\n this,\n this.coord && this.coord.output().type === 'polar' ? GrammarMarkType.arc : GrammarMarkType.rect,\n attrs\n );\n\n return super.addGraphicItem(attrs, groupKey, graphicItem);\n }\n\n release(): void {\n super.release();\n this._encoders = null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/interval.ts"],"names":[],"mappings":";;;AAEA,6CAA6C;AAC7C,0CAAiD;AACjD,iDAAqD;AACrD,wCAA8C;AAC9C,wCAAiE;AAUjE,uCAAoC;AACpC,6CAAyC;AACzC,mDAA0D;AAE1D,6DAAiE;AACjE,6CAA0C;AAE1C,MAAa,QAAS,SAAQ,WAAI;IAOhC,WAAW,CAAC,KAAa,EAAE,OAAsC,EAAE,KAA6B;QAC9F,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEzC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAErC,OAAO,IAAI,CAAC;IACd,CAAC;IAES,wBAAwB,CAAC,KAAa;QAC9C,IAAI,CA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BAAe,CAAC,IAAI,EAC/F,KAAK,CACN,CAAC;QAEF,OAAO,KAAK,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;;AAvIH,4BAwIC;AAvIQ,iBAAQ,GAAG,uBAAe,CAAC,QAAQ,CAAC;AAyItC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,iBAAO,CAAC,YAAY,CAAC,uBAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC3D,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B","file":"interval.js","sourcesContent":["import type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { ScaleEnum } from '@visactor/vscale';\nimport { GrammarMarkType } from '../graph/enums';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { isScaleEncode } from '../parse/mark';\nimport { getGrammarOutput, isFunctionType } from '../parse/util';\nimport type {\n StateEncodeSpec,\n MarkSpec,\n IElement,\n MarkFunctionType,\n AttributeTransform,\n GetSignleEncodeSpecByType,\n BaseSignleEncodeSpec\n} from '../types';\nimport { Mark } from '../view/mark';\nimport { isNil } from '@visactor/vutils';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport type { IPolarCoordinate } from '@visactor/vgrammar-coordinate';\nimport { transformsByType } from '../graph/attributes/transform';\nimport { Factory } from '../core/factory';\n\nexport class Interval extends Mark {\n static markType = GrammarMarkType.interval;\n declare markType: GrammarMarkType.interval;\n protected declare spec: MarkSpec;\n\n protected _encoders: StateEncodeSpec;\n\n encodeState(state: string, channel: string | BaseSignleEncodeSpec, value?: MarkFunctionType<any>) {\n super.encodeState(state, channel, value);\n\n this._updateComponentEncoders(state);\n\n return this;\n }\n\n protected _updateComponentEncoders(state: string) {\n if (!this._encoders) {\n this._encoders = {};\n }\n\n const userEncoder = this.spec.encode[state] as GetSignleEncodeSpecByType<'interval'>;\n\n if (userEncoder && state === 'update') {\n const params = this.parameters();\n const scales: Record<string, IBaseScale> = isFunctionType(userEncoder)\n ? null\n : Object.keys(userEncoder).reduce((res, channel) => {\n if (isScaleEncode(userEncoder[channel])) {\n res[channel] = getGrammarOutput(userEncoder[channel].scale, params);\n }\n return res;\n }, {});\n\n this._encoders[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const userEncodeRes = invokeEncoder(userEncoder, datum, element, parameters);\n\n this.disableCoordinateTransform = false;\n if (scales && scales.x && scales.x.type === ScaleEnum.Band) {\n if (!isNil(scales.y)) {\n const domain = scales.y.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.y1 = scales.y.scale(baseValue);\n }\n const bandWidth = (scales.x as IBandLikeScale).bandwidth();\n\n // TODO: handle bandWidth dynamically\n userEncodeRes.x = userEncodeRes.x + bandWidth / 4;\n userEncodeRes.x1 = userEncodeRes.x + bandWidth / 2;\n } else if (scales && scales.y && scales.y.type === ScaleEnum.Band) {\n if (!isNil(scales.x)) {\n const domain = scales.x.domain();\n const min = Math.min.apply(null, domain);\n const max = Math.max.apply(null, domain);\n const baseValue = min > 0 ? min : max < 0 ? max : 0;\n\n userEncodeRes.x1 = scales.x.scale(baseValue);\n }\n const bandWidth = (scales.y as IBandLikeScale).bandwidth();\n\n userEncodeRes.y = userEncodeRes.y + bandWidth / 4;\n userEncodeRes.y1 = userEncodeRes.y + bandWidth / 2;\n }\n\n if (scales) {\n const scaleGrammar =\n this.view.getScaleById((userEncoder as any).x?.scale) ??\n this.view.getScaleById((userEncoder as any).y?.scale);\n const coord = scaleGrammar.getCoordinate();\n\n if (coord && coord.type === 'polar') {\n this.disableCoordinateTransform = true;\n const origin = (coord as IPolarCoordinate).origin();\n userEncodeRes.cx = origin.x;\n userEncodeRes.cy = origin.y;\n }\n }\n\n return userEncodeRes;\n }\n } as GetSignleEncodeSpecByType<'interval'>;\n } else {\n this._encoders[state] = userEncoder;\n }\n }\n\n protected _getEncoders() {\n return this._encoders ?? {};\n }\n\n getAttributeTransforms() {\n if (this.coord && this.coord.output().type === 'polar') {\n return [\n {\n channels: ['x', 'y', 'x1', 'y1', 'cx', 'cy'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = storedAttrs.cx;\n graphicAttributes.y = storedAttrs.cy;\n if (this.coord.output().isTransposed()) {\n graphicAttributes.startAngle = storedAttrs.y;\n graphicAttributes.endAngle = storedAttrs.y1;\n graphicAttributes.innerRadius = storedAttrs.x;\n graphicAttributes.outerRadius = storedAttrs.x1;\n } else {\n //\n graphicAttributes.startAngle = storedAttrs.x;\n graphicAttributes.endAngle = storedAttrs.x1;\n graphicAttributes.innerRadius = storedAttrs.y;\n graphicAttributes.outerRadius = storedAttrs.y1;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ] as AttributeTransform[];\n }\n\n return transformsByType.rect;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const graphicItem = createGraphicItem(\n this,\n this.coord && this.coord.output().type === 'polar' ? GrammarMarkType.arc : GrammarMarkType.rect,\n attrs\n );\n\n return super.addGraphicItem(attrs, groupKey, graphicItem);\n }\n\n release(): void {\n super.release();\n this._encoders = null;\n }\n}\n\nexport const registerIntervalMark = () => {\n Factory.registerMark(GrammarMarkType.interval, Interval);\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import { GrammarMarkType } from '../graph/enums';
|
|
|
2
2
|
import type { MarkSpec } from '../types';
|
|
3
3
|
import { Mark } from '../view/mark';
|
|
4
4
|
export declare class Text extends Mark {
|
|
5
|
+
static markType: GrammarMarkType;
|
|
5
6
|
markType: GrammarMarkType.text;
|
|
6
7
|
protected spec: MarkSpec;
|
|
7
8
|
addGraphicItem(initAttrs: any, groupKey?: string): any;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.Text = void 0;
|
|
6
6
|
|
|
7
|
-
const enums_1 = require("../graph/enums"), mark_1 = require("../view/mark"), graphic_1 = require("../graph/util/graphic"),
|
|
7
|
+
const enums_1 = require("../graph/enums"), mark_1 = require("../view/mark"), graphic_1 = require("../graph/util/graphic"), transform_1 = require("../graph/attributes/transform");
|
|
8
8
|
|
|
9
9
|
class Text extends mark_1.Mark {
|
|
10
10
|
addGraphicItem(initAttrs, groupKey) {
|
|
@@ -14,12 +14,12 @@ class Text extends mark_1.Mark {
|
|
|
14
14
|
}
|
|
15
15
|
getAttributeTransforms() {
|
|
16
16
|
var _a;
|
|
17
|
-
return "richtext" === (null === (_a = this.getGroupGraphicItem()) || void 0 === _a ? void 0 : _a.type) ?
|
|
17
|
+
return "richtext" === (null === (_a = this.getGroupGraphicItem()) || void 0 === _a ? void 0 : _a.type) ? transform_1.transformsByType.richtext : transform_1.transformsByType.text;
|
|
18
18
|
}
|
|
19
19
|
release() {
|
|
20
20
|
super.release();
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
exports.Text = Text;
|
|
24
|
+
exports.Text = Text, Text.markType = enums_1.GrammarMarkType.text;
|
|
25
25
|
//# sourceMappingURL=text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/semantic-marks/text.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEjD,uCAAoC;AACpC,mDAA0D;AAC1D,
|
|
1
|
+
{"version":3,"sources":["../src/semantic-marks/text.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AAEjD,uCAAoC;AACpC,mDAA0D;AAC1D,6DAAiE;AAEjE,MAAa,IAAK,SAAQ,WAAI;IAK5B,cAAc,CAAC,SAAc,EAAE,QAAiB;QAC9C,MAAM,UAAU,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC;QACnC,MAAM,MAAM,GAAG,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,MAAK,MAAM,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,2BAAiB,EACnC,IAAa,EACb,MAAM,CAAC,CAAC,CAAC,uBAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,uBAAe,CAAC,IAAI,EACxD,SAAS,CACV,CAAC;QAEF,IAAI,MAAM,EAAE;YACV,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED,sBAAsB;;QACpB,OAAO,CAAA,MAAA,IAAI,CAAC,mBAAmB,EAAE,0CAAE,IAAI,MAAK,UAAU,CAAC,CAAC,CAAC,4BAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,4BAAgB,CAAC,IAAI,CAAC;IAC7G,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;;AA3BH,oBA4BC;AA3BQ,aAAQ,GAAG,uBAAe,CAAC,IAAI,CAAC","file":"text.js","sourcesContent":["import { GrammarMarkType } from '../graph/enums';\nimport type { IMark, MarkSpec } from '../types';\nimport { Mark } from '../view/mark';\nimport { createGraphicItem } from '../graph/util/graphic';\nimport { transformsByType } from '../graph/attributes/transform';\n\nexport class Text extends Mark {\n static markType = GrammarMarkType.text;\n declare markType: GrammarMarkType.text;\n protected declare spec: MarkSpec;\n\n addGraphicItem(initAttrs: any, groupKey?: string) {\n const textConfig = initAttrs?.text;\n const isRich = textConfig?.type === 'rich';\n const graphicItem = createGraphicItem(\n this as IMark,\n isRich ? GrammarMarkType.richtext : GrammarMarkType.text,\n initAttrs\n );\n\n if (isRich) {\n initAttrs.textConfig = [];\n }\n\n return super.addGraphicItem(initAttrs, groupKey, graphicItem);\n }\n\n getAttributeTransforms() {\n return this.getGroupGraphicItem()?.type === 'richtext' ? transformsByType.richtext : transformsByType.text;\n }\n\n release(): void {\n super.release();\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes } from '@visactor/vrender-components';
|
|
1
|
+
import type { ContinuousPlayerAttributes, DataLabelAttrs, LineDataLabelAttrs, DataZoomAttributes, DiscretePlayerAttributes, LineLabelAttrs, RectLabelAttrs, SymbolLabelAttrs, ArcLabelAttrs, TooltipAttributes, BaseLabelAttrs, TitleAttrs, ScrollBarAttributes } from '@visactor/vrender-components';
|
|
2
2
|
import type { IComponentTheme, RecursivePartial } from '../../types';
|
|
3
3
|
export declare const dataLabel: RecursivePartial<DataLabelAttrs>;
|
|
4
|
+
export declare const lineDataLabel: RecursivePartial<LineDataLabelAttrs>;
|
|
4
5
|
export declare const lineLabel: RecursivePartial<LineLabelAttrs>;
|
|
5
6
|
export declare const rectLabel: RecursivePartial<RectLabelAttrs>;
|
|
6
7
|
export declare const symbolLabel: RecursivePartial<SymbolLabelAttrs>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.defaultComponentTheme = exports.scrollbar = exports.title = exports.tooltip = exports.discretePlayer = exports.continuousPlayer = exports.datazoom = exports.pointLabel = exports.arcLabel = exports.symbolLabel = exports.rectLabel = exports.lineLabel = exports.dataLabel = void 0;
|
|
5
|
+
}), exports.defaultComponentTheme = exports.scrollbar = exports.title = exports.tooltip = exports.discretePlayer = exports.continuousPlayer = exports.datazoom = exports.pointLabel = exports.arcLabel = exports.symbolLabel = exports.rectLabel = exports.lineLabel = exports.lineDataLabel = exports.dataLabel = void 0;
|
|
6
6
|
|
|
7
7
|
const axis = {
|
|
8
8
|
label: {
|
|
@@ -351,6 +351,17 @@ exports.dataLabel = {
|
|
|
351
351
|
height: 400
|
|
352
352
|
},
|
|
353
353
|
dataLabels: []
|
|
354
|
+
}, exports.lineDataLabel = {
|
|
355
|
+
type: "line-data",
|
|
356
|
+
data: [ {
|
|
357
|
+
text: ""
|
|
358
|
+
} ],
|
|
359
|
+
position: "top",
|
|
360
|
+
overlap: {
|
|
361
|
+
avoidBaseMark: !1,
|
|
362
|
+
clampForce: !1
|
|
363
|
+
},
|
|
364
|
+
smartInvert: !1
|
|
354
365
|
}, exports.lineLabel = {
|
|
355
366
|
type: "line",
|
|
356
367
|
data: [ {
|
|
@@ -483,6 +494,7 @@ exports.title = {
|
|
|
483
494
|
rectLabel: exports.rectLabel,
|
|
484
495
|
symbolLabel: exports.symbolLabel,
|
|
485
496
|
arcLabel: exports.arcLabel,
|
|
497
|
+
lineDataLabel: exports.lineDataLabel,
|
|
486
498
|
datazoom: exports.datazoom,
|
|
487
499
|
continuousPlayer: exports.continuousPlayer,
|
|
488
500
|
discretePlayer: exports.discretePlayer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":";;;AA6BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAA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EW,QAAA,SAAS,GAA0C;IAC9D,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE;QACT,IAAI,EAAE,mBAAmB;KAC1B;CACF,CAAC;AAEW,QAAA,qBAAqB,GAAoB;IACpD,IAAI;IACJ,UAAU;IAEV,IAAI;IACJ,UAAU;IAEV,cAAc;IACd,WAAW;IACX,UAAU;IAEV,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS,EAAT,iBAAS;IACT,UAAU,EAAV,kBAAU;IACV,SAAS,EAAT,iBAAS;IACT,SAAS,EAAT,iBAAS;IACT,WAAW,EAAX,mBAAW;IACX,QAAQ,EAAR,gBAAQ;IAER,QAAQ,EAAR,gBAAQ;IAER,gBAAgB,EAAhB,wBAAgB;IAChB,cAAc,EAAd,sBAAc;IAEd,OAAO,EAAP,eAAO;IAEP,KAAK,EAAL,aAAK;IAEL,SAAS,EAAT,iBAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: true,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n\n datazoom,\n\n continuousPlayer,\n discretePlayer,\n\n tooltip,\n\n title,\n\n scrollbar\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/theme/common/component.ts"],"names":[],"mappings":";;;AA8BA,MAAM,IAAI,GAAyC;IACjD,KAAK,EAAE;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,KAAK,EAAE;YACL,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,CAAC;SACf;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;QACb,cAAc,EAAE,IAAI;QACpB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,KAAK;QACb,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;IACrB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACL,CAAC;A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Aa;IACb,eAAe;IACf,eAAe;IACf,gBAAgB;IAEhB,MAAM;IAEN,SAAS,EAAT,iBAAS;IACT,UAAU,EAAV,kBAAU;IACV,SAAS,EAAT,iBAAS;IACT,SAAS,EAAT,iBAAS;IACT,WAAW,EAAX,mBAAW;IACX,QAAQ,EAAR,gBAAQ;IACR,aAAa,EAAb,qBAAa;IAEb,QAAQ,EAAR,gBAAQ;IAER,gBAAgB,EAAhB,wBAAgB;IAChB,cAAc,EAAd,sBAAc;IAEd,OAAO,EAAP,eAAO;IAEP,KAAK,EAAL,aAAK;IAEL,SAAS,EAAT,iBAAS;CACV,CAAC","file":"component.js","sourcesContent":["import type {\n CircleAxisAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n LineDataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n ArcLabelAttrs,\n TooltipAttributes,\n BaseLabelAttrs,\n TitleAttrs,\n LineAxisGridAttributes,\n CircleAxisGridAttributes,\n ScrollBarAttributes\n} from '@visactor/vrender-components';\nimport type { IComponentTheme, RecursivePartial } from '../../types';\n\nconst axis: RecursivePartial<LineAxisAttributes> = {\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#89909d',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n start: { x: 0, y: 0 },\n end: { x: 100, y: 0 },\n x: 0,\n y: 0\n};\n\nconst circleAxis: RecursivePartial<CircleAxisAttributes> = {\n title: {\n space: 4,\n padding: [0, 0, 0, 0],\n textStyle: {\n fontSize: 12,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n },\n text: 'theta'\n },\n label: {\n visible: true,\n inside: false,\n space: 4,\n style: {\n fontSize: 12,\n fill: '#6F6F6F',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n tick: {\n visible: true,\n inside: false,\n alignWithLabel: true,\n length: 4,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n inside: false,\n count: 4,\n length: 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n line: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n items: [],\n startAngle: 0,\n endAngle: Math.PI * 2,\n radius: 100,\n innerRadius: 0,\n center: { x: 0, y: 0 },\n x: 0,\n y: 0\n};\n\nconst grid: RecursivePartial<LineAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst circleGrid: RecursivePartial<CircleAxisGridAttributes> = {\n style: {\n stroke: '#f1f2f5'\n }\n};\n\nconst discreteLegend: RecursivePartial<DiscreteLegendAttrs> = {\n layout: 'vertical',\n title: {\n align: 'start',\n space: 12,\n textStyle: {\n fontSize: 12,\n fontWeight: 'bold',\n fill: '#2C3542'\n }\n },\n item: {\n spaceCol: 10,\n spaceRow: 10,\n shape: {\n space: 4,\n style: {\n size: 10,\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n stroke: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n label: {\n space: 4,\n style: {\n fontSize: 12,\n fill: 'black',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8',\n fillOpacity: 0.5\n }\n }\n },\n value: {\n alignRight: false,\n style: {\n fontSize: 12,\n fill: '#ccc',\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n opacity: 0.85\n },\n unSelected: {\n fill: '#D8D8D8'\n }\n }\n },\n background: {\n style: {\n cursor: 'pointer'\n },\n state: {\n selectedHover: {\n fillOpacity: 0.7,\n fill: 'gray'\n },\n unSelectedHover: {\n fillOpacity: 0.2,\n fill: 'gray'\n }\n }\n },\n focus: false,\n focusIconStyle: {\n size: 10,\n fill: '#333',\n cursor: 'pointer'\n },\n visible: true,\n padding: {\n top: 2,\n bottom: 2,\n left: 2,\n right: 2\n }\n },\n autoPage: true,\n pager: {\n space: 12,\n handler: {\n style: {\n size: 10\n },\n space: 4\n }\n },\n hover: true,\n select: true,\n selectMode: 'multiple',\n allowAllCanceled: false,\n items: [\n {\n index: 0,\n id: '',\n label: '',\n shape: {\n fill: '#6690F2',\n stroke: '#6690F2',\n symbolType: 'circle'\n }\n }\n ]\n};\n\nconst colorLegend: RecursivePartial<ColorLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n colors: [],\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 8,\n railStyle: {\n cornerRadius: 5\n }\n};\n\nconst sizeLegend: RecursivePartial<SizeLegendAttributes> = {\n title: {\n visible: false,\n text: ''\n },\n trackStyle: {\n fill: '#ccc'\n },\n layout: 'horizontal',\n align: 'bottom',\n railWidth: 200,\n railHeight: 6,\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nconst lineCrosshair: RecursivePartial<LineCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 }\n};\n\nconst rectCrosshair: RecursivePartial<RectCrosshairAttrs> = {\n start: { x: 0, y: 0 },\n end: { x: 0, y: 0 },\n rectStyle: {\n width: 10,\n height: 10\n }\n};\n\nconst sectorCrosshair: RecursivePartial<SectorCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI / 6\n};\n\nconst circleCrosshair: RecursivePartial<CircleCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2\n};\n\nconst polygonCrosshair: RecursivePartial<PolygonCrosshairAttrs> = {\n center: { x: 0, y: 0 },\n radius: 100,\n startAngle: 0,\n endAngle: Math.PI * 2,\n sides: 6\n};\n\nconst slider: RecursivePartial<SliderAttributes> = {\n layout: 'horizontal',\n railWidth: 200,\n railHeight: 10,\n railStyle: {\n cornerRadius: 5\n },\n range: {\n draggableTrack: true\n },\n startText: {\n visible: true,\n text: '',\n space: 8\n },\n endText: {\n visible: true,\n text: '',\n space: 8\n },\n min: 0,\n max: 1,\n value: [0, 1]\n};\n\nexport const dataLabel: RecursivePartial<DataLabelAttrs> = {\n size: { width: 400, height: 400 },\n dataLabels: []\n};\n\nexport const lineDataLabel: RecursivePartial<LineDataLabelAttrs> = {\n type: 'line-data',\n data: [\n {\n text: ''\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: false,\n clampForce: false\n },\n smartInvert: false\n};\n\nexport const lineLabel: RecursivePartial<LineLabelAttrs> = {\n type: 'line',\n data: [\n {\n text: '',\n data: {}\n }\n ],\n position: 'start',\n overlap: {\n avoidBaseMark: true,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const rectLabel: RecursivePartial<RectLabelAttrs> = {\n type: 'rect',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const symbolLabel: RecursivePartial<SymbolLabelAttrs> = {\n type: 'symbol',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n position: 'top',\n overlap: {\n avoidBaseMark: true,\n size: {\n width: 1000,\n height: 1000\n },\n strategy: [\n {\n type: 'position'\n }\n ]\n },\n smartInvert: false\n};\n\nexport const arcLabel: RecursivePartial<ArcLabelAttrs> = {\n type: 'arc',\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n width: 800,\n height: 600,\n position: 'outside',\n\n zIndex: 302\n};\n\nexport const pointLabel: RecursivePartial<BaseLabelAttrs> = {\n data: [\n {\n text: '',\n fill: '#606773',\n data: {}\n }\n ],\n overlap: {\n avoidBaseMark: false,\n clampForce: false,\n size: {\n width: 1000,\n height: 1000\n }\n },\n smartInvert: false\n};\n\nexport const datazoom: RecursivePartial<DataZoomAttributes> = {\n orient: 'bottom',\n showDetail: 'auto',\n brushSelect: true,\n start: 0,\n end: 1,\n position: { x: 0, y: 0 },\n size: { width: 500, height: 40 },\n previewData: []\n};\n\nexport const continuousPlayer: RecursivePartial<ContinuousPlayerAttributes> = {};\n\nexport const discretePlayer: RecursivePartial<DiscretePlayerAttributes> = {};\n\nexport const tooltip: RecursivePartial<TooltipAttributes> = {};\n\nexport const title: RecursivePartial<TitleAttrs> = {\n textStyle: {\n fill: '#21252c'\n },\n subtextStyle: {\n fill: '#606773'\n }\n};\n\nexport const scrollbar: RecursivePartial<ScrollBarAttributes> = {\n width: 12,\n height: 12,\n padding: [2, 2],\n railStyle: {\n fill: 'rgba(0, 0, 0, .1)'\n }\n};\n\nexport const defaultComponentTheme: IComponentTheme = {\n axis,\n circleAxis,\n\n grid,\n circleGrid,\n\n discreteLegend,\n colorLegend,\n sizeLegend,\n\n lineCrosshair,\n rectCrosshair,\n sectorCrosshair,\n circleCrosshair,\n polygonCrosshair,\n\n slider,\n\n dataLabel,\n pointLabel,\n lineLabel,\n rectLabel,\n symbolLabel,\n arcLabel,\n lineDataLabel,\n\n datazoom,\n\n continuousPlayer,\n disc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SACT;KACF;CACF,CAAC,CAAC;AACH,cAAc,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,KAAK,EAAE;IAC7D,SAAS,EAAE;QACT,IAAI,EAAE,SAAS;KAChB;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,SAAS;KAChB;CACF,CAAC,CAAC;AAEU,QAAA,SAAS,GAAW;IAC/B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,2BAAe;IACxB,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE;QACP,OAAO,EAAE;YACP,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;YACT,SAAS;SACV;KACF;IACD,KAAK,EAAE,uBAAgB;IACvB,UAAU,EAAE,cAAc;CAC3B,CAAC","file":"dark.js","sourcesContent":["import type { ITheme } from '../types';\nimport { defaultComponentTheme } from './common/component';\nimport { DEFAULT_PADDING } from './common/constants';\nimport { defaultMarkTheme } from './common/mark';\n\nconst darkComponents = Object.assign({}, defaultComponentTheme);\ndarkComponents.axis = Object.assign({}, darkComponents.axis, {\n label: { style: { fill: '#bbbdc3' } },\n line: { style: { stroke: '#4b4f54' } },\n tick: { style: { stroke: '#4b4f54' } },\n subTick: { style: { stroke: '#4b4f54' } }\n});\ndarkComponents.circleAxis = Object.assign({}, darkComponents.circleAxis, {\n label: { style: { fill: '#bbbdc3' } },\n line: { style: { stroke: '#4b4f54' } },\n tick: { style: { stroke: '#4b4f54' } },\n subTick: { style: { stroke: '#4b4f54' } }\n});\ndarkComponents.grid = Object.assign({}, darkComponents.grid, {\n style: { stroke: '#404349' }\n});\ndarkComponents.circleGrid = Object.assign({}, darkComponents.circleGrid, {\n style: { stroke: '#404349' }\n});\ndarkComponents.rectLabel = Object.assign({}, darkComponents.rectLabel, {\n data: [\n {\n text: '',\n fill: '#888c93',\n data: {}\n }\n ]\n});\ndarkComponents.lineLabel = Object.assign({}, darkComponents.lineLabel, {\n data: [\n {\n text: '',\n fill: '#888c93',\n data: {}\n }\n ]\n});\n\ndarkComponents.symbolLabel = Object.assign({}, darkComponents.symbolLabel, {\n data: [\n {\n text: '',\n fill: '#888c93',\n data: {}\n }\n ]\n});\ndarkComponents.title = Object.assign({}, darkComponents.title, {\n textStyle: {\n fill: '#fdfdfd'\n },\n subtextStyle: {\n fill: '#888c93'\n }\n});\n\nexport const darkTheme: ITheme = {\n name: 'dark',\n padding: DEFAULT_PADDING,\n background: '#202226',\n palette: {\n default: [\n '#5383F4',\n '#7BCF8E',\n '#FF9D2C',\n '#FFDB26',\n '#7568D9',\n '#80D8FB',\n '#1857A3',\n '#CAB0E8',\n '#FF8867',\n '#B9E493',\n '#2CB4A8',\n '#B9E4E3'\n ]\n },\n marks: defaultMarkTheme,\n components: darkComponents\n};\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.transform = void 0;
|
|
6
|
+
|
|
7
|
+
const util_1 = require("../util/util"), samplerMap = {
|
|
8
|
+
min: util_1.min,
|
|
9
|
+
max: util_1.max,
|
|
10
|
+
average: util_1.average,
|
|
11
|
+
sum: util_1.sum
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function lttb(size, array, isGroup, yfield) {
|
|
15
|
+
const frameSize = Math.floor(array.length / size), newIndices = [], len = array.length;
|
|
16
|
+
let maxArea, area, nextIndex, currentIndex = 0, sampledIndex = 0;
|
|
17
|
+
newIndices[sampledIndex++] = currentIndex;
|
|
18
|
+
for (let i = 1; i < len - 1; i += frameSize) {
|
|
19
|
+
const nextFrameStart = Math.min(i + frameSize, len - 1), nextFrameEnd = Math.min(i + 2 * frameSize, len), avgX = (nextFrameEnd + nextFrameStart) / 2;
|
|
20
|
+
let avgY = 0;
|
|
21
|
+
for (let idx = nextFrameStart; idx < nextFrameEnd; idx++) {
|
|
22
|
+
const value = array[idx][yfield];
|
|
23
|
+
Number.isNaN(value) || (avgY += value);
|
|
24
|
+
}
|
|
25
|
+
avgY /= nextFrameEnd - nextFrameStart;
|
|
26
|
+
const frameStart = i, frameEnd = Math.min(i + frameSize, len), pointAX = i - 1, pointAY = array[currentIndex][yfield];
|
|
27
|
+
maxArea = -1, nextIndex = frameStart;
|
|
28
|
+
for (let idx = frameStart; idx < frameEnd; idx++) {
|
|
29
|
+
const value = array[idx][yfield];
|
|
30
|
+
Number.isNaN(yfield) || (area = Math.abs((pointAX - avgX) * (value - pointAY) - (pointAX - idx) * (avgY - pointAY)),
|
|
31
|
+
area > maxArea && (maxArea = area, nextIndex = idx));
|
|
32
|
+
}
|
|
33
|
+
newIndices[sampledIndex++] = nextIndex, currentIndex = nextIndex;
|
|
34
|
+
}
|
|
35
|
+
newIndices[sampledIndex - 1] !== len - 1 && (newIndices[sampledIndex++] = len - 1);
|
|
36
|
+
return newIndices.map((i => isGroup ? array[i].i : i));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function sample(size, array, isGroup, mode, yfield) {
|
|
40
|
+
let frameSize = Math.floor(array.length / size);
|
|
41
|
+
const newIndices = [], len = array.length;
|
|
42
|
+
let sampledIndex = 0, frameValues = [];
|
|
43
|
+
newIndices.push(sampledIndex), array[sampledIndex][yfield] = array[sampledIndex][yfield];
|
|
44
|
+
for (let i = 1; i < len - 1; i += frameSize) {
|
|
45
|
+
frameSize > len - i && (frameSize = len - i, frameValues.length = frameSize), frameValues = [];
|
|
46
|
+
for (let k = 0; k < frameSize; k++) frameValues.push(array[i + k][yfield]);
|
|
47
|
+
const value = samplerMap[mode](frameValues);
|
|
48
|
+
sampledIndex = Math.min(Math.round(i + frameValues.length / 2) || 0, len - 1), array[sampledIndex][yfield] = value,
|
|
49
|
+
newIndices.push(sampledIndex);
|
|
50
|
+
}
|
|
51
|
+
return newIndices.map((i => isGroup ? array[i].i : i));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function sampleMin(size, array, isGroup, yfield) {
|
|
55
|
+
return sample(size, array, isGroup, "min", yfield);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function sampleMax(size, array, isGroup, yfield) {
|
|
59
|
+
return sample(size, array, isGroup, "max", yfield);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function sampleAverage(size, array, isGroup, yfield) {
|
|
63
|
+
return sample(size, array, isGroup, "average", yfield);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function sampleSum(size, array, isGroup, yfield) {
|
|
67
|
+
return sample(size, array, isGroup, "sum", yfield);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const transform = (options, upstreamData) => {
|
|
71
|
+
let size = options.size;
|
|
72
|
+
const factor = options.factor || 1;
|
|
73
|
+
if (Array.isArray(size) && (size = Math.floor(size[1] - size[0])), size *= factor,
|
|
74
|
+
size <= 0) return [];
|
|
75
|
+
if (upstreamData.length <= size) return upstreamData;
|
|
76
|
+
if (options.skipfirst) return upstreamData.slice(0, 1);
|
|
77
|
+
const {mode: mode, yfield: y, groupBy: groupBy} = options, yfield = null != y ? y : "y";
|
|
78
|
+
let sampler = lttb;
|
|
79
|
+
if ("min" === mode ? sampler = sampleMin : "max" === mode ? sampler = sampleMax : "average" === mode ? sampler = sampleAverage : "sum" === mode && (sampler = sampleSum),
|
|
80
|
+
upstreamData.length) {
|
|
81
|
+
const groups = {};
|
|
82
|
+
if (groupBy) {
|
|
83
|
+
for (let i = 0, n = upstreamData.length; i < n; i++) {
|
|
84
|
+
const datum = upstreamData[i], groupId = datum[groupBy];
|
|
85
|
+
groups[groupId] ? groups[groupId].push({
|
|
86
|
+
[yfield]: datum[yfield],
|
|
87
|
+
i: i
|
|
88
|
+
}) : (groups[groupId] = [], groups[groupId].push({
|
|
89
|
+
[yfield]: datum[yfield],
|
|
90
|
+
i: i
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
let rawIndice = [];
|
|
94
|
+
return Object.keys(groups).forEach((groupName => {
|
|
95
|
+
const group = groups[groupName];
|
|
96
|
+
if (group.length <= size) {
|
|
97
|
+
const indices = group.map((datum => datum.i));
|
|
98
|
+
rawIndice = rawIndice.concat(indices);
|
|
99
|
+
} else {
|
|
100
|
+
const indices = sampler(size, group, !0, yfield);
|
|
101
|
+
rawIndice = rawIndice.concat(indices), group.forEach((datum => upstreamData[datum.i][yfield] = datum[yfield]));
|
|
102
|
+
}
|
|
103
|
+
})), rawIndice.sort(((a, b) => a - b)), rawIndice.map((index => upstreamData[index]));
|
|
104
|
+
}
|
|
105
|
+
return sampler(size, upstreamData, !1, yfield).map((index => upstreamData[index]));
|
|
106
|
+
}
|
|
107
|
+
return [];
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
exports.transform = transform;
|
|
111
|
+
//# sourceMappingURL=sampling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/transforms/data/sampling.ts"],"names":[],"mappings":";;;AACA,uCAAsD;AAEtD,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,UAAG;IACR,GAAG,EAAE,UAAG;IACR,OAAO,EAAE,cAAO;IAChB,GAAG,EAAE,UAAG;CACT,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY,EAAE,KAAY,EAAE,OAAgB,EAAE,MAAc;IACxE,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IAEzB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,OAAO,CAAC;IACZ,IAAI,IAAI,CAAC;IACT,IAAI,SAAS,CAAC;IAGd,UAAU,CAAC,YAAY,EAAE,CAAC,GAAG,YAAY,CA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OAAO,CAAC,SAAS,CAAC,EAAE;gBACtC,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;gBAChC,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI,EAAE;oBACxB,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;wBACvC,OAAO,KAAK,CAAC,CAAC,CAAC;oBACjB,CAAC,CAAC,CAAC;oBACH,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;iBACvC;qBAAM;oBACL,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;oBACnD,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBACtC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;iBAChF;YACH,CAAC,CAAC,CAAC;YAGH,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAEhC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;SAC9D;QACD,OAAO,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;KACrF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AArFW,QAAA,SAAS,aAqFpB","file":"sampling.js","sourcesContent":["import type { SampleTransformOptions } from '../../types';\nimport { average, max, min, sum } from '../util/util';\n\nconst samplerMap = {\n min: min,\n max: max,\n average: average,\n sum: sum\n};\n\nfunction lttb(size: number, array: any[], isGroup: boolean, yfield: string) {\n const frameSize = Math.floor(array.length / size);\n const newIndices = [];\n const len = array.length;\n\n let currentIndex = 0;\n let sampledIndex = 0;\n let maxArea;\n let area;\n let nextIndex;\n\n // First frame use the first data.\n newIndices[sampledIndex++] = currentIndex;\n\n for (let i = 1; i < len - 1; i += frameSize) {\n const nextFrameStart = Math.min(i + frameSize, len - 1);\n const nextFrameEnd = Math.min(i + frameSize * 2, len);\n\n const avgX = (nextFrameEnd + nextFrameStart) / 2;\n let avgY = 0;\n\n for (let idx = nextFrameStart; idx < nextFrameEnd; idx++) {\n const value = array[idx][yfield];\n if (Number.isNaN(value)) {\n continue;\n }\n avgY += value;\n }\n avgY /= nextFrameEnd - nextFrameStart;\n\n const frameStart = i;\n const frameEnd = Math.min(i + frameSize, len);\n\n const pointAX = i - 1;\n const pointAY = array[currentIndex][yfield];\n\n maxArea = -1;\n\n nextIndex = frameStart;\n // Find a point from current frame that construct a triangel with largest area with previous selected point\n // And the average of next frame.\n for (let idx = frameStart; idx < frameEnd; idx++) {\n const value = array[idx][yfield];\n if (Number.isNaN(yfield)) {\n continue;\n }\n // Calculate triangle area over three buckets\n area = Math.abs((pointAX - avgX) * (value - pointAY) - (pointAX - idx) * (avgY - pointAY));\n if (area > maxArea) {\n maxArea = area;\n nextIndex = idx; // Next a is this b\n }\n }\n\n newIndices[sampledIndex++] = nextIndex;\n\n currentIndex = nextIndex; // This a is the next a (chosen b)\n }\n\n // First frame use the last data.\n if (newIndices[sampledIndex - 1] !== len - 1) {\n newIndices[sampledIndex++] = len - 1;\n }\n\n // output newly added tuples\n const newRawIndices = newIndices.map(i => (isGroup ? array[i].i : i));\n return newRawIndices;\n}\n\nfunction sample(size: number, array: any[], isGroup: boolean, mode: 'min' | 'max' | 'average' | 'sum', yfield: string) {\n let frameSize = Math.floor(array.length / size);\n const newIndices = [];\n const len = array.length;\n let sampledIndex = 0;\n let frameValues = [];\n\n newIndices.push(sampledIndex);\n array[sampledIndex][yfield] = array[sampledIndex][yfield];\n\n for (let i = 1; i < len - 1; i += frameSize) {\n if (frameSize > len - i) {\n frameSize = len - i;\n frameValues.length = frameSize;\n }\n frameValues = [];\n for (let k = 0; k < frameSize; k++) {\n frameValues.push(array[i + k][yfield]);\n }\n const value = samplerMap[mode](frameValues);\n sampledIndex = Math.min(Math.round(i + frameValues.length / 2) || 0, len - 1);\n array[sampledIndex][yfield] = value;\n newIndices.push(sampledIndex);\n }\n const newRawIndices = newIndices.map(i => (isGroup ? array[i].i : i));\n return newRawIndices;\n}\n\nfunction sampleMin(size: number, array: any[], isGroup: boolean, yfield: string) {\n return sample(size, array, isGroup, 'min', yfield);\n}\n\nfunction sampleMax(size: number, array: any[], isGroup: boolean, yfield: string) {\n return sample(size, array, isGroup, 'max', yfield);\n}\n\nfunction sampleAverage(size: number, array: any[], isGroup: boolean, yfield: string) {\n return sample(size, array, isGroup, 'average', yfield);\n}\n\nfunction sampleSum(size: number, array: any[], isGroup: boolean, yfield: string) {\n return sample(size, array, isGroup, 'sum', yfield);\n}\n\n/**\n * Samples tuples passing through this operator.\n * mode: 'lttb' - Uses lttb sampling to maintain a trend-maintained sample.\n * mode: 'min' | 'max' | 'average' | 'sum' - Uses aggregation methods to location sample points.\n * @constructor\n * @param {object} options - The parameters for this operator.\n * @param {number} [options.size=1000] - The maximum number of samples.\n * @param {string} [options.yfield] - The yfield string of data.\n * @param {string} [options.groupBy] - The groupBy string of data.\n */\n\nexport const transform = (options: SampleTransformOptions, upstreamData: any[]) => {\n let size = options.size;\n const factor = options.factor || 1;\n\n if (Array.isArray(size)) {\n size = Math.floor(size[1] - size[0]);\n }\n\n size *= factor;\n\n // size<=0的特殊情况不采样,返回空\n if (size <= 0) {\n return [];\n }\n\n // 数据<size的情况,不进行采样,保留所有数据\n if (upstreamData.length <= size) {\n return upstreamData;\n }\n\n const skipfirst = options.skipfirst;\n // 如果是ChartSpace的第一次数据流(evaluateAsync),不需要采样,返回一条数据供布局使用\n // 这里需要依据this.value.length判断是不是第一次数据流,\n // 以避免点击图例,updateChartData等操作清空所有label\n if (skipfirst) {\n return upstreamData.slice(0, 1);\n }\n\n const { mode, yfield: y, groupBy } = options;\n const yfield = y ?? 'y';\n\n // 采样方法\n let sampler = lttb;\n if (mode === 'min') {\n sampler = sampleMin;\n } else if (mode === 'max') {\n sampler = sampleMax;\n } else if (mode === 'average') {\n sampler = sampleAverage;\n } else if (mode === 'sum') {\n sampler = sampleSum;\n }\n\n // 处理数据source,source为采样前的原始数据\n if (upstreamData.length) {\n // 如果有groupBy,数据分组\n const groups = {};\n if (groupBy) {\n for (let i = 0, n = upstreamData.length; i < n; i++) {\n const datum = upstreamData[i];\n const groupId = datum[groupBy];\n if (groups[groupId]) {\n groups[groupId].push({ [yfield]: datum[yfield], i });\n } else {\n groups[groupId] = [];\n groups[groupId].push({ [yfield]: datum[yfield], i });\n }\n }\n\n // 分组采样\n let rawIndice: any[] = [];\n\n Object.keys(groups).forEach(groupName => {\n const group = groups[groupName];\n if (group.length <= size) {\n const indices = group.map((datum: any) => {\n return datum.i;\n });\n rawIndice = rawIndice.concat(indices);\n } else {\n const indices = sampler(size, group, true, yfield);\n rawIndice = rawIndice.concat(indices);\n group.forEach((datum: any) => (upstreamData[datum.i][yfield] = datum[yfield]));\n }\n });\n\n // 采样后,按照原始顺序排序\n rawIndice.sort((a, b) => a - b);\n\n return rawIndice.map((index: number) => upstreamData[index]);\n }\n return sampler(size, upstreamData, false, yfield).map(index => upstreamData[index]);\n }\n\n return [];\n};\n"]}
|