New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dchart-core

Package Overview
Dependencies
Maintainers
1
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dchart-core - npm Package Compare versions

Comparing version 2.3.29 to 2.3.30

2

com/arc.js

@@ -1,1 +0,1 @@

function Arc(n,e,r){this.reset(),this.options={radius:0,innerRadius:0,outerRadius:0,cornerRadius:0,padAngle:0,startAngle:function(n){return n.startAngle},endAngle:function(n){return n.endAngle}},this.arc=null,this.init(n,e,r),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Arc=Com.extend(Arc,{renderSeries:function(){var n=this.options;this.arc=d3.svg.arc().outerRadius(n.outerRadius||n._radius).innerRadius(n.innerRadius).cornerRadius(n.cornerRadius).padAngle(n.padAngle).startAngle(function(e){return"function"==typeof n.startAngle?n.startAngle(e):e.startAngle+(n.startAngle||0)}).endAngle(function(e){return"function"==typeof n.endAngle?n.endAngle(e):e.endAngle+(n.endAngle||0)})},getArc:function(){return this.arc},updateSeries:function(){this.renderSeries()}}),module.exports=Arc;
"use strict";function Arc(e,n,r){this.reset(),this.options={radius:0,innerRadius:0,outerRadius:0,cornerRadius:0,padAngle:0,startAngle:function(e){return e.startAngle},endAngle:function(e){return e.endAngle}},this.arc=null,this.init(e,n,r),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Arc=Com.extend(Arc,{renderSeries:function(){var e=this.options;this.arc=d3.svg.arc().outerRadius(e.outerRadius||e._radius).innerRadius(e.innerRadius).cornerRadius(e.cornerRadius).padAngle(e.padAngle).startAngle(function(n){return"function"==typeof e.startAngle?e.startAngle(n):n.startAngle+(e.startAngle||0)}).endAngle(function(n){return"function"==typeof e.endAngle?e.endAngle(n):n.endAngle+(e.endAngle||0)})},getArc:function(){return this.arc},updateSeries:function(){this.renderSeries()}}),module.exports=Arc;

@@ -1,1 +0,1 @@

"use strict";function Axis(t,i,e){this.reset(),this.options={fontSize:12,fontColor:"#fff",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,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,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,i,e),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Axis=Com.extend(Axis,{init:function(t,i,e){return t||this.el?(t&&(this.el=d3.select(t)),this.isReset=this.options&&_.toLower(this.options.type)!==_.toLower(i.type)?!0:!1,this.options=_.deepMerge(this.options,i),void(this.alloptions=e||this.alloptions)):!1},_valid:function(){var t=this.options,i=["defaults","category","time","nondecile"];-1===_.indexOf(i,t.type.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.type+" in types.",t.type=i[0],this.valid=!1),t.type=_.initialUpperCase(t.type);var e=["left","top","right","bottom"];-1===_.indexOf(e,t.orient.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.orient+" in orients.",t.orient=e[0],this.valid=!1),t.orient=_.initialUpperCase(t.orient)},renderSeries:function(){var t=this.options;this["cal"+t.orient](),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".tick line").style("display",!t.net&&"none"||"block"),this.isReset=!1},cut:function(t,i){for(var e=(t[1]-t[0])/(i-1),s=0;i-1>s;s++)t[s+1]=t[0]+e*(s+1);return t},format:function(){var t=this.options,i=this.axisx,e=this.x;if(i.tickPadding(t.dy),"object"==typeof t.tickSize?i.tickSize.apply(this,t.tickSize):i.tickSize(t.tickSize),t.tickValues&&i.tickValues(t.tickValues),t.ticks)if("Category"===t.type&&_.isNumber(t.ticks)){var s=this._data;t.tickFormat=function(i,e){var n=_.toNumber(t.ticks),a=s.length,r=parseInt((a-1)/(n-1));if(0===r)return i;var o=(a-1)%(n-1),l=parseInt(o%2&&o/2+1||o/2),h=o-l;return l>e?"":h>=a-e?"":(e-l)%r?"":i}}else if("array"==typeof t.ticks)i.ticks.apply(this,t.ticks);else if(_.isNumber(t.ticks))if("Time"!==t.type){t.ticks=_.toNumber(t.ticks);var n=_.clone(e.domain());switch(t.ticks){case 0:i.tickValues([n[0]]);break;case 1:i.tickValues([n[1]]);break;case 2:i.tickValues(n);break;default:n=this.cut(n,t.ticks),i.tickValues(n)}}else i.ticks.call(this,t.ticks);if("string"==typeof t.tickFormat)i.tickFormat(d3.format(t.tickFormat));else if("function"==typeof t.tickFormat){var a=this;i.tickFormat(function(i,e){return t.tickFormat.call(a._data[e],i,e)})}},_afterAxis:function(){var t=this.options;"function"==typeof t._afterAxis&&t._afterAxis.call(this)},renderLabel:function(){var t=this.options,i=this.alloptions;if(!t.label)return void this.el.select(".axis-unit").remove();if(t.labelInAxis){var e=this.el.select(".axis-unit")[0][0]&&this.el.select(".axis-unit")||this.el.append("g").attr({"class":"axis-unit"}),s=this.el.selectAll(".tick:nth-last-child(3)"),n=s.select("text");"Left"===t.orient||"Right"===t.orient?e.attr("transform","translate(0,"+-1.5*parseInt(n.style("font-size"))+")"):e.attr("transform","translate("+((t.innerWidth||i.innerWidth)+3*parseInt(n.style("font-size")))+", 0)");var a=e.select("text")[0][0]&&e.select("text")||e.append("text");a.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"),fill:n.style("fill")})}},calLeft:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),s=this.axisx=d3.svg.axis().scale(e).orient("left");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.call(s):this.el=this.el.append("g").attr("class","axis").call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",x2:t.innerWidth||i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateLeft:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),this.format(),this._afterAxis(),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||i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calRight:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),s=this.axisx=d3.svg.axis().scale(e).orient("right");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).call(s):this.el=this.el.append("g").attr({"class":"axis",transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",x2:-t.innerWidth||-i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateRight:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),this.format(),this._afterAxis(),this.el.attr({transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).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||-i.innerWidth,y2:"0"}).style({stroke:t.netColor})},calTop:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),s=this.axisx=d3.svg.axis().scale(e).orient("top");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.call(s):this.el=this.el.append("g").attr("class","axis").call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",y2:t.innerHeight||i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateTop:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),this.format(),this._afterAxis(),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||i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calBottom:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),s=this.axisx=d3.svg.axis().scale(e).orient("bottom");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate(0,"+(t.innerHeight||i.innerHeight)+")"}).call(s):this.el=this.el.append("g").attr({"class":"axis",transform:"translate(0,"+(t.innerHeight||i.innerHeight)+")"}).call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",y2:-t.innerHeight||-i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateBottom:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),this.format(),this._afterAxis(),this.el.attr("transform","translate(0,"+(t.innerHeight||i.innerHeight)+")").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||-i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},axisDefaults:function(t){var i=this.x=d3.scale.linear().range(t),e=this.calExtent(),s=this.options;if(_.isNumber(s.ticks)&&!_.isNumber(s.min)&&Math.abs(e[1]-e[0])%(s.ticks-1)){var n=Math.max(Math.abs(e[1]-e[0])/(s.ticks-1),.1);e[0]=e[1]-n*(s.ticks-1)}return i.domain(e),i},updateAxisDefaults:function(t){this.x.range(t);var i=this.calExtent(),e=this.options;if(_.isNumber(e.ticks)&&!_.isNumber(e.min)&&Math.abs(i[1]-i[0])%(e.ticks-1)){var s=Math.max(Math.abs(i[1]-i[0])/(e.ticks-1),.1);i[0]=i[1]-s*(e.ticks-1)}return this.x.domain(i),this.x},axisCategory:function(t){var i,e=this.options;i=this.x=_.isArray(e.padding)?d3.scale.ordinal().rangeBands(t,e.padding[0],e.padding[1]):d3.scale.ordinal().rangeBands(t,e.padding/2,e.padding);var s=this.calExtent();return i.domain(s),i},updateAxisCategory:function(t){var i=this.options;return _.isArray(i.padding)?this.x.rangeBands(t,i.padding[0],i.padding[1]):this.x.rangeBands(t,i.padding/2,i.padding),this.x.domain(this.calExtent()),this.x},axisTime:function(t){var i,e=this.options,s=this.x=d3.time.scale().range(t),n=d3.time.format(e.format);return _.isDate(e.min)&&_.isDate(e.max)?i=[e.min,e.max]:e.min&&e.max?i=[n.parse(e.min),n.parse(e.max)]:(i=d3.extent(_.map(this._data,function(t){return"string"==typeof t[e.key]?n.parse(t[e.key]):"object"==typeof t[e.key]?t[e.key]:void console.log("date error: "+t[e.key]+"is not a Date")})),e.min&&(i[0]=_.isDate(e.min)?e.min:n.parse(e.min)),e.max&&(i[1]=_.isDate(e.max)?e.max:n.parse(e.max))),s.domain(i),s},updateAxisTime:function(t){var i=this.options;this.x.range(t);var e,s=d3.time.format(i.format);return _.isDate(i.min)&&_.isDate(i.max)?e=[i.min,i.max]:i.min&&i.max?e=[s.parse(i.min),s.parse(i.max)]:(e=d3.extent(_.map(this._data,function(t){return"string"==typeof t[i.key]?s.parse(t[i.key]):"object"==typeof t[i.key]?t[i.key]:void console.log("date error: "+t[i.key]+"is not a Date")})),i.min&&(e[0]=_.isDate(i.min)?i.min:s.parse(i.min)),i.max&&(e[1]=_.isDate(i.max)?i.max:s.parse(i.max))),this.x.domain(e),this.x},axisNondecile:function(t){var i=this.options,e=this.x=d3.scale.linear().range(t);i.max=_.sum(this._data,i.nondecile.key),e.domain(this.calExtent());var s=_.groupBy(this._data,i.key),n=this._data=[],a=0,r=n.length,o=(t[1]-t[0])/(e.domain()[1]-e.domain()[0]);for(var l in s){var h={sum:_.sum(s[l],i.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[i.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,i.nondecile.tickPadding&&0!==h.begin&&(h.begin=(e(h.begin)-i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),i.nondecile.tickPadding&&0!==r&&(h.end=(e(h.end)+i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),h.radio=(h.end-h.begin)/h.sum,n.push(h)}return i._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center"))},i.afterRender=function(){this.el.selectAll(".tick").data(this._data)},e},updateAxisNondecile:function(t){var i=this.options,e=this.x.range(t);i.max=_.sum(this._data,i.nondecile.key),e.domain(this.calExtent());var s=_.groupBy(this._data,i.key),n=this._data=[],a=0,r=n.length,o=(t[1]-t[0])/(e.domain()[1]-e.domain()[0]);for(var l in s){var h={sum:_.sum(s[l],i.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[i.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,i.nondecile.tickPadding&&0!==h.begin&&(h.begin=(e(h.begin)-i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),i.nondecile.tickPadding&&0!==r&&(h.end=(e(h.end)+i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),h.radio=(h.end-h.begin)/h.sum,n.push(h)}return e.domain(this.calExtent()),i._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center")),this.el&&this.el.selectAll(".tick").data(_.pluck(this._data,"center"))},e},calExtent:function(){var t=this.options,i=[];if(_.isNumber(t.min)&&_.isNumber(t.max))i=[t.min,t.max];else if("category"!==t.type.toLocaleLowerCase()){var e=[];this._data.forEach(function(i){var s=i[t.key];_.isArray(s)?("defaults"===t.type.toLocaleLowerCase()&&(s=_.map(s,function(t){return _.toNumber(t)})),e=_.union(e,s)):("defaults"===t.type.toLocaleLowerCase()&&(s=_.toNumber(s)),e.push(s))}),i=d3.extent(e),_.isNumber(t.min)&&(i[0]=t.min),_.isNumber(t.max)&&(i[1]=t.max)}else i=_.map(this._data,function(i){return i[t.key]});return i},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 i=this.options,e=i.groupPadding;return this.groupX=Array.isArray(e)?d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e[0])?e[0]:.4,_.isNumber(e[1])?e[1]:0):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 i=[],e=0;t>e;e++)i.push(""+e);return i},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&&"none"||"block"),this.isReset=!1},renderStyle:function(){var t=this.options,i=this.el.selectAll(".tick text").style({fill:t.fontColor,"font-size":t.fontSize,"stroke-width":0,display:t.textShow&&"block"||"none"});t.fontStrokeWidth&&i.style({stroke:t.fontColor,"stroke-width":t.fontStrokeWidth}),t.rotate&&_.isNumber(t.rotate)?i.each(function(){var i=d3.select(this),e=_.toNumber(i.attr("x")),s=_.toNumber(i.attr("y")),n=t.rotate/360*2*Math.PI;i.attr("transform",(("Top"===t.orient||"Bottom"===t.orient)&&"translate(0 "+.5*Math.sin(n)*t.fontSize*("Bottom"===t.orient&&.01||-1.99)+")"||"")+" rotate("+t.rotate+" "+e+" "+s+")").style({"text-anchor":"start"})}):i.attr("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;
"use strict";function Axis(t,i,e){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,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,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,i,e),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Axis=Com.extend(Axis,{init:function(t,i,e){return t||this.el?(t&&(this.el=d3.select(t)),this.isReset=this.options&&_.toLower(this.options.type)!==_.toLower(i.type)?!0:!1,this.options=_.deepMerge(this.options,i),void(this.alloptions=e||this.alloptions)):!1},_valid:function(){var t=this.options,i=["defaults","category","time","nondecile"];-1===_.indexOf(i,t.type.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.type+" in types.",t.type=i[0],this.valid=!1),t.type=_.initialUpperCase(t.type);var e=["left","top","right","bottom"];-1===_.indexOf(e,t.orient.toLowerCase())&&(this.msg="axis arguments error. there is no "+t.orient+" in orients.",t.orient=e[0],this.valid=!1),t.orient=_.initialUpperCase(t.orient)},renderSeries:function(){var t=this.options;this["cal"+t.orient](),this.renderStyle(),this.renderLabel(),"function"==typeof t.afterRender&&t.afterRender.call(this),this.el.selectAll(".tick line").style("display",!t.net&&"none"||"block"),this.isReset=!1},cut:function(t,i){for(var e=(t[1]-t[0])/(i-1),s=0;i-1>s;s++)t[s+1]=t[0]+e*(s+1);return t},format:function(){var t=this.options,i=this.axisx,e=this.x;if(i.tickPadding(t.dy),"object"==typeof t.tickSize?i.tickSize.apply(this,t.tickSize):i.tickSize(t.tickSize),t.tickValues&&i.tickValues(t.tickValues),t.ticks)if("Category"===t.type&&_.isNumber(t.ticks)){var s=this._data;t.tickFormat=function(i,e){var n=_.toNumber(t.ticks),a=s.length,r=parseInt((a-1)/(n-1));if(0===r)return i;var o=(a-1)%(n-1),l=parseInt(o%2&&o/2+1||o/2),h=o-l;return l>e?"":h>=a-e?"":(e-l)%r?"":i}}else if("array"==typeof t.ticks)i.ticks.apply(this,t.ticks);else if(_.isNumber(t.ticks))if("Time"!==t.type){t.ticks=_.toNumber(t.ticks);var n=_.clone(e.domain());switch(t.ticks){case 0:i.tickValues([n[0]]);break;case 1:i.tickValues([n[1]]);break;case 2:i.tickValues(n);break;default:n=this.cut(n,t.ticks),i.tickValues(n)}}else i.ticks.call(this,t.ticks);if("string"==typeof t.tickFormat)i.tickFormat(d3.format(t.tickFormat));else if("function"==typeof t.tickFormat){var a=this;i.tickFormat(function(i,e){return t.tickFormat.call(a._data[e],i,e)})}},_afterAxis:function(){var t=this.options;"function"==typeof t._afterAxis&&t._afterAxis.call(this)},renderLabel:function(){var t=this.options,i=this.alloptions;if(!t.label)return void this.el.select(".axis-unit").remove();if(t.labelInAxis){var e=this.el.select(".axis-unit")[0][0]&&this.el.select(".axis-unit")||this.el.append("g").attr({"class":"axis-unit"}),s=this.el.selectAll(".tick:nth-last-child(3)"),n=s.select("text");"Left"===t.orient||"Right"===t.orient?e.attr("transform","translate(0,"+-1.5*parseInt(n.style("font-size"))+")"):e.attr("transform","translate("+((t.innerWidth||i.innerWidth)+3*parseInt(n.style("font-size")))+", 0)");var a=e.select("text")[0][0]&&e.select("text")||e.append("text");a.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"),fill:n.style("fill")})}},calLeft:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),s=this.axisx=d3.svg.axis().scale(e).orient("left");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.call(s):this.el=this.el.append("g").attr("class","axis").call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",x2:t.innerWidth||i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateLeft:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),this.format(),this._afterAxis(),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||i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calRight:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),s=this.axisx=d3.svg.axis().scale(e).orient("right");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).call(s):this.el=this.el.append("g").attr({"class":"axis",transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",x2:-t.innerWidth||-i.innerWidth,y2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateRight:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[t.innerHeight||i.innerHeight,0]),this.format(),this._afterAxis(),this.el.attr({transform:"translate("+(t.innerWidth||i.innerWidth)+", 0)"}).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||-i.innerWidth,y2:"0"}).style({stroke:t.netColor})},calTop:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),s=this.axisx=d3.svg.axis().scale(e).orient("top");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.call(s):this.el=this.el.append("g").attr("class","axis").call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",y2:t.innerHeight||i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateTop:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),this.format(),this._afterAxis(),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||i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},calBottom:function(){var t=this.options,i=this.alloptions,e=this.x=this["axis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),s=this.axisx=d3.svg.axis().scale(e).orient("bottom");this.format(),this._afterAxis(),-1!==this.el.attr("class").indexOf("axis")?this.el.attr({transform:"translate(0,"+(t.innerHeight||i.innerHeight)+")"}).call(s):this.el=this.el.append("g").attr({"class":"axis",transform:"translate(0,"+(t.innerHeight||i.innerHeight)+")"}).call(s),this.net=this.el.selectAll(".tick"+("Category"!==t.type&&1!==t.ticks?":not(:first-child)":"")).append("line").attr({"class":"net-line",y2:-t.innerHeight||-i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},updateBottom:function(){var t=this.options,i=this.alloptions;this["updateAxis"+t.type].call(this,[0,t.innerWidth||i.innerWidth]),this.format(),this._afterAxis(),this.el.attr("transform","translate(0,"+(t.innerHeight||i.innerHeight)+")").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||-i.innerHeight,x2:"0"}).style({"stroke-dasharray":"2 2",stroke:t.netColor})},axisDefaults:function(t){var i=this.x=d3.scale.linear().range(t),e=this.calExtent(),s=this.options;if(_.isNumber(s.ticks)&&!_.isNumber(s.min)&&Math.abs(e[1]-e[0])%(s.ticks-1)){var n=Math.max(Math.abs(e[1]-e[0])/(s.ticks-1),.1);e[0]=e[1]-n*(s.ticks-1)}return i.domain(e),i},updateAxisDefaults:function(t){this.x.range(t);var i=this.calExtent(),e=this.options;if(_.isNumber(e.ticks)&&!_.isNumber(e.min)&&Math.abs(i[1]-i[0])%(e.ticks-1)){var s=Math.max(Math.abs(i[1]-i[0])/(e.ticks-1),.1);i[0]=i[1]-s*(e.ticks-1)}return this.x.domain(i),this.x},axisCategory:function(t){var i,e=this.options;i=this.x=_.isArray(e.padding)?d3.scale.ordinal().rangeBands(t,e.padding[0],e.padding[1]):d3.scale.ordinal().rangeBands(t,e.padding/2,e.padding);var s=this.calExtent();return i.domain(s),i},updateAxisCategory:function(t){var i=this.options;return _.isArray(i.padding)?this.x.rangeBands(t,i.padding[0],i.padding[1]):this.x.rangeBands(t,i.padding/2,i.padding),this.x.domain(this.calExtent()),this.x},axisTime:function(t){var i,e=this.options,s=this.x=d3.time.scale().range(t),n=d3.time.format(e.format);return _.isDate(e.min)&&_.isDate(e.max)?i=[e.min,e.max]:e.min&&e.max?i=[n.parse(e.min),n.parse(e.max)]:(i=d3.extent(_.map(this._data,function(t){return"string"==typeof t[e.key]?n.parse(t[e.key]):"object"==typeof t[e.key]?t[e.key]:void console.log("date error: "+t[e.key]+"is not a Date")})),e.min&&(i[0]=_.isDate(e.min)?e.min:n.parse(e.min)),e.max&&(i[1]=_.isDate(e.max)?e.max:n.parse(e.max))),s.domain(i),s},updateAxisTime:function(t){var i=this.options;this.x.range(t);var e,s=d3.time.format(i.format);return _.isDate(i.min)&&_.isDate(i.max)?e=[i.min,i.max]:i.min&&i.max?e=[s.parse(i.min),s.parse(i.max)]:(e=d3.extent(_.map(this._data,function(t){return"string"==typeof t[i.key]?s.parse(t[i.key]):"object"==typeof t[i.key]?t[i.key]:void console.log("date error: "+t[i.key]+"is not a Date")})),i.min&&(e[0]=_.isDate(i.min)?i.min:s.parse(i.min)),i.max&&(e[1]=_.isDate(i.max)?i.max:s.parse(i.max))),this.x.domain(e),this.x},axisNondecile:function(t){var i=this.options,e=this.x=d3.scale.linear().range(t);i.max=_.sum(this._data,i.nondecile.key),e.domain(this.calExtent());var s=_.groupBy(this._data,i.key),n=this._data=[],a=0,r=n.length,o=(t[1]-t[0])/(e.domain()[1]-e.domain()[0]);for(var l in s){var h={sum:_.sum(s[l],i.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[i.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,i.nondecile.tickPadding&&0!==h.begin&&(h.begin=(e(h.begin)-i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),i.nondecile.tickPadding&&0!==r&&(h.end=(e(h.end)+i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),h.radio=(h.end-h.begin)/h.sum,n.push(h)}return i._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center"))},i.afterRender=function(){this.el.selectAll(".tick").data(this._data)},e},updateAxisNondecile:function(t){var i=this.options,e=this.x.range(t);i.max=_.sum(this._data,i.nondecile.key),e.domain(this.calExtent());var s=_.groupBy(this._data,i.key),n=this._data=[],a=0,r=n.length,o=(t[1]-t[0])/(e.domain()[1]-e.domain()[0]);for(var l in s){var h={sum:_.sum(s[l],i.nondecile.key),begin:a,end:0,center:0,radio:0};r--,h[i.key]=l,h.end=h.begin+h.sum,a+=h.sum,h.center=(h.begin+h.end)/2,i.nondecile.tickPadding&&0!==h.begin&&(h.begin=(e(h.begin)-i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),i.nondecile.tickPadding&&0!==r&&(h.end=(e(h.end)+i.nondecile.tickPadding/2-t[0])/o+e.domain()[0]),h.radio=(h.end-h.begin)/h.sum,n.push(h)}return e.domain(this.calExtent()),i._afterAxis=function(){this.axisx.tickValues(_.pluck(this._data,"center")),this.el&&this.el.selectAll(".tick").data(_.pluck(this._data,"center"))},e},calExtent:function(){var t=this.options,i=[];if(_.isNumber(t.min)&&_.isNumber(t.max))i=[t.min,t.max];else if("category"!==t.type.toLocaleLowerCase()){var e=[];this._data.forEach(function(i){var s=i[t.key];_.isArray(s)?("defaults"===t.type.toLocaleLowerCase()&&(s=_.map(s,function(t){return _.toNumber(t)})),e=_.union(e,s)):("defaults"===t.type.toLocaleLowerCase()&&(s=_.toNumber(s)),e.push(s))}),i=d3.extent(e),_.isNumber(t.min)&&(i[0]=t.min),_.isNumber(t.max)&&(i[1]=t.max)}else i=_.map(this._data,function(i){return i[t.key]});return i},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 i=this.options,e=i.groupPadding;return this.groupX=Array.isArray(e)?d3.scale.ordinal().rangeBands([0,this.x.rangeBand()],_.isNumber(e[0])?e[0]:.4,_.isNumber(e[1])?e[1]:0):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 i=[],e=0;t>e;e++)i.push(""+e);return i},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&&"none"||"block"),this.isReset=!1},renderStyle:function(){var t=this.options,i=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&&i.style({stroke:t.fontColor,"stroke-width":t.fontStrokeWidth}),t.rotate&&_.isNumber(t.rotate)?i.each(function(){var i=d3.select(this),e=_.toNumber(i.attr("x")),s=_.toNumber(i.attr("y")),n=t.rotate/360*2*Math.PI;i.attr("transform",(("Top"===t.orient||"Bottom"===t.orient)&&"translate(0 "+.5*Math.sin(n)*t.fontSize*("Bottom"===t.orient&&.01||-1.99)+")"||"")+" rotate("+t.rotate+" "+e+" "+s+")").style({"text-anchor":"start"})}):i.attr("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;

@@ -1,1 +0,1 @@

function BG(t,e,i){this.reset(),this.options={stroke:"rgba(170,170,170,0.5)",fill:"rgba(170,170,170,0.5)",strokeWidth:1,style:"dashed",dashed:"4 4"},this.init(t,e,i),this._valid(),this.el=this.el.append("g").attr({"class":"background"})}var _=require("../util"),Com=require("./index"),d3=require("d3");BG=Com.extend(BG,{renderSplitGuidesLine:function(t,e){var i=this.alloptions,s=t.selectAll(".tick line");switch(e&&s.transition().duration(i.animatedTiming).ease(i.animatedEasing),t.options.orient.toLowerCase()){case"left":s.attr("x2",t.alloptions.innerWidth);break;case"right":s.attr("x2",-t.alloptions.innerWidth);break;case"top":s.attr("y2",t.alloptions.innerHeight);break;case"bottom":s.attr("y2",-t.alloptions.innerHeight)}},renderGrid:function(t,e){for(var i=this.alloptions.innerHeight,s=this.alloptions.innerWidth,r=(i-1)/t,n=(s-1)/e,a=this.el,l=0;i>l;l+=r)a.append("path").attr({"class":"bg-path h",d:"M0 "+l+"h"+s});for(var o=0;s>o;o+=n)a.append("path").attr({"class":"bg-path v",d:"M"+o+" 0v"+i});return this},renderCircles:function(t){var e=this.el,i=this.options,s=this.alloptions,r=t.getX(),n=t.options.tickValues;t.selectAll(".tick").each(function(t,a){var l=e.select(".serie-bg")[0][a]?de.select(e.selectAll(".serie-bg")[0][a]):e.append("circle").attr("class","serie-bg");l.attr({cx:s.innerWidth/2,cy:s.innerHeight/2,r:r(n[a])}).style({stroke:i.stroke,strokeWidth:i.strokeWidth,"stroke-dasharray":"dashed"===i.style?i.dashed||"4 4":"none"})})},renderVerticalTicks:function(t){if(!(0>=t)){var e=this.alloptions.innerHeight,i=(e-1)/t,s=this.el;return s.selectAll(".bg-path.v").each(function(){for(var e=d3.select(this),r=parseFloat(e.attr("d").match(/[-+]?[0-9]*\.?[0-9]+/g)[0]),n=0;t>n;n++)s.append("line").attr({"class":"tick",x1:r,y1:n*i,x2:r+4,y2:n*i})}),this}},color:function(t){var e=this.alloptions;if(!this.el)return this.msg="there is no el",void this.emit("error",{msg:this.msg});var i=this.el.select(".color");return i[0].length?i.style("fill",t):this.el.append("rect").attr({"class":"color",x:0,y:0,width:e.innerWidth,height:e.innerHeight}).style("fill",t),this}}),module.exports=BG;
"use strict";function BG(t,e,i){this.reset(),this.options={stroke:"rgba(170,170,170,0.5)",fill:"rgba(170,170,170,0.5)",strokeWidth:1,style:"dashed",dashed:"4 4"},this.init(t,e,i),this._valid(),this.el=this.el.append("g").attr({"class":"background"})}var _=require("../util"),Com=require("./index"),d3=require("d3");BG=Com.extend(BG,{renderSplitGuidesLine:function(t,e){var i=this.alloptions,s=t.selectAll(".tick line");switch(e&&s.transition().duration(i.animatedTiming).ease(i.animatedEasing),t.options.orient.toLowerCase()){case"left":s.attr("x2",t.alloptions.innerWidth);break;case"right":s.attr("x2",-t.alloptions.innerWidth);break;case"top":s.attr("y2",t.alloptions.innerHeight);break;case"bottom":s.attr("y2",-t.alloptions.innerHeight)}},renderGrid:function(t,e){for(var i=this.alloptions.innerHeight,s=this.alloptions.innerWidth,r=(i-1)/t,n=(s-1)/e,a=this.el,l=0;i>l;l+=r)a.append("path").attr({"class":"bg-path h",d:"M0 "+l+"h"+s});for(var o=0;s>o;o+=n)a.append("path").attr({"class":"bg-path v",d:"M"+o+" 0v"+i});return this},renderCircles:function(t){var e=this.el,i=this.options,s=this.alloptions,r=t.getX(),n=t.options.tickValues;t.selectAll(".tick").each(function(t,a){var l=e.select(".serie-bg")[0][a]?e.select(e.selectAll(".serie-bg")[0][a]):e.append("circle").attr("class","serie-bg");l.attr({cx:s.innerWidth/2,cy:s.innerHeight/2,r:r(n[a])}).style({stroke:i.stroke,strokeWidth:i.strokeWidth,"stroke-dasharray":"dashed"===i.style?i.dashed||"4 4":"none"})})},renderVerticalTicks:function(t){if(!(0>=t)){var e=this.alloptions.innerHeight,i=(e-1)/t,s=this.el;return s.selectAll(".bg-path.v").each(function(){for(var e=d3.select(this),r=parseFloat(e.attr("d").match(/[-+]?[0-9]*\.?[0-9]+/g)[0]),n=0;t>n;n++)s.append("line").attr({"class":"tick",x1:r,y1:n*i,x2:r+4,y2:n*i})}),this}},color:function(t){var e=this.alloptions;if(!this.el)return this.msg="there is no el",void this.emit("error",{msg:this.msg});var i=this.el.select(".color");return i[0].length?i.style("fill",t):this.el.append("rect").attr({"class":"color",x:0,y:0,width:e.innerWidth,height:e.innerHeight}).style("fill",t),this}}),module.exports=BG;

@@ -1,1 +0,1 @@

function Legend(e,t,n){this.reset(),this.options={type:"horizontal",renderType:"defaults"},this.init(e,t,n),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Legend=Com.extend(Legend,{_valid:function(){var e=this.options,t=["horizontal","vertical"];-1===_.indexOf(t,e.type.toLowerCase())&&(this.msg="legend arguments error. there is no "+e.type+" in types.",e.type=t[0],this.valid=!1),e.type=_.initialUpperCase(e.type);var n=["defaults"];-1===_.indexOf(n,e.renderType.toLowerCase())&&(this.msg="legend arguments error. there is no "+e.renderType+" in types.",e.renderType=n[0],this.valid=!1),e.renderType=_.initialUpperCase(e.renderType)},renderSeries:function(){var e=this.options,t=this.alloptions,n=t.beforeLayout.legend,i=e.margin||t.margin,l=_.extend(_.omit(n,"position"),{margin:i.top+"px "+i.right+"px "+i.bottom+"px "+i.left+"px"});return this.el=this.el.append("div").attr({"class":"legend"}).style(l),this.svg=this.el.append("svg").attr({width:n.width,height:n.height}).append("g"),this["cal"+e.type](),this},calHorizontal:function(){for(var e=this.options,t=this.alloptions,n=this.data(),i=t.yaxis.key,l=Math.max(e.legendLabels.length,_.maxBy(n,function(e){return e[i].length})[i].length),s=t.beforeLayout.legend,r=s.width/l,a=this,d=0;l>d;d++){var o=e.legendLabels[d]||"legend"+(d+1),h={x:d*r,y:0,width:r,height:s.height},g=a.svg.select(".legend"+(d+1))[0][0]?a.svg.select(".legend"+(d+1)):a.svg.append("g").attr({"class":"legend-label legend"+(d+1)});"function"==typeof e.customRender?e.customRender.call(g,o,h,d):this["render"+e.renderType](g,o,h,d)}this.svg.selectAll(".legend-label.legend"+l+" ~ .legend-label").remove()},calVertical:function(){for(var e=this.options,t=this.alloptions,n=t.yaxis.key,i=Math.max(e.legendLabels.length,_.maxBy(data,function(e){return e[n].length})[n].length),l=e.beforeLayout.legend,s=l.height/i,r=this,a=0;i>a;a++){var d=e.legendLabels[a]||"legend"+(a+1),o={x:0,y:a*s,width:l.width,height:s},h=r.svg.select(".legend"+(a+1))[0][0]?r.svg.select(".legend"+(a+1)):r.svg.append("g").attr({"class":"legend-label legend"+(a+1)});"function"==typeof e.customRender?e.customRender.call(h,d,o,a):this["render"+e.renderType](h,d,o,a)}this.svg.selectAll(".legend-label.legend"+i+" ~ .legend-label").remove()},renderDefaults:function(e,t,n){e.attr({transform:"translate("+(n.x+n.width/2)+", "+(n.y+n.height/2)+")"}),e.append("text").html(t).attr({x:30,y:5,dy:".35em"})},updateSeries:function(){return this["cal"+this.options.type](),this}}),module.exports=Legend;
"use strict";function Legend(e,t,n){this.reset(),this.options={type:"horizontal",renderType:"defaults"},this.init(e,t,n),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Legend=Com.extend(Legend,{_valid:function(){var e=this.options,t=["horizontal","vertical"];-1===_.indexOf(t,e.type.toLowerCase())&&(this.msg="legend arguments error. there is no "+e.type+" in types.",e.type=t[0],this.valid=!1),e.type=_.initialUpperCase(e.type);var n=["defaults"];-1===_.indexOf(n,e.renderType.toLowerCase())&&(this.msg="legend arguments error. there is no "+e.renderType+" in types.",e.renderType=n[0],this.valid=!1),e.renderType=_.initialUpperCase(e.renderType)},renderSeries:function(){var e=this.options,t=this.alloptions,n=t.beforeLayout.legend,i=e.margin||t.margin,l=_.extend(_.omit(n,"position"),{margin:i.top+"px "+i.right+"px "+i.bottom+"px "+i.left+"px"});return this.el=this.el.append("div").attr({"class":"legend"}).style(l),this.svg=this.el.append("svg").attr({width:n.width,height:n.height}).append("g"),this["cal"+e.type](),this},calHorizontal:function(){for(var e=this.options,t=this.alloptions,n=this.data(),i=t.yaxis.key,l=Math.max(e.legendLabels.length,_.maxBy(n,function(e){return e[i].length})[i].length),s=t.beforeLayout.legend,r=s.width/l,a=this,d=0;l>d;d++){var o=e.legendLabels[d]||"legend"+(d+1),h={x:d*r,y:0,width:r,height:s.height},g=a.svg.select(".legend"+(d+1))[0][0]?a.svg.select(".legend"+(d+1)):a.svg.append("g").attr({"class":"legend-label legend"+(d+1)});"function"==typeof e.customRender?e.customRender.call(g,o,h,d):this["render"+e.renderType](g,o,h,d)}this.svg.selectAll(".legend-label.legend"+l+" ~ .legend-label").remove()},calVertical:function(){for(var e=this.options,t=this.alloptions,n=t.yaxis.key,i=Math.max(e.legendLabels.length,_.maxBy(data,function(e){return e[n].length})[n].length),l=e.beforeLayout.legend,s=l.height/i,r=this,a=0;i>a;a++){var d=e.legendLabels[a]||"legend"+(a+1),o={x:0,y:a*s,width:l.width,height:s},h=r.svg.select(".legend"+(a+1))[0][0]?r.svg.select(".legend"+(a+1)):r.svg.append("g").attr({"class":"legend-label legend"+(a+1)});"function"==typeof e.customRender?e.customRender.call(h,d,o,a):this["render"+e.renderType](h,d,o,a)}this.svg.selectAll(".legend-label.legend"+i+" ~ .legend-label").remove()},renderDefaults:function(e,t,n){e.attr({transform:"translate("+(n.x+n.width/2)+", "+(n.y+n.height/2)+")"}),e.append("text").html(t).attr({x:30,y:5,dy:".35em"})},updateSeries:function(){return this["cal"+this.options.type](),this}}),module.exports=Legend;

@@ -1,1 +0,1 @@

function Time(t,i,e){this.reset(),this.init(t,i,e),this.el.attr("class","timeline"),this.axis,this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3"),Axis=require("./axis");Time=Com.extend(Time,{renderSeries:function(){var t=this.options,i=this.alloptions,e=this._data,r=this,s=this.el,a=s.append("svg").attr({width:i.innerWidth,height:66}).append("g").attr("transform","translate(40,20)"),n=this.axis=new Axis({_data:e,type:"time",key:"time",orient:"bottom",format:t.format,svg:a,width:i.innerWidth-80,height:10});n.render();var h=n.getX(),o=d3.svg.brush().x(h).on("brush",function(){r.emit("time.brush",o)});a.append("g").attr("class","x brush").call(o).selectAll("rect").attr("y",-6).attr("height",17)},getX:function(){return this.axis.getX()}}),module.exports=Time;
"use strict";function Time(t,i,e){this.reset(),this.init(t,i,e),this.el.attr("class","timeline"),this.axis,this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3"),Axis=require("./axis");Time=Com.extend(Time,{renderSeries:function(){var t=this.options,i=this.alloptions,e=this._data,r=this,s=this.el,a=s.append("svg").attr({width:i.innerWidth,height:66}).append("g").attr("transform","translate(40,20)"),n=this.axis=new Axis({_data:e,type:"time",key:"time",orient:"bottom",format:t.format,svg:a,width:i.innerWidth-80,height:10});n.render();var h=n.getX(),o=d3.svg.brush().x(h).on("brush",function(){r.emit("time.brush",o)});a.append("g").attr("class","x brush").call(o).selectAll("rect").attr("y",-6).attr("height",17)},getX:function(){return this.axis.getX()}}),module.exports=Time;

@@ -1,1 +0,1 @@

function Tooltip(t,e,i,o){this.reset(),this.comObj=e,this.options={show:"true",formatter:{},enterFocus:!1,hideDelay:100,trigger:"axis",axisPointer:"none",backgroundColor:"rgba(0,0,0,.8)",color:"#fff",beforeFormat:null,padding:16},this.init(t,i,o),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Tooltip=Com.extend(Tooltip,{init:function(t,e,i){return t||this.el?(t&&(this.el=d3.select(t)),this.options=_.deepMerge(this.options,e),void(this.alloptions=i||this.alloptions)):!1},_valid:function(){},renderSeries:function(){var t=this.options,e=this.alloptions;this.layer={};var i=this.el.select(".con-svg");this.layer.width=e.innerWidth,this.layer.height=e.innerHeight,this.layer.svgContainer=i,this.layer.x=this.comObj.getComs("axis","xaxis"),this.layer.y=this.comObj.getComs("axis","yaxis"),this.dispatch=d3.dispatch("elementMouseover","elementMouseout"),this.tooltip=this.el.select(".dc-tooltip")[0][0]?this.el.select(".dc-tooltip"):this.el.append("div").attr("class","dc-tooltip").style({display:"none",position:"absolute",color:t.color,background:t.backgroundColor,padding:t.padding+"px","border-radius":"5%"});var o=this;this.tooltip.on("mouseenter",function(){o.options.enterFocus&&clearTimeout(o._hideTimeout)}).on("mouseout",function(){o.options.enterFocus&&o._delayHide(o.options.hideDelay)}),this.initGuildLayer()},show:function(t,e,i){"function"==typeof i&&(t=i.call(this,t));var o=this.defaultFormatter(t);"function"==typeof this.options.formatter&&(o=this.options.formatter(t));var s,n,r,a,l,u=d3.mouse(e[0][0]),d=this.alloptions,h=this.isVertical();h?(s=this.layer.x.getX(),n=d.xaxis.key,r=d.xaxis.type,a=this.layer.y,l=d.yaxis.orient):(s=this.layer.y.getX(),n=d.yaxis.key,r=d.yaxis.type,a=this.layer.x,l=d.xaxis.orient);var c=h&&s("time"===r&&new Date(t[n])||t[n])+20+d.margin.left+(d.margin.containLabel&&"left"===l&&a.el[0][0].getBBox().width||0)||u[0]+d.margin.left+20,p=h&&u[1]+d.margin.top+20||s("time"===r&&new Date(t[n])||t[n])+20+d.margin.top+(d.margin.containLabel&&"top"===l&&a.el[0][0].getBBox().height||0);this.tooltip.html(o),this.tooltip.transition().duration(20).style("display","block"),this.tooltip.style("left",c+"px").style("top",p+"px")},hide:function(){this.options.enterFocus?this._delayHide():this._contentHide()},_contentHide:function(){this.tooltip.transition().duration(20).style("display","none")},_delayHide:function(){if(this.options.enterFocus){var t=this;this._hideTimeout=setTimeout(function(){t._contentHide()},this.options.hideDelay)}},defaultFormatter:function(t){var e='<div class="dchart-tooltip">',i=0;return _.forIn(t,function(t,o){e+=(0!==i&&"<br>"||"")+o+":"+t.toString(),i++}),e+="</div>"},initGuildLayer:function(){function t(){var t=d3.mouse(this),d=t[0],h=t[1],c=!0,p=!1,y=u.isVertical(),g=y&&s.getX()||o.getX(),m=y&&g.range()||_.clone(g.range()).reverse(),f=y&&g.domain()||_.clone(g.domain()).reverse();if(c&&(d-=r.left,h-=r.top,r.containLabel&&("top"===l.xaxis.orient&&(h-=s.options.__height),"left"===l.yaxis.orient&&(d-=o.options.__width))),0>d||0>h||d>e||h>i||p)return n.elementMouseout({mouseX:d,mouseY:h}),void a.renderGuildLayer(null);a.renderGuildLayer(null);var x="function"==typeof g.rangeBands,v=void 0,L=y&&d||h;if(x){var b=d3.bisect(m,L)-1;if(!(m[b]+g.rangeBand()>=L))return n.elementMouseout({mouseX:d,mouseY:h}),void a.renderGuildLayer(null);v=f[b]}else v=g.invert(L);n.elementMouseover({mouseX:d,mouseY:h,pointValue:v})}this.wrap=this.el.select(".guildLayer")[0][0]?this.el.select(".guildLayer"):this.el.select(".series").append("g").attr("class","guildLayer"),guildLineLayer=this.wrap.select(".guildLineLayer")[0][0]?this.wrap.select(".guildLineLayer"):this.wrap.append("g").attr("class","guildLineLayer");var e=(guildLineLayer.select(".guildLine")[0][0]?guildLineLayer.select(".guildLine"):guildLineLayer.append("g").attr("class","guildLine"),this.layer.width),i=this.layer.height,o=this.layer.y,s=this.layer.x,n=this.dispatch,r=this.alloptions.margin,a=(this.renderGuildLayer,this),l=this.alloptions,u=this;this.layer.svgContainer.on("mousemove",t).on("mouseout",t)},renderGuildLayer:function(t){var e=this.isVertical(),i=this,o=this.el.select(".guildLine").selectAll("line").data(null!=t?[t]:[],String);o.enter().append("line").attr("class","tooltip-guideline").attr("x1",function(t){return e&&_.isNumber(t)?t:0}).attr("x2",function(t){return e&&_.isNumber(t)?t:i.layer.width}).attr("y1",function(t){return e&&i.layer.height||t}).attr("y2",function(t){return!e&&_.isNumber(t)?t:0}),o.exit().remove()},isVertical:function(){var t=this.alloptions;return"time"===t.xaxis.type||"category"===t.xaxis.type?!0:"time"===t.yaxis.type||"category"===t.yaxis.type?!1:!0},updateEvent:function(){var t,e,i,o,s=this,n=this.alloptions,r=this.options,a=this.isVertical(),l=n.xaxis.key,u=n.yaxis.key;a?(t=l,e=n.xaxis.type,i=this.comObj.getComs("axis","xaxis").getX(),o=n.xaxis.format):(t=u,e=n.yaxis.type,i=this.comObj.getComs("axis","yaxis").getX(),o=n.yaxis.format),this.dispatch.on("elementMouseover",function(n){var d=s.data();if(closestPoint=function(s){var n=a&&window.screen.availWidth||window.screen.availHeight;return index=0,d.forEach(function(r,a){var l=r[t];"time"===e&&o&&(l=d3.time.format(o).parse(r[t])),diff=Math.abs(i(l)-i(s.pointValue)),diff<n&&(n=diff,index=a,closestValue=l)}),d[index]}(n),"line"===r.axisPointer){var h=i(closestValue)+("category"===e?i.rangeBand()/2:0);s.renderGuildLayer(h)}s.show(closestPoint,s.layer.svgContainer.select(".con-g"),r.beforeFormat||function(t){var e={};return e[l]=t[l].toString(),e[u]=t[u].toString(),e})}),this.dispatch.on("elementMouseout",function(){s.hide()})},destroy:function(){this.tooltip&&this.tooltip.remove()}}),module.exports=Tooltip;
"use strict";function Tooltip(t,e,i,o){this.reset(),this.comObj=e,this.options={show:"true",formatter:{},enterFocus:!1,hideDelay:100,trigger:"axis",axisPointer:"none",backgroundColor:"rgba(0,0,0,.8)",color:"#fff",beforeFormat:null,padding:16},this.init(t,i,o),this._valid()}var _=require("../util"),Com=require("./index"),d3=require("d3");Tooltip=Com.extend(Tooltip,{init:function(t,e,i){return t||this.el?(t&&(this.el=d3.select(t)),this.options=_.deepMerge(this.options,e),void(this.alloptions=i||this.alloptions)):!1},_valid:function(){},renderSeries:function(){var t=this.options,e=this.alloptions;this.layer={};var i=this.el.select(".con-svg");this.layer.width=e.innerWidth,this.layer.height=e.innerHeight,this.layer.svgContainer=i,this.layer.x=this.comObj.getComs("axis","xaxis"),this.layer.y=this.comObj.getComs("axis","yaxis"),this.dispatch=d3.dispatch("elementMouseover","elementMouseout"),this.tooltip=this.el.select(".dc-tooltip")[0][0]?this.el.select(".dc-tooltip"):this.el.append("div").attr("class","dc-tooltip").style({display:"none",position:"absolute",color:t.color,background:t.backgroundColor,padding:t.padding+"px","border-radius":"5%"});var o=this;this.tooltip.on("mouseenter",function(){o.options.enterFocus&&clearTimeout(o._hideTimeout)}).on("mouseout",function(){o.options.enterFocus&&o._delayHide(o.options.hideDelay)}),this.initGuildLayer()},show:function(t,e,i){"function"==typeof i&&(t=i.call(this,t));var o=this.defaultFormatter(t);"function"==typeof this.options.formatter&&(o=this.options.formatter(t));var s,n,r,a,l,u=d3.mouse(e[0][0]),d=this.alloptions,h=this.isVertical();h?(s=this.layer.x.getX(),n=d.xaxis.key,r=d.xaxis.type,a=this.layer.y,l=d.yaxis.orient):(s=this.layer.y.getX(),n=d.yaxis.key,r=d.yaxis.type,a=this.layer.x,l=d.xaxis.orient);var c=h&&s("time"===r&&new Date(t[n])||t[n])+20+d.margin.left+(d.margin.containLabel&&"left"===l&&a.el[0][0].getBBox().width||0)||u[0]+d.margin.left+20,p=h&&u[1]+d.margin.top+20||s("time"===r&&new Date(t[n])||t[n])+20+d.margin.top+(d.margin.containLabel&&"top"===l&&a.el[0][0].getBBox().height||0);this.tooltip.html(o),this.tooltip.transition().duration(20).style("display","block"),this.tooltip.style("left",c+"px").style("top",p+"px")},hide:function(){this.options.enterFocus?this._delayHide():this._contentHide()},_contentHide:function(){this.tooltip.transition().duration(20).style("display","none")},_delayHide:function(){if(this.options.enterFocus){var t=this;this._hideTimeout=setTimeout(function(){t._contentHide()},this.options.hideDelay)}},defaultFormatter:function(t){var e='<div class="dchart-tooltip">',i=0;return _.forIn(t,function(t,o){e+=(0!==i&&"<br>"||"")+o+":"+t.toString(),i++}),e+="</div>"},initGuildLayer:function(){function t(){var t=d3.mouse(this),d=t[0],h=t[1],c=!0,p=!1,y=u.isVertical(),g=y&&s.getX()||o.getX(),m=y&&g.range()||_.clone(g.range()).reverse(),f=y&&g.domain()||_.clone(g.domain()).reverse();if(c&&(d-=r.left,h-=r.top,r.containLabel&&("top"===l.xaxis.orient&&(h-=s.options.__height),"left"===l.yaxis.orient&&(d-=o.options.__width))),0>d||0>h||d>e||h>i||p)return n.elementMouseout({mouseX:d,mouseY:h}),void a.renderGuildLayer(null);a.renderGuildLayer(null);var x="function"==typeof g.rangeBands,v=void 0,L=y&&d||h;if(x){var b=d3.bisect(m,L)-1;if(!(m[b]+g.rangeBand()>=L))return n.elementMouseout({mouseX:d,mouseY:h}),void a.renderGuildLayer(null);v=f[b]}else v=g.invert(L);n.elementMouseover({mouseX:d,mouseY:h,pointValue:v})}this.wrap=this.el.select(".guildLayer")[0][0]?this.el.select(".guildLayer"):this.el.select(".series").append("g").attr("class","guildLayer"),guildLineLayer=this.wrap.select(".guildLineLayer")[0][0]?this.wrap.select(".guildLineLayer"):this.wrap.append("g").attr("class","guildLineLayer");var e=(guildLineLayer.select(".guildLine")[0][0]?guildLineLayer.select(".guildLine"):guildLineLayer.append("g").attr("class","guildLine"),this.layer.width),i=this.layer.height,o=this.layer.y,s=this.layer.x,n=this.dispatch,r=this.alloptions.margin,a=(this.renderGuildLayer,this),l=this.alloptions,u=this;this.layer.svgContainer.on("mousemove",t).on("mouseout",t)},renderGuildLayer:function(t){var e=this.isVertical(),i=this,o=this.el.select(".guildLine").selectAll("line").data(null!=t?[t]:[],String);o.enter().append("line").attr("class","tooltip-guideline").attr("x1",function(t){return e&&_.isNumber(t)?t:0}).attr("x2",function(t){return e&&_.isNumber(t)?t:i.layer.width}).attr("y1",function(t){return e&&i.layer.height||t}).attr("y2",function(t){return!e&&_.isNumber(t)?t:0}),o.exit().remove()},isVertical:function(){var t=this.alloptions;return"time"===t.xaxis.type||"category"===t.xaxis.type?!0:"time"===t.yaxis.type||"category"===t.yaxis.type?!1:!0},updateEvent:function(){var t,e,i,o,s=this,n=this.alloptions,r=this.options,a=this.isVertical(),l=n.xaxis.key,u=n.yaxis.key;a?(t=l,e=n.xaxis.type,i=this.comObj.getComs("axis","xaxis").getX(),o=n.xaxis.format):(t=u,e=n.yaxis.type,i=this.comObj.getComs("axis","yaxis").getX(),o=n.yaxis.format),this.dispatch.on("elementMouseover",function(n){var d=s.data();if(closestPoint=function(s){var n=a&&window.screen.availWidth||window.screen.availHeight;return index=0,d.forEach(function(r,a){var l=r[t];"time"===e&&o&&(l=d3.time.format(o).parse(r[t])),diff=Math.abs(i(l)-i(s.pointValue)),diff<n&&(n=diff,index=a,closestValue=l)}),d[index]}(n),"line"===r.axisPointer){var h=i(closestValue)+("category"===e?i.rangeBand()/2:0);s.renderGuildLayer(h)}s.show(closestPoint,s.layer.svgContainer.select(".con-g"),r.beforeFormat||function(t){var e={};return e[l]=t[l].toString(),e[u]=t[u].toString(),e})}),this.dispatch.on("elementMouseout",function(){s.hide()})},destroy:function(){this.tooltip&&this.tooltip.remove()}}),module.exports=Tooltip;
{
"name": "dchart-core",
"version": "2.3.29",
"version": "2.3.30",
"description": "",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc