tvcharts 0.6.74 → 0.6.75

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.
@@ -258,7 +258,9 @@ var AxisProxy = /** @class */function () {
258
258
  fromTime: +categories[visibleFrom],
259
259
  toTime: +categories[visibleTo],
260
260
  offsetRightDistance: lastBarRightSideDiffBarCount > 0 ? lastBarRightSideDiffBarCount * barSpace : 0,
261
- offsetLeftDistance: from < 0 ? -from * barSpace : 0
261
+ offsetLeftDistance: from < 0 ? -from * barSpace : 0,
262
+ lastBarRightSideDiffBarCount: lastBarRightSideDiffBarCount,
263
+ barSpace: barSpace
262
264
  });
263
265
  } else {
264
266
  if (dataZoomModel.get('useValueRange') && (dataZoomModel.settledOption.startValue || dataZoomModel.settledOption.endValue)) {
@@ -342,10 +342,10 @@ var DataZoomModel = /** @class */function (_super) {
342
342
  thisOption[names[1]] = settledOption[names[1]] = opt[names[1]];
343
343
  }
344
344
  }, this);
345
- if (opt.barSpace) {
345
+ if (typeof opt.barSpace === 'number') {
346
346
  thisOption.barSpace = opt.barSpace;
347
347
  }
348
- if (opt.lastBarRightSideDiffBarCount) {
348
+ if (typeof opt.lastBarRightSideDiffBarCount === 'number') {
349
349
  thisOption.lastBarRightSideDiffBarCount = opt.lastBarRightSideDiffBarCount;
350
350
  }
351
351
  if (!isLocal && (typeof opt.barSpace === 'number' || typeof opt.lastBarRightSideDiffBarCount === 'number')) {
@@ -704,6 +704,84 @@ var ECharts = /** @class */function (_super) {
704
704
  return this.getDataURL(opts);
705
705
  }
706
706
  };
707
+ ECharts.prototype.getWindowConnectedDataURL = function (opts) {
708
+ if (this._disposed) {
709
+ disposedWarning(this.id);
710
+ return;
711
+ }
712
+ var isSvg = opts.type === 'svg';
713
+ var mathMin = Math.min;
714
+ var mathMax = Math.max;
715
+ var MAX_NUMBER = Infinity;
716
+ var left = MAX_NUMBER;
717
+ var top = MAX_NUMBER;
718
+ var right = -MAX_NUMBER;
719
+ var bottom = -MAX_NUMBER;
720
+ var canvasList = [];
721
+ var dpr = opts && opts.pixelRatio || this.getDevicePixelRatio();
722
+ var layoutId = this.layout;
723
+ // const groupId = this.group;
724
+ var groupIds = [];
725
+ each(instances, function (chart, id) {
726
+ if (chart.layout === layoutId && !groupIds.includes(chart.group)) {
727
+ groupIds.push(chart.group);
728
+ }
729
+ });
730
+ each(instances, function (chart, id) {
731
+ if (groupIds.includes(chart.group)) {
732
+ var canvas = isSvg ? chart.getZr().painter.getSvgDom().innerHTML : chart.renderToCanvas(clone(opts));
733
+ var boundingRect = chart.getDom().getBoundingClientRect();
734
+ left = mathMin(boundingRect.left, left);
735
+ top = mathMin(boundingRect.top, top);
736
+ right = mathMax(boundingRect.right, right);
737
+ bottom = mathMax(boundingRect.bottom, bottom);
738
+ canvasList.push({
739
+ dom: canvas,
740
+ left: boundingRect.left,
741
+ top: boundingRect.top
742
+ });
743
+ }
744
+ });
745
+ left *= dpr;
746
+ top *= dpr;
747
+ right *= dpr;
748
+ bottom *= dpr;
749
+ var width = right - left;
750
+ var height = bottom - top;
751
+ var targetCanvas = platformApi.createCanvas();
752
+ var zr = zrender.init(targetCanvas, {
753
+ renderer: isSvg ? 'svg' : 'canvas'
754
+ });
755
+ zr.resize({
756
+ width: width,
757
+ height: height
758
+ });
759
+ if (opts.connectedBackgroundColor) {
760
+ zr.add(new graphic.Rect({
761
+ shape: {
762
+ x: 0,
763
+ y: 0,
764
+ width: width,
765
+ height: height
766
+ },
767
+ style: {
768
+ fill: opts.connectedBackgroundColor
769
+ }
770
+ }));
771
+ }
772
+ each(canvasList, function (item) {
773
+ var img = new graphic.Image({
774
+ style: {
775
+ x: item.left * dpr - left,
776
+ y: item.top * dpr - top,
777
+ image: item.dom
778
+ }
779
+ });
780
+ zr.add(img);
781
+ });
782
+ zr.refreshImmediately();
783
+ return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
784
+ };
707
785
  ECharts.prototype.convertToPixel = function (finder, value) {
708
786
  return doConvertPixel(this, 'convertToPixel', finder, value);
709
787
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.6.74",
3
+ "version": "0.6.75",
4
4
  "description": "基于echarts5.5.0二次开发",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -8230,6 +8230,13 @@ declare class ECharts extends Eventful<ECEventDefinition> {
8230
8230
  connectedBackgroundColor?: ZRColor;
8231
8231
  excludeComponents?: string[];
8232
8232
  }): string;
8233
+ getWindowConnectedDataURL(opts?: {
8234
+ type?: 'png' | 'jpeg' | 'svg';
8235
+ pixelRatio?: number;
8236
+ backgroundColor?: ZRColor;
8237
+ connectedBackgroundColor?: ZRColor;
8238
+ excludeComponents?: string[];
8239
+ }): string;
8233
8240
  /**
8234
8241
  * Convert from logical coordinate system to pixel coordinate system.
8235
8242
  * See CoordinateSystem#convertToPixel.
@@ -8231,6 +8231,13 @@ declare class ECharts extends Eventful<ECEventDefinition> {
8231
8231
  connectedBackgroundColor?: ZRColor;
8232
8232
  excludeComponents?: string[];
8233
8233
  }): string;
8234
+ getWindowConnectedDataURL(opts?: {
8235
+ type?: 'png' | 'jpeg' | 'svg';
8236
+ pixelRatio?: number;
8237
+ backgroundColor?: ZRColor;
8238
+ connectedBackgroundColor?: ZRColor;
8239
+ excludeComponents?: string[];
8240
+ }): string;
8234
8241
  /**
8235
8242
  * Convert from logical coordinate system to pixel coordinate system.
8236
8243
  * See CoordinateSystem#convertToPixel.
@@ -183,6 +183,13 @@ declare class ECharts extends Eventful<ECEventDefinition> {
183
183
  connectedBackgroundColor?: ZRColor;
184
184
  excludeComponents?: string[];
185
185
  }): string;
186
+ getWindowConnectedDataURL(opts?: {
187
+ type?: 'png' | 'jpeg' | 'svg';
188
+ pixelRatio?: number;
189
+ backgroundColor?: ZRColor;
190
+ connectedBackgroundColor?: ZRColor;
191
+ excludeComponents?: string[];
192
+ }): string;
186
193
  /**
187
194
  * Convert from logical coordinate system to pixel coordinate system.
188
195
  * See CoordinateSystem#convertToPixel.