@visactor/vchart-extension 2.0.15 → 2.0.16

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 (97) hide show
  1. package/build/index.js +592 -11
  2. package/build/index.min.js +2 -2
  3. package/cjs/charts/ranking-bar/ranking-bar.d.ts +1 -1
  4. package/cjs/charts/ranking-bar/ranking-bar.js.map +1 -1
  5. package/cjs/charts/ranking-list/constant.d.ts +1 -1
  6. package/cjs/charts/ranking-list/constant.js.map +1 -1
  7. package/cjs/charts/ranking-list/ranking-list.d.ts +1 -1
  8. package/cjs/charts/ranking-list/ranking-list.js.map +1 -1
  9. package/cjs/charts/sequence-scatter-kde/sequence-scatter-kde-transformer.js.map +1 -1
  10. package/cjs/charts/sequence-scatter-kde/sequence-scatter-kde.d.ts +1 -1
  11. package/cjs/charts/sequence-scatter-kde/sequence-scatter-kde.js.map +1 -1
  12. package/cjs/charts/sequence-scatter-link/sequence-scatter-link-transformer.js +1 -1
  13. package/cjs/charts/sequence-scatter-link/sequence-scatter-link-transformer.js.map +1 -1
  14. package/cjs/charts/sequence-scatter-link/sequence-scatter-link.d.ts +1 -1
  15. package/cjs/charts/sequence-scatter-link/sequence-scatter-link.js.map +1 -1
  16. package/cjs/charts/sequence-scatter-pixel/sequence-scatter-pixel-transformer.js.map +1 -1
  17. package/cjs/charts/sequence-scatter-pixel/sequence-scatter-pixel.d.ts +1 -1
  18. package/cjs/charts/sequence-scatter-pixel/sequence-scatter-pixel.js.map +1 -1
  19. package/cjs/charts/sequence-scatter-pixel/utils.d.ts +1 -1
  20. package/cjs/charts/sequence-scatter-pixel/utils.js.map +1 -1
  21. package/cjs/charts/timeline/index.d.ts +4 -0
  22. package/cjs/charts/timeline/index.js +31 -0
  23. package/cjs/charts/timeline/index.js.map +1 -0
  24. package/cjs/charts/timeline/interface.d.ts +7 -0
  25. package/cjs/charts/timeline/interface.js +6 -0
  26. package/cjs/charts/timeline/interface.js.map +1 -0
  27. package/cjs/charts/timeline/series/constant.d.ts +1 -0
  28. package/cjs/charts/timeline/series/constant.js +6 -0
  29. package/cjs/charts/timeline/series/constant.js.map +1 -0
  30. package/cjs/charts/timeline/series/event-series.d.ts +53 -0
  31. package/cjs/charts/timeline/series/event-series.js +339 -0
  32. package/cjs/charts/timeline/series/event-series.js.map +1 -0
  33. package/cjs/charts/timeline/series/interface.d.ts +28 -0
  34. package/cjs/charts/timeline/series/interface.js +6 -0
  35. package/cjs/charts/timeline/series/interface.js.map +1 -0
  36. package/cjs/charts/timeline/series/theme.d.ts +2 -0
  37. package/cjs/charts/timeline/series/theme.js +43 -0
  38. package/cjs/charts/timeline/series/theme.js.map +1 -0
  39. package/cjs/charts/timeline/timeline-transformer.d.ts +10 -0
  40. package/cjs/charts/timeline/timeline-transformer.js +84 -0
  41. package/cjs/charts/timeline/timeline-transformer.js.map +1 -0
  42. package/cjs/charts/timeline/timeline.d.ts +12 -0
  43. package/cjs/charts/timeline/timeline.js +25 -0
  44. package/cjs/charts/timeline/timeline.js.map +1 -0
  45. package/cjs/components/map-label/map-label-transformer.d.ts +1 -1
  46. package/cjs/components/map-label/map-label-transformer.js.map +1 -1
  47. package/cjs/index.d.ts +1 -0
  48. package/cjs/index.js +5 -5
  49. package/cjs/index.js.map +1 -1
  50. package/esm/charts/ranking-bar/ranking-bar.d.ts +1 -1
  51. package/esm/charts/ranking-bar/ranking-bar.js.map +1 -1
  52. package/esm/charts/ranking-list/constant.d.ts +1 -1
  53. package/esm/charts/ranking-list/constant.js.map +1 -1
  54. package/esm/charts/ranking-list/ranking-list.d.ts +1 -1
  55. package/esm/charts/ranking-list/ranking-list.js.map +1 -1
  56. package/esm/charts/sequence-scatter-kde/sequence-scatter-kde-transformer.js.map +1 -1
  57. package/esm/charts/sequence-scatter-kde/sequence-scatter-kde.d.ts +1 -1
  58. package/esm/charts/sequence-scatter-kde/sequence-scatter-kde.js.map +1 -1
  59. package/esm/charts/sequence-scatter-link/sequence-scatter-link-transformer.js +1 -1
  60. package/esm/charts/sequence-scatter-link/sequence-scatter-link-transformer.js.map +1 -1
  61. package/esm/charts/sequence-scatter-link/sequence-scatter-link.d.ts +1 -1
  62. package/esm/charts/sequence-scatter-link/sequence-scatter-link.js.map +1 -1
  63. package/esm/charts/sequence-scatter-pixel/sequence-scatter-pixel-transformer.js.map +1 -1
  64. package/esm/charts/sequence-scatter-pixel/sequence-scatter-pixel.d.ts +1 -1
  65. package/esm/charts/sequence-scatter-pixel/sequence-scatter-pixel.js.map +1 -1
  66. package/esm/charts/sequence-scatter-pixel/utils.d.ts +1 -1
  67. package/esm/charts/sequence-scatter-pixel/utils.js.map +1 -1
  68. package/esm/charts/timeline/index.d.ts +4 -0
  69. package/esm/charts/timeline/index.js +6 -0
  70. package/esm/charts/timeline/index.js.map +1 -0
  71. package/esm/charts/timeline/interface.d.ts +7 -0
  72. package/esm/charts/timeline/interface.js +2 -0
  73. package/esm/charts/timeline/interface.js.map +1 -0
  74. package/esm/charts/timeline/series/constant.d.ts +1 -0
  75. package/esm/charts/timeline/series/constant.js +2 -0
  76. package/esm/charts/timeline/series/constant.js.map +1 -0
  77. package/esm/charts/timeline/series/event-series.d.ts +53 -0
  78. package/esm/charts/timeline/series/event-series.js +337 -0
  79. package/esm/charts/timeline/series/event-series.js.map +1 -0
  80. package/esm/charts/timeline/series/interface.d.ts +28 -0
  81. package/esm/charts/timeline/series/interface.js +2 -0
  82. package/esm/charts/timeline/series/interface.js.map +1 -0
  83. package/esm/charts/timeline/series/theme.d.ts +2 -0
  84. package/esm/charts/timeline/series/theme.js +39 -0
  85. package/esm/charts/timeline/series/theme.js.map +1 -0
  86. package/esm/charts/timeline/timeline-transformer.d.ts +10 -0
  87. package/esm/charts/timeline/timeline-transformer.js +77 -0
  88. package/esm/charts/timeline/timeline-transformer.js.map +1 -0
  89. package/esm/charts/timeline/timeline.d.ts +12 -0
  90. package/esm/charts/timeline/timeline.js +19 -0
  91. package/esm/charts/timeline/timeline.js.map +1 -0
  92. package/esm/components/map-label/map-label-transformer.d.ts +1 -1
  93. package/esm/components/map-label/map-label-transformer.js.map +1 -1
  94. package/esm/index.d.ts +1 -0
  95. package/esm/index.js +2 -0
  96. package/esm/index.js.map +1 -1
  97. package/package.json +7 -7
package/build/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@visactor/vchart')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@visactor/vchart'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VChartExtension = {}, global.VChart));
5
- })(this, (function (exports, vchart) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@visactor/vchart'), require('@visactor/vutils')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@visactor/vchart', '@visactor/vutils'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VChartExtension = {}, global.VChart, global.VUtils));
5
+ })(this, (function (exports, vchart, vutils) { 'use strict';
6
6
 
7
7
  class RankingBarChartSpecTransformer extends vchart.BaseChartSpecTransformer {
8
8
  transformSpec(spec) {
@@ -1475,7 +1475,7 @@
1475
1475
  var _a, _b, _c, _d, _e;
1476
1476
  super.transformSpec(spec);
1477
1477
  const dataSpecs = processSequenceData$2(spec);
1478
- const showTooltip = spec.taskType === 'neighborhood' ? false : true;
1478
+ const showTooltip = spec.taskType !== 'neighborhood';
1479
1479
  spec.type = 'common';
1480
1480
  spec.dataKey = DATA_KEY$2;
1481
1481
  spec.data = dataSpecs[0].data;
@@ -1536,9 +1536,7 @@
1536
1536
  if (datum.type === 'same_type') {
1537
1537
  return [0, 0];
1538
1538
  }
1539
- else {
1540
- return [3, 2];
1541
- }
1539
+ return [3, 2];
1542
1540
  },
1543
1541
  lineWidth: 0.8,
1544
1542
  strokeOpacity: 0.6
@@ -1583,7 +1581,7 @@
1583
1581
  visible: true,
1584
1582
  style: {
1585
1583
  visible: () => {
1586
- return spec.taskType == 'neighborhood';
1584
+ return spec.taskType === 'neighborhood';
1587
1585
  },
1588
1586
  type: 'text',
1589
1587
  fontFamily: 'Console',
@@ -1989,7 +1987,7 @@
1989
1987
  {
1990
1988
  type: 'text',
1991
1989
  dataIndex: 1,
1992
- style: Object.assign({ text: (datum) => datum['iter'], x: 10, y: () => 10, textBaseline: 'top', textAlign: 'left', fontSize: 25, fontWeight: 'bolder', fill: 'black', fillOpacity: 0.2 }, (_b = spec.infoLabel) === null || _b === void 0 ? void 0 : _b.style)
1990
+ style: Object.assign({ text: (datum) => datum.iter, x: 10, y: () => 10, textBaseline: 'top', textAlign: 'left', fontSize: 25, fontWeight: 'bolder', fill: 'black', fillOpacity: 0.2 }, (_b = spec.infoLabel) === null || _b === void 0 ? void 0 : _b.style)
1993
1991
  },
1994
1992
  {
1995
1993
  type: 'symbol',
@@ -2226,7 +2224,7 @@
2226
2224
  {
2227
2225
  type: 'text',
2228
2226
  dataIndex: 1,
2229
- style: Object.assign({ text: (datum) => datum['inter'], x: 50, y: () => 10, textBaseline: 'top', textAlign: 'left', fontSize: 100, fontWeight: 'bolder', fill: 'black', fillOpacity: 0.2 }, (_e = spec.infoLabel) === null || _e === void 0 ? void 0 : _e.style)
2227
+ style: Object.assign({ text: (datum) => datum.inter, x: 50, y: () => 10, textBaseline: 'top', textAlign: 'left', fontSize: 100, fontWeight: 'bolder', fill: 'black', fillOpacity: 0.2 }, (_e = spec.infoLabel) === null || _e === void 0 ? void 0 : _e.style)
2230
2228
  }
2231
2229
  ];
2232
2230
  spec.tooltip = {
@@ -5244,6 +5242,586 @@
5244
5242
  vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
5245
5243
  };
5246
5244
 
5245
+ class TimelineChartSpecTransformer extends vchart.BaseChartSpecTransformer {
5246
+ _getDefaultSeriesSpec(spec) {
5247
+ return super._getDefaultSeriesSpec(spec, [
5248
+ 'timeField',
5249
+ 'eventField',
5250
+ 'seriesField',
5251
+ 'titleField',
5252
+ 'subTitleField',
5253
+ 'iconField',
5254
+ 'dot',
5255
+ 'title',
5256
+ 'subTitle',
5257
+ 'icon',
5258
+ 'line',
5259
+ 'arrow',
5260
+ 'labelPosition',
5261
+ 'sortDataByAxis'
5262
+ ]);
5263
+ }
5264
+ _setDefaultXAxisSpec(spec) {
5265
+ return {
5266
+ type: 'band',
5267
+ orient: 'bottom',
5268
+ label: {
5269
+ visible: false
5270
+ },
5271
+ tick: {
5272
+ visible: false
5273
+ },
5274
+ grid: {
5275
+ visible: false
5276
+ },
5277
+ domainLine: {
5278
+ visible: false
5279
+ },
5280
+ paddingInner: 0,
5281
+ paddingOuter: 0
5282
+ };
5283
+ }
5284
+ _setDefaultYAxisSpec(spec) {
5285
+ return {
5286
+ type: 'band',
5287
+ inverse: true,
5288
+ orient: 'left',
5289
+ label: {
5290
+ visible: false
5291
+ },
5292
+ tick: {
5293
+ visible: false
5294
+ },
5295
+ grid: {
5296
+ visible: false
5297
+ },
5298
+ domainLine: {
5299
+ visible: false
5300
+ },
5301
+ paddingInner: 0,
5302
+ paddingOuter: 0
5303
+ };
5304
+ }
5305
+ _transformAxisSpec(spec) {
5306
+ if (!spec.axes) {
5307
+ spec.axes = [];
5308
+ }
5309
+ const haxAxes = { x: false, y: false };
5310
+ spec.axes.forEach((axis) => {
5311
+ const { orient } = axis;
5312
+ let defaultSpec = null;
5313
+ if (orient === 'top' || orient === 'bottom') {
5314
+ haxAxes.x = true;
5315
+ defaultSpec = this._setDefaultXAxisSpec(spec);
5316
+ }
5317
+ if (orient === 'left' || orient === 'right') {
5318
+ haxAxes.y = true;
5319
+ defaultSpec = this._setDefaultYAxisSpec(spec);
5320
+ }
5321
+ if (defaultSpec) {
5322
+ Object.keys(defaultSpec).forEach(key => {
5323
+ axis[key] = vutils.isObject(axis[key])
5324
+ ? vutils.merge(defaultSpec[key], axis[key])
5325
+ : vutils.isNil(axis[key])
5326
+ ? defaultSpec[key]
5327
+ : axis[key];
5328
+ });
5329
+ }
5330
+ });
5331
+ if (!haxAxes.x) {
5332
+ spec.axes.push(this._setDefaultXAxisSpec(spec));
5333
+ }
5334
+ if (!haxAxes.y) {
5335
+ spec.axes.push(this._setDefaultYAxisSpec(spec));
5336
+ }
5337
+ }
5338
+ transformSpec(spec) {
5339
+ var _a, _b;
5340
+ super.transformSpec(spec);
5341
+ this.transformSeriesSpec(spec);
5342
+ this._transformAxisSpec(spec);
5343
+ const direction = (_a = spec.direction) !== null && _a !== void 0 ? _a : 'horizontal';
5344
+ (_b = spec.series) === null || _b === void 0 ? void 0 : _b.forEach(seriesSpec => {
5345
+ if (direction === 'vertical') {
5346
+ if (seriesSpec.timeField && !seriesSpec.yField) {
5347
+ seriesSpec.yField = seriesSpec.timeField;
5348
+ }
5349
+ if (!seriesSpec.xField) {
5350
+ seriesSpec.xField = seriesSpec.seriesField || '__vchart_timeline_dummy__';
5351
+ }
5352
+ }
5353
+ else {
5354
+ if (seriesSpec.timeField && !seriesSpec.xField) {
5355
+ seriesSpec.xField = seriesSpec.timeField;
5356
+ }
5357
+ if (!seriesSpec.yField) {
5358
+ seriesSpec.yField = seriesSpec.seriesField || '__vchart_timeline_dummy__';
5359
+ }
5360
+ }
5361
+ });
5362
+ }
5363
+ }
5364
+
5365
+ const EVENT_SERIES_TYPE = 'event';
5366
+
5367
+ const event = {
5368
+ dot: {
5369
+ style: {
5370
+ size: 8
5371
+ }
5372
+ },
5373
+ icon: {
5374
+ visible: false,
5375
+ style: {
5376
+ size: 20
5377
+ }
5378
+ },
5379
+ line: {
5380
+ visible: true,
5381
+ style: {
5382
+ stroke: '#c0c3c7',
5383
+ lineWidth: 1
5384
+ }
5385
+ },
5386
+ title: {
5387
+ visible: true,
5388
+ offset: 6,
5389
+ subTitleGap: 4,
5390
+ style: {
5391
+ fontSize: 14
5392
+ }
5393
+ },
5394
+ subTitle: {
5395
+ visible: true,
5396
+ style: {
5397
+ fontSize: 12
5398
+ }
5399
+ },
5400
+ arrow: {
5401
+ visible: false,
5402
+ thickness: 16
5403
+ }
5404
+ };
5405
+
5406
+ const eventSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["line"]: { name: "line", type: "line" }, ["dot"]: { name: "dot", type: "symbol" }, icon: { name: 'icon', type: "symbol" }, ["title"]: { name: "title", type: "text" }, ["subTitle"]: { name: "subTitle", type: "text" }, arrow: { name: 'arrow', type: "path" } });
5407
+ class EventSeries extends vchart.CartesianSeries {
5408
+ constructor() {
5409
+ super(...arguments);
5410
+ this.type = EVENT_SERIES_TYPE;
5411
+ this.transformerConstructor = vchart.BaseSeriesSpecTransformer;
5412
+ this.coordinate = 'cartesian';
5413
+ }
5414
+ setAttrFromSpec() {
5415
+ super.setAttrFromSpec();
5416
+ this.setSeriesField(this._spec.seriesField);
5417
+ this._timeField = this._spec.timeField;
5418
+ this._eventField = this._spec.eventField;
5419
+ this._subTitleField = this._spec.subTitleField;
5420
+ this._iconField = this._spec.iconField;
5421
+ this._labelPosition = this._spec.labelPosition;
5422
+ }
5423
+ getDimensionField() {
5424
+ return this._timeField ? [this._timeField] : [];
5425
+ }
5426
+ getMeasureField() {
5427
+ const fields = [];
5428
+ if (this._eventField) {
5429
+ fields.push(this._eventField);
5430
+ }
5431
+ if (this._subTitleField) {
5432
+ fields.push(this._subTitleField);
5433
+ }
5434
+ return fields;
5435
+ }
5436
+ initMark() {
5437
+ this._axisLineMark = this._createMark(EventSeries.mark.line, {
5438
+ isSeriesMark: true,
5439
+ groupKey: this._seriesField
5440
+ });
5441
+ this._arrowMark = this._createMark(EventSeries.mark.arrow, {
5442
+ isSeriesMark: true
5443
+ });
5444
+ this._dotMark = this._createMark(EventSeries.mark.dot, {
5445
+ isSeriesMark: true
5446
+ });
5447
+ this._iconMark = this._createMark(EventSeries.mark.icon, {
5448
+ isSeriesMark: true
5449
+ });
5450
+ this._titleMark = this._createMark(EventSeries.mark.title);
5451
+ this._subTitleMark = this._createMark(EventSeries.mark.subTitle);
5452
+ }
5453
+ initTooltip() {
5454
+ super.initTooltip();
5455
+ this._dotMark && this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark);
5456
+ this._titleMark && this._tooltipHelper.activeTriggerSet.mark.add(this._titleMark);
5457
+ this._subTitleMark && this._tooltipHelper.activeTriggerSet.mark.add(this._subTitleMark);
5458
+ this._iconMark && this._tooltipHelper.activeTriggerSet.mark.add(this._iconMark);
5459
+ this._arrowMark && this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark);
5460
+ }
5461
+ initMarkStyle() {
5462
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
5463
+ if (this._axisLineMark) {
5464
+ this.setMarkStyle(this._axisLineMark, {
5465
+ points: this._getAxisPoints.bind(this),
5466
+ visible: this._isFirstDataInGroup.bind(this),
5467
+ stroke: '#c0c3c7',
5468
+ lineWidth: 1
5469
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5470
+ }
5471
+ const dotSpec = this._spec.dot;
5472
+ const dotSize = typeof ((_a = dotSpec === null || dotSpec === void 0 ? void 0 : dotSpec.style) === null || _a === void 0 ? void 0 : _a.size) === 'number' ? dotSpec.style.size : 8;
5473
+ const titleSpec = this._spec.title;
5474
+ const titleStyle = (_b = titleSpec === null || titleSpec === void 0 ? void 0 : titleSpec.style) !== null && _b !== void 0 ? _b : {};
5475
+ const subTitleSpec = this._spec.subTitle;
5476
+ const subTitleStyle = (_c = subTitleSpec === null || subTitleSpec === void 0 ? void 0 : subTitleSpec.style) !== null && _c !== void 0 ? _c : {};
5477
+ const titleFontSize = typeof titleStyle.fontSize === 'number' ? titleStyle.fontSize : 14;
5478
+ const labelOffset = dotSize / 2 + ((_d = titleSpec === null || titleSpec === void 0 ? void 0 : titleSpec.offset) !== null && _d !== void 0 ? _d : 6);
5479
+ if (this._dotMark) {
5480
+ this.setMarkStyle(this._dotMark, {
5481
+ x: (datum) => this._getPoint(datum).x,
5482
+ y: (datum) => this._getPoint(datum).y,
5483
+ size: dotSize,
5484
+ fill: (_f = (_e = dotSpec === null || dotSpec === void 0 ? void 0 : dotSpec.style) === null || _e === void 0 ? void 0 : _e.fill) !== null && _f !== void 0 ? _f : this.getColorAttribute()
5485
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5486
+ }
5487
+ if (this._arrowMark) {
5488
+ this.setMarkStyle(this._arrowMark, {
5489
+ path: (datum) => this._getArrowPath(datum),
5490
+ fill: (_h = (_g = dotSpec === null || dotSpec === void 0 ? void 0 : dotSpec.style) === null || _g === void 0 ? void 0 : _g.fill) !== null && _h !== void 0 ? _h : this.getColorAttribute()
5491
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5492
+ }
5493
+ if (this._titleMark) {
5494
+ this.setMarkStyle(this._titleMark, Object.assign(Object.assign({ fontSize: 14 }, titleStyle), { x: (datum) => this._getTitlePosition(datum, labelOffset).x, y: (datum) => this._getTitlePosition(datum, labelOffset).y, textAlign: (datum) => this._getLabelTextAlign(datum), textBaseline: (datum) => this._getLabelTextBaseline(datum, true), text: (datum) => this._getDatumString(datum, this._eventField) }), vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5495
+ }
5496
+ if (this._subTitleMark) {
5497
+ this.setMarkStyle(this._subTitleMark, Object.assign(Object.assign({}, subTitleStyle), { x: (datum) => this._getSubTitlePosition(datum, labelOffset, titleFontSize).x, y: (datum) => this._getSubTitlePosition(datum, labelOffset, titleFontSize).y, textAlign: (datum) => this._getLabelTextAlign(datum), textBaseline: (datum) => this._getLabelTextBaseline(datum, false), text: (datum) => this._getDatumString(datum, this._subTitleField) }), vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5498
+ }
5499
+ const iconSpec = this._spec.icon;
5500
+ const iconSize = typeof ((_j = iconSpec === null || iconSpec === void 0 ? void 0 : iconSpec.style) === null || _j === void 0 ? void 0 : _j.size) === 'number' ? iconSpec.style.size : 20;
5501
+ const iconOffset = (vutils.isValid(iconSpec === null || iconSpec === void 0 ? void 0 : iconSpec.offset) ? iconSpec.offset + dotSize / 2 : labelOffset) + iconSize / 2;
5502
+ if (this._iconMark) {
5503
+ this.setMarkStyle(this._iconMark, {
5504
+ x: (datum) => this._getIconPosition(datum, iconOffset).x,
5505
+ y: (datum) => this._getIconPosition(datum, iconOffset).y,
5506
+ size: iconSize,
5507
+ fill: (_l = (_k = iconSpec === null || iconSpec === void 0 ? void 0 : iconSpec.style) === null || _k === void 0 ? void 0 : _k.fill) !== null && _l !== void 0 ? _l : this.getColorAttribute(),
5508
+ shape: (datum) => this._getDatumString(datum, this._iconField) || 'circle'
5509
+ }, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
5510
+ }
5511
+ }
5512
+ _getLabelSide(datum) {
5513
+ const data = this._getViewDataList();
5514
+ const index = data.indexOf(datum);
5515
+ const position = this._labelPosition;
5516
+ if (this.direction === 'vertical') {
5517
+ switch (position) {
5518
+ case 'left':
5519
+ return 'primary';
5520
+ case 'right':
5521
+ return 'secondary';
5522
+ case 'left-right':
5523
+ return index % 2 === 0 ? 'primary' : 'secondary';
5524
+ case 'right-left':
5525
+ return index % 2 === 0 ? 'secondary' : 'primary';
5526
+ default:
5527
+ return 'primary';
5528
+ }
5529
+ }
5530
+ else {
5531
+ switch (position) {
5532
+ case 'top':
5533
+ return 'primary';
5534
+ case 'bottom':
5535
+ return 'secondary';
5536
+ case 'top-bottom':
5537
+ return index % 2 === 0 ? 'primary' : 'secondary';
5538
+ case 'bottom-top':
5539
+ return index % 2 === 0 ? 'secondary' : 'primary';
5540
+ default:
5541
+ return 'primary';
5542
+ }
5543
+ }
5544
+ }
5545
+ _getLabelTextAlign(datum) {
5546
+ if (this.direction === 'vertical') {
5547
+ const side = this._getLabelSide(datum);
5548
+ return side === 'primary' ? 'right' : 'left';
5549
+ }
5550
+ return 'center';
5551
+ }
5552
+ _getLabelTextBaseline(datum, isTitle) {
5553
+ if (this.direction === 'vertical') {
5554
+ return 'middle';
5555
+ }
5556
+ const side = this._getLabelSide(datum);
5557
+ return side === 'primary' ? 'bottom' : 'top';
5558
+ }
5559
+ _getTitlePosition(datum, offset) {
5560
+ const point = this._getPoint(datum);
5561
+ const side = this._getLabelSide(datum);
5562
+ if (this.direction === 'vertical') {
5563
+ return {
5564
+ x: side === 'primary' ? point.x - offset : point.x + offset,
5565
+ y: point.y
5566
+ };
5567
+ }
5568
+ return {
5569
+ x: point.x,
5570
+ y: side === 'primary' ? point.y - offset : point.y + offset
5571
+ };
5572
+ }
5573
+ _getSubTitlePosition(datum, offset, titleFontSize) {
5574
+ var _a, _b, _c, _d;
5575
+ const point = this._getPoint(datum);
5576
+ const side = this._getLabelSide(datum);
5577
+ const gap = (_b = (_a = this._spec.title) === null || _a === void 0 ? void 0 : _a.subTitleGap) !== null && _b !== void 0 ? _b : 4;
5578
+ if (this.direction === 'vertical') {
5579
+ const titleStyle = (_d = (_c = this._spec.title) === null || _c === void 0 ? void 0 : _c.style) !== null && _d !== void 0 ? _d : {};
5580
+ const titleLineHeight = typeof titleStyle.lineHeight === 'number' ? titleStyle.lineHeight : titleFontSize * 1.2;
5581
+ return {
5582
+ x: side === 'primary' ? point.x - offset : point.x + offset,
5583
+ y: point.y + titleLineHeight + gap
5584
+ };
5585
+ }
5586
+ return {
5587
+ x: point.x,
5588
+ y: side === 'primary' ? point.y - (offset + titleFontSize + gap) : point.y + (offset + titleFontSize + gap)
5589
+ };
5590
+ }
5591
+ _getIconPosition(datum, offset) {
5592
+ const point = this._getPoint(datum);
5593
+ const side = this._getLabelSide(datum);
5594
+ if (this.direction === 'vertical') {
5595
+ return {
5596
+ x: side === 'primary' ? point.x + offset : point.x - offset,
5597
+ y: point.y
5598
+ };
5599
+ }
5600
+ return {
5601
+ x: point.x,
5602
+ y: side === 'primary' ? point.y + offset : point.y - offset
5603
+ };
5604
+ }
5605
+ _getViewDataList() {
5606
+ var _a, _b;
5607
+ return (_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.latestData) !== null && _b !== void 0 ? _b : [];
5608
+ }
5609
+ _getPoint(datum) {
5610
+ if (this.direction === 'vertical') {
5611
+ const x = this._getPositionFromAxis(datum, this.getXAxisHelper(), this._seriesField);
5612
+ const y = this._getPositionFromAxis(datum, this.getYAxisHelper(), this._timeField);
5613
+ return { x, y };
5614
+ }
5615
+ const x = this._getPositionFromAxis(datum, this.getXAxisHelper(), this._timeField);
5616
+ const y = this._getPositionFromAxis(datum, this.getYAxisHelper(), this._seriesField);
5617
+ return { x, y };
5618
+ }
5619
+ _getPositionFromAxis(datum, axisHelper, field) {
5620
+ var _a, _b, _c, _d, _e, _f;
5621
+ if (!axisHelper) {
5622
+ return this._getDefaultPosition(field);
5623
+ }
5624
+ if (!field || !(field in datum)) {
5625
+ return this._getDefaultPosition(field);
5626
+ }
5627
+ const value = datum[field];
5628
+ const axisType = (_b = (_a = axisHelper.getSpec) === null || _a === void 0 ? void 0 : _a.call(axisHelper)) === null || _b === void 0 ? void 0 : _b.type;
5629
+ if (axisType === 'band' || !axisHelper.isContinuous) {
5630
+ return (_d = (_c = axisHelper.dataToPosition) === null || _c === void 0 ? void 0 : _c.call(axisHelper, [value], { bandPosition: 0.5 })) !== null && _d !== void 0 ? _d : this._getDefaultPosition(field);
5631
+ }
5632
+ return (_f = (_e = axisHelper.valueToPosition) === null || _e === void 0 ? void 0 : _e.call(axisHelper, value)) !== null && _f !== void 0 ? _f : this._getDefaultPosition(field);
5633
+ }
5634
+ onXAxisHelperUpdate() {
5635
+ var _a;
5636
+ (_a = super.onXAxisHelperUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
5637
+ this.onMarkPositionUpdate();
5638
+ }
5639
+ onYAxisHelperUpdate() {
5640
+ var _a;
5641
+ (_a = super.onYAxisHelperUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
5642
+ this.onMarkPositionUpdate();
5643
+ }
5644
+ _getDefaultPosition(field) {
5645
+ const rect = this._region.getLayoutRect();
5646
+ if (!this._seriesField || field === this._seriesField) {
5647
+ const isHorizontal = this.direction !== 'vertical';
5648
+ return isHorizontal ? rect.height * 0.5 : rect.width * 0.5;
5649
+ }
5650
+ return 0;
5651
+ }
5652
+ _getAxisPoints(datum) {
5653
+ const rect = this._region.getLayoutRect();
5654
+ if (this.direction === 'vertical') {
5655
+ const x = this._getPositionFromAxis(datum, this.getXAxisHelper(), this._seriesField);
5656
+ return [
5657
+ { x, y: 0 },
5658
+ { x, y: rect.height }
5659
+ ];
5660
+ }
5661
+ const y = this._getPositionFromAxis(datum, this.getYAxisHelper(), this._seriesField);
5662
+ return [
5663
+ { x: 0, y },
5664
+ { x: rect.width, y }
5665
+ ];
5666
+ }
5667
+ _isFirstDataInGroup(datum) {
5668
+ if (!this._seriesField) {
5669
+ const data = this._getViewDataList();
5670
+ return data.indexOf(datum) === 0;
5671
+ }
5672
+ const data = this._getViewDataList();
5673
+ const categoryValue = datum[this._seriesField];
5674
+ const firstInGroup = data.find(d => this._seriesField && d[this._seriesField] === categoryValue);
5675
+ return datum === firstInGroup;
5676
+ }
5677
+ _getNextDatum(datum) {
5678
+ const data = this._getViewDataList();
5679
+ const currentIndex = data.indexOf(datum);
5680
+ if (currentIndex === -1 || currentIndex === data.length - 1) {
5681
+ return null;
5682
+ }
5683
+ if (!this._seriesField) {
5684
+ return data[currentIndex + 1];
5685
+ }
5686
+ const categoryValue = datum[this._seriesField];
5687
+ for (let i = currentIndex + 1; i < data.length; i++) {
5688
+ const nextDatum = data[i];
5689
+ if (nextDatum[this._seriesField] === categoryValue) {
5690
+ return nextDatum;
5691
+ }
5692
+ }
5693
+ return null;
5694
+ }
5695
+ _getPreviousDatum(datum) {
5696
+ const data = this._getViewDataList();
5697
+ const currentIndex = data.indexOf(datum);
5698
+ if (currentIndex === -1 || currentIndex === 0) {
5699
+ return null;
5700
+ }
5701
+ if (!this._seriesField) {
5702
+ return data[currentIndex - 1];
5703
+ }
5704
+ const categoryValue = datum[this._seriesField];
5705
+ for (let i = currentIndex - 1; i >= 0; i--) {
5706
+ const prevDatum = data[i];
5707
+ if (prevDatum[this._seriesField] === categoryValue) {
5708
+ return prevDatum;
5709
+ }
5710
+ }
5711
+ return null;
5712
+ }
5713
+ _getArrowPath(datum) {
5714
+ var _a, _b;
5715
+ const point = this._getPoint(datum);
5716
+ const nextDatum = this._getNextDatum(datum);
5717
+ const prevDatum = this._getPreviousDatum(datum);
5718
+ const arrowThickness = (_b = (_a = this._spec.arrow) === null || _a === void 0 ? void 0 : _a.thickness) !== null && _b !== void 0 ? _b : 16;
5719
+ const rect = this._region.getLayoutRect();
5720
+ if (this.direction === 'vertical') {
5721
+ const axisHelper = this.getYAxisHelper();
5722
+ const inverse = axisHelper.isInverse();
5723
+ const startPoint = prevDatum
5724
+ ? {
5725
+ x: point.x,
5726
+ y: (this._getPoint(prevDatum).y + point.y) / 2
5727
+ }
5728
+ : { x: point.x, y: inverse ? 0 : rect.height };
5729
+ const endPoint = nextDatum
5730
+ ? {
5731
+ x: point.x,
5732
+ y: (this._getPoint(nextDatum).y + point.y) / 2
5733
+ }
5734
+ : { x: point.x, y: inverse ? rect.height : 0 };
5735
+ const tag = inverse ? 1 : -1;
5736
+ const arrowHeight = arrowThickness / 3;
5737
+ const arrowWidth = arrowThickness / 2;
5738
+ return `M ${startPoint.x - arrowWidth} ${startPoint.y} L ${startPoint.x} ${startPoint.y + tag * arrowHeight} L ${startPoint.x + arrowWidth} ${startPoint.y}
5739
+ L ${endPoint.x + arrowWidth} ${endPoint.y - tag * arrowHeight}
5740
+ L ${endPoint.x} ${endPoint.y}
5741
+ L ${endPoint.x - arrowWidth} ${endPoint.y - tag * arrowHeight} Z`;
5742
+ }
5743
+ const axisHelper = this.getXAxisHelper();
5744
+ const inverse = axisHelper.isInverse();
5745
+ const startPoint = prevDatum
5746
+ ? {
5747
+ x: (this._getPoint(prevDatum).x + point.x) / 2,
5748
+ y: point.y
5749
+ }
5750
+ : { x: inverse ? rect.width : 0, y: point.y };
5751
+ const endPoint = nextDatum
5752
+ ? {
5753
+ x: (this._getPoint(nextDatum).x + point.x) / 2,
5754
+ y: point.y
5755
+ }
5756
+ : { x: inverse ? 0 : rect.width, y: point.y };
5757
+ const tag = inverse ? -1 : 1;
5758
+ const arrowHeight = arrowThickness / 2;
5759
+ const arrowWidth = arrowThickness / 3;
5760
+ return `M ${startPoint.x} ${startPoint.y - arrowHeight} L ${startPoint.x + tag * arrowWidth} ${startPoint.y} L ${startPoint.x} ${startPoint.y + arrowHeight}
5761
+ L ${endPoint.x - tag * arrowWidth} ${endPoint.y + arrowHeight}
5762
+ L ${endPoint.x} ${endPoint.y}
5763
+ L ${endPoint.x - tag * arrowWidth} ${endPoint.y - arrowHeight} Z`;
5764
+ }
5765
+ _getDatumString(datum, field) {
5766
+ if (!datum || !field) {
5767
+ return '';
5768
+ }
5769
+ const value = datum[field];
5770
+ return typeof value === 'string' ? value : value == null ? '' : String(value);
5771
+ }
5772
+ valueToPosition(timeValue, eventValue) {
5773
+ if (timeValue && typeof timeValue === 'object') {
5774
+ return this.dataToPosition(timeValue);
5775
+ }
5776
+ const mockDatum = {};
5777
+ if (this._timeField) {
5778
+ mockDatum[this._timeField] = timeValue;
5779
+ }
5780
+ if (this._eventField && eventValue !== undefined) {
5781
+ mockDatum[this._eventField] = eventValue;
5782
+ }
5783
+ return this._getPoint(mockDatum);
5784
+ }
5785
+ getActiveMarks() {
5786
+ return [
5787
+ this._axisLineMark,
5788
+ this._dotMark,
5789
+ this._iconMark,
5790
+ this._arrowMark,
5791
+ this._titleMark,
5792
+ this._subTitleMark
5793
+ ].filter(Boolean);
5794
+ }
5795
+ }
5796
+ EventSeries.type = EVENT_SERIES_TYPE;
5797
+ EventSeries.mark = eventSeriesMark;
5798
+ EventSeries.builtInTheme = { event };
5799
+ EventSeries.transformerConstructor = vchart.BaseSeriesSpecTransformer;
5800
+ const registerEventSeries = () => {
5801
+ vchart.registerSymbolMark();
5802
+ vchart.registerTextMark();
5803
+ vchart.registerLineMark();
5804
+ vchart.registerPathMark();
5805
+ vchart.Factory.registerSeries(EventSeries.type, EventSeries);
5806
+ };
5807
+
5808
+ class TimelineChart extends vchart.BaseChart {
5809
+ constructor() {
5810
+ super(...arguments);
5811
+ this.transformerConstructor = TimelineChartSpecTransformer;
5812
+ this.type = 'timeline';
5813
+ this.seriesType = 'event';
5814
+ }
5815
+ }
5816
+ TimelineChart.type = 'timeline';
5817
+ TimelineChart.seriesType = 'event';
5818
+ TimelineChart.transformerConstructor = TimelineChartSpecTransformer;
5819
+ const registerTimelineChart = () => {
5820
+ vchart.registerMarkTooltipProcessor();
5821
+ registerEventSeries();
5822
+ vchart.Factory.registerChart(TimelineChart.type, TimelineChart);
5823
+ };
5824
+
5247
5825
  const SERIES_BREAK = 'seriesBreak';
5248
5826
 
5249
5827
  function generateZigzagPath(start, end, size, angle, isVertical = false) {
@@ -7277,6 +7855,7 @@
7277
7855
  exports.SequenceScatterPixel = SequenceScatterPixel;
7278
7856
  exports.SeriesBreakComponent = SeriesBreakComponent;
7279
7857
  exports.SeriesLabelComponent = SeriesLabelComponent;
7858
+ exports.TimelineChart = TimelineChart;
7280
7859
  exports.WordCloud3dChart = WordCloud3dChart;
7281
7860
  exports.WordCloud3dChartSpecTransformer = WordCloud3dChartSpecTransformer;
7282
7861
  exports.WordCloud3dSeries = WordCloud3dSeries;
@@ -7303,6 +7882,7 @@
7303
7882
  exports.registerCandlestickSeries = registerCandlestickSeries;
7304
7883
  exports.registerCombinationCandlestickChart = registerCombinationCandlestickChart;
7305
7884
  exports.registerConversionFunnelChart = registerConversionFunnelChart;
7885
+ exports.registerEventSeries = registerEventSeries;
7306
7886
  exports.registerFunnel3dChart = registerFunnel3dChart;
7307
7887
  exports.registerFunnel3dSeries = registerFunnel3dSeries;
7308
7888
  exports.registerHistogram3dChart = registerHistogram3dChart;
@@ -7323,6 +7903,7 @@
7323
7903
  exports.registerSequenceScatterPixel = registerSequenceScatterPixel;
7324
7904
  exports.registerSeriesBreak = registerSeriesBreak;
7325
7905
  exports.registerSeriesLabel = registerSeriesLabel;
7906
+ exports.registerTimelineChart = registerTimelineChart;
7326
7907
  exports.registerWordCloud3dChart = registerWordCloud3dChart;
7327
7908
  exports.registerWordCloud3dSeries = registerWordCloud3dSeries;
7328
7909
  exports.registerWordCloudShape3dChart = registerWordCloudShape3dChart;