@visactor/vchart-extension 2.0.4-alpha.0 → 2.0.4-alpha.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.
Files changed (95) hide show
  1. package/build/index.js +533 -0
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/candlestick/candlestick-transformer.d.ts +6 -0
  4. package/cjs/charts/candlestick/candlestick-transformer.js +24 -0
  5. package/cjs/charts/candlestick/candlestick-transformer.js.map +1 -0
  6. package/cjs/charts/candlestick/candlestick.d.ts +10 -0
  7. package/cjs/charts/candlestick/candlestick.js +25 -0
  8. package/cjs/charts/candlestick/candlestick.js.map +1 -0
  9. package/cjs/charts/candlestick/index.d.ts +3 -0
  10. package/cjs/charts/candlestick/index.js +22 -0
  11. package/cjs/charts/candlestick/index.js.map +1 -0
  12. package/cjs/charts/candlestick/interface.d.ts +6 -0
  13. package/cjs/charts/candlestick/interface.js +6 -0
  14. package/cjs/charts/candlestick/interface.js.map +1 -0
  15. package/cjs/charts/candlestick/mark/candlestick.d.ts +11 -0
  16. package/cjs/charts/candlestick/mark/candlestick.js +62 -0
  17. package/cjs/charts/candlestick/mark/candlestick.js.map +1 -0
  18. package/cjs/charts/candlestick/mark/interface.d.ts +9 -0
  19. package/cjs/charts/candlestick/mark/interface.js +6 -0
  20. package/cjs/charts/candlestick/mark/interface.js.map +1 -0
  21. package/cjs/charts/candlestick/series/animation.d.ts +32 -0
  22. package/cjs/charts/candlestick/series/animation.js +132 -0
  23. package/cjs/charts/candlestick/series/animation.js.map +1 -0
  24. package/cjs/charts/candlestick/series/candlestick.d.ts +105 -0
  25. package/cjs/charts/candlestick/series/candlestick.js +143 -0
  26. package/cjs/charts/candlestick/series/candlestick.js.map +1 -0
  27. package/cjs/charts/candlestick/series/constant.d.ts +77 -0
  28. package/cjs/charts/candlestick/series/constant.js +26 -0
  29. package/cjs/charts/candlestick/series/constant.js.map +1 -0
  30. package/cjs/charts/candlestick/series/interface.d.ts +20 -0
  31. package/cjs/charts/candlestick/series/interface.js +6 -0
  32. package/cjs/charts/candlestick/series/interface.js.map +1 -0
  33. package/cjs/charts/candlestick/series/theme.d.ts +3 -0
  34. package/cjs/charts/candlestick/series/theme.js +34 -0
  35. package/cjs/charts/candlestick/series/theme.js.map +1 -0
  36. package/cjs/charts/candlestick/series/tooltip-helper.d.ts +9 -0
  37. package/cjs/charts/candlestick/series/tooltip-helper.js +70 -0
  38. package/cjs/charts/candlestick/series/tooltip-helper.js.map +1 -0
  39. package/cjs/charts/conversion-funnel/constants.js +2 -1
  40. package/cjs/charts/funnel-3d/theme.js +1 -2
  41. package/cjs/charts/image-cloud/image-cloud-transformer.js +2 -1
  42. package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  43. package/cjs/charts/pictogram/element-select-by-graphic-name.js +1 -1
  44. package/cjs/charts/pictogram/index.js +1 -1
  45. package/cjs/charts/pictogram/interface.js +1 -1
  46. package/cjs/index.d.ts +1 -0
  47. package/cjs/index.js +3 -2
  48. package/cjs/index.js.map +1 -1
  49. package/esm/charts/candlestick/candlestick-transformer.d.ts +6 -0
  50. package/esm/charts/candlestick/candlestick-transformer.js +16 -0
  51. package/esm/charts/candlestick/candlestick-transformer.js.map +1 -0
  52. package/esm/charts/candlestick/candlestick.d.ts +10 -0
  53. package/esm/charts/candlestick/candlestick.js +22 -0
  54. package/esm/charts/candlestick/candlestick.js.map +1 -0
  55. package/esm/charts/candlestick/index.d.ts +3 -0
  56. package/esm/charts/candlestick/index.js +6 -0
  57. package/esm/charts/candlestick/index.js.map +1 -0
  58. package/esm/charts/candlestick/interface.d.ts +6 -0
  59. package/esm/charts/candlestick/interface.js +2 -0
  60. package/esm/charts/candlestick/interface.js.map +1 -0
  61. package/esm/charts/candlestick/mark/candlestick.d.ts +11 -0
  62. package/esm/charts/candlestick/mark/candlestick.js +58 -0
  63. package/esm/charts/candlestick/mark/candlestick.js.map +1 -0
  64. package/esm/charts/candlestick/mark/interface.d.ts +9 -0
  65. package/esm/charts/candlestick/mark/interface.js +2 -0
  66. package/esm/charts/candlestick/mark/interface.js.map +1 -0
  67. package/esm/charts/candlestick/series/animation.d.ts +32 -0
  68. package/esm/charts/candlestick/series/animation.js +124 -0
  69. package/esm/charts/candlestick/series/animation.js.map +1 -0
  70. package/esm/charts/candlestick/series/candlestick.d.ts +105 -0
  71. package/esm/charts/candlestick/series/candlestick.js +145 -0
  72. package/esm/charts/candlestick/series/candlestick.js.map +1 -0
  73. package/esm/charts/candlestick/series/constant.d.ts +77 -0
  74. package/esm/charts/candlestick/series/constant.js +27 -0
  75. package/esm/charts/candlestick/series/constant.js.map +1 -0
  76. package/esm/charts/candlestick/series/interface.d.ts +20 -0
  77. package/esm/charts/candlestick/series/interface.js +2 -0
  78. package/esm/charts/candlestick/series/interface.js.map +1 -0
  79. package/esm/charts/candlestick/series/theme.d.ts +3 -0
  80. package/esm/charts/candlestick/series/theme.js +52 -0
  81. package/esm/charts/candlestick/series/theme.js.map +1 -0
  82. package/esm/charts/candlestick/series/tooltip-helper.d.ts +9 -0
  83. package/esm/charts/candlestick/series/tooltip-helper.js +64 -0
  84. package/esm/charts/candlestick/series/tooltip-helper.js.map +1 -0
  85. package/esm/charts/conversion-funnel/constants.js +2 -1
  86. package/esm/charts/funnel-3d/theme.js +1 -2
  87. package/esm/charts/image-cloud/image-cloud-transformer.js +2 -1
  88. package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
  89. package/esm/charts/pictogram/element-select-by-graphic-name.js +1 -1
  90. package/esm/charts/pictogram/index.js +1 -1
  91. package/esm/charts/pictogram/interface.js +1 -1
  92. package/esm/index.d.ts +1 -0
  93. package/esm/index.js +2 -0
  94. package/esm/index.js.map +1 -1
  95. package/package.json +4 -4
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.registerCandlestickSeries = exports.CandlestickSeries = exports.DEFAULT_STROKE_COLOR = void 0;
6
+
7
+ const candlestick_1 = require("../mark/candlestick"), vchart_1 = require("@visactor/vchart"), vchart_2 = require("@visactor/vchart"), vutils_1 = require("@visactor/vutils"), animation_1 = require("./animation"), constant_1 = require("./constant"), tooltip_helper_1 = require("./tooltip-helper"), theme_1 = require("./theme");
8
+
9
+ exports.DEFAULT_STROKE_COLOR = "#000";
10
+
11
+ class CandlestickSeries extends vchart_1.CartesianSeries {
12
+ constructor() {
13
+ super(...arguments), this.type = constant_1.CANDLESTICK_SERIES_TYPE, this._mergedStyles = {
14
+ rising: {},
15
+ falling: {},
16
+ doji: {}
17
+ };
18
+ }
19
+ getOpenField() {
20
+ return this._openField;
21
+ }
22
+ getHighField() {
23
+ return this._highField;
24
+ }
25
+ getLowField() {
26
+ return this._lowField;
27
+ }
28
+ getCloseField() {
29
+ return this._closeField;
30
+ }
31
+ getBoxFill() {
32
+ return this._boxFill;
33
+ }
34
+ getStrokeColor() {
35
+ return this._strokeColor;
36
+ }
37
+ setAttrFromSpec() {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h;
39
+ super.setAttrFromSpec();
40
+ const spec = this._spec, CandlestickStyle = null !== (_b = null === (_a = spec.candlestick) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {};
41
+ this._openField = spec.openField, this._highField = spec.highField, this._lowField = spec.lowField,
42
+ this._closeField = spec.closeField, this._boxWidth = CandlestickStyle.boxWidth,
43
+ this._boxFill = CandlestickStyle.boxFill, this._strokeColor = CandlestickStyle.strokeColor,
44
+ this._buildMergedStyles(CandlestickStyle, null !== (_d = null === (_c = spec.rising) || void 0 === _c ? void 0 : _c.style) && void 0 !== _d ? _d : {}, null !== (_f = null === (_e = spec.falling) || void 0 === _e ? void 0 : _e.style) && void 0 !== _f ? _f : {}, null !== (_h = null === (_g = spec.doji) || void 0 === _g ? void 0 : _g.style) && void 0 !== _h ? _h : {});
45
+ }
46
+ initMark() {
47
+ this._candlestickMark = this._createMark(CandlestickSeries.mark.candlestick, {
48
+ groupKey: this._seriesField,
49
+ isSeriesMark: !0
50
+ });
51
+ }
52
+ initMarkStyle() {
53
+ var _a;
54
+ const candlestickMark = this._candlestickMark;
55
+ if (candlestickMark) {
56
+ const CandlestickStyles = {
57
+ fill: datum => this.mergeStyle(datum).boxFill,
58
+ stroke: datum => this.mergeStyle(datum).stroke,
59
+ lineWidth: datum => this.mergeStyle(datum).lineWidth,
60
+ boxWidth: null !== (_a = this._boxWidth) && void 0 !== _a ? _a : this._getMarkWidth.bind(this),
61
+ x: this.dataToPositionX.bind(this)
62
+ };
63
+ candlestickMark.setGlyphConfig({}), this.setMarkStyle(candlestickMark, CandlestickStyles, vchart_1.STATE_VALUE_ENUM.STATE_NORMAL, vchart_1.AttributeLevel.Series);
64
+ }
65
+ }
66
+ initCandlestickMarkStyle() {
67
+ var _a;
68
+ const candlestickMark = this._candlestickMark, axisHelper = this._yAxisHelper;
69
+ if (candlestickMark && axisHelper) {
70
+ const {dataToPosition: dataToPosition} = axisHelper, scale = null === (_a = null == axisHelper ? void 0 : axisHelper.getScale) || void 0 === _a ? void 0 : _a.call(axisHelper, 0);
71
+ this.setMarkStyle(candlestickMark, {
72
+ open: datum => (0, vchart_2.valueInScaleRange)(dataToPosition(this.getDatumPositionValues(datum, this._openField), {
73
+ bandPosition: this._bandPosition
74
+ }), scale),
75
+ high: datum => (0, vchart_2.valueInScaleRange)(dataToPosition(this.getDatumPositionValues(datum, this._highField), {
76
+ bandPosition: this._bandPosition
77
+ }), scale),
78
+ low: datum => (0, vchart_2.valueInScaleRange)(dataToPosition(this.getDatumPositionValues(datum, this._lowField), {
79
+ bandPosition: this._bandPosition
80
+ }), scale),
81
+ close: datum => (0, vchart_2.valueInScaleRange)(dataToPosition(this.getDatumPositionValues(datum, this._closeField), {
82
+ bandPosition: this._bandPosition
83
+ }), scale)
84
+ }, vchart_1.STATE_VALUE_ENUM.STATE_NORMAL, vchart_1.AttributeLevel.Series);
85
+ }
86
+ }
87
+ init(option) {
88
+ super.init(option), this.initCandlestickMarkStyle();
89
+ }
90
+ _initAnimationSpec(config = {}) {
91
+ const newConfig = (0, vutils_1.merge)({}, config);
92
+ return [ "appear", "enter", "update", "exit", "disappear" ].forEach((state => {
93
+ newConfig[state] && "scaleIn" === newConfig[state].type ? newConfig[state].type = "candlestickScaleIn" : newConfig[state] && "scaleOut" === newConfig[state].type && (newConfig[state].type = "candlestickScaleOut");
94
+ })), newConfig;
95
+ }
96
+ initAnimation() {
97
+ var _a;
98
+ const animationParams = (0, vchart_1.getGroupAnimationParams)(this);
99
+ if (this._candlestickMark) {
100
+ const newDefaultConfig = this._initAnimationSpec(null === (_a = vchart_1.Factory.getAnimationInKey("scaleInOut")) || void 0 === _a ? void 0 : _a()), newConfig = this._initAnimationSpec((0,
101
+ vchart_1.userAnimationConfig)(constant_1.CANDLESTICK_SERIES_TYPE, this._spec, this._markAttributeContext));
102
+ this._candlestickMark.setAnimationConfig((0, vchart_1.animationConfig)(newDefaultConfig, newConfig, animationParams));
103
+ }
104
+ }
105
+ initTooltip() {
106
+ this._tooltipHelper = new tooltip_helper_1.CandlestickSeriesTooltipHelper(this),
107
+ this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);
108
+ }
109
+ _buildMergedStyles(baseStyle, risingStyle, fallingStyle, dojiStyle) {
110
+ this._mergedStyles.rising = (0, vutils_1.merge)({}, baseStyle, risingStyle), this._mergedStyles.falling = (0,
111
+ vutils_1.merge)({}, baseStyle, fallingStyle), this._mergedStyles.doji = (0, vutils_1.merge)({}, baseStyle, dojiStyle);
112
+ }
113
+ mergeStyle(datum) {
114
+ const open = this.getDatumPositionValues(datum, this._openField)[0], close = this.getDatumPositionValues(datum, this._closeField)[0];
115
+ return open < close ? this._mergedStyles.rising : open > close ? this._mergedStyles.falling : this._mergedStyles.doji;
116
+ }
117
+ _getMarkWidth() {
118
+ if (this._autoBoxWidth) return this._autoBoxWidth;
119
+ const bandAxisHelper = this._xAxisHelper, xField = this._fieldX, autoBoxWidth = bandAxisHelper.getBandwidth(xField.length - 1) / xField.length;
120
+ return this._autoBoxWidth = autoBoxWidth, this._autoBoxWidth;
121
+ }
122
+ onLayoutEnd() {
123
+ super.onLayoutEnd(), this._autoBoxWidth = null;
124
+ }
125
+ getActiveMarks() {
126
+ return [ this._candlestickMark ];
127
+ }
128
+ }
129
+
130
+ exports.CandlestickSeries = CandlestickSeries, CandlestickSeries.type = constant_1.CANDLESTICK_SERIES_TYPE,
131
+ CandlestickSeries.builtInTheme = {
132
+ candlestick: theme_1.candlestick
133
+ }, CandlestickSeries.mark = constant_1.CandlestickSeriesMark;
134
+
135
+ const registerCandlestickSeries = () => {
136
+ (0, candlestick_1.registerCandlestickMark)(), (0, vchart_1.registerSymbolMark)(),
137
+ (0, vchart_1.registerScaleInOutAnimation)(), (0, vchart_1.registerCartesianBandAxis)(),
138
+ (0, vchart_1.registerCartesianLinearAxis)(), (0, animation_1.registerCandlestickScaleAnimation)(),
139
+ vchart_1.Factory.registerSeries(CandlestickSeries.type, CandlestickSeries);
140
+ };
141
+
142
+ exports.registerCandlestickSeries = registerCandlestickSeries;
143
+ //# sourceMappingURL=candlestick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/series/candlestick.ts"],"names":[],"mappings":";;;AAAA,qDAAgF;AAChF,6CAe0B;AAC1B,6CAAqD;AAErD,6CAAyC;AAEzC,2CAAgE;AAChE,yCAA4E;AAC5E,qDAAkE;AAClE,mCAAsC;AAEzB,QAAA,oBAAoB,GAAG,MAAM,CAAC;AAC3C,MAAa,iBAA6E,SAAQ,wBAAkB;IAApH;;QAEE,SAAI,GAAG,kCAAuB,CAAC;QA8BvB,kBAAa,GAA6C;YAChE,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,EAAE;SACT,CAAC;IA8KJ,CAAC;IA3MC,YAAY;QACV,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC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QACtE,MAAM,YAAY,GAAG,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,WAAW;QACT,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACjC,CAAC;;AAjNH,8CAkNC;AAjNiB,sBAAI,GAAW,kCAAuB,CAAC;AAGvC,8BAAY,GAAG,EAAE,WAAW,EAAX,mBAAW,EAAE,CAAC;AAC/B,sBAAI,GAAG,gCAAqB,CAAC;AA+MxC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,IAAA,qCAAuB,GAAE,CAAC;IAC1B,IAAA,2BAAkB,GAAE,CAAC;IACrB,IAAA,oCAA2B,GAAE,CAAC;IAC9B,IAAA,kCAAyB,GAAE,CAAC;IAC5B,IAAA,oCAA2B,GAAE,CAAC;IAC9B,IAAA,6CAAiC,GAAE,CAAC;IACpC,gBAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AACpE,CAAC,CAAC;AARW,QAAA,yBAAyB,6BAQpC","file":"candlestick.js","sourcesContent":["import { registerCandlestickMark, ICandlestickMark } from '../mark/candlestick';\nimport {\n registerSymbolMark,\n registerScaleInOutAnimation,\n registerCartesianBandAxis,\n registerCartesianLinearAxis,\n CartesianSeries,\n IMark,\n Factory,\n STATE_VALUE_ENUM,\n AttributeLevel,\n Datum,\n IModelInitOption,\n getGroupAnimationParams,\n animationConfig,\n userAnimationConfig\n} from '@visactor/vchart';\nimport { valueInScaleRange } from '@visactor/vchart';\nimport { IGlyphMark } from '@visactor/vchart';\nimport { merge } from '@visactor/vutils';\nimport type { ICandlestickSeriesSpec } from './interface';\nimport { registerCandlestickScaleAnimation } from './animation';\nimport { CANDLESTICK_SERIES_TYPE, CandlestickSeriesMark } from './constant';\nimport { CandlestickSeriesTooltipHelper } from './tooltip-helper';\nimport { candlestick } from './theme';\n\nexport const DEFAULT_STROKE_COLOR = '#000';\nexport class CandlestickSeries<T extends ICandlestickSeriesSpec = ICandlestickSeriesSpec> extends CartesianSeries<T> {\n static readonly type: string = CANDLESTICK_SERIES_TYPE;\n type = CANDLESTICK_SERIES_TYPE;\n\n static readonly builtInTheme = { candlestick };\n static readonly mark = CandlestickSeriesMark;\n protected _openField: string;\n getOpenField(): string {\n return this._openField;\n }\n protected _highField: string;\n getHighField(): string {\n return this._highField;\n }\n protected _lowField: string;\n getLowField(): string {\n return this._lowField;\n }\n protected _closeField: string;\n getCloseField(): string {\n return this._closeField;\n }\n protected _boxWidth: number;\n protected _boxFill: string | ((datum: Datum) => string);\n getBoxFill(): string | ((datum: Datum) => string) {\n return this._boxFill;\n }\n protected _strokeColor: string;\n getStrokeColor(): string {\n return this._strokeColor;\n }\n private _autoBoxWidth: number;\n private _mergedStyles: { rising: any; falling: any; doji: any } = {\n rising: {},\n falling: {},\n doji: {}\n };\n\n setAttrFromSpec() {\n super.setAttrFromSpec();\n const spec = this._spec;\n const CandlestickStyle: any = spec.candlestick?.style ?? {};\n this._openField = spec.openField;\n this._highField = spec.highField;\n this._lowField = spec.lowField;\n this._closeField = spec.closeField;\n this._boxWidth = CandlestickStyle.boxWidth;\n this._boxFill = CandlestickStyle.boxFill;\n this._strokeColor = CandlestickStyle.strokeColor;\n this._buildMergedStyles(\n CandlestickStyle,\n spec.rising?.style ?? {},\n spec.falling?.style ?? {},\n spec.doji?.style ?? {}\n );\n }\n\n private _candlestickMark?: ICandlestickMark;\n\n initMark(): void {\n this._candlestickMark = this._createMark(CandlestickSeries.mark.candlestick, {\n groupKey: this._seriesField,\n isSeriesMark: true\n }) as ICandlestickMark;\n }\n\n initMarkStyle(): void {\n const candlestickMark = this._candlestickMark;\n if (candlestickMark) {\n const CandlestickStyles = {\n fill: (datum: Datum) => {\n const boxFill = this.mergeStyle(datum).boxFill;\n return boxFill;\n },\n stroke: (datum: Datum) => {\n const strokeColor = this.mergeStyle(datum).stroke;\n return strokeColor;\n },\n lineWidth: (datum: Datum) => {\n const lineWidth = this.mergeStyle(datum).lineWidth;\n return lineWidth;\n },\n boxWidth: this._boxWidth ?? this._getMarkWidth.bind(this),\n x: this.dataToPositionX.bind(this)\n };\n (candlestickMark as IGlyphMark).setGlyphConfig({});\n this.setMarkStyle(candlestickMark, CandlestickStyles, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);\n }\n }\n\n initCandlestickMarkStyle() {\n const candlestickMark = this._candlestickMark;\n const axisHelper = this._yAxisHelper;\n if (candlestickMark && axisHelper) {\n const { dataToPosition } = axisHelper;\n const scale = axisHelper?.getScale?.(0);\n this.setMarkStyle(\n candlestickMark,\n {\n open: (datum: Datum) =>\n valueInScaleRange(\n dataToPosition(this.getDatumPositionValues(datum, this._openField), {\n bandPosition: this._bandPosition\n }),\n scale\n ),\n high: (datum: Datum) =>\n valueInScaleRange(\n dataToPosition(this.getDatumPositionValues(datum, this._highField), {\n bandPosition: this._bandPosition\n }),\n scale\n ),\n low: (datum: Datum) =>\n valueInScaleRange(\n dataToPosition(this.getDatumPositionValues(datum, this._lowField), {\n bandPosition: this._bandPosition\n }),\n scale\n ),\n close: (datum: Datum) =>\n valueInScaleRange(\n dataToPosition(this.getDatumPositionValues(datum, this._closeField), {\n bandPosition: this._bandPosition\n }),\n scale\n )\n },\n STATE_VALUE_ENUM.STATE_NORMAL,\n AttributeLevel.Series\n );\n }\n }\n\n init(option: IModelInitOption): void {\n super.init(option);\n //init在axis初始化之后才被执行,此时axisHelper不为空\n this.initCandlestickMarkStyle();\n }\n\n private _initAnimationSpec(config: any = {}) {\n const newConfig = merge({}, config);\n ['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {\n if (newConfig[state] && newConfig[state].type === 'scaleIn') {\n newConfig[state].type = 'candlestickScaleIn';\n } else if (newConfig[state] && newConfig[state].type === 'scaleOut') {\n newConfig[state].type = 'candlestickScaleOut';\n }\n });\n return newConfig;\n }\n\n initAnimation() {\n const animationParams = getGroupAnimationParams(this);\n\n if (this._candlestickMark) {\n const newDefaultConfig = this._initAnimationSpec(Factory.getAnimationInKey('scaleInOut')?.());\n const newConfig = this._initAnimationSpec(\n userAnimationConfig(CANDLESTICK_SERIES_TYPE, this._spec, this._markAttributeContext)\n );\n this._candlestickMark.setAnimationConfig(animationConfig(newDefaultConfig, newConfig, animationParams));\n }\n }\n\n protected initTooltip() {\n this._tooltipHelper = new CandlestickSeriesTooltipHelper(this);\n this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);\n }\n\n private _buildMergedStyles(baseStyle: any, risingStyle: any, fallingStyle: any, dojiStyle: any) {\n this._mergedStyles.rising = merge({}, baseStyle, risingStyle);\n this._mergedStyles.falling = merge({}, baseStyle, fallingStyle);\n this._mergedStyles.doji = merge({}, baseStyle, dojiStyle);\n }\n\n protected mergeStyle(datum: Datum): any {\n const open = this.getDatumPositionValues(datum, this._openField)[0];\n const close = this.getDatumPositionValues(datum, this._closeField)[0];\n if (open < close) {\n return this._mergedStyles.rising;\n } else if (open > close) {\n return this._mergedStyles.falling;\n } else {\n return this._mergedStyles.doji;\n }\n }\n\n private _getMarkWidth() {\n if (this._autoBoxWidth) {\n return this._autoBoxWidth;\n }\n //获取自适应的图元宽度\n const bandAxisHelper = this._xAxisHelper;\n const xField = this._fieldX;\n\n const innerBandWidth = bandAxisHelper.getBandwidth(xField.length - 1);\n const autoBoxWidth = innerBandWidth / xField.length;\n this._autoBoxWidth = autoBoxWidth;\n\n return this._autoBoxWidth;\n }\n\n onLayoutEnd() {\n super.onLayoutEnd();\n this._autoBoxWidth = null;\n }\n\n getActiveMarks(): IMark[] {\n return [this._candlestickMark];\n }\n}\n\nexport const registerCandlestickSeries = () => {\n registerCandlestickMark();\n registerSymbolMark();\n registerScaleInOutAnimation();\n registerCartesianBandAxis();\n registerCartesianLinearAxis();\n registerCandlestickScaleAnimation();\n Factory.registerSeries(CandlestickSeries.type, CandlestickSeries);\n};\n"]}
@@ -0,0 +1,77 @@
1
+ export declare const CANDLESTICK_CHART_TYPE = "candlestick";
2
+ export declare const CANDLESTICK_SERIES_TYPE = "candlestick";
3
+ export declare enum CANDLESTICK_TOOLTIP_KEYS {
4
+ OPEN = "open",
5
+ HIGH = "high",
6
+ LOW = "low",
7
+ CLOSE = "close",
8
+ SERIES_FIELD = "seriesField"
9
+ }
10
+ export declare const enum CandlestickMarkNameEnum {
11
+ candlestick = "candlestick"
12
+ }
13
+ export declare const CandlestickSeriesMark: {
14
+ candlestick: {
15
+ name: CandlestickMarkNameEnum;
16
+ type: string;
17
+ };
18
+ label?: import("@visactor/vchart").ISeriesMarkInfo;
19
+ point?: import("@visactor/vchart").ISeriesMarkInfo;
20
+ line?: import("@visactor/vchart").ISeriesMarkInfo;
21
+ area?: import("@visactor/vchart").ISeriesMarkInfo;
22
+ bar?: import("@visactor/vchart").ISeriesMarkInfo;
23
+ boxPlot?: import("@visactor/vchart").ISeriesMarkInfo;
24
+ outlier?: import("@visactor/vchart").ISeriesMarkInfo;
25
+ circlePacking?: import("@visactor/vchart").ISeriesMarkInfo;
26
+ group?: import("@visactor/vchart").ISeriesMarkInfo;
27
+ gridBackground?: import("@visactor/vchart").ISeriesMarkInfo;
28
+ grid?: import("@visactor/vchart").ISeriesMarkInfo;
29
+ dot?: import("@visactor/vchart").ISeriesMarkInfo;
30
+ title?: import("@visactor/vchart").ISeriesMarkInfo;
31
+ subTitle?: import("@visactor/vchart").ISeriesMarkInfo;
32
+ symbol?: import("@visactor/vchart").ISeriesMarkInfo;
33
+ funnel?: import("@visactor/vchart").ISeriesMarkInfo;
34
+ transform?: import("@visactor/vchart").ISeriesMarkInfo;
35
+ transformLabel?: import("@visactor/vchart").ISeriesMarkInfo;
36
+ outerLabel?: import("@visactor/vchart").ISeriesMarkInfo;
37
+ outerLabelLine?: import("@visactor/vchart").ISeriesMarkInfo;
38
+ pin?: import("@visactor/vchart").ISeriesMarkInfo;
39
+ pinBackground?: import("@visactor/vchart").ISeriesMarkInfo;
40
+ pointer?: import("@visactor/vchart").ISeriesMarkInfo;
41
+ segment?: import("@visactor/vchart").ISeriesMarkInfo;
42
+ track?: import("@visactor/vchart").ISeriesMarkInfo;
43
+ cell?: import("@visactor/vchart").ISeriesMarkInfo;
44
+ cellBackground?: import("@visactor/vchart").ISeriesMarkInfo;
45
+ link?: import("@visactor/vchart").ISeriesMarkInfo;
46
+ arrow?: import("@visactor/vchart").ISeriesMarkInfo;
47
+ pie?: import("@visactor/vchart").ISeriesMarkInfo;
48
+ labelLine?: import("@visactor/vchart").ISeriesMarkInfo;
49
+ progress?: import("@visactor/vchart").ISeriesMarkInfo;
50
+ minLabel?: import("@visactor/vchart").ISeriesMarkInfo;
51
+ maxLabel?: import("@visactor/vchart").ISeriesMarkInfo;
52
+ rose?: import("@visactor/vchart").ISeriesMarkInfo;
53
+ node?: import("@visactor/vchart").ISeriesMarkInfo;
54
+ sunburst?: import("@visactor/vchart").ISeriesMarkInfo;
55
+ nonLeaf?: import("@visactor/vchart").ISeriesMarkInfo;
56
+ leaf?: import("@visactor/vchart").ISeriesMarkInfo;
57
+ nonLeafLabel?: import("@visactor/vchart").ISeriesMarkInfo;
58
+ leaderLine?: import("@visactor/vchart").ISeriesMarkInfo;
59
+ stackLabel?: import("@visactor/vchart").ISeriesMarkInfo;
60
+ word?: import("@visactor/vchart").ISeriesMarkInfo;
61
+ fillingWord?: import("@visactor/vchart").ISeriesMarkInfo;
62
+ wordMask?: import("@visactor/vchart").ISeriesMarkInfo;
63
+ nodePoint?: import("@visactor/vchart").ISeriesMarkInfo;
64
+ ripplePoint?: import("@visactor/vchart").ISeriesMarkInfo;
65
+ centerPoint?: import("@visactor/vchart").ISeriesMarkInfo;
66
+ centerLabel?: import("@visactor/vchart").ISeriesMarkInfo;
67
+ barBackground?: import("@visactor/vchart").ISeriesMarkInfo;
68
+ lineLabel?: import("@visactor/vchart").ISeriesMarkInfo;
69
+ areaLabel?: import("@visactor/vchart").ISeriesMarkInfo;
70
+ liquidGroup?: import("@visactor/vchart").ISeriesMarkInfo;
71
+ liquid?: import("@visactor/vchart").ISeriesMarkInfo;
72
+ liquidBackground?: import("@visactor/vchart").ISeriesMarkInfo;
73
+ liquidOutline?: import("@visactor/vchart").ISeriesMarkInfo;
74
+ circle?: import("@visactor/vchart").ISeriesMarkInfo;
75
+ overlap?: import("@visactor/vchart").ISeriesMarkInfo;
76
+ overlapLabel?: import("@visactor/vchart").ISeriesMarkInfo;
77
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.CandlestickSeriesMark = exports.CandlestickMarkNameEnum = exports.CANDLESTICK_TOOLTIP_KEYS = exports.CANDLESTICK_SERIES_TYPE = exports.CANDLESTICK_CHART_TYPE = void 0;
6
+
7
+ const vchart_1 = require("@visactor/vchart");
8
+
9
+ var CANDLESTICK_TOOLTIP_KEYS, CandlestickMarkNameEnum;
10
+
11
+ exports.CANDLESTICK_CHART_TYPE = "candlestick", exports.CANDLESTICK_SERIES_TYPE = "candlestick",
12
+ function(CANDLESTICK_TOOLTIP_KEYS) {
13
+ CANDLESTICK_TOOLTIP_KEYS.OPEN = "open", CANDLESTICK_TOOLTIP_KEYS.HIGH = "high",
14
+ CANDLESTICK_TOOLTIP_KEYS.LOW = "low", CANDLESTICK_TOOLTIP_KEYS.CLOSE = "close",
15
+ CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD = "seriesField";
16
+ }(CANDLESTICK_TOOLTIP_KEYS = exports.CANDLESTICK_TOOLTIP_KEYS || (exports.CANDLESTICK_TOOLTIP_KEYS = {})),
17
+ function(CandlestickMarkNameEnum) {
18
+ CandlestickMarkNameEnum.candlestick = "candlestick";
19
+ }(CandlestickMarkNameEnum = exports.CandlestickMarkNameEnum || (exports.CandlestickMarkNameEnum = {})),
20
+ exports.CandlestickSeriesMark = Object.assign(Object.assign({}, vchart_1.baseSeriesMark), {
21
+ candlestick: {
22
+ name: "candlestick",
23
+ type: "candlestick"
24
+ }
25
+ });
26
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/series/constant.ts"],"names":[],"mappings":";;;AAAA,6CAAkD;AAErC,QAAA,sBAAsB,GAAG,aAAa,CAAC;AACvC,QAAA,uBAAuB,GAAG,aAAa,CAAC;AAErD,IAAY,wBAMX;AAND,WAAY,wBAAwB;IAClC,yCAAa,CAAA;IACb,yCAAa,CAAA;IACb,uCAAW,CAAA;IACX,2CAAe,CAAA;IACf,wDAA4B,CAAA;AAC9B,CAAC,EANW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAMnC;AAED,IAAkB,uBAEjB;AAFD,WAAkB,uBAAuB;IACvC,sDAA2B,CAAA;AAC7B,CAAC,EAFiB,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAExC;AAEY,QAAA,qBAAqB,mCAC7B,uBAAc,KACjB,eAAqC,EAAE,EAAE,IAAI,eAAqC,EAAE,IAAI,EAAE,aAAa,EAAE,IACzG","file":"constant.js","sourcesContent":["import { baseSeriesMark } from '@visactor/vchart';\n\nexport const CANDLESTICK_CHART_TYPE = 'candlestick';\nexport const CANDLESTICK_SERIES_TYPE = 'candlestick';\n\nexport enum CANDLESTICK_TOOLTIP_KEYS {\n OPEN = 'open',\n HIGH = 'high',\n LOW = 'low',\n CLOSE = 'close',\n SERIES_FIELD = 'seriesField'\n}\n\nexport const enum CandlestickMarkNameEnum {\n candlestick = 'candlestick'\n}\n\nexport const CandlestickSeriesMark = {\n ...baseSeriesMark,\n [CandlestickMarkNameEnum.candlestick]: { name: CandlestickMarkNameEnum.candlestick, type: 'candlestick' }\n};\n"]}
@@ -0,0 +1,20 @@
1
+ import type { IAnimationSpec, IMarkSpec, ICartesianSeriesSpec, SeriesMarkNameEnum, IMarkTheme, ICartesianSeriesTheme } from '@visactor/vchart';
2
+ import type { ICandlestickMarkSpec } from '../mark/interface';
3
+ export interface ICandlestickSeriesSpec extends Omit<ICartesianSeriesSpec, 'xField' | 'yField' | 'direction'>, IAnimationSpec<SeriesMarkNameEnum.boxPlot, string> {
4
+ type: 'candlestick';
5
+ xField: string | string[];
6
+ openField?: string;
7
+ highField?: string;
8
+ lowField?: string;
9
+ closeField?: string;
10
+ rising?: IMarkSpec<ICandlestickMarkSpec>;
11
+ falling?: IMarkSpec<ICandlestickMarkSpec>;
12
+ doji?: IMarkSpec<ICandlestickMarkSpec>;
13
+ candlestick?: IMarkSpec<ICandlestickMarkSpec>;
14
+ }
15
+ export interface ICandlestickSeriesTheme extends ICartesianSeriesTheme {
16
+ candlestick?: Partial<IMarkTheme<ICandlestickMarkSpec>>;
17
+ rising?: Partial<IMarkTheme<ICandlestickMarkSpec>>;
18
+ falling?: Partial<IMarkTheme<ICandlestickMarkSpec>>;
19
+ doji?: Partial<IMarkTheme<ICandlestickMarkSpec>>;
20
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ });
6
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/series/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type {\n IAnimationSpec,\n IMarkSpec,\n ICartesianSeriesSpec,\n SeriesMarkNameEnum,\n IMarkTheme,\n ICartesianSeriesTheme\n} from '@visactor/vchart';\nimport type { ICandlestickMarkSpec } from '../mark/interface';\n\nexport interface ICandlestickSeriesSpec\n extends Omit<ICartesianSeriesSpec, 'xField' | 'yField' | 'direction'>,\n IAnimationSpec<SeriesMarkNameEnum.boxPlot, string> {\n type: 'candlestick';\n /**\n * 时间轴字段\n */\n xField: string | string[];\n /**\n * 开盘价字段\n */\n openField?: string;\n /**\n * 最高价字段\n */\n highField?: string;\n /**\n * 最低价字段\n */\n lowField?: string;\n /**\n * 收盘价字段\n */\n closeField?: string;\n /**\n * 上涨蜡烛图颜色\n */\n rising?: IMarkSpec<ICandlestickMarkSpec>;\n /**\n * 下跌蜡烛图颜色\n */\n falling?: IMarkSpec<ICandlestickMarkSpec>;\n /**\n * 平盘蜡烛图颜色\n */\n doji?: IMarkSpec<ICandlestickMarkSpec>;\n /**\n * 蜡烛图标记配置\n */\n candlestick?: IMarkSpec<ICandlestickMarkSpec>;\n}\n\nexport interface ICandlestickSeriesTheme extends ICartesianSeriesTheme {\n candlestick?: Partial<IMarkTheme<ICandlestickMarkSpec>>;\n rising?: Partial<IMarkTheme<ICandlestickMarkSpec>>;\n falling?: Partial<IMarkTheme<ICandlestickMarkSpec>>;\n doji?: Partial<IMarkTheme<ICandlestickMarkSpec>>;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { ICandlestickSeriesTheme } from '../series/interface';
2
+ export declare const getCandlestickTheme: () => ICandlestickSeriesTheme;
3
+ export declare const candlestick: ICandlestickSeriesTheme;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.candlestick = exports.getCandlestickTheme = void 0;
6
+
7
+ const getCandlestickTheme = () => ({
8
+ rising: {
9
+ style: {
10
+ boxFill: "#FF0000",
11
+ stroke: "#FF0000"
12
+ }
13
+ },
14
+ falling: {
15
+ style: {
16
+ boxFill: "#00AA00",
17
+ stroke: "#00AA00"
18
+ }
19
+ },
20
+ doji: {
21
+ style: {
22
+ boxFill: "#000000",
23
+ stroke: "#000000"
24
+ }
25
+ },
26
+ candlestick: {
27
+ style: {
28
+ lineWidth: 1
29
+ }
30
+ }
31
+ });
32
+
33
+ exports.getCandlestickTheme = getCandlestickTheme, exports.candlestick = (0, exports.getCandlestickTheme)();
34
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/series/theme.ts"],"names":[],"mappings":";;;AAEO,MAAM,mBAAmB,GAAG,GAA4B,EAAE;IAC/D,MAAM,GAAG,GAA4B;QACnC,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,OAAO,EAAE,SAAS;gBAClB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,OAAO,EAAE,SAAS;gBAClB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,OAAO,EAAE,SAAS;gBAClB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,SAAS,EAAE,CAAC;aACb;SACF;KACF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AA3BW,QAAA,mBAAmB,uBA2B9B;AAEW,QAAA,WAAW,GAA4B,IAAA,2BAAmB,GAAE,CAAC","file":"theme.js","sourcesContent":["import type { ICandlestickSeriesTheme } from '../series/interface';\n\nexport const getCandlestickTheme = (): ICandlestickSeriesTheme => {\n const res: ICandlestickSeriesTheme = {\n rising: {\n style: {\n boxFill: '#FF0000',\n stroke: '#FF0000'\n }\n },\n falling: {\n style: {\n boxFill: '#00AA00',\n stroke: '#00AA00'\n }\n },\n doji: {\n style: {\n boxFill: '#000000',\n stroke: '#000000'\n }\n },\n candlestick: {\n style: {\n lineWidth: 1\n }\n }\n };\n return res;\n};\n\nexport const candlestick: ICandlestickSeriesTheme = getCandlestickTheme();\n"]}
@@ -0,0 +1,9 @@
1
+ import type { ISeriesTooltipHelper, Datum, ITooltipLinePattern, TooltipActiveType } from '@visactor/vchart';
2
+ import { BaseSeriesTooltipHelper } from '@visactor/vchart';
3
+ import { CANDLESTICK_TOOLTIP_KEYS } from './constant';
4
+ export declare class CandlestickSeriesTooltipHelper extends BaseSeriesTooltipHelper implements ISeriesTooltipHelper {
5
+ protected getDefaultContentList(activeType: TooltipActiveType): ITooltipLinePattern[];
6
+ getContentKey: (contentType: CANDLESTICK_TOOLTIP_KEYS) => (datum: any) => string;
7
+ getContentValue: (contentType: CANDLESTICK_TOOLTIP_KEYS) => (datum: any) => any;
8
+ shapeColorCallback: (datum: Datum) => any;
9
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.CandlestickSeriesTooltipHelper = void 0;
6
+
7
+ const vchart_1 = require("@visactor/vchart"), constant_1 = require("./constant");
8
+
9
+ class CandlestickSeriesTooltipHelper extends vchart_1.BaseSeriesTooltipHelper {
10
+ constructor() {
11
+ super(...arguments), this.getContentKey = contentType => datum => {
12
+ switch (contentType) {
13
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.OPEN:
14
+ return this.series.getOpenField();
15
+
16
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.HIGH:
17
+ return this.series.getHighField();
18
+
19
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.LOW:
20
+ return this.series.getLowField();
21
+
22
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.CLOSE:
23
+ return this.series.getCloseField();
24
+
25
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD:
26
+ return this.series.getSeriesField();
27
+ }
28
+ return null;
29
+ }, this.getContentValue = contentType => datum => {
30
+ switch (contentType) {
31
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.OPEN:
32
+ return datum[this.series.getOpenField()];
33
+
34
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.HIGH:
35
+ return datum[this.series.getHighField()];
36
+
37
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.LOW:
38
+ return datum[this.series.getLowField()];
39
+
40
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.CLOSE:
41
+ return datum[this.series.getCloseField()];
42
+
43
+ case constant_1.CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD:
44
+ return datum[this.series.getSeriesField()];
45
+ }
46
+ return null;
47
+ }, this.shapeColorCallback = datum => this.series.getMarkInName("candlestick").getAttribute("stroke", datum);
48
+ }
49
+ getDefaultContentList(activeType) {
50
+ return [ {
51
+ key: this.getContentKey(constant_1.CANDLESTICK_TOOLTIP_KEYS.OPEN),
52
+ value: this.getContentValue(constant_1.CANDLESTICK_TOOLTIP_KEYS.OPEN)
53
+ }, {
54
+ key: this.getContentKey(constant_1.CANDLESTICK_TOOLTIP_KEYS.HIGH),
55
+ value: this.getContentValue(constant_1.CANDLESTICK_TOOLTIP_KEYS.HIGH)
56
+ }, {
57
+ key: this.getContentKey(constant_1.CANDLESTICK_TOOLTIP_KEYS.LOW),
58
+ value: this.getContentValue(constant_1.CANDLESTICK_TOOLTIP_KEYS.LOW)
59
+ }, {
60
+ key: this.getContentKey(constant_1.CANDLESTICK_TOOLTIP_KEYS.CLOSE),
61
+ value: this.getContentValue(constant_1.CANDLESTICK_TOOLTIP_KEYS.CLOSE)
62
+ }, {
63
+ key: this.getContentKey(constant_1.CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD),
64
+ value: this.getContentValue(constant_1.CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD)
65
+ } ];
66
+ }
67
+ }
68
+
69
+ exports.CandlestickSeriesTooltipHelper = CandlestickSeriesTooltipHelper;
70
+ //# sourceMappingURL=tooltip-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/series/tooltip-helper.ts"],"names":[],"mappings":";;;AACA,6CAA2D;AAC3D,yCAAsD;AAGtD,MAAa,8BAA+B,SAAQ,gCAAuB;IAA3E;;QA0BE,kBAAa,GAAG,CAAC,WAAqC,EAAE,EAAE,CAAC,CAAC,KAAU,EAAE,EAAE;YACxE,QAAQ,WAAW,EAAE;gBACnB,KAAK,mCAAwB,CAAC,IAAI,CAAC,CAAC;oBAClC,MAAM,SAAS,GAAI,IAAI,CAAC,MAA4B,CAAC,YAAY,EAAE,CAAC;oBACpE,OAAO,SAAS,C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IAAI,CAAC,aAAa,CAAC,mCAAwB,CAAC,YAAY,CAAC;gBAC9D,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,mCAAwB,CAAC,YAAY,CAAC;aACnE;SACF,CAAC;IACJ,CAAC;CAyDF;AAlFD,wEAkFC","file":"tooltip-helper.js","sourcesContent":["import type { ISeriesTooltipHelper, Datum, ITooltipLinePattern, TooltipActiveType } from '@visactor/vchart';\nimport { BaseSeriesTooltipHelper } from '@visactor/vchart';\nimport { CANDLESTICK_TOOLTIP_KEYS } from './constant';\nimport type { CandlestickSeries } from './candlestick';\n\nexport class CandlestickSeriesTooltipHelper extends BaseSeriesTooltipHelper implements ISeriesTooltipHelper {\n /** 获取默认的tooltip pattern */\n protected getDefaultContentList(activeType: TooltipActiveType): ITooltipLinePattern[] {\n return [\n {\n key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.OPEN),\n value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.OPEN)\n },\n {\n key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.HIGH),\n value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.HIGH)\n },\n {\n key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.LOW),\n value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.LOW)\n },\n {\n key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.CLOSE),\n value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.CLOSE)\n },\n {\n key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD),\n value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD)\n }\n ];\n }\n getContentKey = (contentType: CANDLESTICK_TOOLTIP_KEYS) => (datum: any) => {\n switch (contentType) {\n case CANDLESTICK_TOOLTIP_KEYS.OPEN: {\n const openField = (this.series as CandlestickSeries).getOpenField();\n return openField;\n }\n case CANDLESTICK_TOOLTIP_KEYS.HIGH: {\n const highField = (this.series as CandlestickSeries).getHighField();\n return highField;\n }\n case CANDLESTICK_TOOLTIP_KEYS.LOW: {\n const lowField = (this.series as CandlestickSeries).getLowField();\n return lowField;\n }\n case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {\n const closeField = (this.series as CandlestickSeries).getCloseField();\n return closeField;\n }\n case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {\n const seriesField = (this.series as CandlestickSeries).getSeriesField();\n return seriesField;\n }\n }\n\n return null;\n };\n\n getContentValue = (contentType: CANDLESTICK_TOOLTIP_KEYS) => (datum: any) => {\n switch (contentType) {\n case CANDLESTICK_TOOLTIP_KEYS.OPEN: {\n const openField = (this.series as CandlestickSeries).getOpenField();\n return datum[openField];\n }\n case CANDLESTICK_TOOLTIP_KEYS.HIGH: {\n const highField = (this.series as CandlestickSeries).getHighField();\n return datum[highField];\n }\n case CANDLESTICK_TOOLTIP_KEYS.LOW: {\n const lowField = (this.series as CandlestickSeries).getLowField();\n return datum[lowField];\n }\n case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {\n const closeField = (this.series as CandlestickSeries).getCloseField();\n return datum[closeField];\n }\n case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {\n const seriesField = (this.series as CandlestickSeries).getSeriesField();\n return datum[seriesField];\n }\n }\n\n return null;\n };\n shapeColorCallback = (datum: Datum) => {\n return this.series.getMarkInName('candlestick').getAttribute('stroke' as any, datum) as any;\n };\n}\n"]}
@@ -20,4 +20,5 @@ exports.DEFAULT_ARROW_MARK_STYLE = {
20
20
  fontSize: 12
21
21
  }, exports.DEFAULT_FUNNEL_BACKGROUND_MARK_STYLE = {
22
22
  fill: "#eff1f9"
23
- };
23
+ };
24
+ //# sourceMappingURL=constants.js.map
@@ -6,5 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  const vchart_1 = require("@visactor/vchart");
8
8
 
9
- exports.funnel3d = (0, vchart_1.getFunnelTheme)(!0);
10
- //# sourceMappingURL=theme.js.map
9
+ exports.funnel3d = (0, vchart_1.getFunnelTheme)(!0);
@@ -15,4 +15,5 @@ class ImageCloudChartSpecTransformer extends vchart_1.BaseChartSpecTransformer {
15
15
  }
16
16
  }
17
17
 
18
- exports.ImageCloudChartSpecTransformer = ImageCloudChartSpecTransformer;
18
+ exports.ImageCloudChartSpecTransformer = ImageCloudChartSpecTransformer;
19
+ //# sourceMappingURL=image-cloud-transformer.js.map
@@ -50,4 +50,4 @@ const registerElementHighlightByGraphicName = () => {
50
50
  };
51
51
 
52
52
  exports.registerElementHighlightByGraphicName = registerElementHighlightByGraphicName;
53
- //# sourceMappingURL=element-highlight-by-graphic-name.js.map
53
+ //# sourceMappingURL=element-highlight-by-graphic-name.js.map
@@ -28,4 +28,4 @@ const registerElementSelectByGraphicName = () => {
28
28
  };
29
29
 
30
30
  exports.registerElementSelectByGraphicName = registerElementSelectByGraphicName;
31
- //# sourceMappingURL=element-select-by-graphic-name.js.map
31
+ //# sourceMappingURL=element-select-by-graphic-name.js.map
@@ -20,4 +20,4 @@ Object.defineProperty(exports, "__esModule", {
20
20
  }), __exportStar(require("./pictogram"), exports), __exportStar(require("./interface"), exports),
21
21
  __exportStar(require("./pictogram-transformer"), exports), __exportStar(require("./series/pictogram"), exports),
22
22
  __exportStar(require("./series/svg-source"), exports), __exportStar(require("./series/interface"), exports);
23
- //# sourceMappingURL=index.js.map
23
+ //# sourceMappingURL=index.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=interface.js.map
6
+ //# sourceMappingURL=interface.js.map
package/cjs/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './charts/range-column-3d';
14
14
  export { register3DPlugin } from './charts/3d/plugin';
15
15
  export * from './charts/pictogram';
16
16
  export * from './charts/image-cloud';
17
+ export * from './charts/candlestick';
17
18
  export * from './components/series-break';
18
19
  export * from './components/bar-link';
19
20
  export * from './components/series-label';
package/cjs/index.js CHANGED
@@ -35,5 +35,6 @@ Object.defineProperty(exports, "register3DPlugin", {
35
35
  return plugin_1.register3DPlugin;
36
36
  }
37
37
  }), __exportStar(require("./charts/pictogram"), exports), __exportStar(require("./charts/image-cloud"), exports),
38
- __exportStar(require("./components/series-break"), exports), __exportStar(require("./components/bar-link"), exports),
39
- __exportStar(require("./components/series-label"), exports), __exportStar(require("./components/map-label"), exports);
38
+ __exportStar(require("./charts/candlestick"), exports), __exportStar(require("./components/series-break"), exports),
39
+ __exportStar(require("./components/bar-link"), exports), __exportStar(require("./components/series-label"), exports),
40
+ __exportStar(require("./components/map-label"), exports);
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,qEAAmD;AACnD,6DAA2C;AAC3C,uFAAqE;AACrE,qFAAmE;AACnE,yFAAuE;AAEvE,kDAAgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,kDAAgC;AAChC,yDAAuC;AACvC,mDAAiC;AACjC,2DAAyC;AACzC,6CAAsD;AAA7C,0GAAA,gBAAgB,OAAA;AACzB,qDAAmC;AACnC,uDAAqC;AAErC,4DAA0C;AAC1C,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC","file":"index.js","sourcesContent":["export * from './charts/ranking-bar/ranking-bar';\nexport * from './charts/ranking-list/ranking-list';\nexport * from './charts/conversion-funnel';\nexport * from './charts/sequence-scatter-link/sequence-scatter-link';\nexport * from './charts/sequence-scatter-kde/sequence-scatter-kde';\nexport * from './charts/sequence-scatter-pixel/sequence-scatter-pixel';\n\nexport * from './charts/bar-3d';\nexport * from './charts/funnel-3d';\nexport * from './charts/histogram-3d';\nexport * from './charts/pie-3d';\nexport * from './charts/word-cloud-3d';\nexport * from './charts/axis-3d';\nexport * from './charts/range-column-3d';\nexport { register3DPlugin } from './charts/3d/plugin';\nexport * from './charts/pictogram';\nexport * from './charts/image-cloud';\n\nexport * from './components/series-break';\nexport * from './components/bar-link';\nexport * from './components/series-label';\nexport * from './components/map-label';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,qEAAmD;AACnD,6DAA2C;AAC3C,uFAAqE;AACrE,qFAAmE;AACnE,yFAAuE;AAEvE,kDAAgC;AAChC,qDAAmC;AACnC,wDAAsC;AACtC,kDAAgC;AAChC,yDAAuC;AACvC,mDAAiC;AACjC,2DAAyC;AACzC,6CAAsD;AAA7C,0GAAA,gBAAgB,OAAA;AACzB,qDAAmC;AACnC,uDAAqC;AACrC,uDAAqC;AAErC,4DAA0C;AAC1C,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC","file":"index.js","sourcesContent":["export * from './charts/ranking-bar/ranking-bar';\nexport * from './charts/ranking-list/ranking-list';\nexport * from './charts/conversion-funnel';\nexport * from './charts/sequence-scatter-link/sequence-scatter-link';\nexport * from './charts/sequence-scatter-kde/sequence-scatter-kde';\nexport * from './charts/sequence-scatter-pixel/sequence-scatter-pixel';\n\nexport * from './charts/bar-3d';\nexport * from './charts/funnel-3d';\nexport * from './charts/histogram-3d';\nexport * from './charts/pie-3d';\nexport * from './charts/word-cloud-3d';\nexport * from './charts/axis-3d';\nexport * from './charts/range-column-3d';\nexport { register3DPlugin } from './charts/3d/plugin';\nexport * from './charts/pictogram';\nexport * from './charts/image-cloud';\nexport * from './charts/candlestick';\n\nexport * from './components/series-break';\nexport * from './components/bar-link';\nexport * from './components/series-label';\nexport * from './components/map-label';\n"]}
@@ -0,0 +1,6 @@
1
+ import { CartesianChartSpecTransformer } from '@visactor/vchart';
2
+ import type { ICandlestickChartSpec } from './interface';
3
+ export declare class CandlestickChartSpecTransformer<T extends ICandlestickChartSpec = ICandlestickChartSpec> extends CartesianChartSpecTransformer<T> {
4
+ protected _getDefaultSeriesSpec(spec: T): any;
5
+ transformSpec(spec: T): void;
6
+ }
@@ -0,0 +1,16 @@
1
+ import { CartesianChartSpecTransformer, setDefaultCrosshairForCartesianChart } from "@visactor/vchart";
2
+
3
+ export class CandlestickChartSpecTransformer extends CartesianChartSpecTransformer {
4
+ _getDefaultSeriesSpec(spec) {
5
+ const dataFields = [ spec.openField, spec.highField, spec.lowField, spec.closeField ], seriesSpec = super._getDefaultSeriesSpec(spec, [ "candlestick", "openField", "highField", "lowField", "closeField", "rising", "falling", "doji" ]);
6
+ return seriesSpec.yField = dataFields, seriesSpec;
7
+ }
8
+ transformSpec(spec) {
9
+ super.transformSpec(spec), spec.axes || (spec.axes = [ {
10
+ orient: "bottom"
11
+ }, {
12
+ orient: "left"
13
+ } ]), setDefaultCrosshairForCartesianChart(spec);
14
+ }
15
+ }
16
+ //# sourceMappingURL=candlestick-transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/candlestick-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,oCAAoC,EAAE,MAAM,kBAAkB,CAAC;AAGvG,MAAM,OAAO,+BAEX,SAAQ,6BAAgC;IAC9B,qBAAqB,CAAC,IAAO;QACrC,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACpF,MAAM,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC,IAAI,EAAE;YACnD,aAAa;YACb,WAAW;YACX,WAAW;YACX,UAAU;YACV,YAAY;YACZ,QAAQ;YACR,SAAS;YACT,MAAM;SACP,CAAC,CAAC;QACH,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC;QAC/B,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,aAAa,CAAC,IAAO;QACnB,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,IAAI,GAAG;gBACV;oBACE,MAAM,EAAE,QAAQ;iBACjB;gBACD;oBACE,MAAM,EAAE,MAAM;iBACf;aACF,CAAC;SACH;QACD,oCAAoC,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF","file":"candlestick-transformer.js","sourcesContent":["import { CartesianChartSpecTransformer, setDefaultCrosshairForCartesianChart } from '@visactor/vchart';\nimport type { ICandlestickChartSpec } from './interface';\n\nexport class CandlestickChartSpecTransformer<\n T extends ICandlestickChartSpec = ICandlestickChartSpec\n> extends CartesianChartSpecTransformer<T> {\n protected _getDefaultSeriesSpec(spec: T): any {\n const dataFields = [spec.openField, spec.highField, spec.lowField, spec.closeField];\n const seriesSpec = super._getDefaultSeriesSpec(spec, [\n 'candlestick',\n 'openField',\n 'highField',\n 'lowField',\n 'closeField',\n 'rising',\n 'falling',\n 'doji'\n ]);\n seriesSpec.yField = dataFields;\n return seriesSpec;\n }\n\n transformSpec(spec: T): void {\n super.transformSpec(spec);\n if (!spec.axes) {\n spec.axes = [\n {\n orient: 'bottom'\n },\n {\n orient: 'left'\n }\n ];\n }\n setDefaultCrosshairForCartesianChart(spec);\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { CandlestickChartSpecTransformer } from './candlestick-transformer';
2
+ import { ICandlestickChartSpec } from './interface';
3
+ import { BaseChart } from '@visactor/vchart';
4
+ export declare class CandlestickChart<T extends ICandlestickChartSpec = ICandlestickChartSpec> extends BaseChart<T> {
5
+ static readonly type: string;
6
+ static readonly seriesType: string;
7
+ static readonly transformerConstructor: typeof CandlestickChartSpecTransformer;
8
+ protected _setModelOption(): void;
9
+ }
10
+ export declare const registerCandlestickChart: () => void;
@@ -0,0 +1,22 @@
1
+ import { CandlestickChartSpecTransformer } from "./candlestick-transformer";
2
+
3
+ import { registerCandlestickSeries } from "./series/candlestick";
4
+
5
+ import { BaseChart, Factory, registerMarkTooltipProcessor, registerDimensionTooltipProcessor, registerDimensionEvents, registerDimensionHover, getCartesianDimensionInfo, getDimensionInfoByValue, getCartesianCrosshairRect } from "@visactor/vchart";
6
+
7
+ import { CANDLESTICK_CHART_TYPE, CANDLESTICK_SERIES_TYPE } from "./series/constant";
8
+
9
+ export class CandlestickChart extends BaseChart {
10
+ _setModelOption() {
11
+ this._modelOption.getDimensionInfo = getCartesianDimensionInfo, this._modelOption.getDimensionInfoByValue = getDimensionInfoByValue,
12
+ this._modelOption.getRectByDimensionData = getCartesianCrosshairRect;
13
+ }
14
+ }
15
+
16
+ CandlestickChart.type = CANDLESTICK_CHART_TYPE, CandlestickChart.seriesType = CANDLESTICK_SERIES_TYPE,
17
+ CandlestickChart.transformerConstructor = CandlestickChartSpecTransformer;
18
+
19
+ export const registerCandlestickChart = () => {
20
+ registerDimensionTooltipProcessor(), registerMarkTooltipProcessor(), registerDimensionEvents(),
21
+ registerDimensionHover(), registerCandlestickSeries(), Factory.registerChart(CandlestickChart.type, CandlestickChart);
22
+ };