@grapecity/wijmo.chart.render 5.20252.42 → 5.20261.48

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.
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  # Wijmo
4
4
 
5
+ **Note: Starting from 2027v1, Wijmo npm packages will be published only under the @mescius scope. Users using the @grapecity scope during the 2026 period will need to migrate to @mescius.**
6
+
7
+ ---
8
+
5
9
  Wijmo is a complete set of [JavaScript UI components](https://developer.mescius.com/wijmo?utm_source=npmwebsite&utm_medium=prospects&utm_campaign=wijmo_npm) for enterprise development. It includes a powerful data grid, charts, pivot tools, inputs, and much more and is available in your favorite framework, including [Angular](https://developer.mescius.com/wijmo/angular-ui-components?utm_source=npmwebsite&utm_medium=prospects&utm_campaign=wijmo_npm), [React](https://developer.mescius.com/wijmo/react-ui-components?utm_source=npmwebsite&utm_medium=prospects&utm_campaign=wijmo_npm), and [Vue](https://developer.mescius.com/wijmo/vue-ui-components?utm_source=npmwebsite&utm_medium=prospects&utm_campaign=wijmo_npm).
6
10
 
7
11
  Cut your development time in half with Wijmo's lightweight, high-performance JavaScript UI components.
@@ -122,6 +126,10 @@ Submit questions to our team of [Wijmo Experts](https://developer.mescius.com/fo
122
126
 
123
127
  ## Wijmo JP
124
128
 
129
+ **注:2027v1以降、Wijmoのnpmパッケージは@mesciusスコープでのみ公開されます。2026年期間中に@grapecityスコープを使用しているユーザーは、@mesciusに移行する必要があります。**
130
+
131
+ ---
132
+
125
133
  [Wijmo](https://developer.mescius.jp/wijmo)は、Webアプリケーション開発に最適な数多くのUIを搭載するJavaScriptコンポーネントセットです。高速・軽量であり、開発工数の削減に大きく寄与します。データグリッド、チャート、ピボットテーブル、入力など、業務アプリケーション開発に必要となるコントロールを多数収録し、またAngularやReact、Vue.jsといったJavaScriptフレームワークにも対応しています。
126
134
 
127
135
  なお、日本語版での動作保証は日本語版サイトで公開しているバージョンのみとなります。
@@ -161,6 +169,10 @@ Submit questions to our team of [Wijmo Experts](https://developer.mescius.com/fo
161
169
 
162
170
  ## Wijmo CN
163
171
 
172
+ **注意:从 2027v1 开始,Wijmo 的 npm 包将仅在 @mescius 作用域下发布。在 2026 年期间仍在使用 @grapecity 作用域的用户,需要迁移到 @mescius。**
173
+
174
+ ---
175
+
164
176
  Wijmo 是一套完整的企业级 JavaScript UI 开发组件。 它包括强大的表格、图表、数据透视、输入等组件,并且可以支持各类主流前端框架,包括 Angular、React 和 Vue。
165
177
 
166
178
  Wijmo 的轻量级、高性能 JavaScript UI 组件可以将您的开发时间缩短一半。
@@ -255,6 +267,11 @@ Wijmo 开发包可以从 [这里](https://www.grapecity.com.cn/developer/wijmojs
255
267
 
256
268
  # Wijmo KR
257
269
 
270
+ **참고: 2027 v1부터 Wijmo npm 패키지는 @mescius 스코프에서만 제공됩니다.
271
+ 현재 @grapecity 스코프를 사용 중인 사용자는 2026년 내에 @mescius 스코프로 마이그레이션해 주시기 바랍니다.**
272
+
273
+ ---
274
+
258
275
  Wijmo(위즈모)는 고성능의 Web App 개발을 위한 완전한 JavaScript UI 컴포넌트 세트입니다. 강력한 데이터 그리드(DataGrid), 차트(Chart), 피벗 도구(OLAP/Pivop), 입력(Input) 등 개발에 필요한 100+의 다양한 컨트롤이 포함되어 있습니다.
259
276
 
260
277
  또한, Wijmo는 Angular, React 및 Vue 등 개발자가 빠른 웹 개발과 효율적인 코드 유지 관리를 쉽게 할 수 있도록 JavaScript 프레임워크에 대한 지원을 제공합니다.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20252.42
3
+ * Wijmo Library 5.20261.48
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_chart_1=require("@grapecity/wijmo.chart"),selfModule=__importStar(require("@grapecity/wijmo.chart.render"));class _CanvasRenderEngine{constructor(t,e=!1){this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(t,e){var i=this._canvasRect[e];if(i){t.beginPath();t.rect(i.left,i.top,i.width,i.height);t.clip();t.closePath()}};this._applyCanvasStyles=function(t,e,i,s,n){var l,a,r,o=this._canvas.getContext("2d"),h=this.stroke,_=this.fill,g=this.strokeWidth;e&&void 0!==e.stroke&&(h=e.stroke);e&&void 0!==e.fill&&(_=this._getOpacityColor(e.fill,e["fill-opacity"]));if(t){a=window.getComputedStyle(t);r=t.getBBox()}if(n){if(a){o.fillStyle=a.fill;l=a.fontStyle+" "+a.fontWeight+" "+a.fontSize+" "+a.fontFamily;o.font=l}else if(this.fontSize){o.fillStyle=this.textFill;o.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;l=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;o.font=l;if(o.font.replace(/\"/g,"'")!==l.replace(/\"/g,"'")){l=this._canvasDefaultFont.fontSize+" "+(o.font.split(" ")[1]||"sans-serif");o.font=l}}}else{if(a){h=a.stroke&&"none"!==a.stroke?a.stroke:h;_=a.fill&&"none"!==a.fill?this._getOpacityColor(a.fill,a["fill-opacity"]):_;g=a.strokeWidth?a.strokeWidth:g}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,r);o.lineWidth=+g.replace(/px/g,"");o.stroke()}if(s&&null!=_&&"transparent"!==_&&"none"!==_){this._applyColor("fillStyle",_,r);o.fill()}}};this._element=t;this._canvas=document.createElement("canvas");this._svgEngine=new wijmo_chart_1._SvgRenderEngine(t);this._element.appendChild(this._canvas);this._applyCSSStyles=e}beginRender(){var t,e=this._svgEngine.element,i=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();i=e}this._element.appendChild(e);this._canvasRect={};t=window.getComputedStyle(i);this._canvasDefaultFont={fontSize:t.fontSize,fontFamily:t.fontFamily,textFill:t.color}}endRender(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)}setViewportSize(t,e){var i=this._canvas;i.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(t,e);i.width=t;i.height=e}get element(){return this._canvas}get fill(){return this._fill}set fill(t){this._svgEngine.fill=t;this._fill=t}get fontSize(){return this._fontSize}set fontSize(t){this._svgEngine.fontSize=t;var e=null==t||isNaN(t)?t:t+"px";this._fontSize=e}get fontFamily(){return this._fontFamily}set fontFamily(t){this._svgEngine.fontFamily=t;this._fontFamily=t}get stroke(){return this._stroke}set stroke(t){this._svgEngine.stroke=t;this._stroke=t}get strokeWidth(){return this._strokeWidth}set strokeWidth(t){this._svgEngine.strokeWidth=t;this._strokeWidth=t}get textFill(){return this._textFill}set textFill(t){this._svgEngine.textFill=t;this._textFill=t}get cssPriority(){return this._cssPriority}set cssPriority(t){this._svgEngine.cssPriority=t;this._cssPriority=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}addClipRect(t,e){if(t&&e){this._applyCSSStyles&&this._svgEngine.addClipRect(t,e);this._canvasRect[e]=t.clone()}}drawEllipse(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawEllipse(t,e,i,s,n,l));r.save();r.beginPath();if(r.ellipse)r.ellipse(t,e,i,s,0,0,2*Math.PI);else{r.translate(t,e);r.scale(1,s/i);r.translate(-t,-e);r.arc(t,e,i,0,2*Math.PI);r.scale(1,1)}this._applyCanvasStyles(a,l,n,!0);r.restore();return a}}drawRect(t,e,i,s,n,l,a){if(!this.readOnly){var r,o=this._canvas.getContext("2d");this._applyCSSStyles&&(r=this._svgEngine.drawRect(t,e,i,s,n,l,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.rect(t,e,i,s);this._applyCanvasStyles(r,l,n,!0);o.restore();return r}}drawLine(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawLine(t,e,i,s,n,l));r.save();r.beginPath();r.moveTo(t,e);r.lineTo(i,s);this._applyCanvasStyles(a,l,n);r.restore();return a}}drawLines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=l||Math.min(t.length,e.length);this._applyCSSStyles&&(a=this._svgEngine.drawLines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(t[0],e[0]);for(r=1;r<h;r++)o.lineTo(t[r],e[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawSplines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=new wijmo_chart_1._Spline(t,e,l).calculate(),_=h.xs,g=h.ys,p=Math.min(_.length,g.length);this._applyCSSStyles&&(a=this._svgEngine.drawSplines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(_[0],g[0]);for(r=1;r<p;r++)o.lineTo(_[r],g[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawPolygon(t,e,i,s,n){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var l,a,r=this._canvas.getContext("2d"),o=Math.min(t.length,e.length);this._applyCSSStyles&&(l=this._svgEngine.drawPolygon(t,e,i,s,n));r.save();this._applyCanvasClip(r,n);r.beginPath();r.moveTo(t[0],e[0]);for(a=1;a<o;a++)r.lineTo(t[a],e[a]);r.closePath();this._applyCanvasStyles(l,s,i,!0);r.restore();return l}}drawPieSegment(t,e,i,s,n,l,a,r){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),_=s,g=s+n;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(t,e,i,s,n,l,a,r));h.save();this._applyCanvasClip(h,r);h.beginPath();h.moveTo(t,e);h.arc(t,e,i,_,g,!1);h.lineTo(t,e);this._applyCanvasStyles(o,a,l,!0);h.restore();return o}}drawDonutSegment(t,e,i,s,n,l,a,r,o){if(!this.readOnly){var h,_,g,p=this._canvas.getContext("2d"),y=n,f=n+l;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(t,e,i,s,n,l,a,r,o));(_=new wijmo_1.Point(t,e)).x+=s*Math.cos(y);_.y+=s*Math.sin(y);(g=new wijmo_1.Point(t,e)).x+=s*Math.cos(f);g.y+=s*Math.sin(f);p.save();this._applyCanvasClip(p,o);p.beginPath();p.moveTo(_.x,_.y);p.arc(t,e,i,y,f,!1);p.lineTo(g.x,g.y);p.arc(t,e,s,f,y,!0);this._applyCanvasStyles(h,r,a,!0);p.restore();return h}}drawString(t,e,i,s){if(!this.readOnly){var n,l=this._canvas.getContext("2d");this._applyCSSStyles&&(n=this._svgEngine.drawString(t,e,i,s));l.save();l.textBaseline="bottom";this._applyCanvasStyles(n,s,i,!0,!0);l.fillText(t,e.x,e.y);l.restore();return n}}drawStringRotated(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");r.measureText(t);this._applyCSSStyles&&(a=this._svgEngine.drawStringRotated(t,e,i,s,n,l));r.save();r.textBaseline="bottom";r.translate(i.x,i.y);r.rotate(Math.PI/180*s);r.translate(-i.x,-i.y);this._applyCanvasStyles(a,l,n,!0,!0);r.fillText(t,e.x,e.y);r.restore();return a}}measureString(t,e,i,s){var n,l=l=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(t,e,i,s);this._applyCanvasStyles(null,null,e,!0,!0);n=l.measureText(t).width;return new wijmo_1.Size(n,1.5*parseInt(l.font))}startGroup(t,e,i=!1){var s,n=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.startGroup(t,e,i));n.save();this._applyCanvasClip(n,e);return s}endGroup(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()}drawImage(t,e,i,s,n){if(!this.readOnly){var l,a=this._canvas.getContext("2d"),r=new Image;this._applyCSSStyles&&(l=this._svgEngine.drawImage(t,e,i,s,n));r.onload=function(){a.drawImage(r,e,i,s,n)};r.src=t;return l}}_getOpacityColor(t,e){var i=new wijmo_1.Color(t);if(t.indexOf("url")>-1)return this.fill;if(t.indexOf("-")>-1){this.fill=t;return t}null!=e&&1===i.a&&(i.a=isNaN(e)?1:Number(e));return i.toString()}_applyColor(t,e,i){let s=_GradientColorUtil.tryParse(e),n=this._canvas.getContext("2d");if(null!=s)if(wijmo_1.isString(s)||null==i)n[t]=s;else{let e;if(null!=s.x1)e=s.relative?n.createLinearGradient(i.x+s.x1*i.width,i.y+s.y1*i.height,i.x+s.x2*i.width,i.y+s.y2*i.height):n.createLinearGradient(s.x1,s.y1,s.x2,s.y2);else if(null!=s.r)if(s.relative){let t=i.x+s.cx*i.width,l=i.y+s.cy*i.height,a=s.r*i.width,r=s.r*i.height/a,o=i.x+(null==s.fx?s.cx:s.fx)*i.width,h=i.y+(null==s.fy?s.cy:s.fy)*i.height,_=(null==s.fr?0:s.fr)*i.width,g=(null==s.fr?0:s.fr)*i.height,p=Math.min(_,g);e=n.createRadialGradient(o,h/r,p,t,l/r,a);n.setTransform(1,0,0,r,0,0)}else e=n.createRadialGradient(null==s.fx?s.cx:s.fx,null==s.fy?s.cy:s.fy,s.fr||0,s.cx,s.cy,s.r);s.colors&&s.colors.length>0&&null!=e&&s.colors.forEach(t=>{let i=new wijmo_1.Color("#000000");null!=t.color&&(i=t.color);null!=t.opacity&&(i.a=t.opacity);e.addColorStop(t.offset,i.toString())});n[t]=e}}}exports._CanvasRenderEngine=_CanvasRenderEngine;class _GradientColorUtil{static tryParse(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var e,i=t.replace(/\s+/g,"").split(/\-/g),s=i[0][0],n=!1,l=i[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);if("l"===s||"L"===s){e={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===s&&(n=!0);["x1","y1","x2","y2"].forEach((t,i)=>{null!=l[i]&&(e[t]=+l[i])})}else if("r"===s||"R"===s){e={cx:"0",cy:"0",r:"0",colors:[]};"r"===s&&(n=!0);["cx","cy","r","fx","fy","fr"].forEach((t,i)=>{null!=l[i]&&""!==l[i]&&(e[t]=+l[i])})}e.relative=n;_GradientColorUtil.parsedColor[t]=e;var a=i.length-1;i.forEach((t,i)=>{t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var s=t.split(":"),n={color:new wijmo_1.Color("#000000")};null!=s[0]&&(n.color=wijmo_1.Color.fromString(s[0]));null!=s[1]?n.offset=+s[1]:n.offset=i/a;null!=s[2]&&(n.opacity=+s[2]);e.colors.push(n)});return e}}_GradientColorUtil.parsedColor={};if(wijmo_chart_1.FlexChartBase&&wijmo_chart_1.FlexChartBase.prototype&&wijmo_chart_1.FlexChartBase.prototype._exportToImage&&wijmo_1.isIE()){const t=wijmo_chart_1.FlexChartBase.prototype._exportToImage;wijmo_chart_1.FlexChartBase.prototype._exportToImage=function(e,i){if("svg"===e){t.call(this,e,i);return}let s=this._bgColor(this.hostElement);this._isTransparent(s)&&(s="#ffffff");var n,l,a=new _CanvasRenderEngine(this.hostElement,!0);this._render(a,!1,s);n=(l=a.element).toDataURL("image/"+e);l.parentNode.removeChild(l);i.call(null,n);l=null;a=null}}wijmo_1._registerModule("wijmo.chart.render",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@grapecity/wijmo"),wijmo_chart_1=require("@grapecity/wijmo.chart"),selfModule=__importStar(require("@grapecity/wijmo.chart.render"));class _CanvasRenderEngine{constructor(t,e=!1){this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(t,e){var i=this._canvasRect[e];if(i){t.beginPath();t.rect(i.left,i.top,i.width,i.height);t.clip();t.closePath()}};this._applyCanvasStyles=function(t,e,i,s,n){var a,l,r,o=this._canvas.getContext("2d"),h=this.stroke,_=this.fill,g=this.strokeWidth;e&&void 0!==e.stroke&&(h=e.stroke);e&&void 0!==e.fill&&(_=this._getOpacityColor(e.fill,e["fill-opacity"]));if(t){l=window.getComputedStyle(t);r=t.getBBox()}if(n){if(l){o.fillStyle=l.fill;a=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;o.font=a}else if(this.fontSize){o.fillStyle=this.textFill;o.font=`${this.fontSize} ${this.fontFamily||"sans-serif"}`}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;a=`${this._canvasDefaultFont.fontSize} ${this._canvasDefaultFont.fontFamily}`;o.font=a;if(o.font.replace(/"/g,"'")!==a.replace(/"/g,"'")){a=`${this._canvasDefaultFont.fontSize} ${o.font.split(" ")[1]||"sans-serif"}`;o.font=a}}}else{if(l){h=l.stroke&&"none"!==l.stroke?l.stroke:h;_=l.fill&&"none"!==l.fill?this._getOpacityColor(l.fill,l["fill-opacity"]):_;g=l.strokeWidth?l.strokeWidth:g}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,r);o.lineWidth=+g.replace(/px/g,"");o.stroke()}if(s&&null!=_&&"transparent"!==_&&"none"!==_){this._applyColor("fillStyle",_,r);o.fill()}}};this._element=t;this._canvas=document.createElement("canvas");this._svgEngine=new wijmo_chart_1._SvgRenderEngine(t);this._element.appendChild(this._canvas);this._applyCSSStyles=e}beginRender(){var t,e=this._svgEngine.element,i=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();i=e}this._element.appendChild(e);this._canvasRect={};t=window.getComputedStyle(i);this._canvasDefaultFont={fontSize:t.fontSize,fontFamily:t.fontFamily,textFill:t.color}}endRender(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)}setViewportSize(t,e){var i=this._canvas;i.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(t,e);i.width=t;i.height=e}get element(){return this._canvas}get fill(){return this._fill}set fill(t){this._svgEngine.fill=t;this._fill=t}get fontSize(){return this._fontSize}set fontSize(t){this._svgEngine.fontSize=t;var e=null==t||isNaN(t)?t:t+"px";this._fontSize=e}get fontFamily(){return this._fontFamily}set fontFamily(t){this._svgEngine.fontFamily=t;this._fontFamily=t}get stroke(){return this._stroke}set stroke(t){this._svgEngine.stroke=t;this._stroke=t}get strokeWidth(){return this._strokeWidth}set strokeWidth(t){this._svgEngine.strokeWidth=t;this._strokeWidth=t}get textFill(){return this._textFill}set textFill(t){this._svgEngine.textFill=t;this._textFill=t}get cssPriority(){return this._cssPriority}set cssPriority(t){this._svgEngine.cssPriority=t;this._cssPriority=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}addClipRect(t,e){if(t&&e){this._applyCSSStyles&&this._svgEngine.addClipRect(t,e);this._canvasRect[e]=t.clone()}}drawEllipse(t,e,i,s,n,a){if(!this.readOnly){var l,r=this._canvas.getContext("2d");this._applyCSSStyles&&(l=this._svgEngine.drawEllipse(t,e,i,s,n,a));r.save();r.beginPath();if(r.ellipse)r.ellipse(t,e,i,s,0,0,2*Math.PI);else{r.translate(t,e);r.scale(1,s/i);r.translate(-t,-e);r.arc(t,e,i,0,2*Math.PI);r.scale(1,1)}this._applyCanvasStyles(l,a,n,!0);r.restore();return l}}drawRect(t,e,i,s,n,a,l){if(!this.readOnly){var r,o=this._canvas.getContext("2d");this._applyCSSStyles&&(r=this._svgEngine.drawRect(t,e,i,s,n,a,l));o.save();this._applyCanvasClip(o,l);o.beginPath();o.rect(t,e,i,s);this._applyCanvasStyles(r,a,n,!0);o.restore();return r}}drawLine(t,e,i,s,n,a){if(!this.readOnly){var l,r=this._canvas.getContext("2d");this._applyCSSStyles&&(l=this._svgEngine.drawLine(t,e,i,s,n,a));r.save();r.beginPath();r.moveTo(t,e);r.lineTo(i,s);this._applyCanvasStyles(l,a,n);r.restore();return l}}drawLines(t,e,i,s,n,a){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var l,r,o=this._canvas.getContext("2d"),h=a||Math.min(t.length,e.length);this._applyCSSStyles&&(l=this._svgEngine.drawLines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(t[0],e[0]);for(r=1;r<h;r++)o.lineTo(t[r],e[r]);this._applyCanvasStyles(l,s,i);o.restore();return l}}drawSplines(t,e,i,s,n,a){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var l,r,o=this._canvas.getContext("2d"),h=new wijmo_chart_1._Spline(t,e,a).calculate(),_=h.xs,g=h.ys,p=Math.min(_.length,g.length);this._applyCSSStyles&&(l=this._svgEngine.drawSplines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(_[0],g[0]);for(r=1;r<p;r++)o.lineTo(_[r],g[r]);this._applyCanvasStyles(l,s,i);o.restore();return l}}drawPolygon(t,e,i,s,n){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,l,r=this._canvas.getContext("2d"),o=Math.min(t.length,e.length);this._applyCSSStyles&&(a=this._svgEngine.drawPolygon(t,e,i,s,n));r.save();this._applyCanvasClip(r,n);r.beginPath();r.moveTo(t[0],e[0]);for(l=1;l<o;l++)r.lineTo(t[l],e[l]);r.closePath();this._applyCanvasStyles(a,s,i,!0);r.restore();return a}}drawPieSegment(t,e,i,s,n,a,l,r){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),_=s,g=s+n;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(t,e,i,s,n,a,l,r));h.save();this._applyCanvasClip(h,r);h.beginPath();h.moveTo(t,e);h.arc(t,e,i,_,g,!1);h.lineTo(t,e);this._applyCanvasStyles(o,l,a,!0);h.restore();return o}}drawDonutSegment(t,e,i,s,n,a,l,r,o){if(!this.readOnly){var h,_,g,p=this._canvas.getContext("2d"),y=n,f=n+a;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(t,e,i,s,n,a,l,r,o));(_=new wijmo_1.Point(t,e)).x+=s*Math.cos(y);_.y+=s*Math.sin(y);(g=new wijmo_1.Point(t,e)).x+=s*Math.cos(f);g.y+=s*Math.sin(f);p.save();this._applyCanvasClip(p,o);p.beginPath();p.moveTo(_.x,_.y);p.arc(t,e,i,y,f,!1);p.lineTo(g.x,g.y);p.arc(t,e,s,f,y,!0);this._applyCanvasStyles(h,r,l,!0);p.restore();return h}}drawString(t,e,i,s){if(!this.readOnly){var n,a=this._canvas.getContext("2d");this._applyCSSStyles&&(n=this._svgEngine.drawString(t,e,i,s));a.save();a.textBaseline="bottom";this._applyCanvasStyles(n,s,i,!0,!0);a.fillText(t,e.x,e.y);a.restore();return n}}drawStringRotated(t,e,i,s,n,a){if(!this.readOnly){var l,r=this._canvas.getContext("2d");r.measureText(t);this._applyCSSStyles&&(l=this._svgEngine.drawStringRotated(t,e,i,s,n,a));r.save();r.textBaseline="bottom";r.translate(i.x,i.y);r.rotate(Math.PI/180*s);r.translate(-i.x,-i.y);this._applyCanvasStyles(l,a,n,!0,!0);r.fillText(t,e.x,e.y);r.restore();return l}}measureString(t,e,i,s){var n,a=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(t,e,i,s);this._applyCanvasStyles(null,null,e,!0,!0);n=a.measureText(t).width;return new wijmo_1.Size(n,1.5*parseInt(a.font))}startGroup(t,e,i=!1){var s,n=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.startGroup(t,e,i));n.save();this._applyCanvasClip(n,e);return s}endGroup(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()}drawImage(t,e,i,s,n){if(!this.readOnly){var a,l=this._canvas.getContext("2d"),r=new Image;this._applyCSSStyles&&(a=this._svgEngine.drawImage(t,e,i,s,n));r.onload=()=>{l.drawImage(r,e,i,s,n)};r.src=t;return a}}_getOpacityColor(t,e){var i=new wijmo_1.Color(t);if(t.indexOf("url")>-1)return this.fill;if(t.indexOf("-")>-1){this.fill=t;return t}null!=e&&1===i.a&&(i.a=isNaN(e)?1:Number(e));return i.toString()}_applyColor(t,e,i){const s=_GradientColorUtil.tryParse(e),n=this._canvas.getContext("2d");if(null!=s)if(wijmo_1.isString(s)||null==i)n[t]=s;else{let e;if(null!=s.x1)e=s.relative?n.createLinearGradient(i.x+s.x1*i.width,i.y+s.y1*i.height,i.x+s.x2*i.width,i.y+s.y2*i.height):n.createLinearGradient(s.x1,s.y1,s.x2,s.y2);else if(null!=s.r)if(s.relative){const t=i.x+s.cx*i.width,a=i.y+s.cy*i.height,l=s.r*i.width,r=s.r*i.height/l,o=i.x+(null==s.fx?s.cx:s.fx)*i.width,h=i.y+(null==s.fy?s.cy:s.fy)*i.height,_=(null==s.fr?0:s.fr)*i.width,g=(null==s.fr?0:s.fr)*i.height,p=Math.min(_,g);e=n.createRadialGradient(o,h/r,p,t,a/r,l);n.setTransform(1,0,0,r,0,0)}else e=n.createRadialGradient(null==s.fx?s.cx:s.fx,null==s.fy?s.cy:s.fy,s.fr||0,s.cx,s.cy,s.r);s.colors&&s.colors.length>0&&null!=e&&s.colors.forEach(t=>{let i=new wijmo_1.Color("#000000");null!=t.color&&(i=t.color);null!=t.opacity&&(i.a=t.opacity);e.addColorStop(t.offset,i.toString())});n[t]=e}}}exports._CanvasRenderEngine=_CanvasRenderEngine;class _GradientColorUtil{static tryParse(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var e,i=t.replace(/\s+/g,"").split(/-/g),s=i[0][0],n=!1,a=i[0].match(/\(\S+\)/)[0].replace(/[(\\)]/g,"").split(/,/g);if("l"===s||"L"===s){e={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===s&&(n=!0);["x1","y1","x2","y2"].forEach((t,i)=>{null!=a[i]&&(e[t]=+a[i])})}else if("r"===s||"R"===s){e={cx:"0",cy:"0",r:"0",colors:[]};"r"===s&&(n=!0);["cx","cy","r","fx","fy","fr"].forEach((t,i)=>{null!=a[i]&&""!==a[i]&&(e[t]=+a[i])})}e.relative=n;_GradientColorUtil.parsedColor[t]=e;var l=i.length-1;i.forEach((t,i)=>{t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var s=t.split(":"),n={color:new wijmo_1.Color("#000000")};null!=s[0]&&(n.color=wijmo_1.Color.fromString(s[0]));null!=s[1]?n.offset=+s[1]:n.offset=i/l;null!=s[2]&&(n.opacity=+s[2]);e.colors.push(n)});return e}}_GradientColorUtil.parsedColor={};if(wijmo_chart_1.FlexChartBase&&wijmo_chart_1.FlexChartBase.prototype&&wijmo_chart_1.FlexChartBase.prototype._exportToImage&&wijmo_1.isIE()){const t=wijmo_chart_1.FlexChartBase.prototype._exportToImage;wijmo_chart_1.FlexChartBase.prototype._exportToImage=function(e,i){if("svg"===e){t.call(this,e,i);return}let s=this._bgColor(this.hostElement);this._isTransparent(s)&&(s="#ffffff");var n,a,l=new _CanvasRenderEngine(this.hostElement,!0);this._render(l,!1,s);n=(a=l.element).toDataURL("image/"+e);a.parentNode.removeChild(a);i.call(null,n);a=null;l=null}}wijmo_1._registerModule("wijmo.chart.render",selfModule);
package/es2015-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20252.42
3
+ * Wijmo Library 5.20261.48
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{Color,isString,Size,Point,isIE,_registerModule}from"@grapecity/wijmo";import{_SvgRenderEngine,_Spline,FlexChartBase}from"@grapecity/wijmo.chart";import*as selfModule from"@grapecity/wijmo.chart.render";export class _CanvasRenderEngine{constructor(t,e=!1){this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(t,e){var i=this._canvasRect[e];if(i){t.beginPath();t.rect(i.left,i.top,i.width,i.height);t.clip();t.closePath()}};this._applyCanvasStyles=function(t,e,i,s,n){var l,a,r,o=this._canvas.getContext("2d"),h=this.stroke,g=this.fill,p=this.strokeWidth;e&&void 0!==e.stroke&&(h=e.stroke);e&&void 0!==e.fill&&(g=this._getOpacityColor(e.fill,e["fill-opacity"]));if(t){a=window.getComputedStyle(t);r=t.getBBox()}if(n){if(a){o.fillStyle=a.fill;l=a.fontStyle+" "+a.fontWeight+" "+a.fontSize+" "+a.fontFamily;o.font=l}else if(this.fontSize){o.fillStyle=this.textFill;o.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;l=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;o.font=l;if(o.font.replace(/\"/g,"'")!==l.replace(/\"/g,"'")){l=this._canvasDefaultFont.fontSize+" "+(o.font.split(" ")[1]||"sans-serif");o.font=l}}}else{if(a){h=a.stroke&&"none"!==a.stroke?a.stroke:h;g=a.fill&&"none"!==a.fill?this._getOpacityColor(a.fill,a["fill-opacity"]):g;p=a.strokeWidth?a.strokeWidth:p}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,r);o.lineWidth=+p.replace(/px/g,"");o.stroke()}if(s&&null!=g&&"transparent"!==g&&"none"!==g){this._applyColor("fillStyle",g,r);o.fill()}}};this._element=t;this._canvas=document.createElement("canvas");this._svgEngine=new _SvgRenderEngine(t);this._element.appendChild(this._canvas);this._applyCSSStyles=e}beginRender(){var t,e=this._svgEngine.element,i=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();i=e}this._element.appendChild(e);this._canvasRect={};t=window.getComputedStyle(i);this._canvasDefaultFont={fontSize:t.fontSize,fontFamily:t.fontFamily,textFill:t.color}}endRender(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)}setViewportSize(t,e){var i=this._canvas;i.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(t,e);i.width=t;i.height=e}get element(){return this._canvas}get fill(){return this._fill}set fill(t){this._svgEngine.fill=t;this._fill=t}get fontSize(){return this._fontSize}set fontSize(t){this._svgEngine.fontSize=t;var e=null==t||isNaN(t)?t:t+"px";this._fontSize=e}get fontFamily(){return this._fontFamily}set fontFamily(t){this._svgEngine.fontFamily=t;this._fontFamily=t}get stroke(){return this._stroke}set stroke(t){this._svgEngine.stroke=t;this._stroke=t}get strokeWidth(){return this._strokeWidth}set strokeWidth(t){this._svgEngine.strokeWidth=t;this._strokeWidth=t}get textFill(){return this._textFill}set textFill(t){this._svgEngine.textFill=t;this._textFill=t}get cssPriority(){return this._cssPriority}set cssPriority(t){this._svgEngine.cssPriority=t;this._cssPriority=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}addClipRect(t,e){if(t&&e){this._applyCSSStyles&&this._svgEngine.addClipRect(t,e);this._canvasRect[e]=t.clone()}}drawEllipse(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawEllipse(t,e,i,s,n,l));r.save();r.beginPath();if(r.ellipse)r.ellipse(t,e,i,s,0,0,2*Math.PI);else{r.translate(t,e);r.scale(1,s/i);r.translate(-t,-e);r.arc(t,e,i,0,2*Math.PI);r.scale(1,1)}this._applyCanvasStyles(a,l,n,!0);r.restore();return a}}drawRect(t,e,i,s,n,l,a){if(!this.readOnly){var r,o=this._canvas.getContext("2d");this._applyCSSStyles&&(r=this._svgEngine.drawRect(t,e,i,s,n,l,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.rect(t,e,i,s);this._applyCanvasStyles(r,l,n,!0);o.restore();return r}}drawLine(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawLine(t,e,i,s,n,l));r.save();r.beginPath();r.moveTo(t,e);r.lineTo(i,s);this._applyCanvasStyles(a,l,n);r.restore();return a}}drawLines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=l||Math.min(t.length,e.length);this._applyCSSStyles&&(a=this._svgEngine.drawLines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(t[0],e[0]);for(r=1;r<h;r++)o.lineTo(t[r],e[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawSplines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=new _Spline(t,e,l).calculate(),g=h.xs,p=h.ys,y=Math.min(g.length,p.length);this._applyCSSStyles&&(a=this._svgEngine.drawSplines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(g[0],p[0]);for(r=1;r<y;r++)o.lineTo(g[r],p[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawPolygon(t,e,i,s,n){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var l,a,r=this._canvas.getContext("2d"),o=Math.min(t.length,e.length);this._applyCSSStyles&&(l=this._svgEngine.drawPolygon(t,e,i,s,n));r.save();this._applyCanvasClip(r,n);r.beginPath();r.moveTo(t[0],e[0]);for(a=1;a<o;a++)r.lineTo(t[a],e[a]);r.closePath();this._applyCanvasStyles(l,s,i,!0);r.restore();return l}}drawPieSegment(t,e,i,s,n,l,a,r){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),g=s,p=s+n;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(t,e,i,s,n,l,a,r));h.save();this._applyCanvasClip(h,r);h.beginPath();h.moveTo(t,e);h.arc(t,e,i,g,p,!1);h.lineTo(t,e);this._applyCanvasStyles(o,a,l,!0);h.restore();return o}}drawDonutSegment(t,e,i,s,n,l,a,r,o){if(!this.readOnly){var h,g,p,y=this._canvas.getContext("2d"),f=n,_=n+l;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(t,e,i,s,n,l,a,r,o));(g=new Point(t,e)).x+=s*Math.cos(f);g.y+=s*Math.sin(f);(p=new Point(t,e)).x+=s*Math.cos(_);p.y+=s*Math.sin(_);y.save();this._applyCanvasClip(y,o);y.beginPath();y.moveTo(g.x,g.y);y.arc(t,e,i,f,_,!1);y.lineTo(p.x,p.y);y.arc(t,e,s,_,f,!0);this._applyCanvasStyles(h,r,a,!0);y.restore();return h}}drawString(t,e,i,s){if(!this.readOnly){var n,l=this._canvas.getContext("2d");this._applyCSSStyles&&(n=this._svgEngine.drawString(t,e,i,s));l.save();l.textBaseline="bottom";this._applyCanvasStyles(n,s,i,!0,!0);l.fillText(t,e.x,e.y);l.restore();return n}}drawStringRotated(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");r.measureText(t);this._applyCSSStyles&&(a=this._svgEngine.drawStringRotated(t,e,i,s,n,l));r.save();r.textBaseline="bottom";r.translate(i.x,i.y);r.rotate(Math.PI/180*s);r.translate(-i.x,-i.y);this._applyCanvasStyles(a,l,n,!0,!0);r.fillText(t,e.x,e.y);r.restore();return a}}measureString(t,e,i,s){var n,l=l=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(t,e,i,s);this._applyCanvasStyles(null,null,e,!0,!0);n=l.measureText(t).width;return new Size(n,1.5*parseInt(l.font))}startGroup(t,e,i=!1){var s,n=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.startGroup(t,e,i));n.save();this._applyCanvasClip(n,e);return s}endGroup(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()}drawImage(t,e,i,s,n){if(!this.readOnly){var l,a=this._canvas.getContext("2d"),r=new Image;this._applyCSSStyles&&(l=this._svgEngine.drawImage(t,e,i,s,n));r.onload=function(){a.drawImage(r,e,i,s,n)};r.src=t;return l}}_getOpacityColor(t,e){var i=new Color(t);if(t.indexOf("url")>-1)return this.fill;if(t.indexOf("-")>-1){this.fill=t;return t}null!=e&&1===i.a&&(i.a=isNaN(e)?1:Number(e));return i.toString()}_applyColor(t,e,i){let s=_GradientColorUtil.tryParse(e),n=this._canvas.getContext("2d");if(null!=s)if(isString(s)||null==i)n[t]=s;else{let e;if(null!=s.x1)e=s.relative?n.createLinearGradient(i.x+s.x1*i.width,i.y+s.y1*i.height,i.x+s.x2*i.width,i.y+s.y2*i.height):n.createLinearGradient(s.x1,s.y1,s.x2,s.y2);else if(null!=s.r)if(s.relative){let t=i.x+s.cx*i.width,l=i.y+s.cy*i.height,a=s.r*i.width,r=s.r*i.height/a,o=i.x+(null==s.fx?s.cx:s.fx)*i.width,h=i.y+(null==s.fy?s.cy:s.fy)*i.height,g=(null==s.fr?0:s.fr)*i.width,p=(null==s.fr?0:s.fr)*i.height,y=Math.min(g,p);e=n.createRadialGradient(o,h/r,y,t,l/r,a);n.setTransform(1,0,0,r,0,0)}else e=n.createRadialGradient(null==s.fx?s.cx:s.fx,null==s.fy?s.cy:s.fy,s.fr||0,s.cx,s.cy,s.r);s.colors&&s.colors.length>0&&null!=e&&s.colors.forEach(t=>{let i=new Color("#000000");null!=t.color&&(i=t.color);null!=t.opacity&&(i.a=t.opacity);e.addColorStop(t.offset,i.toString())});n[t]=e}}}class _GradientColorUtil{static tryParse(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var e,i=t.replace(/\s+/g,"").split(/\-/g),s=i[0][0],n=!1,l=i[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);if("l"===s||"L"===s){e={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===s&&(n=!0);["x1","y1","x2","y2"].forEach((t,i)=>{null!=l[i]&&(e[t]=+l[i])})}else if("r"===s||"R"===s){e={cx:"0",cy:"0",r:"0",colors:[]};"r"===s&&(n=!0);["cx","cy","r","fx","fy","fr"].forEach((t,i)=>{null!=l[i]&&""!==l[i]&&(e[t]=+l[i])})}e.relative=n;_GradientColorUtil.parsedColor[t]=e;var a=i.length-1;i.forEach((t,i)=>{t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var s=t.split(":"),n={color:new Color("#000000")};null!=s[0]&&(n.color=Color.fromString(s[0]));null!=s[1]?n.offset=+s[1]:n.offset=i/a;null!=s[2]&&(n.opacity=+s[2]);e.colors.push(n)});return e}}_GradientColorUtil.parsedColor={};if(FlexChartBase&&FlexChartBase.prototype&&FlexChartBase.prototype._exportToImage&&isIE()){const t=FlexChartBase.prototype._exportToImage;FlexChartBase.prototype._exportToImage=function(e,i){if("svg"===e){t.call(this,e,i);return}let s=this._bgColor(this.hostElement);this._isTransparent(s)&&(s="#ffffff");var n,l,a=new _CanvasRenderEngine(this.hostElement,!0);this._render(a,!1,s);n=(l=a.element).toDataURL("image/"+e);l.parentNode.removeChild(l);i.call(null,n);l=null;a=null}}_registerModule("wijmo.chart.render",selfModule);
14
+ import{Color,isString,Size,Point,isIE,_registerModule}from"@grapecity/wijmo";import{_SvgRenderEngine,_Spline,FlexChartBase}from"@grapecity/wijmo.chart";import*as selfModule from"@grapecity/wijmo.chart.render";export class _CanvasRenderEngine{constructor(t,e=!1){this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(t,e){var i=this._canvasRect[e];if(i){t.beginPath();t.rect(i.left,i.top,i.width,i.height);t.clip();t.closePath()}};this._applyCanvasStyles=function(t,e,i,s,n){var l,a,r,o=this._canvas.getContext("2d"),h=this.stroke,g=this.fill,p=this.strokeWidth;e&&void 0!==e.stroke&&(h=e.stroke);e&&void 0!==e.fill&&(g=this._getOpacityColor(e.fill,e["fill-opacity"]));if(t){a=window.getComputedStyle(t);r=t.getBBox()}if(n){if(a){o.fillStyle=a.fill;l=`${a.fontStyle} ${a.fontWeight} ${a.fontSize} ${a.fontFamily}`;o.font=l}else if(this.fontSize){o.fillStyle=this.textFill;o.font=`${this.fontSize} ${this.fontFamily||"sans-serif"}`}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;l=`${this._canvasDefaultFont.fontSize} ${this._canvasDefaultFont.fontFamily}`;o.font=l;if(o.font.replace(/"/g,"'")!==l.replace(/"/g,"'")){l=`${this._canvasDefaultFont.fontSize} ${o.font.split(" ")[1]||"sans-serif"}`;o.font=l}}}else{if(a){h=a.stroke&&"none"!==a.stroke?a.stroke:h;g=a.fill&&"none"!==a.fill?this._getOpacityColor(a.fill,a["fill-opacity"]):g;p=a.strokeWidth?a.strokeWidth:p}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,r);o.lineWidth=+p.replace(/px/g,"");o.stroke()}if(s&&null!=g&&"transparent"!==g&&"none"!==g){this._applyColor("fillStyle",g,r);o.fill()}}};this._element=t;this._canvas=document.createElement("canvas");this._svgEngine=new _SvgRenderEngine(t);this._element.appendChild(this._canvas);this._applyCSSStyles=e}beginRender(){var t,e=this._svgEngine.element,i=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();i=e}this._element.appendChild(e);this._canvasRect={};t=window.getComputedStyle(i);this._canvasDefaultFont={fontSize:t.fontSize,fontFamily:t.fontFamily,textFill:t.color}}endRender(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)}setViewportSize(t,e){var i=this._canvas;i.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(t,e);i.width=t;i.height=e}get element(){return this._canvas}get fill(){return this._fill}set fill(t){this._svgEngine.fill=t;this._fill=t}get fontSize(){return this._fontSize}set fontSize(t){this._svgEngine.fontSize=t;var e=null==t||isNaN(t)?t:t+"px";this._fontSize=e}get fontFamily(){return this._fontFamily}set fontFamily(t){this._svgEngine.fontFamily=t;this._fontFamily=t}get stroke(){return this._stroke}set stroke(t){this._svgEngine.stroke=t;this._stroke=t}get strokeWidth(){return this._strokeWidth}set strokeWidth(t){this._svgEngine.strokeWidth=t;this._strokeWidth=t}get textFill(){return this._textFill}set textFill(t){this._svgEngine.textFill=t;this._textFill=t}get cssPriority(){return this._cssPriority}set cssPriority(t){this._svgEngine.cssPriority=t;this._cssPriority=t}get readOnly(){return this._readOnly}set readOnly(t){this._readOnly=t}addClipRect(t,e){if(t&&e){this._applyCSSStyles&&this._svgEngine.addClipRect(t,e);this._canvasRect[e]=t.clone()}}drawEllipse(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawEllipse(t,e,i,s,n,l));r.save();r.beginPath();if(r.ellipse)r.ellipse(t,e,i,s,0,0,2*Math.PI);else{r.translate(t,e);r.scale(1,s/i);r.translate(-t,-e);r.arc(t,e,i,0,2*Math.PI);r.scale(1,1)}this._applyCanvasStyles(a,l,n,!0);r.restore();return a}}drawRect(t,e,i,s,n,l,a){if(!this.readOnly){var r,o=this._canvas.getContext("2d");this._applyCSSStyles&&(r=this._svgEngine.drawRect(t,e,i,s,n,l,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.rect(t,e,i,s);this._applyCanvasStyles(r,l,n,!0);o.restore();return r}}drawLine(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawLine(t,e,i,s,n,l));r.save();r.beginPath();r.moveTo(t,e);r.lineTo(i,s);this._applyCanvasStyles(a,l,n);r.restore();return a}}drawLines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=l||Math.min(t.length,e.length);this._applyCSSStyles&&(a=this._svgEngine.drawLines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(t[0],e[0]);for(r=1;r<h;r++)o.lineTo(t[r],e[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawSplines(t,e,i,s,n,l){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var a,r,o=this._canvas.getContext("2d"),h=new _Spline(t,e,l).calculate(),g=h.xs,p=h.ys,y=Math.min(g.length,p.length);this._applyCSSStyles&&(a=this._svgEngine.drawSplines([0,1],[1,0],i,s,n));o.save();this._applyCanvasClip(o,n);o.beginPath();o.moveTo(g[0],p[0]);for(r=1;r<y;r++)o.lineTo(g[r],p[r]);this._applyCanvasStyles(a,s,i);o.restore();return a}}drawPolygon(t,e,i,s,n){if(t&&e&&0!==t.length&&0!==e.length&&!this.readOnly){var l,a,r=this._canvas.getContext("2d"),o=Math.min(t.length,e.length);this._applyCSSStyles&&(l=this._svgEngine.drawPolygon(t,e,i,s,n));r.save();this._applyCanvasClip(r,n);r.beginPath();r.moveTo(t[0],e[0]);for(a=1;a<o;a++)r.lineTo(t[a],e[a]);r.closePath();this._applyCanvasStyles(l,s,i,!0);r.restore();return l}}drawPieSegment(t,e,i,s,n,l,a,r){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),g=s,p=s+n;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(t,e,i,s,n,l,a,r));h.save();this._applyCanvasClip(h,r);h.beginPath();h.moveTo(t,e);h.arc(t,e,i,g,p,!1);h.lineTo(t,e);this._applyCanvasStyles(o,a,l,!0);h.restore();return o}}drawDonutSegment(t,e,i,s,n,l,a,r,o){if(!this.readOnly){var h,g,p,y=this._canvas.getContext("2d"),f=n,_=n+l;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(t,e,i,s,n,l,a,r,o));(g=new Point(t,e)).x+=s*Math.cos(f);g.y+=s*Math.sin(f);(p=new Point(t,e)).x+=s*Math.cos(_);p.y+=s*Math.sin(_);y.save();this._applyCanvasClip(y,o);y.beginPath();y.moveTo(g.x,g.y);y.arc(t,e,i,f,_,!1);y.lineTo(p.x,p.y);y.arc(t,e,s,_,f,!0);this._applyCanvasStyles(h,r,a,!0);y.restore();return h}}drawString(t,e,i,s){if(!this.readOnly){var n,l=this._canvas.getContext("2d");this._applyCSSStyles&&(n=this._svgEngine.drawString(t,e,i,s));l.save();l.textBaseline="bottom";this._applyCanvasStyles(n,s,i,!0,!0);l.fillText(t,e.x,e.y);l.restore();return n}}drawStringRotated(t,e,i,s,n,l){if(!this.readOnly){var a,r=this._canvas.getContext("2d");r.measureText(t);this._applyCSSStyles&&(a=this._svgEngine.drawStringRotated(t,e,i,s,n,l));r.save();r.textBaseline="bottom";r.translate(i.x,i.y);r.rotate(Math.PI/180*s);r.translate(-i.x,-i.y);this._applyCanvasStyles(a,l,n,!0,!0);r.fillText(t,e.x,e.y);r.restore();return a}}measureString(t,e,i,s){var n,l=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(t,e,i,s);this._applyCanvasStyles(null,null,e,!0,!0);n=l.measureText(t).width;return new Size(n,1.5*parseInt(l.font))}startGroup(t,e,i=!1){var s,n=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.startGroup(t,e,i));n.save();this._applyCanvasClip(n,e);return s}endGroup(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()}drawImage(t,e,i,s,n){if(!this.readOnly){var l,a=this._canvas.getContext("2d"),r=new Image;this._applyCSSStyles&&(l=this._svgEngine.drawImage(t,e,i,s,n));r.onload=()=>{a.drawImage(r,e,i,s,n)};r.src=t;return l}}_getOpacityColor(t,e){var i=new Color(t);if(t.indexOf("url")>-1)return this.fill;if(t.indexOf("-")>-1){this.fill=t;return t}null!=e&&1===i.a&&(i.a=isNaN(e)?1:Number(e));return i.toString()}_applyColor(t,e,i){const s=_GradientColorUtil.tryParse(e),n=this._canvas.getContext("2d");if(null!=s)if(isString(s)||null==i)n[t]=s;else{let e;if(null!=s.x1)e=s.relative?n.createLinearGradient(i.x+s.x1*i.width,i.y+s.y1*i.height,i.x+s.x2*i.width,i.y+s.y2*i.height):n.createLinearGradient(s.x1,s.y1,s.x2,s.y2);else if(null!=s.r)if(s.relative){const t=i.x+s.cx*i.width,l=i.y+s.cy*i.height,a=s.r*i.width,r=s.r*i.height/a,o=i.x+(null==s.fx?s.cx:s.fx)*i.width,h=i.y+(null==s.fy?s.cy:s.fy)*i.height,g=(null==s.fr?0:s.fr)*i.width,p=(null==s.fr?0:s.fr)*i.height,y=Math.min(g,p);e=n.createRadialGradient(o,h/r,y,t,l/r,a);n.setTransform(1,0,0,r,0,0)}else e=n.createRadialGradient(null==s.fx?s.cx:s.fx,null==s.fy?s.cy:s.fy,s.fr||0,s.cx,s.cy,s.r);s.colors&&s.colors.length>0&&null!=e&&s.colors.forEach(t=>{let i=new Color("#000000");null!=t.color&&(i=t.color);null!=t.opacity&&(i.a=t.opacity);e.addColorStop(t.offset,i.toString())});n[t]=e}}}class _GradientColorUtil{static tryParse(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var e,i=t.replace(/\s+/g,"").split(/-/g),s=i[0][0],n=!1,l=i[0].match(/\(\S+\)/)[0].replace(/[(\\)]/g,"").split(/,/g);if("l"===s||"L"===s){e={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===s&&(n=!0);["x1","y1","x2","y2"].forEach((t,i)=>{null!=l[i]&&(e[t]=+l[i])})}else if("r"===s||"R"===s){e={cx:"0",cy:"0",r:"0",colors:[]};"r"===s&&(n=!0);["cx","cy","r","fx","fy","fr"].forEach((t,i)=>{null!=l[i]&&""!==l[i]&&(e[t]=+l[i])})}e.relative=n;_GradientColorUtil.parsedColor[t]=e;var a=i.length-1;i.forEach((t,i)=>{t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var s=t.split(":"),n={color:new Color("#000000")};null!=s[0]&&(n.color=Color.fromString(s[0]));null!=s[1]?n.offset=+s[1]:n.offset=i/a;null!=s[2]&&(n.opacity=+s[2]);e.colors.push(n)});return e}}_GradientColorUtil.parsedColor={};if(FlexChartBase&&FlexChartBase.prototype&&FlexChartBase.prototype._exportToImage&&isIE()){const t=FlexChartBase.prototype._exportToImage;FlexChartBase.prototype._exportToImage=function(e,i){if("svg"===e){t.call(this,e,i);return}let s=this._bgColor(this.hostElement);this._isTransparent(s)&&(s="#ffffff");var n,l,a=new _CanvasRenderEngine(this.hostElement,!0);this._render(a,!1,s);n=(l=a.element).toDataURL("image/"+e);l.parentNode.removeChild(l);i.call(null,n);l=null;a=null}}_registerModule("wijmo.chart.render",selfModule);
package/es5-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20252.42
3
+ * Wijmo Library 5.20261.48
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{Color,isString,Size,Point,isIE,_registerModule}from"@grapecity/wijmo";import{_SvgRenderEngine,_Spline,FlexChartBase}from"@grapecity/wijmo.chart";import*as selfModule from"@grapecity/wijmo.chart.render";var _CanvasRenderEngine=function(){function _CanvasRenderEngine(e,t){void 0===t&&(t=!1);this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(e,t){var n=this._canvasRect[t];if(n){e.beginPath();e.rect(n.left,n.top,n.width,n.height);e.clip();e.closePath()}};this._applyCanvasStyles=function(e,t,n,i,a){var r,s,l,o=this._canvas.getContext("2d"),h=this.stroke,p=this.fill,f=this.strokeWidth;t&&void 0!==t.stroke&&(h=t.stroke);t&&void 0!==t.fill&&(p=this._getOpacityColor(t.fill,t["fill-opacity"]));if(e){s=window.getComputedStyle(e);l=e.getBBox()}if(a){if(s){o.fillStyle=s.fill;r=s.fontStyle+" "+s.fontWeight+" "+s.fontSize+" "+s.fontFamily;o.font=r}else if(this.fontSize){o.fillStyle=this.textFill;o.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;r=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;o.font=r;if(o.font.replace(/\"/g,"'")!==r.replace(/\"/g,"'")){r=this._canvasDefaultFont.fontSize+" "+(o.font.split(" ")[1]||"sans-serif");o.font=r}}}else{if(s){h=s.stroke&&"none"!==s.stroke?s.stroke:h;p=s.fill&&"none"!==s.fill?this._getOpacityColor(s.fill,s["fill-opacity"]):p;f=s.strokeWidth?s.strokeWidth:f}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,l);o.lineWidth=+f.replace(/px/g,"");o.stroke()}if(i&&null!=p&&"transparent"!==p&&"none"!==p){this._applyColor("fillStyle",p,l);o.fill()}}};this._element=e;this._canvas=document.createElement("canvas");this._svgEngine=new _SvgRenderEngine(e);this._element.appendChild(this._canvas);this._applyCSSStyles=t}_CanvasRenderEngine.prototype.beginRender=function(){var e,t=this._svgEngine.element,n=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();n=t}this._element.appendChild(t);this._canvasRect={};e=window.getComputedStyle(n);this._canvasDefaultFont={fontSize:e.fontSize,fontFamily:e.fontFamily,textFill:e.color}};_CanvasRenderEngine.prototype.endRender=function(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)};_CanvasRenderEngine.prototype.setViewportSize=function(e,t){var n=this._canvas;n.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(e,t);n.width=e;n.height=t};Object.defineProperty(_CanvasRenderEngine.prototype,"element",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fill",{get:function(){return this._fill},set:function(e){this._svgEngine.fill=e;this._fill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._svgEngine.fontSize=e;var t=null==e||isNaN(e)?e:e+"px";this._fontSize=t},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._svgEngine.fontFamily=e;this._fontFamily=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"stroke",{get:function(){return this._stroke},set:function(e){this._svgEngine.stroke=e;this._stroke=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"strokeWidth",{get:function(){return this._strokeWidth},set:function(e){this._svgEngine.strokeWidth=e;this._strokeWidth=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"textFill",{get:function(){return this._textFill},set:function(e){this._svgEngine.textFill=e;this._textFill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"cssPriority",{get:function(){return this._cssPriority},set:function(e){this._svgEngine.cssPriority=e;this._cssPriority=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"readOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=e},enumerable:!0,configurable:!0});_CanvasRenderEngine.prototype.addClipRect=function(e,t){if(e&&t){this._applyCSSStyles&&this._svgEngine.addClipRect(e,t);this._canvasRect[t]=e.clone()}};_CanvasRenderEngine.prototype.drawEllipse=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawEllipse(e,t,n,i,a,r));l.save();l.beginPath();if(l.ellipse)l.ellipse(e,t,n,i,0,0,2*Math.PI);else{l.translate(e,t);l.scale(1,i/n);l.translate(-e,-t);l.arc(e,t,n,0,2*Math.PI);l.scale(1,1)}this._applyCanvasStyles(s,r,a,!0);l.restore();return s}};_CanvasRenderEngine.prototype.drawRect=function(e,t,n,i,a,r,s){if(!this.readOnly){var l,o=this._canvas.getContext("2d");this._applyCSSStyles&&(l=this._svgEngine.drawRect(e,t,n,i,a,r,s));o.save();this._applyCanvasClip(o,s);o.beginPath();o.rect(e,t,n,i);this._applyCanvasStyles(l,r,a,!0);o.restore();return l}};_CanvasRenderEngine.prototype.drawLine=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawLine(e,t,n,i,a,r));l.save();l.beginPath();l.moveTo(e,t);l.lineTo(n,i);this._applyCanvasStyles(s,r,a);l.restore();return s}};_CanvasRenderEngine.prototype.drawLines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,l,o=this._canvas.getContext("2d"),h=r||Math.min(e.length,t.length);this._applyCSSStyles&&(s=this._svgEngine.drawLines([0,1],[1,0],n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(e[0],t[0]);for(l=1;l<h;l++)o.lineTo(e[l],t[l]);this._applyCanvasStyles(s,i,n);o.restore();return s}};_CanvasRenderEngine.prototype.drawSplines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,l,o=this._canvas.getContext("2d"),h=new _Spline(e,t,r).calculate(),p=h.xs,f=h.ys,g=Math.min(p.length,f.length);this._applyCSSStyles&&(s=this._svgEngine.drawSplines([0,1],[1,0],n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(p[0],f[0]);for(l=1;l<g;l++)o.lineTo(p[l],f[l]);this._applyCanvasStyles(s,i,n);o.restore();return s}};_CanvasRenderEngine.prototype.drawPolygon=function(e,t,n,i,a){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var r,s,l=this._canvas.getContext("2d"),o=Math.min(e.length,t.length);this._applyCSSStyles&&(r=this._svgEngine.drawPolygon(e,t,n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(e[0],t[0]);for(s=1;s<o;s++)l.lineTo(e[s],t[s]);l.closePath();this._applyCanvasStyles(r,i,n,!0);l.restore();return r}};_CanvasRenderEngine.prototype.drawPieSegment=function(e,t,n,i,a,r,s,l){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),p=i,f=i+a;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(e,t,n,i,a,r,s,l));h.save();this._applyCanvasClip(h,l);h.beginPath();h.moveTo(e,t);h.arc(e,t,n,p,f,!1);h.lineTo(e,t);this._applyCanvasStyles(o,s,r,!0);h.restore();return o}};_CanvasRenderEngine.prototype.drawDonutSegment=function(e,t,n,i,a,r,s,l,o){if(!this.readOnly){var h,p,f,g=this._canvas.getContext("2d"),y=a,_=a+r;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(e,t,n,i,a,r,s,l,o));(p=new Point(e,t)).x+=i*Math.cos(y);p.y+=i*Math.sin(y);(f=new Point(e,t)).x+=i*Math.cos(_);f.y+=i*Math.sin(_);g.save();this._applyCanvasClip(g,o);g.beginPath();g.moveTo(p.x,p.y);g.arc(e,t,n,y,_,!1);g.lineTo(f.x,f.y);g.arc(e,t,i,_,y,!0);this._applyCanvasStyles(h,l,s,!0);g.restore();return h}};_CanvasRenderEngine.prototype.drawString=function(e,t,n,i){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawString(e,t,n,i));r.save();r.textBaseline="bottom";this._applyCanvasStyles(a,i,n,!0,!0);r.fillText(e,t.x,t.y);r.restore();return a}};_CanvasRenderEngine.prototype.drawStringRotated=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");l.measureText(e);this._applyCSSStyles&&(s=this._svgEngine.drawStringRotated(e,t,n,i,a,r));l.save();l.textBaseline="bottom";l.translate(n.x,n.y);l.rotate(Math.PI/180*i);l.translate(-n.x,-n.y);this._applyCanvasStyles(s,r,a,!0,!0);l.fillText(e,t.x,t.y);l.restore();return s}};_CanvasRenderEngine.prototype.measureString=function(e,t,n,i){var a,r=r=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(e,t,n,i);this._applyCanvasStyles(null,null,t,!0,!0);a=r.measureText(e).width;return new Size(a,1.5*parseInt(r.font))};_CanvasRenderEngine.prototype.startGroup=function(e,t,n){void 0===n&&(n=!1);var i,a=this._canvas.getContext("2d");this._applyCSSStyles&&(i=this._svgEngine.startGroup(e,t,n));a.save();this._applyCanvasClip(a,t);return i};_CanvasRenderEngine.prototype.endGroup=function(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()};_CanvasRenderEngine.prototype.drawImage=function(e,t,n,i,a){if(!this.readOnly){var r,s=this._canvas.getContext("2d"),l=new Image;this._applyCSSStyles&&(r=this._svgEngine.drawImage(e,t,n,i,a));l.onload=function(){s.drawImage(l,t,n,i,a)};l.src=e;return r}};_CanvasRenderEngine.prototype._getOpacityColor=function(e,t){var n=new Color(e);if(e.indexOf("url")>-1)return this.fill;if(e.indexOf("-")>-1){this.fill=e;return e}null!=t&&1===n.a&&(n.a=isNaN(t)?1:Number(t));return n.toString()};_CanvasRenderEngine.prototype._applyColor=function(e,t,n){var i=_GradientColorUtil.tryParse(t),a=this._canvas.getContext("2d");if(null!=i)if(isString(i)||null==n)a[e]=i;else{var r;if(null!=i.x1)r=i.relative?a.createLinearGradient(n.x+i.x1*n.width,n.y+i.y1*n.height,n.x+i.x2*n.width,n.y+i.y2*n.height):a.createLinearGradient(i.x1,i.y1,i.x2,i.y2);else if(null!=i.r)if(i.relative){var s=n.x+i.cx*n.width,l=n.y+i.cy*n.height,o=i.r*n.width,h=i.r*n.height/o,p=n.x+(null==i.fx?i.cx:i.fx)*n.width,f=n.y+(null==i.fy?i.cy:i.fy)*n.height,g=(null==i.fr?0:i.fr)*n.width,y=(null==i.fr?0:i.fr)*n.height,_=Math.min(g,y);r=a.createRadialGradient(p,f/h,_,s,l/h,o);a.setTransform(1,0,0,h,0,0)}else r=a.createRadialGradient(null==i.fx?i.cx:i.fx,null==i.fy?i.cy:i.fy,i.fr||0,i.cx,i.cy,i.r);i.colors&&i.colors.length>0&&null!=r&&i.colors.forEach((function(e){var t=new Color("#000000");null!=e.color&&(t=e.color);null!=e.opacity&&(t.a=e.opacity);r.addColorStop(e.offset,t.toString())}));a[e]=r}};return _CanvasRenderEngine}();export{_CanvasRenderEngine};var _GradientColorUtil=function(){function _GradientColorUtil(){}_GradientColorUtil.tryParse=function(e){if(_GradientColorUtil.parsedColor[e])return _GradientColorUtil.parsedColor[e];if(null==e||-1===e.indexOf("-"))return e;var t,n=e.replace(/\s+/g,"").split(/\-/g),i=n[0][0],a=!1,r=n[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);if("l"===i||"L"===i){t={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===i&&(a=!0);["x1","y1","x2","y2"].forEach((function(e,n){null!=r[n]&&(t[e]=+r[n])}))}else if("r"===i||"R"===i){t={cx:"0",cy:"0",r:"0",colors:[]};"r"===i&&(a=!0);["cx","cy","r","fx","fy","fr"].forEach((function(e,n){null!=r[n]&&""!==r[n]&&(t[e]=+r[n])}))}t.relative=a;_GradientColorUtil.parsedColor[e]=t;var s=n.length-1;n.forEach((function(e,n){e.indexOf(")")>-1&&(e=e.match(/\)\S+/)[0].replace(")",""));var i=e.split(":"),a={color:new Color("#000000")};null!=i[0]&&(a.color=Color.fromString(i[0]));null!=i[1]?a.offset=+i[1]:a.offset=n/s;null!=i[2]&&(a.opacity=+i[2]);t.colors.push(a)}));return t};_GradientColorUtil.parsedColor={};return _GradientColorUtil}();if(FlexChartBase&&FlexChartBase.prototype&&FlexChartBase.prototype._exportToImage&&isIE()){var _exportFn_1=FlexChartBase.prototype._exportToImage;FlexChartBase.prototype._exportToImage=function(e,t){if("svg"!==e){var n=this._bgColor(this.hostElement);this._isTransparent(n)&&(n="#ffffff");var i,a,r=new _CanvasRenderEngine(this.hostElement,!0);this._render(r,!1,n);i=(a=r.element).toDataURL("image/"+e);a.parentNode.removeChild(a);t.call(null,i);a=null;r=null}else _exportFn_1.call(this,e,t)}}_registerModule("wijmo.chart.render",selfModule);
14
+ import{Color,isString,Size,Point,isIE,_registerModule}from"@grapecity/wijmo";import{_SvgRenderEngine,_Spline,FlexChartBase}from"@grapecity/wijmo.chart";import*as selfModule from"@grapecity/wijmo.chart.render";var _CanvasRenderEngine=function(){function _CanvasRenderEngine(e,t){void 0===t&&(t=!1);this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(e,t){var n=this._canvasRect[t];if(n){e.beginPath();e.rect(n.left,n.top,n.width,n.height);e.clip();e.closePath()}};this._applyCanvasStyles=function(e,t,n,i,a){var r,s,l,o=this._canvas.getContext("2d"),h=this.stroke,p=this.fill,f=this.strokeWidth;t&&void 0!==t.stroke&&(h=t.stroke);t&&void 0!==t.fill&&(p=this._getOpacityColor(t.fill,t["fill-opacity"]));if(e){s=window.getComputedStyle(e);l=e.getBBox()}if(a){if(s){o.fillStyle=s.fill;r=s.fontStyle+" "+s.fontWeight+" "+s.fontSize+" "+s.fontFamily;o.font=r}else if(this.fontSize){o.fillStyle=this.textFill;o.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){o.fillStyle=this._canvasDefaultFont.textFill;r=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;o.font=r;if(o.font.replace(/"/g,"'")!==r.replace(/"/g,"'")){r=this._canvasDefaultFont.fontSize+" "+(o.font.split(" ")[1]||"sans-serif");o.font=r}}}else{if(s){h=s.stroke&&"none"!==s.stroke?s.stroke:h;p=s.fill&&"none"!==s.fill?this._getOpacityColor(s.fill,s["fill-opacity"]):p;f=s.strokeWidth?s.strokeWidth:f}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,l);o.lineWidth=+f.replace(/px/g,"");o.stroke()}if(i&&null!=p&&"transparent"!==p&&"none"!==p){this._applyColor("fillStyle",p,l);o.fill()}}};this._element=e;this._canvas=document.createElement("canvas");this._svgEngine=new _SvgRenderEngine(e);this._element.appendChild(this._canvas);this._applyCSSStyles=t}_CanvasRenderEngine.prototype.beginRender=function(){var e,t=this._svgEngine.element,n=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();n=t}this._element.appendChild(t);this._canvasRect={};e=window.getComputedStyle(n);this._canvasDefaultFont={fontSize:e.fontSize,fontFamily:e.fontFamily,textFill:e.color}};_CanvasRenderEngine.prototype.endRender=function(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)};_CanvasRenderEngine.prototype.setViewportSize=function(e,t){var n=this._canvas;n.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(e,t);n.width=e;n.height=t};Object.defineProperty(_CanvasRenderEngine.prototype,"element",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fill",{get:function(){return this._fill},set:function(e){this._svgEngine.fill=e;this._fill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._svgEngine.fontSize=e;var t=null==e||isNaN(e)?e:e+"px";this._fontSize=t},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._svgEngine.fontFamily=e;this._fontFamily=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"stroke",{get:function(){return this._stroke},set:function(e){this._svgEngine.stroke=e;this._stroke=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"strokeWidth",{get:function(){return this._strokeWidth},set:function(e){this._svgEngine.strokeWidth=e;this._strokeWidth=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"textFill",{get:function(){return this._textFill},set:function(e){this._svgEngine.textFill=e;this._textFill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"cssPriority",{get:function(){return this._cssPriority},set:function(e){this._svgEngine.cssPriority=e;this._cssPriority=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"readOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=e},enumerable:!0,configurable:!0});_CanvasRenderEngine.prototype.addClipRect=function(e,t){if(e&&t){this._applyCSSStyles&&this._svgEngine.addClipRect(e,t);this._canvasRect[t]=e.clone()}};_CanvasRenderEngine.prototype.drawEllipse=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawEllipse(e,t,n,i,a,r));l.save();l.beginPath();if(l.ellipse)l.ellipse(e,t,n,i,0,0,2*Math.PI);else{l.translate(e,t);l.scale(1,i/n);l.translate(-e,-t);l.arc(e,t,n,0,2*Math.PI);l.scale(1,1)}this._applyCanvasStyles(s,r,a,!0);l.restore();return s}};_CanvasRenderEngine.prototype.drawRect=function(e,t,n,i,a,r,s){if(!this.readOnly){var l,o=this._canvas.getContext("2d");this._applyCSSStyles&&(l=this._svgEngine.drawRect(e,t,n,i,a,r,s));o.save();this._applyCanvasClip(o,s);o.beginPath();o.rect(e,t,n,i);this._applyCanvasStyles(l,r,a,!0);o.restore();return l}};_CanvasRenderEngine.prototype.drawLine=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawLine(e,t,n,i,a,r));l.save();l.beginPath();l.moveTo(e,t);l.lineTo(n,i);this._applyCanvasStyles(s,r,a);l.restore();return s}};_CanvasRenderEngine.prototype.drawLines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,l,o=this._canvas.getContext("2d"),h=r||Math.min(e.length,t.length);this._applyCSSStyles&&(s=this._svgEngine.drawLines([0,1],[1,0],n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(e[0],t[0]);for(l=1;l<h;l++)o.lineTo(e[l],t[l]);this._applyCanvasStyles(s,i,n);o.restore();return s}};_CanvasRenderEngine.prototype.drawSplines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,l,o=this._canvas.getContext("2d"),h=new _Spline(e,t,r).calculate(),p=h.xs,f=h.ys,g=Math.min(p.length,f.length);this._applyCSSStyles&&(s=this._svgEngine.drawSplines([0,1],[1,0],n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(p[0],f[0]);for(l=1;l<g;l++)o.lineTo(p[l],f[l]);this._applyCanvasStyles(s,i,n);o.restore();return s}};_CanvasRenderEngine.prototype.drawPolygon=function(e,t,n,i,a){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var r,s,l=this._canvas.getContext("2d"),o=Math.min(e.length,t.length);this._applyCSSStyles&&(r=this._svgEngine.drawPolygon(e,t,n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(e[0],t[0]);for(s=1;s<o;s++)l.lineTo(e[s],t[s]);l.closePath();this._applyCanvasStyles(r,i,n,!0);l.restore();return r}};_CanvasRenderEngine.prototype.drawPieSegment=function(e,t,n,i,a,r,s,l){if(!this.readOnly){var o,h=this._canvas.getContext("2d"),p=i,f=i+a;this._applyCSSStyles&&(o=this._svgEngine.drawPieSegment(e,t,n,i,a,r,s,l));h.save();this._applyCanvasClip(h,l);h.beginPath();h.moveTo(e,t);h.arc(e,t,n,p,f,!1);h.lineTo(e,t);this._applyCanvasStyles(o,s,r,!0);h.restore();return o}};_CanvasRenderEngine.prototype.drawDonutSegment=function(e,t,n,i,a,r,s,l,o){if(!this.readOnly){var h,p,f,g=this._canvas.getContext("2d"),y=a,_=a+r;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(e,t,n,i,a,r,s,l,o));(p=new Point(e,t)).x+=i*Math.cos(y);p.y+=i*Math.sin(y);(f=new Point(e,t)).x+=i*Math.cos(_);f.y+=i*Math.sin(_);g.save();this._applyCanvasClip(g,o);g.beginPath();g.moveTo(p.x,p.y);g.arc(e,t,n,y,_,!1);g.lineTo(f.x,f.y);g.arc(e,t,i,_,y,!0);this._applyCanvasStyles(h,l,s,!0);g.restore();return h}};_CanvasRenderEngine.prototype.drawString=function(e,t,n,i){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawString(e,t,n,i));r.save();r.textBaseline="bottom";this._applyCanvasStyles(a,i,n,!0,!0);r.fillText(e,t.x,t.y);r.restore();return a}};_CanvasRenderEngine.prototype.drawStringRotated=function(e,t,n,i,a,r){if(!this.readOnly){var s,l=this._canvas.getContext("2d");l.measureText(e);this._applyCSSStyles&&(s=this._svgEngine.drawStringRotated(e,t,n,i,a,r));l.save();l.textBaseline="bottom";l.translate(n.x,n.y);l.rotate(Math.PI/180*i);l.translate(-n.x,-n.y);this._applyCanvasStyles(s,r,a,!0,!0);l.fillText(e,t.x,t.y);l.restore();return s}};_CanvasRenderEngine.prototype.measureString=function(e,t,n,i){var a,r=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(e,t,n,i);this._applyCanvasStyles(null,null,t,!0,!0);a=r.measureText(e).width;return new Size(a,1.5*parseInt(r.font))};_CanvasRenderEngine.prototype.startGroup=function(e,t,n){void 0===n&&(n=!1);var i,a=this._canvas.getContext("2d");this._applyCSSStyles&&(i=this._svgEngine.startGroup(e,t,n));a.save();this._applyCanvasClip(a,t);return i};_CanvasRenderEngine.prototype.endGroup=function(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()};_CanvasRenderEngine.prototype.drawImage=function(e,t,n,i,a){if(!this.readOnly){var r,s=this._canvas.getContext("2d"),l=new Image;this._applyCSSStyles&&(r=this._svgEngine.drawImage(e,t,n,i,a));l.onload=function(){s.drawImage(l,t,n,i,a)};l.src=e;return r}};_CanvasRenderEngine.prototype._getOpacityColor=function(e,t){var n=new Color(e);if(e.indexOf("url")>-1)return this.fill;if(e.indexOf("-")>-1){this.fill=e;return e}null!=t&&1===n.a&&(n.a=isNaN(t)?1:Number(t));return n.toString()};_CanvasRenderEngine.prototype._applyColor=function(e,t,n){var i=_GradientColorUtil.tryParse(t),a=this._canvas.getContext("2d");if(null!=i)if(isString(i)||null==n)a[e]=i;else{var r;if(null!=i.x1)r=i.relative?a.createLinearGradient(n.x+i.x1*n.width,n.y+i.y1*n.height,n.x+i.x2*n.width,n.y+i.y2*n.height):a.createLinearGradient(i.x1,i.y1,i.x2,i.y2);else if(null!=i.r)if(i.relative){var s=n.x+i.cx*n.width,l=n.y+i.cy*n.height,o=i.r*n.width,h=i.r*n.height/o,p=n.x+(null==i.fx?i.cx:i.fx)*n.width,f=n.y+(null==i.fy?i.cy:i.fy)*n.height,g=(null==i.fr?0:i.fr)*n.width,y=(null==i.fr?0:i.fr)*n.height,_=Math.min(g,y);r=a.createRadialGradient(p,f/h,_,s,l/h,o);a.setTransform(1,0,0,h,0,0)}else r=a.createRadialGradient(null==i.fx?i.cx:i.fx,null==i.fy?i.cy:i.fy,i.fr||0,i.cx,i.cy,i.r);i.colors&&i.colors.length>0&&null!=r&&i.colors.forEach((function(e){var t=new Color("#000000");null!=e.color&&(t=e.color);null!=e.opacity&&(t.a=e.opacity);r.addColorStop(e.offset,t.toString())}));a[e]=r}};return _CanvasRenderEngine}();export{_CanvasRenderEngine};var _GradientColorUtil=function(){function _GradientColorUtil(){}_GradientColorUtil.tryParse=function(e){if(_GradientColorUtil.parsedColor[e])return _GradientColorUtil.parsedColor[e];if(null==e||-1===e.indexOf("-"))return e;var t,n=e.replace(/\s+/g,"").split(/-/g),i=n[0][0],a=!1,r=n[0].match(/\(\S+\)/)[0].replace(/[(\\)]/g,"").split(/,/g);if("l"===i||"L"===i){t={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===i&&(a=!0);["x1","y1","x2","y2"].forEach((function(e,n){null!=r[n]&&(t[e]=+r[n])}))}else if("r"===i||"R"===i){t={cx:"0",cy:"0",r:"0",colors:[]};"r"===i&&(a=!0);["cx","cy","r","fx","fy","fr"].forEach((function(e,n){null!=r[n]&&""!==r[n]&&(t[e]=+r[n])}))}t.relative=a;_GradientColorUtil.parsedColor[e]=t;var s=n.length-1;n.forEach((function(e,n){e.indexOf(")")>-1&&(e=e.match(/\)\S+/)[0].replace(")",""));var i=e.split(":"),a={color:new Color("#000000")};null!=i[0]&&(a.color=Color.fromString(i[0]));null!=i[1]?a.offset=+i[1]:a.offset=n/s;null!=i[2]&&(a.opacity=+i[2]);t.colors.push(a)}));return t};_GradientColorUtil.parsedColor={};return _GradientColorUtil}();if(FlexChartBase&&FlexChartBase.prototype&&FlexChartBase.prototype._exportToImage&&isIE()){var _exportFn_1=FlexChartBase.prototype._exportToImage;FlexChartBase.prototype._exportToImage=function(e,t){if("svg"!==e){var n=this._bgColor(this.hostElement);this._isTransparent(n)&&(n="#ffffff");var i,a,r=new _CanvasRenderEngine(this.hostElement,!0);this._render(r,!1,n);i=(a=r.element).toDataURL("image/"+e);a.parentNode.removeChild(a);t.call(null,i);a=null;r=null}else _exportFn_1.call(this,e,t)}}_registerModule("wijmo.chart.render",selfModule);
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20252.42
3
+ * Wijmo Library 5.20261.48
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -14,7 +14,7 @@
14
14
  * {@module wijmo.chart.render}
15
15
  * Provides various render engines to render flex-chart.
16
16
  * Add this module on page to support chart export in IE browsers.
17
- */
17
+ */
18
18
  /**
19
19
  *
20
20
  */
@@ -50,20 +50,20 @@ export declare class _CanvasRenderEngine implements IRenderEngine {
50
50
  cssPriority: boolean;
51
51
  readOnly: boolean;
52
52
  addClipRect(clipRect: Rect, id: string): void;
53
- drawEllipse(cx: number, cy: number, rx: number, ry: number, className?: string, style?: any): any;
54
- drawRect(x: number, y: number, w: number, h: number, className?: string, style?: any, clipPath?: string): any;
55
- drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, style?: any): any;
56
- drawLines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): any;
57
- drawSplines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): any;
58
- drawPolygon(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string): any;
59
- drawPieSegment(cx: number, cy: number, r: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): any;
60
- drawDonutSegment(cx: number, cy: number, radius: number, innerRadius: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): any;
61
- drawString(s: string, pt: Point, className?: string, style?: any): any;
62
- drawStringRotated(s: string, pt: Point, center: Point, angle: number, className?: string, style?: any): any;
53
+ drawEllipse(cx: number, cy: number, rx: number, ry: number, className?: string, style?: any): SVGElement;
54
+ drawRect(x: number, y: number, w: number, h: number, className?: string, style?: any, clipPath?: string): SVGElement;
55
+ drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, style?: any): SVGElement;
56
+ drawLines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): SVGElement;
57
+ drawSplines(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string, num?: number): SVGElement;
58
+ drawPolygon(xs: number[], ys: number[], className?: string, style?: any, clipPath?: string): SVGElement;
59
+ drawPieSegment(cx: number, cy: number, r: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): SVGElement;
60
+ drawDonutSegment(cx: number, cy: number, radius: number, innerRadius: number, startAngle: number, sweepAngle: number, className?: string, style?: any, clipPath?: string): SVGElement;
61
+ drawString(s: string, pt: Point, className?: string, style?: any): SVGElement;
62
+ drawStringRotated(s: string, pt: Point, center: Point, angle: number, className?: string, style?: any): SVGElement;
63
63
  measureString(s: string, className?: string, groupName?: string, style?: any): Size;
64
- startGroup(className?: string, clipPath?: string, createTransform?: boolean): any;
64
+ startGroup(className?: string, clipPath?: string, createTransform?: boolean): SVGElement;
65
65
  endGroup(): void;
66
- drawImage(imageHref: string, x: number, y: number, w: number, h: number): any;
66
+ drawImage(imageHref: string, x: number, y: number, w: number, h: number): SVGElement;
67
67
  private _applyCanvasClip;
68
68
  private _getOpacityColor;
69
69
  private _applyCanvasStyles;
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20252.42
3
+ * Wijmo Library 5.20261.48
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_chart_1=require("@grapecity/wijmo.chart"),selfModule=__importStar(require("@grapecity/wijmo.chart.render")),_CanvasRenderEngine=function(){function _CanvasRenderEngine(e,t){void 0===t&&(t=!1);this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(e,t){var n=this._canvasRect[t];if(n){e.beginPath();e.rect(n.left,n.top,n.width,n.height);e.clip();e.closePath()}};this._applyCanvasStyles=function(e,t,n,i,a){var r,s,o,l=this._canvas.getContext("2d"),h=this.stroke,p=this.fill,_=this.strokeWidth;t&&void 0!==t.stroke&&(h=t.stroke);t&&void 0!==t.fill&&(p=this._getOpacityColor(t.fill,t["fill-opacity"]));if(e){s=window.getComputedStyle(e);o=e.getBBox()}if(a){if(s){l.fillStyle=s.fill;r=s.fontStyle+" "+s.fontWeight+" "+s.fontSize+" "+s.fontFamily;l.font=r}else if(this.fontSize){l.fillStyle=this.textFill;l.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){l.fillStyle=this._canvasDefaultFont.textFill;r=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;l.font=r;if(l.font.replace(/\"/g,"'")!==r.replace(/\"/g,"'")){r=this._canvasDefaultFont.fontSize+" "+(l.font.split(" ")[1]||"sans-serif");l.font=r}}}else{if(s){h=s.stroke&&"none"!==s.stroke?s.stroke:h;p=s.fill&&"none"!==s.fill?this._getOpacityColor(s.fill,s["fill-opacity"]):p;_=s.strokeWidth?s.strokeWidth:_}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,o);l.lineWidth=+_.replace(/px/g,"");l.stroke()}if(i&&null!=p&&"transparent"!==p&&"none"!==p){this._applyColor("fillStyle",p,o);l.fill()}}};this._element=e;this._canvas=document.createElement("canvas");this._svgEngine=new wijmo_chart_1._SvgRenderEngine(e);this._element.appendChild(this._canvas);this._applyCSSStyles=t}_CanvasRenderEngine.prototype.beginRender=function(){var e,t=this._svgEngine.element,n=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();n=t}this._element.appendChild(t);this._canvasRect={};e=window.getComputedStyle(n);this._canvasDefaultFont={fontSize:e.fontSize,fontFamily:e.fontFamily,textFill:e.color}};_CanvasRenderEngine.prototype.endRender=function(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)};_CanvasRenderEngine.prototype.setViewportSize=function(e,t){var n=this._canvas;n.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(e,t);n.width=e;n.height=t};Object.defineProperty(_CanvasRenderEngine.prototype,"element",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fill",{get:function(){return this._fill},set:function(e){this._svgEngine.fill=e;this._fill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._svgEngine.fontSize=e;var t=null==e||isNaN(e)?e:e+"px";this._fontSize=t},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._svgEngine.fontFamily=e;this._fontFamily=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"stroke",{get:function(){return this._stroke},set:function(e){this._svgEngine.stroke=e;this._stroke=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"strokeWidth",{get:function(){return this._strokeWidth},set:function(e){this._svgEngine.strokeWidth=e;this._strokeWidth=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"textFill",{get:function(){return this._textFill},set:function(e){this._svgEngine.textFill=e;this._textFill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"cssPriority",{get:function(){return this._cssPriority},set:function(e){this._svgEngine.cssPriority=e;this._cssPriority=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"readOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=e},enumerable:!0,configurable:!0});_CanvasRenderEngine.prototype.addClipRect=function(e,t){if(e&&t){this._applyCSSStyles&&this._svgEngine.addClipRect(e,t);this._canvasRect[t]=e.clone()}};_CanvasRenderEngine.prototype.drawEllipse=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawEllipse(e,t,n,i,a,r));o.save();o.beginPath();if(o.ellipse)o.ellipse(e,t,n,i,0,0,2*Math.PI);else{o.translate(e,t);o.scale(1,i/n);o.translate(-e,-t);o.arc(e,t,n,0,2*Math.PI);o.scale(1,1)}this._applyCanvasStyles(s,r,a,!0);o.restore();return s}};_CanvasRenderEngine.prototype.drawRect=function(e,t,n,i,a,r,s){if(!this.readOnly){var o,l=this._canvas.getContext("2d");this._applyCSSStyles&&(o=this._svgEngine.drawRect(e,t,n,i,a,r,s));l.save();this._applyCanvasClip(l,s);l.beginPath();l.rect(e,t,n,i);this._applyCanvasStyles(o,r,a,!0);l.restore();return o}};_CanvasRenderEngine.prototype.drawLine=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawLine(e,t,n,i,a,r));o.save();o.beginPath();o.moveTo(e,t);o.lineTo(n,i);this._applyCanvasStyles(s,r,a);o.restore();return s}};_CanvasRenderEngine.prototype.drawLines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,o,l=this._canvas.getContext("2d"),h=r||Math.min(e.length,t.length);this._applyCSSStyles&&(s=this._svgEngine.drawLines([0,1],[1,0],n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(e[0],t[0]);for(o=1;o<h;o++)l.lineTo(e[o],t[o]);this._applyCanvasStyles(s,i,n);l.restore();return s}};_CanvasRenderEngine.prototype.drawSplines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,o,l=this._canvas.getContext("2d"),h=new wijmo_chart_1._Spline(e,t,r).calculate(),p=h.xs,_=h.ys,f=Math.min(p.length,_.length);this._applyCSSStyles&&(s=this._svgEngine.drawSplines([0,1],[1,0],n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(p[0],_[0]);for(o=1;o<f;o++)l.lineTo(p[o],_[o]);this._applyCanvasStyles(s,i,n);l.restore();return s}};_CanvasRenderEngine.prototype.drawPolygon=function(e,t,n,i,a){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var r,s,o=this._canvas.getContext("2d"),l=Math.min(e.length,t.length);this._applyCSSStyles&&(r=this._svgEngine.drawPolygon(e,t,n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(e[0],t[0]);for(s=1;s<l;s++)o.lineTo(e[s],t[s]);o.closePath();this._applyCanvasStyles(r,i,n,!0);o.restore();return r}};_CanvasRenderEngine.prototype.drawPieSegment=function(e,t,n,i,a,r,s,o){if(!this.readOnly){var l,h=this._canvas.getContext("2d"),p=i,_=i+a;this._applyCSSStyles&&(l=this._svgEngine.drawPieSegment(e,t,n,i,a,r,s,o));h.save();this._applyCanvasClip(h,o);h.beginPath();h.moveTo(e,t);h.arc(e,t,n,p,_,!1);h.lineTo(e,t);this._applyCanvasStyles(l,s,r,!0);h.restore();return l}};_CanvasRenderEngine.prototype.drawDonutSegment=function(e,t,n,i,a,r,s,o,l){if(!this.readOnly){var h,p,_,f=this._canvas.getContext("2d"),g=a,y=a+r;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(e,t,n,i,a,r,s,o,l));(p=new wijmo_1.Point(e,t)).x+=i*Math.cos(g);p.y+=i*Math.sin(g);(_=new wijmo_1.Point(e,t)).x+=i*Math.cos(y);_.y+=i*Math.sin(y);f.save();this._applyCanvasClip(f,l);f.beginPath();f.moveTo(p.x,p.y);f.arc(e,t,n,g,y,!1);f.lineTo(_.x,_.y);f.arc(e,t,i,y,g,!0);this._applyCanvasStyles(h,o,s,!0);f.restore();return h}};_CanvasRenderEngine.prototype.drawString=function(e,t,n,i){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawString(e,t,n,i));r.save();r.textBaseline="bottom";this._applyCanvasStyles(a,i,n,!0,!0);r.fillText(e,t.x,t.y);r.restore();return a}};_CanvasRenderEngine.prototype.drawStringRotated=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");o.measureText(e);this._applyCSSStyles&&(s=this._svgEngine.drawStringRotated(e,t,n,i,a,r));o.save();o.textBaseline="bottom";o.translate(n.x,n.y);o.rotate(Math.PI/180*i);o.translate(-n.x,-n.y);this._applyCanvasStyles(s,r,a,!0,!0);o.fillText(e,t.x,t.y);o.restore();return s}};_CanvasRenderEngine.prototype.measureString=function(e,t,n,i){var a,r=r=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(e,t,n,i);this._applyCanvasStyles(null,null,t,!0,!0);a=r.measureText(e).width;return new wijmo_1.Size(a,1.5*parseInt(r.font))};_CanvasRenderEngine.prototype.startGroup=function(e,t,n){void 0===n&&(n=!1);var i,a=this._canvas.getContext("2d");this._applyCSSStyles&&(i=this._svgEngine.startGroup(e,t,n));a.save();this._applyCanvasClip(a,t);return i};_CanvasRenderEngine.prototype.endGroup=function(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()};_CanvasRenderEngine.prototype.drawImage=function(e,t,n,i,a){if(!this.readOnly){var r,s=this._canvas.getContext("2d"),o=new Image;this._applyCSSStyles&&(r=this._svgEngine.drawImage(e,t,n,i,a));o.onload=function(){s.drawImage(o,t,n,i,a)};o.src=e;return r}};_CanvasRenderEngine.prototype._getOpacityColor=function(e,t){var n=new wijmo_1.Color(e);if(e.indexOf("url")>-1)return this.fill;if(e.indexOf("-")>-1){this.fill=e;return e}null!=t&&1===n.a&&(n.a=isNaN(t)?1:Number(t));return n.toString()};_CanvasRenderEngine.prototype._applyColor=function(e,t,n){var i=_GradientColorUtil.tryParse(t),a=this._canvas.getContext("2d");if(null!=i)if(wijmo_1.isString(i)||null==n)a[e]=i;else{var r;if(null!=i.x1)r=i.relative?a.createLinearGradient(n.x+i.x1*n.width,n.y+i.y1*n.height,n.x+i.x2*n.width,n.y+i.y2*n.height):a.createLinearGradient(i.x1,i.y1,i.x2,i.y2);else if(null!=i.r)if(i.relative){var s=n.x+i.cx*n.width,o=n.y+i.cy*n.height,l=i.r*n.width,h=i.r*n.height/l,p=n.x+(null==i.fx?i.cx:i.fx)*n.width,_=n.y+(null==i.fy?i.cy:i.fy)*n.height,f=(null==i.fr?0:i.fr)*n.width,g=(null==i.fr?0:i.fr)*n.height,y=Math.min(f,g);r=a.createRadialGradient(p,_/h,y,s,o/h,l);a.setTransform(1,0,0,h,0,0)}else r=a.createRadialGradient(null==i.fx?i.cx:i.fx,null==i.fy?i.cy:i.fy,i.fr||0,i.cx,i.cy,i.r);i.colors&&i.colors.length>0&&null!=r&&i.colors.forEach((function(e){var t=new wijmo_1.Color("#000000");null!=e.color&&(t=e.color);null!=e.opacity&&(t.a=e.opacity);r.addColorStop(e.offset,t.toString())}));a[e]=r}};return _CanvasRenderEngine}();exports._CanvasRenderEngine=_CanvasRenderEngine;var _GradientColorUtil=function(){function _GradientColorUtil(){}_GradientColorUtil.tryParse=function(e){if(_GradientColorUtil.parsedColor[e])return _GradientColorUtil.parsedColor[e];if(null==e||-1===e.indexOf("-"))return e;var t,n=e.replace(/\s+/g,"").split(/\-/g),i=n[0][0],a=!1,r=n[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);if("l"===i||"L"===i){t={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===i&&(a=!0);["x1","y1","x2","y2"].forEach((function(e,n){null!=r[n]&&(t[e]=+r[n])}))}else if("r"===i||"R"===i){t={cx:"0",cy:"0",r:"0",colors:[]};"r"===i&&(a=!0);["cx","cy","r","fx","fy","fr"].forEach((function(e,n){null!=r[n]&&""!==r[n]&&(t[e]=+r[n])}))}t.relative=a;_GradientColorUtil.parsedColor[e]=t;var s=n.length-1;n.forEach((function(e,n){e.indexOf(")")>-1&&(e=e.match(/\)\S+/)[0].replace(")",""));var i=e.split(":"),a={color:new wijmo_1.Color("#000000")};null!=i[0]&&(a.color=wijmo_1.Color.fromString(i[0]));null!=i[1]?a.offset=+i[1]:a.offset=n/s;null!=i[2]&&(a.opacity=+i[2]);t.colors.push(a)}));return t};_GradientColorUtil.parsedColor={};return _GradientColorUtil}();if(wijmo_chart_1.FlexChartBase&&wijmo_chart_1.FlexChartBase.prototype&&wijmo_chart_1.FlexChartBase.prototype._exportToImage&&wijmo_1.isIE()){var _exportFn_1=wijmo_chart_1.FlexChartBase.prototype._exportToImage;wijmo_chart_1.FlexChartBase.prototype._exportToImage=function(e,t){if("svg"!==e){var n=this._bgColor(this.hostElement);this._isTransparent(n)&&(n="#ffffff");var i,a,r=new _CanvasRenderEngine(this.hostElement,!0);this._render(r,!1,n);i=(a=r.element).toDataURL("image/"+e);a.parentNode.removeChild(a);t.call(null,i);a=null;r=null}else _exportFn_1.call(this,e,t)}}wijmo_1._registerModule("wijmo.chart.render",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@grapecity/wijmo"),wijmo_chart_1=require("@grapecity/wijmo.chart"),selfModule=__importStar(require("@grapecity/wijmo.chart.render")),_CanvasRenderEngine=function(){function _CanvasRenderEngine(e,t){void 0===t&&(t=!1);this._strokeWidth=1;this._fontSize=null;this._fontFamily=null;this._cssPriority=!0;this._readOnly=!1;this._applyCanvasClip=function(e,t){var n=this._canvasRect[t];if(n){e.beginPath();e.rect(n.left,n.top,n.width,n.height);e.clip();e.closePath()}};this._applyCanvasStyles=function(e,t,n,i,a){var r,s,o,l=this._canvas.getContext("2d"),h=this.stroke,p=this.fill,_=this.strokeWidth;t&&void 0!==t.stroke&&(h=t.stroke);t&&void 0!==t.fill&&(p=this._getOpacityColor(t.fill,t["fill-opacity"]));if(e){s=window.getComputedStyle(e);o=e.getBBox()}if(a){if(s){l.fillStyle=s.fill;r=s.fontStyle+" "+s.fontWeight+" "+s.fontSize+" "+s.fontFamily;l.font=r}else if(this.fontSize){l.fillStyle=this.textFill;l.font=this.fontSize+" "+(this.fontFamily||"sans-serif")}else if(this._canvasDefaultFont){l.fillStyle=this._canvasDefaultFont.textFill;r=this._canvasDefaultFont.fontSize+" "+this._canvasDefaultFont.fontFamily;l.font=r;if(l.font.replace(/"/g,"'")!==r.replace(/"/g,"'")){r=this._canvasDefaultFont.fontSize+" "+(l.font.split(" ")[1]||"sans-serif");l.font=r}}}else{if(s){h=s.stroke&&"none"!==s.stroke?s.stroke:h;p=s.fill&&"none"!==s.fill?this._getOpacityColor(s.fill,s["fill-opacity"]):p;_=s.strokeWidth?s.strokeWidth:_}if("none"!==h&&null!=h){this._applyColor("strokeStyle",h,o);l.lineWidth=+_.replace(/px/g,"");l.stroke()}if(i&&null!=p&&"transparent"!==p&&"none"!==p){this._applyColor("fillStyle",p,o);l.fill()}}};this._element=e;this._canvas=document.createElement("canvas");this._svgEngine=new wijmo_chart_1._SvgRenderEngine(e);this._element.appendChild(this._canvas);this._applyCSSStyles=t}_CanvasRenderEngine.prototype.beginRender=function(){var e,t=this._svgEngine.element,n=this._element;if(this._applyCSSStyles){this._svgEngine.beginRender();n=t}this._element.appendChild(t);this._canvasRect={};e=window.getComputedStyle(n);this._canvasDefaultFont={fontSize:e.fontSize,fontFamily:e.fontFamily,textFill:e.color}};_CanvasRenderEngine.prototype.endRender=function(){this._applyCSSStyles&&this._svgEngine.endRender();this._svgEngine.element.parentNode.removeChild(this._svgEngine.element)};_CanvasRenderEngine.prototype.setViewportSize=function(e,t){var n=this._canvas;n.getContext("2d"),this.fill;this._applyCSSStyles&&this._svgEngine.setViewportSize(e,t);n.width=e;n.height=t};Object.defineProperty(_CanvasRenderEngine.prototype,"element",{get:function(){return this._canvas},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fill",{get:function(){return this._fill},set:function(e){this._svgEngine.fill=e;this._fill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._svgEngine.fontSize=e;var t=null==e||isNaN(e)?e:e+"px";this._fontSize=t},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(e){this._svgEngine.fontFamily=e;this._fontFamily=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"stroke",{get:function(){return this._stroke},set:function(e){this._svgEngine.stroke=e;this._stroke=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"strokeWidth",{get:function(){return this._strokeWidth},set:function(e){this._svgEngine.strokeWidth=e;this._strokeWidth=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"textFill",{get:function(){return this._textFill},set:function(e){this._svgEngine.textFill=e;this._textFill=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"cssPriority",{get:function(){return this._cssPriority},set:function(e){this._svgEngine.cssPriority=e;this._cssPriority=e},enumerable:!0,configurable:!0});Object.defineProperty(_CanvasRenderEngine.prototype,"readOnly",{get:function(){return this._readOnly},set:function(e){this._readOnly=e},enumerable:!0,configurable:!0});_CanvasRenderEngine.prototype.addClipRect=function(e,t){if(e&&t){this._applyCSSStyles&&this._svgEngine.addClipRect(e,t);this._canvasRect[t]=e.clone()}};_CanvasRenderEngine.prototype.drawEllipse=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawEllipse(e,t,n,i,a,r));o.save();o.beginPath();if(o.ellipse)o.ellipse(e,t,n,i,0,0,2*Math.PI);else{o.translate(e,t);o.scale(1,i/n);o.translate(-e,-t);o.arc(e,t,n,0,2*Math.PI);o.scale(1,1)}this._applyCanvasStyles(s,r,a,!0);o.restore();return s}};_CanvasRenderEngine.prototype.drawRect=function(e,t,n,i,a,r,s){if(!this.readOnly){var o,l=this._canvas.getContext("2d");this._applyCSSStyles&&(o=this._svgEngine.drawRect(e,t,n,i,a,r,s));l.save();this._applyCanvasClip(l,s);l.beginPath();l.rect(e,t,n,i);this._applyCanvasStyles(o,r,a,!0);l.restore();return o}};_CanvasRenderEngine.prototype.drawLine=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");this._applyCSSStyles&&(s=this._svgEngine.drawLine(e,t,n,i,a,r));o.save();o.beginPath();o.moveTo(e,t);o.lineTo(n,i);this._applyCanvasStyles(s,r,a);o.restore();return s}};_CanvasRenderEngine.prototype.drawLines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,o,l=this._canvas.getContext("2d"),h=r||Math.min(e.length,t.length);this._applyCSSStyles&&(s=this._svgEngine.drawLines([0,1],[1,0],n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(e[0],t[0]);for(o=1;o<h;o++)l.lineTo(e[o],t[o]);this._applyCanvasStyles(s,i,n);l.restore();return s}};_CanvasRenderEngine.prototype.drawSplines=function(e,t,n,i,a,r){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var s,o,l=this._canvas.getContext("2d"),h=new wijmo_chart_1._Spline(e,t,r).calculate(),p=h.xs,_=h.ys,f=Math.min(p.length,_.length);this._applyCSSStyles&&(s=this._svgEngine.drawSplines([0,1],[1,0],n,i,a));l.save();this._applyCanvasClip(l,a);l.beginPath();l.moveTo(p[0],_[0]);for(o=1;o<f;o++)l.lineTo(p[o],_[o]);this._applyCanvasStyles(s,i,n);l.restore();return s}};_CanvasRenderEngine.prototype.drawPolygon=function(e,t,n,i,a){if(e&&t&&0!==e.length&&0!==t.length&&!this.readOnly){var r,s,o=this._canvas.getContext("2d"),l=Math.min(e.length,t.length);this._applyCSSStyles&&(r=this._svgEngine.drawPolygon(e,t,n,i,a));o.save();this._applyCanvasClip(o,a);o.beginPath();o.moveTo(e[0],t[0]);for(s=1;s<l;s++)o.lineTo(e[s],t[s]);o.closePath();this._applyCanvasStyles(r,i,n,!0);o.restore();return r}};_CanvasRenderEngine.prototype.drawPieSegment=function(e,t,n,i,a,r,s,o){if(!this.readOnly){var l,h=this._canvas.getContext("2d"),p=i,_=i+a;this._applyCSSStyles&&(l=this._svgEngine.drawPieSegment(e,t,n,i,a,r,s,o));h.save();this._applyCanvasClip(h,o);h.beginPath();h.moveTo(e,t);h.arc(e,t,n,p,_,!1);h.lineTo(e,t);this._applyCanvasStyles(l,s,r,!0);h.restore();return l}};_CanvasRenderEngine.prototype.drawDonutSegment=function(e,t,n,i,a,r,s,o,l){if(!this.readOnly){var h,p,_,f=this._canvas.getContext("2d"),g=a,y=a+r;this._applyCSSStyles&&(h=this._svgEngine.drawDonutSegment(e,t,n,i,a,r,s,o,l));(p=new wijmo_1.Point(e,t)).x+=i*Math.cos(g);p.y+=i*Math.sin(g);(_=new wijmo_1.Point(e,t)).x+=i*Math.cos(y);_.y+=i*Math.sin(y);f.save();this._applyCanvasClip(f,l);f.beginPath();f.moveTo(p.x,p.y);f.arc(e,t,n,g,y,!1);f.lineTo(_.x,_.y);f.arc(e,t,i,y,g,!0);this._applyCanvasStyles(h,o,s,!0);f.restore();return h}};_CanvasRenderEngine.prototype.drawString=function(e,t,n,i){if(!this.readOnly){var a,r=this._canvas.getContext("2d");this._applyCSSStyles&&(a=this._svgEngine.drawString(e,t,n,i));r.save();r.textBaseline="bottom";this._applyCanvasStyles(a,i,n,!0,!0);r.fillText(e,t.x,t.y);r.restore();return a}};_CanvasRenderEngine.prototype.drawStringRotated=function(e,t,n,i,a,r){if(!this.readOnly){var s,o=this._canvas.getContext("2d");o.measureText(e);this._applyCSSStyles&&(s=this._svgEngine.drawStringRotated(e,t,n,i,a,r));o.save();o.textBaseline="bottom";o.translate(n.x,n.y);o.rotate(Math.PI/180*i);o.translate(-n.x,-n.y);this._applyCanvasStyles(s,r,a,!0,!0);o.fillText(e,t.x,t.y);o.restore();return s}};_CanvasRenderEngine.prototype.measureString=function(e,t,n,i){var a,r=this._canvas.getContext("2d");if(this._applyCSSStyles)return this._svgEngine.measureString(e,t,n,i);this._applyCanvasStyles(null,null,t,!0,!0);a=r.measureText(e).width;return new wijmo_1.Size(a,1.5*parseInt(r.font))};_CanvasRenderEngine.prototype.startGroup=function(e,t,n){void 0===n&&(n=!1);var i,a=this._canvas.getContext("2d");this._applyCSSStyles&&(i=this._svgEngine.startGroup(e,t,n));a.save();this._applyCanvasClip(a,t);return i};_CanvasRenderEngine.prototype.endGroup=function(){this._applyCSSStyles&&this._svgEngine.endGroup();this._canvas.getContext("2d").restore()};_CanvasRenderEngine.prototype.drawImage=function(e,t,n,i,a){if(!this.readOnly){var r,s=this._canvas.getContext("2d"),o=new Image;this._applyCSSStyles&&(r=this._svgEngine.drawImage(e,t,n,i,a));o.onload=function(){s.drawImage(o,t,n,i,a)};o.src=e;return r}};_CanvasRenderEngine.prototype._getOpacityColor=function(e,t){var n=new wijmo_1.Color(e);if(e.indexOf("url")>-1)return this.fill;if(e.indexOf("-")>-1){this.fill=e;return e}null!=t&&1===n.a&&(n.a=isNaN(t)?1:Number(t));return n.toString()};_CanvasRenderEngine.prototype._applyColor=function(e,t,n){var i=_GradientColorUtil.tryParse(t),a=this._canvas.getContext("2d");if(null!=i)if(wijmo_1.isString(i)||null==n)a[e]=i;else{var r;if(null!=i.x1)r=i.relative?a.createLinearGradient(n.x+i.x1*n.width,n.y+i.y1*n.height,n.x+i.x2*n.width,n.y+i.y2*n.height):a.createLinearGradient(i.x1,i.y1,i.x2,i.y2);else if(null!=i.r)if(i.relative){var s=n.x+i.cx*n.width,o=n.y+i.cy*n.height,l=i.r*n.width,h=i.r*n.height/l,p=n.x+(null==i.fx?i.cx:i.fx)*n.width,_=n.y+(null==i.fy?i.cy:i.fy)*n.height,f=(null==i.fr?0:i.fr)*n.width,g=(null==i.fr?0:i.fr)*n.height,y=Math.min(f,g);r=a.createRadialGradient(p,_/h,y,s,o/h,l);a.setTransform(1,0,0,h,0,0)}else r=a.createRadialGradient(null==i.fx?i.cx:i.fx,null==i.fy?i.cy:i.fy,i.fr||0,i.cx,i.cy,i.r);i.colors&&i.colors.length>0&&null!=r&&i.colors.forEach((function(e){var t=new wijmo_1.Color("#000000");null!=e.color&&(t=e.color);null!=e.opacity&&(t.a=e.opacity);r.addColorStop(e.offset,t.toString())}));a[e]=r}};return _CanvasRenderEngine}();exports._CanvasRenderEngine=_CanvasRenderEngine;var _GradientColorUtil=function(){function _GradientColorUtil(){}_GradientColorUtil.tryParse=function(e){if(_GradientColorUtil.parsedColor[e])return _GradientColorUtil.parsedColor[e];if(null==e||-1===e.indexOf("-"))return e;var t,n=e.replace(/\s+/g,"").split(/-/g),i=n[0][0],a=!1,r=n[0].match(/\(\S+\)/)[0].replace(/[(\\)]/g,"").split(/,/g);if("l"===i||"L"===i){t={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]};"l"===i&&(a=!0);["x1","y1","x2","y2"].forEach((function(e,n){null!=r[n]&&(t[e]=+r[n])}))}else if("r"===i||"R"===i){t={cx:"0",cy:"0",r:"0",colors:[]};"r"===i&&(a=!0);["cx","cy","r","fx","fy","fr"].forEach((function(e,n){null!=r[n]&&""!==r[n]&&(t[e]=+r[n])}))}t.relative=a;_GradientColorUtil.parsedColor[e]=t;var s=n.length-1;n.forEach((function(e,n){e.indexOf(")")>-1&&(e=e.match(/\)\S+/)[0].replace(")",""));var i=e.split(":"),a={color:new wijmo_1.Color("#000000")};null!=i[0]&&(a.color=wijmo_1.Color.fromString(i[0]));null!=i[1]?a.offset=+i[1]:a.offset=n/s;null!=i[2]&&(a.opacity=+i[2]);t.colors.push(a)}));return t};_GradientColorUtil.parsedColor={};return _GradientColorUtil}();if(wijmo_chart_1.FlexChartBase&&wijmo_chart_1.FlexChartBase.prototype&&wijmo_chart_1.FlexChartBase.prototype._exportToImage&&wijmo_1.isIE()){var _exportFn_1=wijmo_chart_1.FlexChartBase.prototype._exportToImage;wijmo_chart_1.FlexChartBase.prototype._exportToImage=function(e,t){if("svg"!==e){var n=this._bgColor(this.hostElement);this._isTransparent(n)&&(n="#ffffff");var i,a,r=new _CanvasRenderEngine(this.hostElement,!0);this._render(r,!1,n);i=(a=r.element).toDataURL("image/"+e);a.parentNode.removeChild(a);t.call(null,i);a=null;r=null}else _exportFn_1.call(this,e,t)}}wijmo_1._registerModule("wijmo.chart.render",selfModule);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@grapecity/wijmo.chart.render",
3
- "version": "5.20252.42",
3
+ "version": "5.20261.48",
4
4
  "description": "UI library for pure JS, Angular, React, Vue and more...",
5
5
  "author": "MESCIUS inc",
6
6
  "license": "Commercial",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "dependencies": {
10
- "@grapecity/wijmo": "5.20252.42",
11
- "@grapecity/wijmo.chart": "5.20252.42"
10
+ "@grapecity/wijmo": "5.20261.48",
11
+ "@grapecity/wijmo.chart": "5.20261.48"
12
12
  },
13
13
  "homepage": "https://developer.mescius.com/wijmo",
14
14
  "bugs": {