@visactor/vchart 1.13.20 → 1.13.21-alpha.0

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 (78) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +32 -5
  3. package/build/index.js +32 -5
  4. package/build/index.min.js +1 -1
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.js +3 -0
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/chart/interface/common.d.ts +2 -0
  9. package/cjs/chart/interface/common.js.map +1 -1
  10. package/cjs/chart/sankey/sankey-transformer.js +1 -1
  11. package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
  12. package/cjs/constant/funnel.js +2 -1
  13. package/cjs/constant/sunburst.js +1 -2
  14. package/cjs/core/index.d.ts +1 -1
  15. package/cjs/core/index.js +1 -1
  16. package/cjs/core/index.js.map +1 -1
  17. package/cjs/core/interface.js +2 -1
  18. package/cjs/core/vchart.d.ts +2 -0
  19. package/cjs/core/vchart.js +8 -4
  20. package/cjs/core/vchart.js.map +1 -1
  21. package/cjs/data/transforms/sankey.d.ts +2 -0
  22. package/cjs/data/transforms/sankey.js +2 -1
  23. package/cjs/data/transforms/sankey.js.map +1 -1
  24. package/cjs/plugin/chart/interface.d.ts +4 -0
  25. package/cjs/plugin/chart/interface.js.map +1 -1
  26. package/cjs/plugin/chart/plugin-service.d.ts +3 -0
  27. package/cjs/plugin/chart/plugin-service.js +13 -0
  28. package/cjs/plugin/chart/plugin-service.js.map +1 -1
  29. package/cjs/plugin/chart/scroll/index.d.ts +2 -0
  30. package/cjs/plugin/chart/scroll/index.js +21 -0
  31. package/cjs/plugin/chart/scroll/index.js.map +1 -0
  32. package/cjs/plugin/chart/scroll/interface.d.ts +11 -0
  33. package/cjs/plugin/chart/scroll/interface.js +6 -0
  34. package/cjs/plugin/chart/scroll/interface.js.map +1 -0
  35. package/cjs/plugin/chart/scroll/scroll.d.ts +41 -0
  36. package/cjs/plugin/chart/scroll/scroll.js +204 -0
  37. package/cjs/plugin/chart/scroll/scroll.js.map +1 -0
  38. package/cjs/series/sankey/interface.d.ts +3 -0
  39. package/cjs/series/sankey/interface.js.map +1 -1
  40. package/cjs/series/sankey/sankey.js +2 -1
  41. package/cjs/series/sankey/sankey.js.map +1 -1
  42. package/esm/chart/base/base-chart.js +3 -0
  43. package/esm/chart/base/base-chart.js.map +1 -1
  44. package/esm/chart/interface/common.d.ts +2 -0
  45. package/esm/chart/interface/common.js.map +1 -1
  46. package/esm/chart/sankey/sankey-transformer.js +1 -1
  47. package/esm/chart/sankey/sankey-transformer.js.map +1 -1
  48. package/esm/constant/funnel.js +2 -1
  49. package/esm/constant/sunburst.js +1 -2
  50. package/esm/core/index.d.ts +1 -1
  51. package/esm/core/index.js +1 -1
  52. package/esm/core/index.js.map +1 -1
  53. package/esm/core/interface.js +2 -1
  54. package/esm/core/vchart.d.ts +2 -0
  55. package/esm/core/vchart.js +8 -4
  56. package/esm/core/vchart.js.map +1 -1
  57. package/esm/data/transforms/sankey.d.ts +2 -0
  58. package/esm/data/transforms/sankey.js +2 -1
  59. package/esm/data/transforms/sankey.js.map +1 -1
  60. package/esm/plugin/chart/interface.d.ts +4 -0
  61. package/esm/plugin/chart/interface.js.map +1 -1
  62. package/esm/plugin/chart/plugin-service.d.ts +3 -0
  63. package/esm/plugin/chart/plugin-service.js +13 -0
  64. package/esm/plugin/chart/plugin-service.js.map +1 -1
  65. package/esm/plugin/chart/scroll/index.d.ts +2 -0
  66. package/esm/plugin/chart/scroll/index.js +4 -0
  67. package/esm/plugin/chart/scroll/index.js.map +1 -0
  68. package/esm/plugin/chart/scroll/interface.d.ts +11 -0
  69. package/esm/plugin/chart/scroll/interface.js +2 -0
  70. package/esm/plugin/chart/scroll/interface.js.map +1 -0
  71. package/esm/plugin/chart/scroll/scroll.d.ts +41 -0
  72. package/esm/plugin/chart/scroll/scroll.js +206 -0
  73. package/esm/plugin/chart/scroll/scroll.js.map +1 -0
  74. package/esm/series/sankey/interface.d.ts +3 -0
  75. package/esm/series/sankey/interface.js.map +1 -1
  76. package/esm/series/sankey/sankey.js +2 -1
  77. package/esm/series/sankey/sankey.js.map +1 -1
  78. package/package.json +4 -4
package/build/index.es.js CHANGED
@@ -62888,6 +62888,9 @@ class ChartPluginService extends BasePluginService {
62888
62888
  super();
62889
62889
  this.globalInstance = globalInstance;
62890
62890
  }
62891
+ getPlugin(name) {
62892
+ return this._plugins.find(plugin => plugin.name === name);
62893
+ }
62891
62894
  onInit(chartSpec) {
62892
62895
  this._plugins.forEach(plugin => {
62893
62896
  plugin.onInit && plugin.onInit(this, chartSpec);
@@ -62914,6 +62917,16 @@ class ChartPluginService extends BasePluginService {
62914
62917
  plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
62915
62918
  });
62916
62919
  }
62920
+ onLayoutRectUpdate() {
62921
+ this._plugins.forEach(plugin => {
62922
+ plugin.onLayoutRectUpdate && plugin.onLayoutRectUpdate(this);
62923
+ });
62924
+ }
62925
+ onAfterRender() {
62926
+ this._plugins.forEach(plugin => {
62927
+ plugin.onAfterRender && plugin.onAfterRender(this);
62928
+ });
62929
+ }
62917
62930
  releaseAll() {
62918
62931
  super.releaseAll();
62919
62932
  this.globalInstance = null;
@@ -63038,6 +63051,9 @@ class VChart {
63038
63051
  getDataSet() {
63039
63052
  return this._dataSet;
63040
63053
  }
63054
+ get chartPlugin() {
63055
+ return this._chartPlugin;
63056
+ }
63041
63057
  constructor(spec, options) {
63042
63058
  var _a, _b, _c, _d, _e, _f, _g, _h;
63043
63059
  this.id = createID();
@@ -63402,6 +63418,7 @@ class VChart {
63402
63418
  return false;
63403
63419
  }
63404
63420
  this._updateAnimateState();
63421
+ this._chartPluginApply('onAfterRender', this._spec);
63405
63422
  this._event.emit(ChartEvent.rendered, {
63406
63423
  chart: this._chart,
63407
63424
  vchart: this
@@ -64233,7 +64250,8 @@ class VChart {
64233
64250
  getSpecInfo: () => { var _a; return (_a = this._specInfo) !== null && _a !== void 0 ? _a : {}; },
64234
64251
  layout: this._option.layout,
64235
64252
  onError: this._onError,
64236
- disableTriggerEvent: this._option.disableTriggerEvent === true
64253
+ disableTriggerEvent: this._option.disableTriggerEvent === true,
64254
+ chartPluginApply: (funcName, ...args) => this._chartPluginApply(funcName, ...args)
64237
64255
  };
64238
64256
  }
64239
64257
  }
@@ -64256,7 +64274,7 @@ const registerVChartCore = () => {
64256
64274
  };
64257
64275
  registerVChartCore();
64258
64276
 
64259
- const version = "1.13.20";
64277
+ const version = "1.13.21-alpha.0";
64260
64278
 
64261
64279
  const addVChartProperty = (data, op) => {
64262
64280
  const context = op.beforeCall();
@@ -71513,6 +71531,7 @@ class BaseChart extends CompilableBase {
71513
71531
  return (_b = (_a = this.getCompiler()) === null || _a === void 0 ? void 0 : _a.getCanvas()) !== null && _b !== void 0 ? _b : null;
71514
71532
  }
71515
71533
  _updateLayoutRect(viewBox) {
71534
+ var _a, _b;
71516
71535
  const canvasRect = this.getCanvasRect();
71517
71536
  let viewRect = canvasRect;
71518
71537
  if (viewBox) {
@@ -71533,6 +71552,7 @@ class BaseChart extends CompilableBase {
71533
71552
  this._layoutRect.x = this.padding.left;
71534
71553
  this._layoutRect.y = this.padding.top;
71535
71554
  this._event.emit(ChartEvent.layoutRectUpdate, { chart: this });
71555
+ (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.chartPluginApply) === null || _b === void 0 ? void 0 : _b.call(_a, 'onLayoutRectUpdate', { chart: this });
71536
71556
  }
71537
71557
  setCurrentTheme() {
71538
71558
  this.updateChartConfig({ change: true, reMake: false }, this._spec);
@@ -86428,7 +86448,12 @@ const sankeyLayout = (data, op) => {
86428
86448
  }
86429
86449
  const layout = new SankeyLayout(op);
86430
86450
  const result = [];
86431
- result.push(layout.layout(originalData, view));
86451
+ if (op.customLayout) {
86452
+ result.push(op.customLayout(layout, originalData, view, op));
86453
+ }
86454
+ else {
86455
+ result.push(layout.layout(originalData, view));
86456
+ }
86432
86457
  return result;
86433
86458
  };
86434
86459
 
@@ -87065,7 +87090,8 @@ class SankeySeries extends CartesianSeries {
87065
87090
  linkHeight: this._spec.linkHeight,
87066
87091
  equalNodeHeight: this._spec.equalNodeHeight,
87067
87092
  linkOverlap: this._spec.linkOverlap,
87068
- inverse: this._spec.inverse
87093
+ inverse: this._spec.inverse,
87094
+ customLayout: this._spec.customLayout
87069
87095
  },
87070
87096
  level: TransformLevel.sankeyLayout
87071
87097
  });
@@ -92697,7 +92723,8 @@ class SankeyChartSpecTransformer extends BaseChartSpecTransformer {
92697
92723
  'link',
92698
92724
  'emphasis',
92699
92725
  'inverse',
92700
- 'overflow'
92726
+ 'overflow',
92727
+ 'customLayout'
92701
92728
  ]);
92702
92729
  return series;
92703
92730
  }
package/build/index.js CHANGED
@@ -62894,6 +62894,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62894
62894
  super();
62895
62895
  this.globalInstance = globalInstance;
62896
62896
  }
62897
+ getPlugin(name) {
62898
+ return this._plugins.find(plugin => plugin.name === name);
62899
+ }
62897
62900
  onInit(chartSpec) {
62898
62901
  this._plugins.forEach(plugin => {
62899
62902
  plugin.onInit && plugin.onInit(this, chartSpec);
@@ -62920,6 +62923,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62920
62923
  plugin.onBeforeInitChart && plugin.onBeforeInitChart(this, chartSpec, actionSource);
62921
62924
  });
62922
62925
  }
62926
+ onLayoutRectUpdate() {
62927
+ this._plugins.forEach(plugin => {
62928
+ plugin.onLayoutRectUpdate && plugin.onLayoutRectUpdate(this);
62929
+ });
62930
+ }
62931
+ onAfterRender() {
62932
+ this._plugins.forEach(plugin => {
62933
+ plugin.onAfterRender && plugin.onAfterRender(this);
62934
+ });
62935
+ }
62923
62936
  releaseAll() {
62924
62937
  super.releaseAll();
62925
62938
  this.globalInstance = null;
@@ -63044,6 +63057,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63044
63057
  getDataSet() {
63045
63058
  return this._dataSet;
63046
63059
  }
63060
+ get chartPlugin() {
63061
+ return this._chartPlugin;
63062
+ }
63047
63063
  constructor(spec, options) {
63048
63064
  var _a, _b, _c, _d, _e, _f, _g, _h;
63049
63065
  this.id = createID();
@@ -63408,6 +63424,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63408
63424
  return false;
63409
63425
  }
63410
63426
  this._updateAnimateState();
63427
+ this._chartPluginApply('onAfterRender', this._spec);
63411
63428
  this._event.emit(ChartEvent.rendered, {
63412
63429
  chart: this._chart,
63413
63430
  vchart: this
@@ -64239,7 +64256,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64239
64256
  getSpecInfo: () => { var _a; return (_a = this._specInfo) !== null && _a !== void 0 ? _a : {}; },
64240
64257
  layout: this._option.layout,
64241
64258
  onError: this._onError,
64242
- disableTriggerEvent: this._option.disableTriggerEvent === true
64259
+ disableTriggerEvent: this._option.disableTriggerEvent === true,
64260
+ chartPluginApply: (funcName, ...args) => this._chartPluginApply(funcName, ...args)
64243
64261
  };
64244
64262
  }
64245
64263
  }
@@ -64262,7 +64280,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64262
64280
  };
64263
64281
  registerVChartCore();
64264
64282
 
64265
- const version = "1.13.20";
64283
+ const version = "1.13.21-alpha.0";
64266
64284
 
64267
64285
  const addVChartProperty = (data, op) => {
64268
64286
  const context = op.beforeCall();
@@ -71519,6 +71537,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71519
71537
  return (_b = (_a = this.getCompiler()) === null || _a === void 0 ? void 0 : _a.getCanvas()) !== null && _b !== void 0 ? _b : null;
71520
71538
  }
71521
71539
  _updateLayoutRect(viewBox) {
71540
+ var _a, _b;
71522
71541
  const canvasRect = this.getCanvasRect();
71523
71542
  let viewRect = canvasRect;
71524
71543
  if (viewBox) {
@@ -71539,6 +71558,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71539
71558
  this._layoutRect.x = this.padding.left;
71540
71559
  this._layoutRect.y = this.padding.top;
71541
71560
  this._event.emit(ChartEvent.layoutRectUpdate, { chart: this });
71561
+ (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.chartPluginApply) === null || _b === void 0 ? void 0 : _b.call(_a, 'onLayoutRectUpdate', { chart: this });
71542
71562
  }
71543
71563
  setCurrentTheme() {
71544
71564
  this.updateChartConfig({ change: true, reMake: false }, this._spec);
@@ -86434,7 +86454,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
86434
86454
  }
86435
86455
  const layout = new SankeyLayout(op);
86436
86456
  const result = [];
86437
- result.push(layout.layout(originalData, view));
86457
+ if (op.customLayout) {
86458
+ result.push(op.customLayout(layout, originalData, view, op));
86459
+ }
86460
+ else {
86461
+ result.push(layout.layout(originalData, view));
86462
+ }
86438
86463
  return result;
86439
86464
  };
86440
86465
 
@@ -87071,7 +87096,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87071
87096
  linkHeight: this._spec.linkHeight,
87072
87097
  equalNodeHeight: this._spec.equalNodeHeight,
87073
87098
  linkOverlap: this._spec.linkOverlap,
87074
- inverse: this._spec.inverse
87099
+ inverse: this._spec.inverse,
87100
+ customLayout: this._spec.customLayout
87075
87101
  },
87076
87102
  level: TransformLevel.sankeyLayout
87077
87103
  });
@@ -92703,7 +92729,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
92703
92729
  'link',
92704
92730
  'emphasis',
92705
92731
  'inverse',
92706
- 'overflow'
92732
+ 'overflow',
92733
+ 'customLayout'
92707
92734
  ]);
92708
92735
  return series;
92709
92736
  }