dchart-core
Advanced tools
Comparing version 2.8.4 to 2.8.5
@@ -1,1 +0,1 @@ | ||
"use strict";function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var i=[],n=!0,s=!1,a=void 0;try{for(var r,o=t[Symbol.iterator]();!(n=(r=o.next()).done)&&(i.push(r.value),!e||i.length!==e);n=!0);}catch(t){s=!0,a=t}finally{try{n||null==o.return||o.return()}finally{if(s)throw a}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}var _=require("../util"),Com=require("./index"),d3=require("d3"),numberUtil=require("../util/number"),TICK_PADDING=2,MAX_TICK_COUNT=30,ONE_SECOND=1e3,timeUnitsMSMap={seconds:ONE_SECOND,minutes:60*ONE_SECOND,hours:60*ONE_SECOND*60,days:60*ONE_SECOND*60*24,months:60*ONE_SECOND*60*24*30,years:60*ONE_SECOND*60*24*30*12};function Axis(t,e,i){this.reset(),this.options={fontSize:12,fontColor:"#fff",fontWeight:"normal",fontStrokeWidth:0,key:"x",type:"defaults",orient:null,dy:0,padding:.4,groupPadding:[.4,.4],assistLine:!0,assistLineColor:"#fff",rotate:0,min:null,max:null,maxLabel:!1,tickSize:0,tickValues:null,tickFormat:null,ticks:null,nondecile:{key:"y",tickPadding:10},format:"%Y-%m-%d",label:null,labelColor:"#aaa",labelInAxis:!0,labelFontSize:12,labelFontWeight:"normal",labelFontStrokeWidth:0,textAnchor:"middle",textShow:!0,net:!1,netColor:"#aaa",digit:0,show:!0},this.x=null,this.axisx=null,this.groupX=null,this.net=null,this.init(t,e,i),this._valid()}function getStep(t){var e=t.step,i=t.f,n=t.maxNeedNice,s=t.tickFormat,a="string"==typeof s?(s.split(".")[1]||"0f").split("f")[0]:0;return e=n?i(Math.ceil(Math.pow(10,a)*e)/Math.pow(10,a)):i(10*e)/10}function isTicksOverlap(t,e){if(t&&e&&t.getBoundingClientRect&&e.getBoundingClientRect){var i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.left+i.width+TICK_PADDING>n.left&&n.left+n.width+TICK_PADDING>i.left&&i.top+i.height+TICK_PADDING>n.top&&n.top+n.height+TICK_PADDING>i.top}return!1}function removeOverlapTicksOfTargetAxis(t,e){return new Promise((function(i,n){if(!t)return i();var s=t.selectAll(".tick")[0],a=[];if(e.maxLabel)for(var r=s.length-1;r>=0;r--){var o=s[r],l=s[r-1];if(o&&l&&o.getBoundingClientRect&&l.getBoundingClientRect)for(;isTicksOverlap(o,l)&&(d3.select(l).remove(),l=s[--r-1]););}else for(r=0;r<s.length;r++){var h=s[r],c=s[r+1];if(h&&c&&h.getBoundingClientRect&&c.getBoundingClientRect)for(;isTicksOverlap(h,c)&&(d3.select(c).remove(),c=s[++r+1]););}return t.selectAll(".tick")[0].forEach((function(t){a.push(t.__data__)})),i(a)}))}Axis=Com.extend(Axis,{init:function(t,e,i){if(!t&&!this.el)return!1;t&&(this.elContainer=d3.select(t)),this.options&&_.toLower(this.options.type)!==_.toLower(e.type)?this.isReset=!0:this.isReset=!1,this.options=_.deepMerge(this.options,e),this.alloptions=i||this.alloptions},_valid:function(){var t=this.options,e=["defaults","category","time","nondecile"];-1===_.indexOf(e,t.type.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.type+" in types.",t.type=e[0],this.valid=!1),t.type=_.initialUpperCase(t.type);var i=["left","top","right","bottom"];-1===_.indexOf(i,t.orient.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.orient+" in orients.",t.orient=i[0],this.valid=!1),t.orient=_.initialUpperCase(t.orient)},renderSeries:function(){var t=this.options;this["cal"+t.orient](),this.__el||(this.__el=this.elContainer.append("g").attr({class:"virtual_axis",opacity:0}).call(this.axisx)),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".tick line").style("display",t.net?"block":"none"),this.isReset=!1},cut:function(t,e,i){var n=_slicedToArray(t,2),s=n[0],a=n[1],r=d3.format(i),o=this.options.maxNeedNice,l=((a=+a||0)-(s=+s||0))/(e-1);l=getStep({step:l,f:r,maxNeedNice:o,tickFormat:i}),t=[],+s==+r(s)&&t.push(s);for(var h=0;h<e-1;h++){var c=r(s+l*(h+1));(c<=a||o)&&t.push(c)}var d=(t=(t=_.uniq(t.map((function(t){return+t})).sort((function(t,e){return t-e})))).filter((function(t){return t<=(o?2*a:a)}))).length-e,u=r(a),f=r(s);return d>0?t.splice(e-1,t.length-e):0===d?t[t.length-1]<u&&(t[t.length-1]=u):d<0&&(t.push(u),t.push(f)),t},format:function(){var t=this,e=this.options,i=this.axisx,n=this.x;i.tickPadding(e.dy),"object"===_typeof(e.tickSize)?i.tickSize.apply(this,e.tickSize):i.tickSize(e.tickSize),e.tickValues&&i.tickValues(e.tickValues);var s=!1;if(e.ticks){if("Category"===e.type&&_.isNumber(e.ticks)){var a=this._data;e.tickFormat=function(t,i){var n=_.toNumber(e.ticks),s=a.length,r=parseInt((s-1)/(n-1));if(0===r)return t;var o=(s-1)%(n-1),l=parseInt(o%2&&o/2+1||o/2);return i<l?"":s-i<=o-l?"":(i-l)%r?"":t},i.ticks.apply(this,[e.ticks])}else if("array"==typeof e.ticks)i.ticks.apply(this,e.ticks);else if(_.isNumber(e.ticks))if("Time"!==e.type)if(e.ticks=_.toNumber(e.ticks),"string"==typeof e.tickFormat){var r=_.clone(n.domain());switch(e.ticks){case 0:i.tickValues([r[0]]);break;case 1:i.tickValues([r[1]]);break;default:if(e.tickFormat){var o=_slicedToArray(r,2),l=o[0],h=o[1];if(r=this.cut(r,e.ticks,e.tickFormat),"defaults"===e.type.toLocaleLowerCase()){var c=+d3.format(e.tickFormat)(h),d=+d3.format(e.tickFormat)(l);r=r.filter((function(t){return+t==+d3.format(e.tickFormat)(t)&&t<=c&&t>=d}))}}i.tickValues(r)}setTimeout((function(){var e=t.el&&t.el.selectAll(".tick")[0];if(e&&e.length>1){var i=e[e.length-2];isTicksOverlap(i,e[e.length-1])&&d3.select(i).remove()}}),0)}else i.ticks(e.ticks),s=!0;else{var u=_slicedToArray(this._getTimeAxisExtent(),2),f=(u[0],u[1]),p=Math.min(MAX_TICK_COUNT,e.ticks);i.ticks(p),e.maxLabel&&i.tickValues([].concat(_toConsumableArray(i.scale().ticks()),[f])),s=!0}}else if(_.isNumber(e.ticks)&&"time"===e.type.toLowerCase()){var m=5*e.tickFormat(new Date).length+5,g=Math.min(e.innerWidth/m||10,MAX_TICK_COUNT);if(this._data.length<g){var y=e.tickFormat;"function"!=typeof y&&(y=d3.format(y));var x=d3.time.format(e.format),k=[],v=[],b=e.key;this._data.map((function(t){var e=x.parse(t[b]);-1===v.indexOf(y(e))&&(v.push(y(e)),k.push(e))})),i.tickValues(k)}else i.ticks(g);s=!0}if("string"==typeof e.tickFormat)i.tickFormat(d3.format(e.tickFormat));else if("function"==typeof e.tickFormat){var A=this;i.tickFormat((function(t,i){return e.tickFormat.call(A._data[i],t,i)}))}s?setTimeout((function(){removeOverlapTicksOfTargetAxis(t.__el,e).then((function(s){if(s&&s.length){var a=d3.svg.axis().scale(n).orient(i.orient()).tickPadding(e.dy).tickFormat(i.tickFormat()).tickValues(s).tickSize(0);t.el.call(a),t.renderStyle()}}))}),0):this.el&&this.el.call(i)},_afterAxis:function(){var t=this.options;"function"==typeof t._afterAxis&&t._afterAxis.call(this)},renderLabel:function(){var t=this.options,e=this.alloptions;if(t.label){if(t.labelInAxis){var i=this.el.select(".axis-unit")[0][0]&&this.el.select(".axis-unit")||this.el.append("g").attr({class:"axis-unit"}),n=this.el.selectAll(".tick:nth-last-child(3)").select("text");n&&n.length&&n[0].length&&("Left"===t.orient||"Right"===t.orient?i.attr("transform","translate(0,"+-1.5*parseInt(n.style("font-size"))+")"):i.attr("transform","translate("+((t.innerWidth||e.innerWidth)+3*parseInt(n.style("font-size")))+", 0)"),(i.select("text")[0][0]&&i.select("text")||i.append("text")).attr({dy:n.attr("dy"),x:n.attr("x"),y:n.attr("y"),transform:n.attr("transform")}).text(t.label).style({"text-anchor":n.style("text-anchor"),"font-size":n.style("font-size"),"font-weight":n.style("font-weight"),fill:n.style("fill")}))}}else this.el.select(".axis-unit").remove()},calLeft:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),n=this.axisx=d3.svg.axis().scale(i).orient("left");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.call(n):this.el=this.elContainer.append("g").attr("class","axis").call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:t.innerWidth||e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateLeft:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),this.format(),this._afterAxis(),this.__el&&this.__el.call(this.axisx),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:t.innerWidth||e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calRight:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),n=this.axisx=d3.svg.axis().scale(i).orient("right");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate("+(t.innerWidth||e.innerWidth)+", 0)"}).call(n):this.el=this.elContainer.append("g").attr({class:"axis",transform:"translate("+(t.innerWidth||e.innerWidth)+", 0)"}).call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:-t.innerWidth||-e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateRight:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),this.format(),this._afterAxis(),this.__el&&this.__el.attr("transform","translate("+(t.innerWidth||e.innerWidth)+", 0)").call(this.axisx),this.el.attr("transform","translate("+(t.innerWidth||e.innerWidth)+", 0)"),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:-t.innerWidth||-e.innerWidth,y2:"0"}).style({stroke:t.netColor})},calTop:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),n=this.axisx=d3.svg.axis().scale(i).orient("top");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.call(n):this.el=this.elContainer.append("g").attr("class","axis").call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:t.innerHeight||e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateTop:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),this.format(),this._afterAxis(),this.__el&&this.__el.call(this.axisx),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:t.innerHeight||e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calBottom:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),n=this.axisx=d3.svg.axis().scale(i).orient("bottom");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate(0,"+(t.innerHeight||e.innerHeight)+")"}).call(n):this.el=this.elContainer.append("g").attr({class:"axis",transform:"translate(0,"+(t.innerHeight||e.innerHeight)+")"}).call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:-t.innerHeight||-e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateBottom:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),this.format(),this._afterAxis(),this.__el&&this.__el.attr("transform","translate(0,"+(t.innerHeight||e.innerHeight)+")").call(this.axisx),this.el.attr("transform","translate(0,"+(t.innerHeight||e.innerHeight)+")"),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:-t.innerHeight||-e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},niceExtent:function(t,e){var i=this.options,n=Math.abs(e[1]-e[0]);t<=1&&(t=2);var s=numberUtil.nice(n/t,!0),a=numberUtil.getPrecisionSafe(s)+2,r=[i.minNeedNice?numberUtil.round(Math.floor(e[0]/s)*s,a):e[0],i.maxNeedNice?numberUtil.round(Math.ceil(e[1]/s)*s,a):e[1]];return _.toNumber(r[0])>_.toNumber(r[1])&&_.reverse(r),"defaults"===i.type.toLocaleLowerCase()&&i.tickFormat&&(r=d3.extent(this.cut(r,i.ticks,i.tickFormat).concat(r[0],r[1]))),r},axisDefaults:function(t){var e=this.x=d3.scale.linear().range(t),i=this.calExtent(),n=this.options,s=this.niceExtent(n.ticks,i);return e.domain(s),e},updateAxisDefaults:function(t){this.x.range(t);var e=this.calExtent(),i=this.options,n=this.niceExtent(i.ticks,e);return this.x.domain(n),this.x},axisCategory:function(t){var e,i=this.options;e=_.isArray(i.padding)?this.x=d3.scale.ordinal().rangeBands(t,i.padding[0],i.padding[1]):this.x=d3.scale.ordinal().rangeBands(t,i.padding/2,i.padding);var n=this.calExtent();return e.domain(n),e},updateAxisCategory:function(t){var e=this.options;return _.isArray(e.padding)?this.x.rangeBands(t,e.padding[0],e.padding[1]):this.x.rangeBands(t,e.padding/2,e.padding),this.x.domain(this.calExtent()),this.x},_setTimeAxisBoundaryGap:function(t){var e=this.options.blank?this.options.blankDis:0;if(e&&this._data&&this._data.length){var i=(+t[1]-t[0])/this._data.length,n=parseInt(i*e);t=[new Date(+t[0]-n),new Date(+t[1]+n)]}return t},_getTimeAxisExtent:function(){var t=this.options,e=d3.time.format(t.format),i=t.min,n=t.max,s=[i=i||"auto",n=n||"auto"],a=e.parse(i),r=e.parse(n),o=_.isDate(a),l=_.isDate(r);if(l&&o)s[0]=a,s[1]=r;else{var h=t.key,c=this._data.map((function(t){var i=t[h];return _.isDate(i)?+i:_.isString(i)?+e.parse(i):(console.log("date error: "+i+"is not a Date"),null)})),d=new Date(_.min(c)),u=new Date(_.max(c));s[0]=o?a:d,s[1]=l?r:u}return+(s=this._setTimeAxisBoundaryGap(s))[0]==+s[1]&&(s[1]=new Date(+s[1]+ONE_SECOND)),s},axisTime:function(t){var e=this._getTimeAxisExtent();return this.x=d3.time.scale().range(t).domain(e),this.x},updateAxisTime:function(t){var e=this._getTimeAxisExtent(),i=_.cloneDeep(this.x.domain());return+i[0]==+e[0]&&+i[1]==+e[1]||(this.__domain=i),this.x.range(t).domain(e),this.x},axisNondecile:function(t){var e=this.options,i=this.x=d3.scale.linear().range(t);e.max=_.sum(this._data,e.nondecile.key),i.domain(this.calExtent());var n=_.groupBy(this._data,e.key),s=this._data=[],a=0,r=s.length,o=(t[1]-t[0])/(i.domain()[1]-i.domain()[0]);for(var l in n){var h={sum:_.sum(n[l],e.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[e.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,e.nondecile.tickPadding&&0!==h.begin&&(h.begin=(i(h.begin)-e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),e.nondecile.tickPadding&&0!==r&&(h.end=(i(h.end)+e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),h.radio=(h.end-h.begin)/h.sum,s.push(h)}return e._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center"))},e.afterRender=function(){this.el.selectAll(".tick").data(this._data)},i},updateAxisNondecile:function(t){var e=this.options,i=this.x.range(t);e.max=_.sum(this._data,e.nondecile.key),i.domain(this.calExtent());var n=_.groupBy(this._data,e.key),s=this._data=[],a=0,r=s.length,o=(t[1]-t[0])/(i.domain()[1]-i.domain()[0]);for(var l in n){var h={sum:_.sum(n[l],e.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[e.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,e.nondecile.tickPadding&&0!==h.begin&&(h.begin=(i(h.begin)-e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),e.nondecile.tickPadding&&0!==r&&(h.end=(i(h.end)+e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),h.radio=(h.end-h.begin)/h.sum,s.push(h)}return i.domain(this.calExtent()),e._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center")),this.el&&this.el.selectAll(".tick").data(_.pluck(this._data,"center"))},i},calExtent:function(){var t=this,e=this.options,i=[];if("category"!==e.type.toLocaleLowerCase()){var n=[];this._data.forEach((function(i){var s=i[e.key];_.isArray(s)?("defaults"===e.type.toLocaleLowerCase()&&(s=_.map(s,(function(e){return _.toNumber(t._getValue(e))}))),n=_.union(n,s)):("defaults"===e.type.toLocaleLowerCase()&&(s=_.toNumber(t._getValue(s))),n.push(s))})),i=d3.extent(n),isFinite(e.min)&&null!==e.min&&(i[0]=e.min),i[1]=e.max||i[1]}else i=_.map(this._data,(function(i){return t._getValue(i[e.key])}));return i},_getValue:function(t){return _.isObject(t)&&t.hasOwnProperty("value")?t.value:t},getX:function(){return this.x},getAxisX:function(){return this.axisx},getMin:function(){return _.first(this.x.domain())},getMax:function(){return _.last(this.x.domain())},calGroupStep:function(t){var e=this.options.groupPadding;return Array.isArray(e)?this.groupX=d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e[0])?e[0]:.4,_.isNumber(e[1])?e[1]:0):this.groupX=d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e)?e:.4),Array.isArray(t)||(t=this._createCategory(parseInt(t))),this.groupX.domain(t),this.groupX},getGroupStep:function(t){return this.groupX?this.groupX.rangeBand():(this.calGroupStep(t),this.groupX.rangeBand())},_createCategory:function(t){for(var e=[],i=0;i<t;i++)e.push(""+i);return e},getGroupX:function(){return this.groupX},updateSeries:function(){var t=this.options;this.el.selectAll(".net-line").remove(),this.isReset&&this["cal"+t.orient]()||this["update"+t.orient](),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".net-line").style("display",t.net?"block":"none"),this.isReset=!1},renderStyle:function(){var t=this.options,e=this.el.selectAll(".tick text").style({fill:t.fontColor,"font-size":t.fontSize,"font-weight":t.fontWeight,"stroke-width":0,display:t.textShow?"block":"none"});t.fontStrokeWidth&&e.style({stroke:t.fontColor,"stroke-width":t.fontStrokeWidth}),t.rotate&&_.isNumber(t.rotate)?e.each((function(e){var i=d3.select(this),n=_.toNumber(i.attr("x")),s=_.toNumber(i.attr("y")),a=t.rotate/360*2*Math.PI;i.attr("transform",(("Top"===t.orient||"Bottom"===t.orient)&&"translate(0 "+.5*Math.sin(a)*t.fontSize*("Bottom"===t.orient?.01:-1.99)+")"||"")+" rotate("+t.rotate+" "+n+" "+s+")").style({"text-anchor":"start"})})):e.attr("transform","none"),this.el.selectAll(".domain, .tick line:not(.net-line)").style({display:t.assistLine?"block":"none",fill:"none",stroke:t.assistLineColor}),this.el.style("display",t.show?"block":"none")}}),module.exports=Axis; | ||
"use strict";function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,i=new Array(t.length);e<t.length;e++)i[e]=t[e];return i}}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var i=[],n=!0,s=!1,a=void 0;try{for(var r,o=t[Symbol.iterator]();!(n=(r=o.next()).done)&&(i.push(r.value),!e||i.length!==e);n=!0);}catch(t){s=!0,a=t}finally{try{n||null==o.return||o.return()}finally{if(s)throw a}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}var _=require("../util"),Com=require("./index"),d3=require("d3"),numberUtil=require("../util/number"),TICK_PADDING=2,MAX_TICK_COUNT=30,ONE_SECOND=1e3,timeUnitsMSMap={seconds:ONE_SECOND,minutes:60*ONE_SECOND,hours:60*ONE_SECOND*60,days:60*ONE_SECOND*60*24,months:60*ONE_SECOND*60*24*30,years:60*ONE_SECOND*60*24*30*12};function Axis(t,e,i){this.reset(),this.options={fontSize:12,fontColor:"#fff",fontWeight:"normal",fontStrokeWidth:0,key:"x",type:"defaults",orient:null,dy:0,padding:.4,groupPadding:[.4,.4],assistLine:!0,assistLineColor:"#fff",rotate:0,min:null,max:null,maxLabel:!1,tickSize:0,tickValues:null,tickFormat:null,ticks:null,nondecile:{key:"y",tickPadding:10},format:"%Y-%m-%d",label:null,labelColor:"#aaa",labelInAxis:!0,labelFontSize:12,labelFontWeight:"normal",labelFontStrokeWidth:0,textAnchor:"middle",textShow:!0,net:!1,netColor:"#aaa",digit:0,show:!0},this.x=null,this.axisx=null,this.groupX=null,this.net=null,this.init(t,e,i),this._valid()}function getStep(t){var e=t.step,i=t.f,n=t.maxNeedNice,s=t.tickFormat,a="string"==typeof s?(s.split(".")[1]||"0f").split("f")[0]:0;return e=n?i(Math.ceil(Math.pow(10,a)*e)/Math.pow(10,a)):i(10*e)/10}function isTicksOverlap(t,e){if(t&&e&&t.getBoundingClientRect&&e.getBoundingClientRect){var i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.left+i.width+TICK_PADDING>n.left&&n.left+n.width+TICK_PADDING>i.left&&i.top+i.height+TICK_PADDING>n.top&&n.top+n.height+TICK_PADDING>i.top}return!1}function removeOverlapTicksOfTargetAxis(t,e){return new Promise((function(i,n){if(!t)return i();var s=t.selectAll(".tick")[0],a=[];if(e.maxLabel)for(var r=s.length-1;r>=0;r--){var o=s[r],l=s[r-1];if(o&&l&&o.getBoundingClientRect&&l.getBoundingClientRect)for(;isTicksOverlap(o,l)&&(d3.select(l).remove(),l=s[--r-1]););}else for(r=0;r<s.length;r++){var h=s[r],c=s[r+1];if(h&&c&&h.getBoundingClientRect&&c.getBoundingClientRect)for(;isTicksOverlap(h,c)&&(d3.select(c).remove(),c=s[++r+1]););}return t.selectAll(".tick")[0].forEach((function(t){a.push(t.__data__)})),i(a)}))}Axis=Com.extend(Axis,{init:function(t,e,i){if(!t&&!this.el)return!1;t&&(this.elContainer=d3.select(t)),this.options&&_.toLower(this.options.type)!==_.toLower(e.type)?this.isReset=!0:this.isReset=!1,this.options=_.deepMerge(this.options,e),this.alloptions=i||this.alloptions},_valid:function(){var t=this.options,e=["defaults","category","time","nondecile"];-1===_.indexOf(e,t.type.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.type+" in types.",t.type=e[0],this.valid=!1),t.type=_.initialUpperCase(t.type);var i=["left","top","right","bottom"];-1===_.indexOf(i,t.orient.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.orient+" in orients.",t.orient=i[0],this.valid=!1),t.orient=_.initialUpperCase(t.orient)},renderSeries:function(){var t=this.options;this["cal"+t.orient](),this.__el||(this.__el=this.elContainer.append("g").attr({class:"virtual_axis",opacity:0}).call(this.axisx)),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".tick line").style("display",t.net?"block":"none"),this.isReset=!1},cut:function(t,e,i){var n=_slicedToArray(t,2),s=n[0],a=n[1],r=d3.format(i),o=this.options.maxNeedNice,l=((a=+a||0)-(s=+s||0))/(e-1);l=getStep({step:l,f:r,maxNeedNice:o,tickFormat:i}),t=[],+s==+r(s)&&t.push(s);for(var h=0;h<e-1;h++){var c=r(s+l*(h+1));(c<=a||o)&&t.push(c)}var d=(t=(t=_.uniq(t.map((function(t){return+t})).sort((function(t,e){return t-e})))).filter((function(t){return t<=(o?2*a:a)}))).length-e,u=r(a),f=r(s);return d>0?t.splice(e-1,t.length-e):0===d?t[t.length-1]<u&&(t[t.length-1]=u):d<0&&(t.push(u),t.push(f)),t},format:function(){var t=this,e=this.options,i=this.axisx,n=this.x;i.tickPadding(e.dy),"object"===_typeof(e.tickSize)?i.tickSize.apply(this,e.tickSize):i.tickSize(e.tickSize),e.tickValues&&i.tickValues(e.tickValues);var s=!1;if(e.ticks){if("Category"===e.type&&_.isNumber(e.ticks)){var a=this._data;e.tickFormat=function(t,i){var n=_.toNumber(e.ticks),s=a.length,r=parseInt((s-1)/(n-1));if(0===r)return t;var o=(s-1)%(n-1),l=parseInt(o%2&&o/2+1||o/2);return i<l?"":s-i<=o-l?"":(i-l)%r?"":t},i.ticks.apply(this,[e.ticks])}else if("array"==typeof e.ticks)i.ticks.apply(this,e.ticks);else if(_.isNumber(e.ticks))if("Time"!==e.type)if(e.ticks=_.toNumber(e.ticks),"string"==typeof e.tickFormat){var r=_.clone(n.domain());switch(e.ticks){case 0:i.tickValues([r[0]]);break;case 1:i.tickValues([r[1]]);break;default:if(e.tickFormat){var o=_slicedToArray(r,2),l=o[0],h=o[1];if(r=this.cut(r,e.ticks,e.tickFormat),"defaults"===e.type.toLocaleLowerCase()){var c=+d3.format(e.tickFormat)(h),d=+d3.format(e.tickFormat)(l);r=r.filter((function(t){return+t==+d3.format(e.tickFormat)(t)&&t<=c&&t>=d}))}}i.tickValues(r)}setTimeout((function(){var e=t.el&&t.el.selectAll(".tick")[0];if(e&&e.length>1){var i=e[e.length-2];isTicksOverlap(i,e[e.length-1])&&d3.select(i).remove()}}),0)}else i.ticks(e.ticks),s=!0;else{var u=_slicedToArray(this._getTimeAxisExtent(),2),f=(u[0],u[1]),p=Math.min(MAX_TICK_COUNT,e.ticks);i.ticks(p),e.maxLabel&&i.tickValues([].concat(_toConsumableArray(i.scale().ticks()),[f])),s=!0}}else if(_.isNumber(e.ticks)&&"time"===e.type.toLowerCase()){var m=5*e.tickFormat(new Date).length+5,g=Math.min(e.innerWidth/m||10,MAX_TICK_COUNT);if(this._data.length<g){var y=e.tickFormat;"function"!=typeof y&&(y=d3.format(y));var x=d3.time.format(e.format),k=[],v=[],b=e.key;this._data.map((function(t){var e=x.parse(t[b]);-1===v.indexOf(y(e))&&(v.push(y(e)),k.push(e))})),i.tickValues(k)}else i.ticks(g);s=!0}if("string"==typeof e.tickFormat)i.tickFormat(d3.format(e.tickFormat));else if("function"==typeof e.tickFormat){var A=this;i.tickFormat((function(t,i){return e.tickFormat.call(A._data[i],t,i)}))}s?setTimeout((function(){removeOverlapTicksOfTargetAxis(t.__el,e).then((function(s){if(s&&s.length){var a=d3.svg.axis().scale(n).orient(i.orient()).tickPadding(e.dy).tickFormat(i.tickFormat()).tickValues(s).tickSize(0);t.el.call(a),t.renderStyle()}}))}),0):this.el&&this.el.call(i)},_afterAxis:function(){var t=this.options;"function"==typeof t._afterAxis&&t._afterAxis.call(this)},renderLabel:function(){var t=this.options,e=this.alloptions;if(t.label){if(t.labelInAxis){var i=this.el.select(".axis-unit")[0][0]&&this.el.select(".axis-unit")||this.el.append("g").attr({class:"axis-unit"}),n=this.el.selectAll(".tick:nth-last-child(3)").select("text");n&&n.length&&n[0].length&&("Left"===t.orient||"Right"===t.orient?i.attr("transform","translate(0,"+-1.5*parseInt(n.style("font-size"))+")"):i.attr("transform","translate("+((t.innerWidth||e.innerWidth)+3*parseInt(n.style("font-size")))+", 0)"),(i.select("text")[0][0]&&i.select("text")||i.append("text")).attr({dy:n.attr("dy"),x:n.attr("x"),y:n.attr("y"),transform:n.attr("transform")}).text(t.label).style({"text-anchor":n.style("text-anchor"),"font-size":n.style("font-size"),"font-weight":n.style("font-weight"),fill:n.style("fill")}))}}else this.el.select(".axis-unit").remove()},calLeft:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),n=this.axisx=d3.svg.axis().scale(i).orient("left");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.call(n):this.el=this.elContainer.append("g").attr("class","axis").call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:t.innerWidth||e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateLeft:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),this.format(),this._afterAxis(),this.__el&&this.__el.call(this.axisx),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:t.innerWidth||e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calRight:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),n=this.axisx=d3.svg.axis().scale(i).orient("right");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate("+(t.innerWidth||e.innerWidth)+", 0)"}).call(n):this.el=this.elContainer.append("g").attr({class:"axis",transform:"translate("+(t.innerWidth||e.innerWidth)+", 0)"}).call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:-t.innerWidth||-e.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateRight:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||e.innerHeight,0]),this.format(),this._afterAxis(),this.__el&&this.__el.attr("transform","translate("+(t.innerWidth||e.innerWidth)+", 0)").call(this.axisx),this.el.attr("transform","translate("+(t.innerWidth||e.innerWidth)+", 0)"),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",x2:-t.innerWidth||-e.innerWidth,y2:"0"}).style({stroke:t.netColor})},calTop:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),n=this.axisx=d3.svg.axis().scale(i).orient("top");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.call(n):this.el=this.elContainer.append("g").attr("class","axis").call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:t.innerHeight||e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateTop:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),this.format(),this._afterAxis(),this.__el&&this.__el.call(this.axisx),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:t.innerHeight||e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calBottom:function(){var t=this.options,e=this.alloptions,i=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),n=this.axisx=d3.svg.axis().scale(i).orient("bottom");this.format(),this._afterAxis(),this.el&&-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate(0,"+(t.innerHeight||e.innerHeight)+")"}).call(n):this.el=this.elContainer.append("g").attr({class:"axis",transform:"translate(0,"+(t.innerHeight||e.innerHeight)+")"}).call(n),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:-t.innerHeight||-e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateBottom:function(){var t=this.options,e=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||e.innerWidth]),this.format(),this._afterAxis(),this.__el&&this.__el.attr("transform","translate(0,"+(t.innerHeight||e.innerHeight)+")").call(this.axisx),this.el.attr("transform","translate(0,"+(t.innerHeight||e.innerHeight)+")"),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({class:"net-line",y2:-t.innerHeight||-e.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},niceExtent:function(t,e){var i=this.options,n=Math.abs(e[1]-e[0]);t<=1&&(t=2);var s=numberUtil.nice(n/t,!0),a=numberUtil.getPrecisionSafe(s)+2,r=[i.minNeedNice?numberUtil.round(Math.floor(e[0]/s)*s,a):e[0],i.maxNeedNice?numberUtil.round(Math.ceil(e[1]/s)*s,a):e[1]];return _.toNumber(r[0])>_.toNumber(r[1])&&_.reverse(r),"defaults"===i.type.toLocaleLowerCase()&&i.tickFormat&&(r=d3.extent(this.cut(r,i.ticks,i.tickFormat).concat(r[0],r[1]))),r},axisDefaults:function(t){var e=this.x=d3.scale.linear().range(t),i=this.calExtent(),n=this.options,s=this.niceExtent(n.ticks,i);return e.domain(s),e},updateAxisDefaults:function(t){this.x.range(t);var e=this.calExtent(),i=this.options,n=this.niceExtent(i.ticks,e);return this.x.domain(n),this.x},axisCategory:function(t){var e,i=this.options;e=_.isArray(i.padding)?this.x=d3.scale.ordinal().rangeBands(t,i.padding[0],i.padding[1]):this.x=d3.scale.ordinal().rangeBands(t,i.padding/2,i.padding);var n=this.calExtent();return e.domain(n),e},updateAxisCategory:function(t){var e=this.options;return _.isArray(e.padding)?this.x.rangeBands(t,e.padding[0],e.padding[1]):this.x.rangeBands(t,e.padding/2,e.padding),this.x.domain(this.calExtent()),this.x},_setTimeAxisBoundaryGap:function(t){var e=this.options.blank?this.options.blankDis:0;if(e&&this._data&&this._data.length){var i=(+t[1]-t[0])/this._data.length,n=parseInt(i*e);t=[new Date(+t[0]-n),new Date(+t[1]+n)]}return t},_getTimeAxisExtent:function(){var t=this.options,e=d3.time.format(t.format),i=t.min,n=t.max,s=[i=i||"auto",n=n||"auto"],a=e.parse(i),r=e.parse(n),o=_.isDate(a),l=_.isDate(r);if(l&&o)s[0]=a,s[1]=r;else{var h=t.key,c=this._data.map((function(t){var i=t[h];return _.isDate(i)?+i:_.isString(i)?+e.parse(i):(console.log("date error: "+i+"is not a Date"),null)})),d=new Date(_.min(c)),u=new Date(_.max(c));s[0]=o?a:d,s[1]=l?r:u}return+(s=this._setTimeAxisBoundaryGap(s))[0]==+s[1]&&(s[1]=new Date(+s[1]+ONE_SECOND)),s},axisTime:function(t){var e=this._getTimeAxisExtent();return this.x=d3.time.scale().range(t).domain(e),this.x},updateAxisTime:function(t){var e=this._getTimeAxisExtent(),i=_.cloneDeep(this.x.domain());return+i[0]==+e[0]&&+i[1]==+e[1]||(this.__domain=i),this.x.range(t).domain(e),this.x},axisNondecile:function(t){var e=this.options,i=this.x=d3.scale.linear().range(t);e.max=_.sum(this._data,e.nondecile.key),i.domain(this.calExtent());var n=_.groupBy(this._data,e.key),s=this._data=[],a=0,r=s.length,o=(t[1]-t[0])/(i.domain()[1]-i.domain()[0]);for(var l in n){var h={sum:_.sum(n[l],e.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[e.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,e.nondecile.tickPadding&&0!==h.begin&&(h.begin=(i(h.begin)-e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),e.nondecile.tickPadding&&0!==r&&(h.end=(i(h.end)+e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),h.radio=(h.end-h.begin)/h.sum,s.push(h)}return e._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center"))},e.afterRender=function(){this.el.selectAll(".tick").data(this._data)},i},updateAxisNondecile:function(t){var e=this.options,i=this.x.range(t);e.max=_.sum(this._data,e.nondecile.key),i.domain(this.calExtent());var n=_.groupBy(this._data,e.key),s=this._data=[],a=0,r=s.length,o=(t[1]-t[0])/(i.domain()[1]-i.domain()[0]);for(var l in n){var h={sum:_.sum(n[l],e.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[e.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,e.nondecile.tickPadding&&0!==h.begin&&(h.begin=(i(h.begin)-e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),e.nondecile.tickPadding&&0!==r&&(h.end=(i(h.end)+e.nondecile.tickPadding/2-t[0])/o+i.domain()[0]),h.radio=(h.end-h.begin)/h.sum,s.push(h)}return i.domain(this.calExtent()),e._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center")),this.el&&this.el.selectAll(".tick").data(_.pluck(this._data,"center"))},i},calExtent:function(){var t=this,e=this.options,i=[];if("category"!==e.type.toLocaleLowerCase()){var n=[];this._data.forEach((function(i){var s=i[e.key];_.isArray(s)?("defaults"===e.type.toLocaleLowerCase()&&(s=_.map(s,(function(e){return _.toNumber(t._getValue(e))}))),n=_.union(n,s)):("defaults"===e.type.toLocaleLowerCase()&&(s=_.toNumber(t._getValue(s))),n.push(s))})),i=d3.extent(n),isFinite(e.min)&&null!==e.min&&(i[0]=e.min),i[1]=e.max||i[1]}else i=_.map(this._data,(function(i){return t._getValue(i[e.key])}));return i},_getValue:function(t){return _.isObject(t)&&t.hasOwnProperty("value")?t.value:t},getX:function(){return this.x},getAxisX:function(){return this.axisx},getMin:function(){return _.first(this.x.domain())},getMax:function(){return _.last(this.x.domain())},calGroupStep:function(t){var e=this.options.groupPadding;return Array.isArray(e)?this.groupX=d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e[0])?e[0]:.4,_.isNumber(e[1])?e[1]:0):this.groupX=d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e)?e:.4),Array.isArray(t)||(t=this._createCategory(parseInt(t))),this.groupX.domain(t),this.groupX},getGroupStep:function(t){return this.groupX?this.groupX.rangeBand():(this.calGroupStep(t),this.groupX.rangeBand())},_createCategory:function(t){for(var e=[],i=0;i<t;i++)e.push(""+i);return e},getGroupX:function(){return this.groupX},updateSeries:function(){var t=this.options;this.el.selectAll(".net-line").remove(),this.isReset&&this["cal"+t.orient]()||this["update"+t.orient](),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".net-line").style("display",t.net?"block":"none"),this.isReset=!1},renderStyle:function(){var t=this.options,e=this.el.selectAll(".tick text").style({fill:t.fontColor,"font-size":t.fontSize,"font-weight":t.fontWeight,"stroke-width":0,display:t.textShow?"block":"none"});t.fontStrokeWidth&&e.style({stroke:t.fontColor,"stroke-width":t.fontStrokeWidth}),t.rotate&&_.isNumber(t.rotate)?e.each((function(e){var i=d3.select(this),n=_.toNumber(i.attr("x")),s=_.toNumber(i.attr("y")),a=t.rotate/360*2*Math.PI;i.attr("transform",(("Top"===t.orient||"Bottom"===t.orient)&&"translate(0 "+.5*Math.sin(a)*t.fontSize*("Bottom"===t.orient?.01:-1.99)+")"||"")+" rotate("+t.rotate+" "+n+" "+s+")").style({"text-anchor":"start"})})):e.each((function(){this.removeAttribute&&this.removeAttribute("transform")})),this.el.selectAll(".domain, .tick line:not(.net-line)").style({display:t.assistLine?"block":"none",fill:"none",stroke:t.assistLineColor}),this.el.style("display",t.show?"block":"none")}}),module.exports=Axis; |
{ | ||
"name": "dchart-core", | ||
"version": "2.8.4", | ||
"version": "2.8.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
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
155518