dchart-core
Advanced tools
Comparing version 2.6.38 to 2.6.39
{ | ||
"name": "dchart-core", | ||
"version": "2.6.38", | ||
"version": "2.6.39", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -1,1 +0,1 @@ | ||
"use strict";function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var DataV=require("../datav"),d3=require("d3"),_=require("../util"),SERIES_INDEX=_.SERIES_INDEX,interactionHandlerSelector=_.interactionHandlerSelector;function Pie(t,e){var r={arc:{startAngle:function(t){return t.startAngle},endAngle:function(t){return t.endAngle},net:!1,netColor:"#aaa"},pyaxis:{key:"y"},color:"#fff",paxis:null,defaultColor:"#1F6086",colors:[]};r=_.deepMerge(r,e),DataV.call(this,t,r)}Pie=DataV.extend(Pie,{data:function(t){null!=t&&(this._data=t);var e=this.options.pyaxis.key;return this._data.forEach(function(t){var r=t[e];r.value=_.toNumber(r.value)}),this._data},beforeRender:function(){var t=this.options;t.arc.radius?t.arc._radius=t.arc.radius:t.arc._radius=Math.min(t.innerHeight,t.innerWidth)/2;var e=this;this.dealColor(t,"defaultColor"),t.colors&&t.colors.length&&t.colors.forEach(function(r,a){e.dealColor(t.colors,"["+a+"]")})},updateBeforeRender:function(){Pie.prototype.beforeRender.call(this)},changeSeries:function(){var t=this,e=this.options,r=this.data(),a=d3.layout.pie().sort(null).value(function(t){var r=t[e.pyaxis.key];return _.isObject(r)&&r.hasOwnProperty("value")&&(r=r.value),"string"==typeof r?_.toNumber(r):r||0}),i=this.getComs("arc","arc").getArc(),n=this._pieData=a(r);n.forEach(function(t){return Object.assign(t,t.data)});var s=this.pies.attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".serie").data(n),l=this.labels.attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".serie-label").data(n),o=function(t){if(!e.paxis._dr)return"translate("+i.centroid(t)+")";var r=e.paxis._dr,a=(t.startAngle+t.endAngle)/2;return"translate("+r*Math.sin(a)+", "+-r*Math.cos(a)+")"},c=function(t,r){return"function"==typeof e.paxis.label?e.paxis.label.call(t,t.data,r):e.paxis.label&&e.paxis.label.length?e.paxis.label[r]:t.data[e.paxis.key]};s.enter().append("path").attr(_defineProperty({class:interactionHandlerSelector+" serie serie1"},SERIES_INDEX,function(t,e){return e})),l.enter().append("text").attr({class:"serie-label",dy:".35em"}).style("text-anchor","middle");var u=function(){t.pies.selectAll(".serie").each(function(t,r){var a=d3.select(this);(function(t,r){var a=e.isFirst,n=e.animationAfterPreviousSeries,s=e.animationDuration,l=e.animationDurationUpdate,o=e.animationEasing;e.animation?this.transition().duration(e.isFirst?s:l).ease(o).delay(n?l*r:0).attrTween("d",function(){this._cur=this._cur||t;var n=d3.interpolate(getAnimationStartInfo(a,e,this._cur,t),t);return this._cur=t,function(t){return i(n(t),r)}}):this.attr({d:i(t,r)}),this.style({fill:e.colors[r]&&e.colors[r].res||e.defaultColor.res||"#fff"})}).call(a,t,r)}),t.labels.selectAll(".serie-label").each(function(t,r){var a=d3.select(this);(function(t,r){var a=e.isFirst,i=e.animationDuration,n=e.animationEasing,s=e.animationDurationUpdate,l=e.animationAfterPreviousSeries;e.animation?e.paxis&&(this.attr("transform",o.bind(null,t)).html(c.bind(null,t,r)),this.html(c.bind(null,t,r)).transition().duration(a?i:s).ease(n).delay(l?s*r:0).attrTween("transform",function(){this._cur=this._cur||t;var r=d3.interpolate(getAnimationStartInfo(a,e,this._cur,t),t);return this._cur=t,function(t){return o(r(t))}})):e.paxis&&this.attr("transform",o.bind(null,t)).html(c.bind(null,t,r))}).call(a,t,r)})};u(),this.addResumeTween(u),s.exit().remove(),l.exit().remove();var d=this.svg.select(".net-g");if(e.arc.net){d[0][0]||(d=this.svg.insert("g",".series").attr("class","net-g"));var h=this._calNet(e.arc._radius),f=d.style("display","block").attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".net-path").data(h);f.enter().append("circle").attr({class:"net-path",cx:0,cy:0}),f.exit().remove(),f.attr({r:function(t){return t}}).style({stroke:e.arc.netColor,fill:"none","stroke-dasharray":"4 4"})}else d[0][0]&&d.style("display","none")},_calNet:function(t){return _.isNumber(t)?[t/4,t/2,t/4*3,t]:[]},renderSeries:function(){this.svg.classed("pie-chart-g",!0);var t=this.options;this.renderCom("arc","arc",this.svg[0][0],t.arc).getArc();this.pies=this.series.append("g").attr("class","series-pies"),this.labels=this.series.append("g").attr("class","series-labels"),this.labels.style("pointer-events","none"),this.changeSeries()},updateSeries:function(){var t=this.options,e=this.data();this.getComs("arc","arc").update(e,t.arc),this.changeSeries()},getSelector:function(){return this.svg.select(".series").selectAll(".serie")},afterRender:function(){var t=this.options,e=this.getComs("tooltip","tooltip");e&&e.update(this.data(),t.tooltip,t),e&&e.updateEvent(this.getSelector.bind(this)),t.tooltip&&!t.tooltip.show&&e&&e.clearListeners()},updateAfterRender:function(){Pie.prototype.afterRender.call(this)}});var getAnimationStartInfo=function(t,e,r,a){var i=e.animationAllFromZero,n=e.animationUpdateFromPrevious,s={startAngle:0,endAngle:0},l={startAngle:a.startAngle,endAngle:a.startAngle};return t?i?s:l:n?r:i?s:l};module.exports=Pie; | ||
"use strict";function _defineProperty(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var DataV=require("../datav"),d3=require("d3"),_=require("../util"),SERIES_INDEX=_.SERIES_INDEX,interactionHandlerSelector=_.interactionHandlerSelector;function Pie(t,e){var r={arc:{startAngle:function(t){return t.startAngle},endAngle:function(t){return t.endAngle},net:!1,netColor:"#aaa"},pyaxis:{key:"y"},color:"#fff",paxis:null,defaultColor:"#1F6086",colors:[]};r=_.deepMerge(r,e),DataV.call(this,t,r)}Pie=DataV.extend(Pie,{data:function(t){null!=t&&(this._data=t);var e=this.options.pyaxis.key;return this._data.forEach(function(t){var r=t[e];r.value=_.toNumber(r.value)}),this._data},beforeRender:function(){var t=this.options;t.arc.radius?t.arc._radius=t.arc.radius:t.arc._radius=Math.min(t.innerHeight,t.innerWidth)/2;var e=this;this.dealColor(t,"defaultColor"),t.colors&&t.colors.length&&t.colors.forEach(function(r,a){e.dealColor(t.colors,"["+a+"]")})},updateBeforeRender:function(){Pie.prototype.beforeRender.call(this)},changeSeries:function(){var t=this,e=this.options,r=this.data(),a=_.sum(r.map(function(t){return t.y.hasOwnProperty("value")?t.y.value:t.y})),i=d3.layout.pie().sort(null).value(function(t){if(!a)return 1;var r=t[e.pyaxis.key];return _.isObject(r)&&r.hasOwnProperty("value")&&(r=r.value),"string"==typeof r?_.toNumber(r):r||0}),n=this.getComs("arc","arc").getArc(),s=this._pieData=i(r);s.forEach(function(t){return Object.assign(t,t.data)});var l=this.pies.attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".serie").data(s),o=this.labels.attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".serie-label").data(s),c=function(t){if(!e.paxis._dr)return"translate("+n.centroid(t)+")";var r=e.paxis._dr,a=(t.startAngle+t.endAngle)/2;return"translate("+r*Math.sin(a)+", "+-r*Math.cos(a)+")"},u=function(t,r){return"function"==typeof e.paxis.label?e.paxis.label.call(t,t.data,r):e.paxis.label&&e.paxis.label.length?e.paxis.label[r]:t.data[e.paxis.key]};l.enter().append("path").attr(_defineProperty({class:interactionHandlerSelector+" serie serie1"},SERIES_INDEX,function(t,e){return e})),o.enter().append("text").attr({class:"serie-label",dy:".35em"}).style("text-anchor","middle");var d=function(){t.pies.selectAll(".serie").each(function(t,r){var a=d3.select(this);(function(t,r){var a=e.isFirst,i=e.animationAfterPreviousSeries,s=e.animationDuration,l=e.animationDurationUpdate,o=e.animationEasing;e.animation?this.transition().duration(e.isFirst?s:l).ease(o).delay(i?l*r:0).attrTween("d",function(){this._cur=this._cur||t;var i=d3.interpolate(getAnimationStartInfo(a,e,this._cur,t),t);return this._cur=t,function(t){return n(i(t),r)}}):this.attr({d:n(t,r)}),this.style({fill:e.colors[r]&&e.colors[r].res||e.defaultColor.res||"#fff"})}).call(a,t,r)}),t.labels.selectAll(".serie-label").each(function(t,r){var a=d3.select(this);(function(t,r){var a=e.isFirst,i=e.animationDuration,n=e.animationEasing,s=e.animationDurationUpdate,l=e.animationAfterPreviousSeries;e.animation?e.paxis&&(this.attr("transform",c.bind(null,t)).html(u.bind(null,t,r)),this.html(u.bind(null,t,r)).transition().duration(a?i:s).ease(n).delay(l?s*r:0).attrTween("transform",function(){this._cur=this._cur||t;var r=d3.interpolate(getAnimationStartInfo(a,e,this._cur,t),t);return this._cur=t,function(t){return c(r(t))}})):e.paxis&&this.attr("transform",c.bind(null,t)).html(u.bind(null,t,r))}).call(a,t,r)})};d(),this.addResumeTween(d),l.exit().remove(),o.exit().remove();var h=this.svg.select(".net-g");if(e.arc.net){h[0][0]||(h=this.svg.insert("g",".series").attr("class","net-g"));var f=this._calNet(e.arc._radius),p=h.style("display","block").attr("transform","translate("+e.innerWidth/2+","+e.innerHeight/2+")").selectAll(".net-path").data(f);p.enter().append("circle").attr({class:"net-path",cx:0,cy:0}),p.exit().remove(),p.attr({r:function(t){return t}}).style({stroke:e.arc.netColor,fill:"none","stroke-dasharray":"4 4"})}else h[0][0]&&h.style("display","none")},_calNet:function(t){return _.isNumber(t)?[t/4,t/2,t/4*3,t]:[]},renderSeries:function(){this.svg.classed("pie-chart-g",!0);var t=this.options;this.renderCom("arc","arc",this.svg[0][0],t.arc).getArc();this.pies=this.series.append("g").attr("class","series-pies"),this.labels=this.series.append("g").attr("class","series-labels"),this.labels.style("pointer-events","none"),this.changeSeries()},updateSeries:function(){var t=this.options,e=this.data();this.getComs("arc","arc").update(e,t.arc),this.changeSeries()},getSelector:function(){return this.svg.select(".series").selectAll(".serie")},afterRender:function(){var t=this.options,e=this.getComs("tooltip","tooltip");e&&e.update(this.data(),t.tooltip,t),e&&e.updateEvent(this.getSelector.bind(this)),t.tooltip&&!t.tooltip.show&&e&&e.clearListeners()},updateAfterRender:function(){Pie.prototype.afterRender.call(this)}});var getAnimationStartInfo=function(t,e,r,a){var i=e.animationAllFromZero,n=e.animationUpdateFromPrevious,s={startAngle:0,endAngle:0},l={startAngle:a.startAngle,endAngle:a.startAngle};return t?i?s:l:n?r:i?s:l};module.exports=Pie; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
149918
2