dchart-core
Advanced tools
Comparing version 1.2.13 to 1.2.14
@@ -1,1 +0,1 @@ | ||
function BarMulti(t,e){var i={xaxis:{type:"category",orient:"bottom"},groupLabel:null,yaxis:{}};_.deepMerge(i,e),DataV.call(this,t,i)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");BarMulti=DataV.extend(BarMulti,{data:function(t){if(!t)return this._data;var e=this.options,i=e.yaxis.key;t.forEach(function(t){_.isArray(t[i])||(t[i]=[t[i]]),t[i]=_.map(t[i],function(t){return"string"==typeof t&&(t=parseInt(t)),t||(t=0),t})}),this._data=t},renderSeries:function(){this.svg.classed("bar-chart-g",!0);var t,e,i=this.options,n=this.data(),r=i.xaxis.key,a=i.yaxis.key;t=this.getComs("axis","xaxis"),e=this.getComs("axis","yaxis");var s=t.getX(),o=e.getX(),u=_.maxBy(n,function(t){return t[a].length})[a].length,l=t.calGroupStep(i.groupLabel||n[0][a].length),c=function(t,n,u){var c=d3.select(this);i.withAnimated?(i.isFirst&&c.attr({x:function(t){return s(t[r])+l(""+u)},y:function(){return o(e.getMin())},width:function(){return l.rangeBand()},height:0}),t[a][u]!==e.getMin()&&void 0!==t[a][u]&&c.transition().duration(i.animatedTiming).ease(i.animatedEasing).attr({x:function(t){return s(t[r])+l(""+u)},y:function(t){return o(t[a][u])},width:function(){return l.rangeBand()},height:function(t){return o(e.getMin())-o(t[a][u])}})||c.transition().duration(i.animatedTiming).ease(i.animatedEasing).attr({x:function(t){return s(t[r])+l(""+u)},y:function(){return o(e.getMin())-1},width:function(){return l.rangeBand()},height:function(){return 1}}),c.transition().duration(i.animatedTiming).ease(i.animatedEasing)):t[a][u]!==e.getMin()&&void 0!==t[a][u]&&c.attr({x:function(t){return s(t[r])+l(""+u)},y:function(t){return o(t[a][u])},width:function(){return l.rangeBand()},height:function(t){return o(e.getMin())-o(t[a][u])}})||c.attr({x:function(t){return s(t[r])+l(""+u)},y:function(){return o(e.getMin())-1},width:function(){return l.rangeBand()},height:function(){return 1}})},d=this.series.selectAll(".series-group").data(this._data),h=i.tooltip&&this.getComs("tooltip","tooltip");this.enterSeries=d.enter().append("g").attr("class","series-group");for(var f=0;u>f;f++){d.each(function(t,e){var i=d3.select(this).select(".serie"+(f+1))[0][0];i&&c.call(d3.select(this).select(".serie"+(f+1))[0][0],t,e,f)});var g=this.enterSeries.append("rect").attr("class","serie serie"+(f+1)).each(function(t,e){c.call(this,t,e,f)});i.tooltip&&i.tooltip.show&&!function(t,e){t.on("mouseover",function(t){this.oldColor=d3.select(this).style("fill"),d3.select(this).style("fill","rgb(155, 207, 241)");var i={};i[r]=t[r],i[a]=t[a][e],h.show(i)}).on("mouseout",function(){d3.select(this).style("fill",this.oldColor),h.hide()})}(g,f)}d.selectAll(".serie.serie"+u+" ~ .serie").remove(),this.outerSeries=d.exit().remove()},updateBeforeRender:function(){this.beforeRender()},updateSeries:function(){BarMulti.prototype.renderSeries.call(this)}}),module.exports=BarMulti; | ||
module.exports=require("./bar"); |
@@ -1,1 +0,1 @@ | ||
function BarMultiCustom(t,e){var a={xaxis:{type:"category",orient:"bottom"},yaxis:{}};_.deepMerge(a,e),DataV.call(this,t,a)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");BarMultiCustom=DataV.extend(BarMultiCustom,{data:function(t){if(!t)return this._data;var e=this.options,a=e.yaxis.key;t.forEach(function(t){_.isArray(t[a])||(t[a]=[t[a]]),t[a]=_.map(t[a],function(t){return"string"==typeof t&&(t=parseInt(t)),t||(t=0),t})}),this._data=t},renderSeries:function(){this.svg.classed("bar-chart-g",!0);var t,e,a=this.options,i=this.data(),o=this,s=a.xaxis.key,n=a.yaxis.key;t=this.getComs("axis","xaxis"),e=this.getComs("axis","yaxis");var r=t.getX(),u=e.getX(),c=_.maxBy(i,function(t){return t[n].length})[n].length,l=t.calGroupStep(a.groupLabel||i[0][n].length),h=function(t,i,c){var h=d3.select(this);a.withAnimated?(a.isFirst&&h.attr({d:function(t){var n=[{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())}];return"function"==typeof a.customPos?(n=a.customPos.call(o,n,i,c),_.pos2Path(n)):"function"==typeof a.customPath?a.customPath.call(o,n,c):_.pos2Path(n)}}),t[n][c]!==e.getMin()&&void 0!==t[n][c]&&h.transition().duration(a.animatedTiming).ease(a.animatedEasing).attr({d:function(t){var h=[{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c),y:u(t[n][c])},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(t[n][c])},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())}];return"function"==typeof a.customPos?(h=a.customPos.call(o,h,i,c),_.pos2Path(h)):"function"==typeof a.customPath?a.customPath.call(o,h,c):_.pos2Path(h)}})||h.transition().duration(a.animatedTiming).ease(a.animatedEasing).attr({d:function(t){var n=[{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c),y:u(e.getMin())-1},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())-1},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())}];return"function"==typeof a.customPos?(n=a.customPos.call(o,n,i,c),_.pos2Path(n)):"function"==typeof a.customPath?a.customPath.call(o,n,c):_.pos2Path(n)}})):t[n][c]!==e.getMin()&&void 0!==t[n][c]&&h.attr({d:function(t){var h=[{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c),y:u(t[n][c])},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(t[n][c])},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())}];return"function"==typeof a.customPos?(h=a.customPos.call(o,h,i,c),_.pos2Path(h)):"function"==typeof a.customPath?a.customPath.call(o,h,c):_.pos2Path(h)}})||h.attr({d:function(t){var n=[{x:r(t[s])+l(""+c),y:u(e.getMin())},{x:r(t[s])+l(""+c),y:u(e.getMin())-1},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())-1},{x:r(t[s])+l(""+c)+l.rangeBand(),y:u(e.getMin())}];return"function"==typeof a.customPos?(n=a.customPos.call(o,n,i,c),_.pos2Path(n)):"function"==typeof a.customPath?a.customPath.call(o,n,c):_.pos2Path(n)}})},d=this.series.selectAll(".series-group").data(this._data),g=a.tooltip&&this.getComs("tooltip","tooltip");this.enterSeries=d.enter().append("g").attr("class","series-group");for(var f=0;c>f;f++){d.each(function(t,e){var a=d3.select(this).select(".serie"+(f+1))[0][0];a&&h.call(d3.select(this).select(".serie"+(f+1))[0][0],t,e,f)});var p=this.enterSeries.append("path").attr("class","serie serie"+(f+1)).each(function(t,e){h.call(this,t,e,f)});a.tooltip&&a.tooltip.show&&!function(t,e){t.on("mouseover",function(t){this.oldColor=d3.select(this).style("fill"),d3.select(this).style("fill","rgb(155, 207, 241)");var a={};a[s]=t[s],a[n]=t[n][e],g.show(a)}).on("mouseout",function(){d3.select(this).style("fill",this.oldColor),g.hide()})}(p,f)}d.selectAll(".serie.serie"+c+" ~ .serie").remove(),this.outerSeries=d.exit().remove()},updateBeforeRender:function(){this.beforeRender()},updateSeries:function(){BarMultiCustom.prototype.renderSeries.call(this)}}),module.exports=BarMultiCustom; | ||
module.exports=require("./barCustom"); |
@@ -1,1 +0,1 @@ | ||
function BarMultiHori(t,e){var i={xaxis:{orient:"bottom",key:"y"},yaxis:{type:"category",key:"x"}};_.deepMerge(i,e),DataV.call(this,t,i)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");BarMultiHori=DataV.extend(BarMultiHori,{data:function(t){if(!t)return this._data;var e=this.options,i=e.xaxis.key;t.forEach(function(t){_.isArray(t[i])||(t[i]=[t[i]]),t[i]=_.map(t[i],function(t){return"string"==typeof t&&(t=parseInt(t)),t||(t=0),t})}),this._data=t.reverse()},renderSeries:function(){this.svg.classed("bar-chart-g",!0);var t,e,i=this.options,n=this.data(),r=i.xaxis.key,a=i.yaxis.key;t=this.getComs("axis","xaxis"),e=this.getComs("axis","yaxis");var s=t.getX(),o=e.getX(),u=_.maxBy(n,function(t){return t[r].length})[r].length,c=((o.rangeBand()-(u-1)*i.padding)/u,e.calGroupStep(i.groupLabel||u)),l=function(e,n,u){var l=d3.select(this);i.withAnimated?(i.isFirst&&l.attr({x:function(){return s(t.getMin())},y:function(t){return o(t[a])+c(""+u)},width:0,height:function(){return c.rangeBand()}}),e[r][u]!==t.getMin()&&void 0!==e[r][u]&&l.transition().duration(i.animatedTiming).ease(i.animatedEasing).attr({x:function(){return s(t.getMin())},y:function(t){return o(t[a])+c(""+u)},width:function(t){return s(t[r][u])},height:function(){return c.rangeBand()}})||l.transition().duration(i.animatedTiming).ease(i.animatedEasing).attr({x:function(){return s(t.getMin())},y:function(t){return o(t[a])+c(""+u)},width:function(){return s(t.getMin())+1},height:function(){return c.rangeBand()}})):e[r][u]!==t.getMin()&&void 0!==e[r][u]&&l.attr({x:function(){return s(t.getMin())},y:function(t){return o(t[a])+c(""+u)},width:function(t){return s(t[r][u])},height:function(){return c.rangeBand()}})||l.attr({x:function(){return s(t.getMin())},y:function(t){return o(t[a])+c(""+u)},width:function(){return s(t.getMin())+1},height:function(){return c.rangeBand()}})},d=this.series.selectAll(".series-group").data(this._data),h=i.tooltip&&this.getComs("tooltip","tooltip");this.enterSeries=d.enter().append("g").attr("class","series-group");for(var f=0;u>f;f++){d.each(function(t,e){var i=d3.select(this).select(".serie"+(f+1))[0][0];i&&l.call(d3.select(this).select(".serie"+(f+1))[0][0],t,e,f)});var g=this.enterSeries.append("rect").attr("class","serie serie"+(f+1)).each(function(t,e){l.call(this,t,e,f)});i.tooltip&&i.tooltip.show&&!function(t,e){t.on("mouseover",function(t){this.oldColor=d3.select(this).style("fill"),d3.select(this).style("fill","rgb(155, 207, 241)");var i={};i[a]=t[a],i[r]=t[r][e],h.show(i)}).on("mouseout",function(){d3.select(this).style("fill",this.oldColor),h.hide()})}(g,f)}d.selectAll(".serie.serie"+u+" ~ .serie").remove(),this.outerSeries=d.exit().remove()},updateBeforeRender:function(){this.beforeRender()},updateSeries:function(){BarMultiHori.prototype.renderSeries.call(this)}}),module.exports=BarMultiHori; | ||
module.exports=require("./barHorizontal"); |
@@ -1,1 +0,1 @@ | ||
function LineMulti(e,t){var i={xaxis:{orient:"bottom"},yaxis:{key:"y"}};_.deepMerge(i,t),DataV.call(this,e,i)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");LineMulti=DataV.extend(LineMulti,{data:function(e){if(!e)return this._data;var t=this.options,i=t.yaxis.key;e.forEach(function(e){_.isArray(e[i])||(e[i]=[e[i]]),e[i]=_.map(e[i],function(e){return"string"==typeof e&&(e=parseInt(e)),e||(e=0),e})}),this._data=e},renderSeries:function(){this.svg.classed("line-chart-g",!0);var e,t,i=this.options,a=this.data(),r=i.xaxis.key,n=i.yaxis.key;e=this.getComs("axis","xaxis"),t=this.getComs("axis","yaxis");var s=e.getX(),o=t.getX(),l=_.maxBy(a,function(e){return e[n].length})[n].length;if(i.tooltip&&i.tooltip.show){var d,u=this.getComs("tooltip","tooltip"),c=i.xaxis.type,x=i.xaxis.format;u.dispatch.on("elementMouseover",function(e){closestPoint=function(e){var t=window.screen.availWidth,i=0;return a.forEach(function(a,n){var s=a.x;"time"===c&&x&&(s=d3.time.format(x).parse(a[r])),diff=Math.abs(u.layer.xScale(s)-u.layer.xScale(e.pointXValue)),diff<t&&(t=diff,i=n,d=s)}),a[i]}(e);var t=u.layer.xScale(d)+("category"===i.xaxis.type?s.rangeBand()/2:0);u.renderGuildLayer(t),u.show(closestPoint,function(e){var t=i.xaxis.type,a="%Y",s=e[r];return"time"===t&&(s=d3.time.format(x||a)(e[r])),{x:s,y:e[n].toString()}})}),u.dispatch.on("elementMouseout",function(){u.hide()})}this.series=this.series.datum(a).each(function(){for(var e=d3.select(this),a=0;l>a;a++){var d=d3.svg.line().x(function(e){return"time"===i.xaxis.type&&"string"==typeof e[r]?s(new Date(e[r]))+(s.rangeBand?s.rangeBand()/2:0):s(e[r])+("category"===i.xaxis.type?s.rangeBand()/2:0)}).y(function(e){return o(e[n][a]||t.getMax())});i.interpolate&&d.interpolate(i.interpolate);var u=e.select(".serie"+(a+1))[0][0]?e.select(".serie"+(a+1)):e.append("path").attr({"class":"serie serie"+(a+1)});i.withAnimated?u.transition().duration(i.animatedTiming).ease(i.animatedEasing).attr({d:d}):u.attr({d:d})}}),this.series.selectAll(".serie.serie"+l+" ~ .serie").remove()},updateSeries:function(){LineMulti.prototype.renderSeries.call(this)}}),module.exports=LineMulti; | ||
module.exports=require("./line"); |
{ | ||
"name": "dchart-core", | ||
"version": "1.2.13", | ||
"version": "1.2.14", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -1,1 +0,1 @@ | ||
function Bubble(e,t){var a={xaxis:{orient:"bottom"},yaxis:{key:"y"},raxis:{key:"r"}};_.deepMerge(a,t),DataV.call(this,e,a)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");Bubble=DataV.extend(Bubble,{beforeRender:function(){var e=this.options,t=(e.yaxis.key,e.raxis.key),a=this.data(),i=e.innerWidth/a.length/4;this.radio=_.maxBy(a,function(e){return e[t]})[t]/i},renderSeries:function(){this.svg.classed("scatterplot-chart-g",!0);var e=this.options,t=this.data(),a=e.xaxis.key,i=e.yaxis.key,n=e.raxis.key,r=this.getComs("axis","xaxis").getX(),s=this.getComs("axis","yaxis").getX(),u=this.radio;this.series=this.series.selectAll(".serie").data(t).enter().append("circle").each(function(){var t=d3.select(this);e.withAnimated?t.attr({"class":"serie",cx:function(e){return r(e[a])+(r.rangeBand?r.rangeBand()/2:0)},cy:function(e){return s(e[i])},r:0}).transition().duration(e.animatedTiming).ease(e.animatedEasing).attr({cx:function(e){return r(e[a])+(r.rangeBand?r.rangeBand()/2:0)},cy:function(e){return s(e[i])},r:function(e){return e[n]/u}}):t.attr({"class":"serie",cx:function(e){return r(e[a])+(r.rangeBand?r.rangeBand()/2:0)},cy:function(e){return s(e[i])},r:function(e){return e[n]/u}})})},updateSeries:function(){var e,t,a=this.options,i=this.data(),n=a.xaxis.key,r=a.yaxis.key,s=a.raxis.key;e=this.getComs("axis","xaxis"),e.update(i,a.xaxis);var u=e.getX(),c=u.rangeBand?u.rangeBand()/2:a.innerWidth/i.length/2,o=this.radio=_.maxBy(i,function(e){return e[s]})[s]/c,d=_.min(i,function(e){return e[r]-e[s]/o});d=d[r]-d[s]/o;var x=_.maxBy(i,function(e){return e[r]+e[s]/o});x=x[r]+x[s]/o,a.yaxis.max=x,a.yaxis.min=d,t=this.getComs("axis","yaxis"),t.update(i,a.yaxis);var h=t.getX();this.series.data(i),this.series.each(function(){var e=d3.select(this);e.attr({"class":"serie",cx:function(e){return u(e[n])+(u.rangeBand?u.rangeBand()/2:0)},cy:function(e){return h(e[r])},r:function(e){return e[s]/o}})})}}),module.exports=Bubble; | ||
function Bubble(e,t){var r={xaxis:{orient:"bottom"},yaxis:{key:"y"},raxis:{key:"r"}};_.deepMerge(r,t),DataV.call(this,e,r)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");Bubble=DataV.extend(Bubble,{data:function(e){if(!e)return this._data;var t=this.options,r=t.yaxis.key,n=t.raxis.key;e.forEach(function(e){_.isArray(e[r])||(e[r]=[e[r]]),e[n]||(e[n]=[]),_.isArray(e[n])||(e[n]=[e[n]]),e[r]=_.map(e[r],function(t,r){return"string"==typeof t&&(t=parseInt(t)),t||(t=0),e[n][r]=e[n][r]||2,t})}),this._data=e},renderSeries:function(){this.svg.classed("scatterplot-chart-g",!0);var e=this.options,t=this.data(),r=e.xaxis.key,n=e.yaxis.key,i=e.raxis.key,a=this.getComs("axis","xaxis").getX(),s=this.getComs("axis","yaxis"),c=s.getX(),u=_.maxBy(t,function(e){return e[n].length})[n].length,o=function(t,u,o){var d=d3.select(this);t[n][o]!==s.getMin()&&void 0!==t[n][o]?e.withAnimated?d.transition().duration(e.animatedTiming).ease(e.animatedEasing).attr({cx:function(){return a(t[r])+(a.rangeBand?a.rangeBand()/2:0)},cy:function(){return c(t[n][o])},r:function(){return t[i][o]||2}}):d.attr({cx:function(){return a(t[r])+(a.rangeBand?a.rangeBand()/2:0)},cy:function(){return c(t[n][o])},r:function(){return t[i][o]||2}}):d.attr({cx:function(){return a(t[r])+(a.rangeBand?a.rangeBand()/2:0)},cy:function(){return c(s.getMin())},r:0})},d=this.series.selectAll(".series-group").data(t);this.enterSeries=d.enter().append("g").attr("class","series-group");for(var l=0;u>l;l++)d.each(function(e,t){var i=d3.select(this),u=i.select(".serie"+(l+1))[0][0]||i.append("circle").attr({"class":"serie serie"+(l+1),cx:function(e){return a(e[r])+(a.rangeBand?a.rangeBand()/2:0)},cy:function(e){return c(e[n][l]||s.getMin())},r:0})[0][0];u&&o.call(u,e,t,l)}),this.enterSeries.append("circle").attr({"class":"serie serie"+(l+1),cx:function(e){return a(e[r])+(a.rangeBand?a.rangeBand()/2:0)},cy:function(e){return c(e[n][l]||s.getMin())},r:0}).each(function(e,t){o.call(this,e,t,l)});d.selectAll(".serie.serie"+u+" ~ .serie").remove(),this.outerSeries=d.exit().remove()},updateSeries:function(){Bubble.prototype.renderSeries.call(this)}}),module.exports=Bubble; |
@@ -1,1 +0,1 @@ | ||
function Scatterplot(t,e){var i={xaxis:{orient:"bottom"},yaxis:{}};_.deepMerge(i,e),DataV.call(this,t,i)}var DataV=require("../datav"),d3=require("d3"),_=require("../util");Scatterplot=DataV.extend(Scatterplot,{renderSeries:function(){this.svg.classed("scatterplot-chart-g",!0);var t=this.options,e=this.data();xAxis=this.renderXAxis("xaxis",this.svg[0][0],t.xaxis),yAxis=this.renderYAxis("yaxis",this.svg[0][0],t.yaxis);var i=t.xaxis.key,r=t.yaxis.key,s=xAxis.getX(),a=yAxis.getX();this.series=this.series.selectAll(".serie").data(e).enter().append("circle").each(function(){var e=d3.select(this);t.withAnimated?e.attr({"class":"serie",cx:function(t){return s(t[i])},cy:function(t){return a(t[r])},r:0}).transition().duration(t.animatedTiming).ease(t.animatedEasing).attr({"class":"serie",cx:function(t){return s(t[i])},cy:function(t){return a(t[r])},r:5}):e.attr({"class":"serie",cx:function(t){return s(t[i])},cy:function(t){return a(t[r])},r:5})})}}),module.exports=Scatterplot; | ||
module.exports=require("./bubble"); |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
35
102107