@visactor/vchart-extension 2.0.3 → 2.0.4-alpha.1

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 +564 -17
  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/funnel-3d/constant.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/funnel-3d/constant.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 +6 -6
@@ -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,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.CandlestickChartSpecTransformer = void 0;
6
+
7
+ const vchart_1 = require("@visactor/vchart");
8
+
9
+ class CandlestickChartSpecTransformer extends vchart_1.CartesianChartSpecTransformer {
10
+ _getDefaultSeriesSpec(spec) {
11
+ const dataFields = [ spec.openField, spec.highField, spec.lowField, spec.closeField ], seriesSpec = super._getDefaultSeriesSpec(spec, [ "candlestick", "openField", "highField", "lowField", "closeField", "rising", "falling", "doji" ]);
12
+ return seriesSpec.yField = dataFields, seriesSpec;
13
+ }
14
+ transformSpec(spec) {
15
+ super.transformSpec(spec), spec.axes || (spec.axes = [ {
16
+ orient: "bottom"
17
+ }, {
18
+ orient: "left"
19
+ } ]), (0, vchart_1.setDefaultCrosshairForCartesianChart)(spec);
20
+ }
21
+ }
22
+
23
+ exports.CandlestickChartSpecTransformer = CandlestickChartSpecTransformer;
24
+ //# sourceMappingURL=candlestick-transformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/candlestick-transformer.ts"],"names":[],"mappings":";;;AAAA,6CAAuG;AAGvG,MAAa,+BAEX,SAAQ,sCAAgC;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,IAAA,6CAAoC,EAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF;AAjCD,0EAiCC","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,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.registerCandlestickChart = exports.CandlestickChart = void 0;
6
+
7
+ const candlestick_transformer_1 = require("./candlestick-transformer"), candlestick_1 = require("./series/candlestick"), vchart_1 = require("@visactor/vchart"), constant_1 = require("./series/constant");
8
+
9
+ class CandlestickChart extends vchart_1.BaseChart {
10
+ _setModelOption() {
11
+ this._modelOption.getDimensionInfo = vchart_1.getCartesianDimensionInfo, this._modelOption.getDimensionInfoByValue = vchart_1.getDimensionInfoByValue,
12
+ this._modelOption.getRectByDimensionData = vchart_1.getCartesianCrosshairRect;
13
+ }
14
+ }
15
+
16
+ exports.CandlestickChart = CandlestickChart, CandlestickChart.type = constant_1.CANDLESTICK_CHART_TYPE,
17
+ CandlestickChart.seriesType = constant_1.CANDLESTICK_SERIES_TYPE, CandlestickChart.transformerConstructor = candlestick_transformer_1.CandlestickChartSpecTransformer;
18
+
19
+ const registerCandlestickChart = () => {
20
+ (0, vchart_1.registerDimensionTooltipProcessor)(), (0, vchart_1.registerMarkTooltipProcessor)(),
21
+ (0, vchart_1.registerDimensionEvents)(), (0, vchart_1.registerDimensionHover)(),
22
+ (0, candlestick_1.registerCandlestickSeries)(), vchart_1.Factory.registerChart(CandlestickChart.type, CandlestickChart);
23
+ };
24
+
25
+ exports.registerCandlestickChart = registerCandlestickChart;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/candlestick.ts"],"names":[],"mappings":";;;AAAA,uEAA4E;AAE5E,sDAAiE;AACjE,6CAU0B;AAC1B,gDAAoF;AACpF,MAAa,gBAA0E,SAAQ,kBAAY;IAI/F,eAAe;QACvB,IAAI,CAAC,YAAY,CAAC,gBAAgB,GAAG,kCAAyB,CAAC;QAC/D,IAAI,CAAC,YAAY,CAAC,uBAAuB,GAAG,gCAAuB,CAAC;QACpE,IAAI,CAAC,YAAY,CAAC,sBAAsB,GAAG,kCAAyB,CAAC;IACvE,CAAC;;AARH,4CASC;AARiB,qBAAI,GAAW,iCAAsB,CAAC;AACtC,2BAAU,GAAW,kCAAuB,CAAC;AAC7C,uCAAsB,GAAG,yDAA+B,CAAC;AAQpE,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,IAAA,0CAAiC,GAAE,CAAC;IACpC,IAAA,qCAA4B,GAAE,CAAC;IAC/B,IAAA,gCAAuB,GAAE,CAAC;IAC1B,IAAA,+BAAsB,GAAE,CAAC;IACzB,IAAA,uCAAyB,GAAE,CAAC;IAC5B,gBAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC;AAPW,QAAA,wBAAwB,4BAOnC","file":"candlestick.js","sourcesContent":["import { CandlestickChartSpecTransformer } from './candlestick-transformer';\nimport { ICandlestickChartSpec } from './interface';\nimport { registerCandlestickSeries } from './series/candlestick';\nimport {\n BaseChart,\n Factory,\n registerMarkTooltipProcessor,\n registerDimensionTooltipProcessor,\n registerDimensionEvents,\n registerDimensionHover,\n getCartesianDimensionInfo,\n getDimensionInfoByValue,\n getCartesianCrosshairRect\n} from '@visactor/vchart';\nimport { CANDLESTICK_CHART_TYPE, CANDLESTICK_SERIES_TYPE } from './series/constant';\nexport class CandlestickChart<T extends ICandlestickChartSpec = ICandlestickChartSpec> extends BaseChart<T> {\n static readonly type: string = CANDLESTICK_CHART_TYPE;\n static readonly seriesType: string = CANDLESTICK_SERIES_TYPE;\n static readonly transformerConstructor = CandlestickChartSpecTransformer; // CandlestickChartSpecTransformer;\n protected _setModelOption() {\n this._modelOption.getDimensionInfo = getCartesianDimensionInfo;\n this._modelOption.getDimensionInfoByValue = getDimensionInfoByValue;\n this._modelOption.getRectByDimensionData = getCartesianCrosshairRect;\n }\n}\n\nexport const registerCandlestickChart = () => {\n registerDimensionTooltipProcessor();\n registerMarkTooltipProcessor();\n registerDimensionEvents();\n registerDimensionHover();\n registerCandlestickSeries();\n Factory.registerChart(CandlestickChart.type, CandlestickChart);\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './candlestick';
2
+ export * from './interface';
3
+ export * from './candlestick-transformer';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
4
+ void 0 === k2 && (k2 = k);
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
7
+ enumerable: !0,
8
+ get: function() {
9
+ return m[k];
10
+ }
11
+ }), Object.defineProperty(o, k2, desc);
12
+ } : function(o, m, k, k2) {
13
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
14
+ }), __exportStar = this && this.__exportStar || function(m, exports) {
15
+ for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
16
+ };
17
+
18
+ Object.defineProperty(exports, "__esModule", {
19
+ value: !0
20
+ }), __exportStar(require("./candlestick"), exports), __exportStar(require("./interface"), exports),
21
+ __exportStar(require("./candlestick-transformer"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,4DAA0C","file":"index.js","sourcesContent":["export * from './candlestick';\nexport * from './interface';\nexport * from './candlestick-transformer';\n"]}
@@ -0,0 +1,6 @@
1
+ import type { IChartExtendsSeriesSpec, ICartesianChartSpec } from '@visactor/vchart';
2
+ import type { ICandlestickSeriesSpec } from './series/interface';
3
+ export interface ICandlestickChartSpec extends ICartesianChartSpec, IChartExtendsSeriesSpec<ICandlestickSeriesSpec> {
4
+ type: 'candlestick';
5
+ series?: ICandlestickSeriesSpec[];
6
+ }
@@ -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/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IChartExtendsSeriesSpec, ICartesianChartSpec } from '@visactor/vchart';\nimport type { ICandlestickSeriesSpec } from './series/interface';\n\nexport interface ICandlestickChartSpec extends ICartesianChartSpec, IChartExtendsSeriesSpec<ICandlestickSeriesSpec> {\n type: 'candlestick';\n /** 系列配置 */\n series?: ICandlestickSeriesSpec[];\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { GlyphMark, IMarkRaw, IMarkStyle } from '@visactor/vchart';
2
+ import type { ICandlestickMarkSpec } from './interface';
3
+ export type ICandlestickMark = IMarkRaw<ICandlestickMarkSpec>;
4
+ export declare const CANDLESTICK_MARK_TYPE = "candlestick";
5
+ export declare class CandlestickMark extends GlyphMark<ICandlestickMarkSpec> implements ICandlestickMark {
6
+ static readonly type = "candlestick";
7
+ readonly type = "candlestick";
8
+ setGlyphConfig(cfg: any): void;
9
+ protected _getDefaultStyle(): IMarkStyle<ICandlestickMarkSpec>;
10
+ }
11
+ export declare const registerCandlestickMark: () => void;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.registerCandlestickMark = exports.CandlestickMark = exports.CANDLESTICK_MARK_TYPE = void 0;
6
+
7
+ const vrender_kits_1 = require("@visactor/vrender-kits"), vchart_1 = require("@visactor/vchart"), vrender_core_1 = require("@visactor/vrender-core"), vchart_2 = require("@visactor/vchart");
8
+
9
+ exports.CANDLESTICK_MARK_TYPE = "candlestick";
10
+
11
+ class CandlestickMark extends vchart_1.GlyphMark {
12
+ constructor() {
13
+ super(...arguments), this.type = CandlestickMark.type;
14
+ }
15
+ setGlyphConfig(cfg) {
16
+ super.setGlyphConfig(cfg), this._subMarks = {
17
+ line: {
18
+ type: "line",
19
+ defaultAttributes: {
20
+ x: 0,
21
+ y: 0
22
+ }
23
+ },
24
+ box: {
25
+ type: "rect"
26
+ }
27
+ }, this._positionChannels = [ "x", "boxWidth", "open", "close", "high", "low" ],
28
+ this._channelEncoder = null, this._positionEncoder = (glyphAttrs, datum, g) => {
29
+ const {x: x = g.attribute.x, boxWidth: boxWidth = g.attribute.boxWidth, open: open = g.attribute.open, close: close = g.attribute.close, low: low = g.attribute.low, high: high = g.attribute.high} = glyphAttrs, attributes = {};
30
+ return attributes.line = {
31
+ points: [ {
32
+ x: x,
33
+ y: low
34
+ }, {
35
+ x: x,
36
+ y: high
37
+ } ]
38
+ }, attributes.box = {
39
+ x: x - boxWidth / 2,
40
+ x1: x + boxWidth / 2,
41
+ y: Math.min(open, close),
42
+ y1: Math.max(open, close),
43
+ drawStrokeWhenZeroWH: !0
44
+ }, attributes;
45
+ };
46
+ }
47
+ _getDefaultStyle() {
48
+ return Object.assign({}, super._getDefaultStyle());
49
+ }
50
+ }
51
+
52
+ exports.CandlestickMark = CandlestickMark, CandlestickMark.type = exports.CANDLESTICK_MARK_TYPE;
53
+
54
+ const registerCandlestickMark = () => {
55
+ (0, vchart_1.registerGlyphMark)(), (0, vrender_kits_1.registerLine)(), (0, vrender_kits_1.registerRect)(),
56
+ vchart_2.Factory.registerGraphicComponent("line", (attrs => (0, vrender_core_1.createLine)(attrs))),
57
+ vchart_2.Factory.registerGraphicComponent("rect", (attrs => (0, vrender_core_1.createRect)(attrs))),
58
+ vchart_2.Factory.registerMark(CandlestickMark.type, CandlestickMark);
59
+ };
60
+
61
+ exports.registerCandlestickMark = registerCandlestickMark;
62
+ //# sourceMappingURL=candlestick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/charts/candlestick/mark/candlestick.ts"],"names":[],"mappings":";;;AAAA,yDAAoE;AACpE,6CAAsF;AACtF,yDAMgC;AAChC,6CAAkD;AAIrC,QAAA,qBAAqB,GAAG,aAAa,CAAC;AAEnD,MAAa,eAAgB,SAAQ,kBAA+B;IAApE;;QAEW,SAAI,GAAG,eAAe,CAAC,IAA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G,CAAC;gBACpB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;gBACxB,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;gBAEzB,oBAAoB,EAAE,IAAI;aAC3B,CAAC;YACF,OAAO,UAAU,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC;IAES,gBAAgB;QACxB,MAAM,YAAY,qBACb,KAAK,CAAC,gBAAgB,EAAE,CAC5B,CAAC;QACF,OAAO,YAAY,CAAC;IACtB,CAAC;;AAnDH,0CAoDC;AAnDiB,oBAAI,GAAG,6BAAqB,CAAC;AAqDxC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,IAAA,0BAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,gBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,CAAC,KAA4B,EAAE,EAAE,CAAC,IAAA,yBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC9F,gBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,CAAC,KAA4B,EAAE,EAAE,CAAC,IAAA,yBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;IAC9F,gBAAO,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AAC9D,CAAC,CAAC;AAPW,QAAA,uBAAuB,2BAOlC","file":"candlestick.js","sourcesContent":["import { registerLine, registerRect } from '@visactor/vrender-kits';\nimport { GlyphMark, registerGlyphMark, IMarkRaw, IMarkStyle } from '@visactor/vchart';\nimport {\n createLine,\n createRect,\n type IGlyph,\n type ILineGraphicAttribute,\n IRectGraphicAttribute\n} from '@visactor/vrender-core';\nimport { Factory, Datum } from '@visactor/vchart';\nimport type { ICandlestickMarkSpec } from './interface';\n\nexport type ICandlestickMark = IMarkRaw<ICandlestickMarkSpec>;\nexport const CANDLESTICK_MARK_TYPE = 'candlestick';\n\nexport class CandlestickMark extends GlyphMark<ICandlestickMarkSpec> implements ICandlestickMark {\n static readonly type = CANDLESTICK_MARK_TYPE;\n readonly type = CandlestickMark.type;\n\n setGlyphConfig(cfg: any): void {\n super.setGlyphConfig(cfg);\n this._subMarks = {\n line: { type: 'line', defaultAttributes: { x: 0, y: 0 } },\n box: { type: 'rect' }\n };\n this._positionChannels = ['x', 'boxWidth', 'open', 'close', 'high', 'low'];\n this._channelEncoder = null;\n this._positionEncoder = (glyphAttrs: any, datum: Datum, g: IGlyph) => {\n const {\n x = g.attribute.x,\n boxWidth = (g.attribute as any).boxWidth,\n open = (g.attribute as any).open,\n close = (g.attribute as any).close,\n low = (g.attribute as any).low,\n high = (g.attribute as any).high\n } = glyphAttrs;\n const attributes: any = {};\n attributes.line = {\n points: [\n {\n x: x,\n y: low\n },\n {\n x: x,\n y: high\n }\n ]\n };\n attributes.box = {\n x: x - boxWidth / 2,\n x1: x + boxWidth / 2,\n y: Math.min(open, close),\n y1: Math.max(open, close),\n // 开盘收盘相同时绘制水平线\n drawStrokeWhenZeroWH: true\n };\n return attributes;\n };\n }\n\n protected _getDefaultStyle() {\n const defaultStyle: IMarkStyle<ICandlestickMarkSpec> = {\n ...super._getDefaultStyle()\n };\n return defaultStyle;\n }\n}\n\nexport const registerCandlestickMark = () => {\n registerGlyphMark();\n registerLine();\n registerRect();\n Factory.registerGraphicComponent('line', (attrs: ILineGraphicAttribute) => createLine(attrs));\n Factory.registerGraphicComponent('rect', (attrs: IRectGraphicAttribute) => createRect(attrs));\n Factory.registerMark(CandlestickMark.type, CandlestickMark);\n};\n"]}
@@ -0,0 +1,9 @@
1
+ import type { Datum, ICommonSpec } from '@visactor/vchart';
2
+ export interface ICandlestickMarkSpec extends ICommonSpec {
3
+ boxWidth?: number;
4
+ boxFill?: string | ((datum: Datum) => string);
5
+ low?: (datum: Datum) => number;
6
+ close?: (datum: Datum) => number;
7
+ open?: (datum: Datum) => number;
8
+ high?: (datum: Datum) => number;
9
+ }
@@ -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/mark/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { Datum, ICommonSpec } from '@visactor/vchart';\n\nexport interface ICandlestickMarkSpec extends ICommonSpec {\n /**\n * box宽度\n */\n boxWidth?: number;\n /**\n * 盒子填充颜色,为空则不填充\n */\n boxFill?: string | ((datum: Datum) => string);\n /**\n * 最低价\n */\n low?: (datum: Datum) => number;\n /**\n * 收盘价\n */\n close?: (datum: Datum) => number;\n /**\n * 开盘价\n */\n open?: (datum: Datum) => number;\n /**\n * 最高价\n */\n high?: (datum: Datum) => number;\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import type { EasingType } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from '@visactor/vrender-animate';
3
+ export interface ICandlestickScaleAnimationOptions {
4
+ center?: number;
5
+ }
6
+ export declare class CandlestickScaleIn extends ACustomAnimate<Record<string, number>> {
7
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ICandlestickScaleAnimationOptions);
8
+ onBind(): void;
9
+ computeAttribute(): {
10
+ from?: {
11
+ [channel: string]: any;
12
+ };
13
+ to?: {
14
+ [channel: string]: any;
15
+ };
16
+ };
17
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
18
+ }
19
+ export declare class CandlestickScaleOut extends ACustomAnimate<Record<string, number>> {
20
+ constructor(from: null, to: null, duration: number, easing: EasingType, params?: ICandlestickScaleAnimationOptions);
21
+ onBind(): void;
22
+ computeAttribute(): {
23
+ from?: {
24
+ [channel: string]: any;
25
+ };
26
+ to?: {
27
+ [channel: string]: any;
28
+ };
29
+ };
30
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
31
+ }
32
+ export declare const registerCandlestickScaleAnimation: () => void;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.registerCandlestickScaleAnimation = exports.CandlestickScaleOut = exports.CandlestickScaleIn = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils"), vrender_animate_1 = require("@visactor/vrender-animate"), scaleIn = () => graphic => {
8
+ const finalAttribute = graphic.getFinalAttribute(), {x: x, y: y, open: open, high: high, low: low, close: close} = finalAttribute, animateAttributes = {
9
+ from: {
10
+ x: x,
11
+ y: y
12
+ },
13
+ to: {
14
+ x: x,
15
+ y: y
16
+ }
17
+ };
18
+ return (0, vutils_1.isValidNumber)(open) && (0, vutils_1.isValidNumber)(close) && (open > close ? (animateAttributes.from.open = low,
19
+ animateAttributes.to.open = open, animateAttributes.from.close = low, animateAttributes.to.close = close,
20
+ (0, vutils_1.isValidNumber)(high) && (animateAttributes.from.high = low, animateAttributes.to.high = high)) : (animateAttributes.from.open = high,
21
+ animateAttributes.to.open = open, animateAttributes.from.close = high, animateAttributes.to.close = close,
22
+ (0, vutils_1.isValidNumber)(low) && (animateAttributes.from.low = high, animateAttributes.to.low = low))),
23
+ animateAttributes;
24
+ }, scaleOut = () => graphic => {
25
+ const finalAttribute = graphic.getFinalAttribute(), {x: x, y: y, open: open, high: high, low: low, close: close} = finalAttribute, animateAttributes = {
26
+ from: {
27
+ x: x,
28
+ y: y
29
+ },
30
+ to: {
31
+ x: x,
32
+ y: y
33
+ }
34
+ };
35
+ return (0, vutils_1.isValidNumber)(open) && (0, vutils_1.isValidNumber)(close) && (open > close ? (animateAttributes.from.open = open,
36
+ animateAttributes.to.open = low, animateAttributes.from.close = close, animateAttributes.to.close = low,
37
+ (0, vutils_1.isValidNumber)(high) && (animateAttributes.from.high = high, animateAttributes.to.high = low)) : (animateAttributes.from.open = open,
38
+ animateAttributes.to.open = high, animateAttributes.from.close = close, animateAttributes.to.close = high,
39
+ (0, vutils_1.isValidNumber)(low) && (animateAttributes.from.low = low, animateAttributes.to.low = high))),
40
+ animateAttributes;
41
+ };
42
+
43
+ class CandlestickScaleIn extends vrender_animate_1.ACustomAnimate {
44
+ constructor(from, to, duration, easing, params) {
45
+ super(from, to, duration, easing, params);
46
+ }
47
+ onBind() {
48
+ super.onBind();
49
+ const finalAttribute = this.target.getFinalAttribute();
50
+ finalAttribute && this.target.setAttributes(finalAttribute);
51
+ const {from: from, to: to} = this.computeAttribute();
52
+ this.propKeys = Object.keys(to).filter((key => null != to[key])), this.animate.reSyncProps(),
53
+ this.from = from, this.to = to, this.target.setAttributes(this.from);
54
+ }
55
+ computeAttribute() {
56
+ return (graphic => {
57
+ const finalAttribute = graphic.getFinalAttribute(), {x: x, y: y, open: open, high: high, low: low, close: close} = finalAttribute, animateAttributes = {
58
+ from: {
59
+ x: x,
60
+ y: y
61
+ },
62
+ to: {
63
+ x: x,
64
+ y: y
65
+ }
66
+ };
67
+ return (0, vutils_1.isValidNumber)(open) && (0, vutils_1.isValidNumber)(close) && (open > close ? (animateAttributes.from.open = low,
68
+ animateAttributes.to.open = open, animateAttributes.from.close = low, animateAttributes.to.close = close,
69
+ (0, vutils_1.isValidNumber)(high) && (animateAttributes.from.high = low, animateAttributes.to.high = high)) : (animateAttributes.from.open = high,
70
+ animateAttributes.to.open = open, animateAttributes.from.close = high, animateAttributes.to.close = close,
71
+ (0, vutils_1.isValidNumber)(low) && (animateAttributes.from.low = high, animateAttributes.to.low = low))),
72
+ animateAttributes;
73
+ })(this.target, this.params, this.params.options);
74
+ }
75
+ onUpdate(end, ratio, out) {
76
+ const attribute = this.target.attribute;
77
+ this.propKeys.forEach((key => {
78
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
79
+ })), this.target.setAttributes(attribute);
80
+ }
81
+ }
82
+
83
+ exports.CandlestickScaleIn = CandlestickScaleIn;
84
+
85
+ class CandlestickScaleOut extends vrender_animate_1.ACustomAnimate {
86
+ constructor(from, to, duration, easing, params) {
87
+ super(from, to, duration, easing, params);
88
+ }
89
+ onBind() {
90
+ var _a;
91
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.diffAttrs) && this.target.setAttributes(this.params.diffAttrs);
92
+ const {from: from, to: to} = this.computeAttribute();
93
+ this.propKeys = Object.keys(to).filter((key => null != to[key])), this.animate.reSyncProps(),
94
+ this.from = from, this.to = to, this.target.setAttributes(this.from);
95
+ }
96
+ computeAttribute() {
97
+ return (graphic => {
98
+ const finalAttribute = graphic.getFinalAttribute(), {x: x, y: y, open: open, high: high, low: low, close: close} = finalAttribute, animateAttributes = {
99
+ from: {
100
+ x: x,
101
+ y: y
102
+ },
103
+ to: {
104
+ x: x,
105
+ y: y
106
+ }
107
+ };
108
+ return (0, vutils_1.isValidNumber)(open) && (0, vutils_1.isValidNumber)(close) && (open > close ? (animateAttributes.from.open = open,
109
+ animateAttributes.to.open = low, animateAttributes.from.close = close, animateAttributes.to.close = low,
110
+ (0, vutils_1.isValidNumber)(high) && (animateAttributes.from.high = high, animateAttributes.to.high = low)) : (animateAttributes.from.open = open,
111
+ animateAttributes.to.open = high, animateAttributes.from.close = close, animateAttributes.to.close = high,
112
+ (0, vutils_1.isValidNumber)(low) && (animateAttributes.from.low = low, animateAttributes.to.low = high))),
113
+ animateAttributes;
114
+ })(this.target, this.params, this.params.options);
115
+ }
116
+ onUpdate(end, ratio, out) {
117
+ const attribute = this.target.attribute;
118
+ this.propKeys.forEach((key => {
119
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
120
+ })), this.target.setAttributes(attribute);
121
+ }
122
+ }
123
+
124
+ exports.CandlestickScaleOut = CandlestickScaleOut;
125
+
126
+ const registerCandlestickScaleAnimation = () => {
127
+ vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("candlestickScaleIn", CandlestickScaleIn),
128
+ vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("candlestickScaleOut", CandlestickScaleOut);
129
+ };
130
+
131
+ exports.registerCandlestickScaleAnimation = registerCandlestickScaleAnimation;
132
+ //# sourceM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from '@visactor/vrender-core';\nimport type { IGlyph } from '@visactor/vrender-core';\nimport type { IAnimationParameters } from '@visactor/vchart';\nimport { isValidNumber } from '@visactor/vutils';\nimport { ACustomAnimate, AnimateExecutor } from '@visactor/vrender-animate';\n\nexport interface ICandlestickScaleAnimationOptions {\n center?: number;\n}\n\ntype TypeAnimation = (\n graphic: IGlyph,\n options: ICandlestickScaleAnimationOptions,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nconst scaleIn = (): TypeAnimation => {\n return (graphic: IGlyph) => {\n const finalAttribute = graphic.getFinalAttribute();\n const { x, y, open, high, low, close } = finalAttribute;\n const animateAttributes: any = { from: { x, y }, to: { x, y } };\n if (isValidNumber(open) && isValidNumber(close)) {\n if (open > close) {\n animateAttributes.from.open = low;\n animateAttributes.to.open = open;\n animateAttributes.from.close = low;\n animateAttributes.to.close = close;\n if (isValidNumber(high)) {\n animateAttributes.from.high = low;\n animateAttributes.to.high = high;\n }\n } else {\n animateAttributes.from.open = high;\n animateAttributes.to.open = open;\n animateAttributes.from.close = high;\n animateAttributes.to.close = close;\n if (isValidNumber(low)) {\n animateAttributes.from.low = high;\n animateAttributes.to.low = low;\n }\n }\n }\n return animateAttributes;\n };\n};\n\nconst scaleOut = (): TypeAnimation => {\n return (graphic: IGlyph) => {\n const finalAttribute = graphic.getFinalAttribute();\n const { x, y, open, high, low, close } = finalAttribute;\n\n const animateAttributes: any = { from: { x, y }, to: { x, y } };\n if (isValidNumber(open) && isValidNumber(close)) {\n if (open > close) {\n animateAttributes.from.open = open;\n animateAttributes.to.open = low;\n animateAttributes.from.close = close;\n animateAttributes.to.close = low;\n if (isValidNumber(high)) {\n animateAttributes.from.high = high;\n animateAttributes.to.high = low;\n }\n } else {\n animateAttributes.from.open = open;\n animateAttributes.to.open = high;\n animateAttributes.from.close = close;\n animateAttributes.to.close = high;\n if (isValidNumber(low)) {\n animateAttributes.from.low = low;\n animateAttributes.to.low = high;\n }\n }\n }\n return animateAttributes;\n };\n};\n\nexport class CandlestickScaleIn extends ACustomAnimate<Record<string, number>> {\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: ICandlestickScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n super.onBind();\n const finalAttribute = this.target.getFinalAttribute();\n if (finalAttribute) {\n this.target.setAttributes(finalAttribute);\n }\n const { from, to } = this.computeAttribute();\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from;\n this.to = to;\n this.target.setAttributes(this.from);\n }\n\n computeAttribute() {\n const attr = scaleIn()(this.target as IGlyph, this.params, this.params.options);\n return attr;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(attribute);\n }\n}\n\nexport class CandlestickScaleOut extends ACustomAnimate<Record<string, number>> {\n constructor(from: null, to: null, duration: number, easing: EasingType, params?: ICandlestickScaleAnimationOptions) {\n super(from, to, duration, easing, params);\n }\n\n onBind(): void {\n if (this.params?.diffAttrs) {\n this.target.setAttributes(this.params.diffAttrs);\n }\n const { from, to } = this.computeAttribute();\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = from;\n this.to = to;\n this.target.setAttributes(this.from);\n }\n\n computeAttribute() {\n const attr = scaleOut()(this.target as IGlyph, this.params, this.params.options);\n return attr;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(attribute);\n }\n}\n\nexport const registerCandlestickScaleAnimation = () => {\n AnimateExecutor.registerBuiltInAnimate('candlestickScaleIn', CandlestickScaleIn);\n AnimateExecutor.registerBuiltInAnimate('candlestickScaleOut', CandlestickScaleOut);\n};\n"]}
@@ -0,0 +1,105 @@
1
+ import { CartesianSeries, IMark, Datum, IModelInitOption } from '@visactor/vchart';
2
+ import type { ICandlestickSeriesSpec } from './interface';
3
+ export declare const DEFAULT_STROKE_COLOR = "#000";
4
+ export declare class CandlestickSeries<T extends ICandlestickSeriesSpec = ICandlestickSeriesSpec> extends CartesianSeries<T> {
5
+ static readonly type: string;
6
+ type: string;
7
+ static readonly builtInTheme: {
8
+ candlestick: import("./interface").ICandlestickSeriesTheme;
9
+ };
10
+ static readonly mark: {
11
+ candlestick: {
12
+ name: import("./constant").CandlestickMarkNameEnum;
13
+ type: string;
14
+ };
15
+ label?: import("@visactor/vchart").ISeriesMarkInfo;
16
+ point?: import("@visactor/vchart").ISeriesMarkInfo;
17
+ line?: import("@visactor/vchart").ISeriesMarkInfo;
18
+ area?: import("@visactor/vchart").ISeriesMarkInfo;
19
+ bar?: import("@visactor/vchart").ISeriesMarkInfo;
20
+ boxPlot?: import("@visactor/vchart").ISeriesMarkInfo;
21
+ outlier?: import("@visactor/vchart").ISeriesMarkInfo;
22
+ circlePacking?: import("@visactor/vchart").ISeriesMarkInfo;
23
+ group?: import("@visactor/vchart").ISeriesMarkInfo;
24
+ gridBackground?: import("@visactor/vchart").ISeriesMarkInfo;
25
+ grid?: import("@visactor/vchart").ISeriesMarkInfo;
26
+ dot?: import("@visactor/vchart").ISeriesMarkInfo;
27
+ title?: import("@visactor/vchart").ISeriesMarkInfo;
28
+ subTitle?: import("@visactor/vchart").ISeriesMarkInfo;
29
+ symbol?: import("@visactor/vchart").ISeriesMarkInfo;
30
+ funnel?: import("@visactor/vchart").ISeriesMarkInfo;
31
+ transform?: import("@visactor/vchart").ISeriesMarkInfo;
32
+ transformLabel?: import("@visactor/vchart").ISeriesMarkInfo;
33
+ outerLabel?: import("@visactor/vchart").ISeriesMarkInfo;
34
+ outerLabelLine?: import("@visactor/vchart").ISeriesMarkInfo;
35
+ pin?: import("@visactor/vchart").ISeriesMarkInfo;
36
+ pinBackground?: import("@visactor/vchart").ISeriesMarkInfo;
37
+ pointer?: import("@visactor/vchart").ISeriesMarkInfo;
38
+ segment?: import("@visactor/vchart").ISeriesMarkInfo;
39
+ track?: import("@visactor/vchart").ISeriesMarkInfo;
40
+ cell?: import("@visactor/vchart").ISeriesMarkInfo;
41
+ cellBackground?: import("@visactor/vchart").ISeriesMarkInfo;
42
+ link?: import("@visactor/vchart").ISeriesMarkInfo;
43
+ arrow?: import("@visactor/vchart").ISeriesMarkInfo;
44
+ pie?: import("@visactor/vchart").ISeriesMarkInfo;
45
+ labelLine?: import("@visactor/vchart").ISeriesMarkInfo;
46
+ progress?: import("@visactor/vchart").ISeriesMarkInfo;
47
+ minLabel?: import("@visactor/vchart").ISeriesMarkInfo;
48
+ maxLabel?: import("@visactor/vchart").ISeriesMarkInfo;
49
+ rose?: import("@visactor/vchart").ISeriesMarkInfo;
50
+ node?: import("@visactor/vchart").ISeriesMarkInfo;
51
+ sunburst?: import("@visactor/vchart").ISeriesMarkInfo;
52
+ nonLeaf?: import("@visactor/vchart").ISeriesMarkInfo;
53
+ leaf?: import("@visactor/vchart").ISeriesMarkInfo;
54
+ nonLeafLabel?: import("@visactor/vchart").ISeriesMarkInfo;
55
+ leaderLine?: import("@visactor/vchart").ISeriesMarkInfo;
56
+ stackLabel?: import("@visactor/vchart").ISeriesMarkInfo;
57
+ word?: import("@visactor/vchart").ISeriesMarkInfo;
58
+ fillingWord?: import("@visactor/vchart").ISeriesMarkInfo;
59
+ wordMask?: import("@visactor/vchart").ISeriesMarkInfo;
60
+ nodePoint?: import("@visactor/vchart").ISeriesMarkInfo;
61
+ ripplePoint?: import("@visactor/vchart").ISeriesMarkInfo;
62
+ centerPoint?: import("@visactor/vchart").ISeriesMarkInfo;
63
+ centerLabel?: import("@visactor/vchart").ISeriesMarkInfo;
64
+ barBackground?: import("@visactor/vchart").ISeriesMarkInfo;
65
+ lineLabel?: import("@visactor/vchart").ISeriesMarkInfo;
66
+ areaLabel?: import("@visactor/vchart").ISeriesMarkInfo;
67
+ liquidGroup?: import("@visactor/vchart").ISeriesMarkInfo;
68
+ liquid?: import("@visactor/vchart").ISeriesMarkInfo;
69
+ liquidBackground?: import("@visactor/vchart").ISeriesMarkInfo;
70
+ liquidOutline?: import("@visactor/vchart").ISeriesMarkInfo;
71
+ circle?: import("@visactor/vchart").ISeriesMarkInfo;
72
+ overlap?: import("@visactor/vchart").ISeriesMarkInfo;
73
+ overlapLabel?: import("@visactor/vchart").ISeriesMarkInfo;
74
+ };
75
+ protected _openField: string;
76
+ getOpenField(): string;
77
+ protected _highField: string;
78
+ getHighField(): string;
79
+ protected _lowField: string;
80
+ getLowField(): string;
81
+ protected _closeField: string;
82
+ getCloseField(): string;
83
+ protected _boxWidth: number;
84
+ protected _boxFill: string | ((datum: Datum) => string);
85
+ getBoxFill(): string | ((datum: Datum) => string);
86
+ protected _strokeColor: string;
87
+ getStrokeColor(): string;
88
+ private _autoBoxWidth;
89
+ private _mergedStyles;
90
+ setAttrFromSpec(): void;
91
+ private _candlestickMark?;
92
+ initMark(): void;
93
+ initMarkStyle(): void;
94
+ initCandlestickMarkStyle(): void;
95
+ init(option: IModelInitOption): void;
96
+ private _initAnimationSpec;
97
+ initAnimation(): void;
98
+ protected initTooltip(): void;
99
+ private _buildMergedStyles;
100
+ protected mergeStyle(datum: Datum): any;
101
+ private _getMarkWidth;
102
+ onLayoutEnd(): void;
103
+ getActiveMarks(): IMark[];
104
+ }
105
+ export declare const registerCandlestickSeries: () => void;