@makechart/axis-bubble 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/index.html +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Change Logs
|
|
2
2
|
|
|
3
|
+
## v0.0.2
|
|
4
|
+
|
|
5
|
+
- extend the lite base ( `@makechart/base` `lite/index.html`, no d3 ): needs `@makechart/base` >= 0.2.0
|
|
6
|
+
and `@plotdb/chart` >= 3.7.0
|
|
7
|
+
d3 is replaced by `d3-force` ( with `d3-dispatch`, `d3-quadtree`, `d3-timer` ) and `d3-force-boundary`
|
|
8
|
+
- fix bug: it didn't render at all. layout is now disabled ( it has no layout markup ), the svg is
|
|
9
|
+
positioned at the top left, and the simulation is actually started
|
|
10
|
+
- fix bug: `d3-force-boundary` was used but not loaded
|
|
11
|
+
- fix bug: `root.seed` was used instead of `@seed`
|
|
12
|
+
- fix bug: clicking before the simulation is ready threw
|
|
13
|
+
- remove debug alpha text
|
|
14
|
+
- fix bug: labels blocked hovering ( `pointer-event` instead of `pointer-events` )
|
|
15
|
+
- add test cases ( `test/index.ls`, run with `npm test` via `@makechart/viewer` )
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## v0.0.1
|
|
4
19
|
|
|
5
20
|
init release
|
package/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<div><script type="@plotdb/block">var mod;module.exports={pkg:{name:"axis-bubble",version:"0.0.1",extend:{name:"@makechart/base"},dependencies:[]},init:function(t){var e,r
|
|
1
|
+
<div><script type="@plotdb/block">var mod;module.exports={pkg:{name:"axis-bubble",version:"0.0.1",extend:{name:"@makechart/base",path:"lite/index.html"},dependencies:[{name:"d3-dispatch",version:"3.0.1",path:"dist/d3-dispatch.min.js",async:false},{name:"d3-quadtree",version:"3.0.1",path:"dist/d3-quadtree.min.js",async:false},{name:"d3-timer",version:"3.0.1",path:"dist/d3-timer.min.js",async:false},{name:"d3-force",version:"3.0.0",path:"dist/d3-force.min.js",async:false},{name:"d3-force-boundary",path:"dist/d3-force-boundary.min.js"}]},init:function(t){var e,i,r;e=t.root,i=t.context,r=t.pubsub;return r.fire("init",{mod:mod({context:i}),layout:false}).then(function(t){return t[0]})}};mod=function(t){var e,n,s,a,i,r,o,c,u,h,l,d,f,m,x;e=t.context;n=e.d3,s=e.forceBoundary,a=e.ldcolor,i=e.chart;r=i.utils,o=r.scale,c=r.color,u=c.turbo,h=c.discrete,l=r.anim.join;d="http://www.w3.org/2000/svg";f=function(t,e){return Array.from(t.querySelectorAll(":scope > "+e))};m=function(t){var e;e=t.filter(function(t){return t!=null&&+t>=+t});if(e.length){return[e.reduce(function(t,e){if(e<t){return e}else{return t}}),e.reduce(function(t,e){if(e>t){return e}else{return t}})]}else{return[undefined,undefined]}};x=function(t){var e,i,r,n,s;t==null&&(t=Math.random());e=[1664525,1013904223,1/4294967296],i=e[0],r=e[1],n=e[2];s=(0<=t&&t<1?t/n:Math.abs(t))|0;return function(){return n*((s=i*s+r|0)>>>0)}};return{sample:function(){return{raw:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200].map(function(t){return{val:Math.random()*50+10,x:Math.random(),cat:Math.ceil(5*Math.random())}}),binding:{color:{key:"cat"},radius:{key:"val"},xpos:{key:"x"}}}},config:{},dimension:{color:{type:"R",name:"顏色"},radius:{type:"R",name:"半徑"},xpos:{type:"R",name:"X座標"}},init:function(){var t,e=this;t=this.svg.style;t.position="absolute";t.left=0;t.top=0;return this.svg.addEventListener("click",function(){e.type=!e.type;e.resize();e.render();if(e.sim){e.sim.stop();return e.sim.alpha(.9)}})},parse:function(){this.xextent=m(this.data.map(function(t){return t.xpos}));this.rextent=m(this.data.map(function(t){return t.radius}));return this.cextent=m(this.data.map(function(t){return t.color}))},resize:function(){var t,e=this;t=x(this.seed);this.scaleX=o.linear().domain(this.xextent).range([0,this.box.width]);if(this.type){this.scaleY=o.linear().domain(this.cextent).range([0,this.box.height])}else{this.scaleY=function(){return e.box.height/2}}this.data.map(function(t){return t.x=t.x||e.scaleX(t.xpos),t.y=t.y||e.box.height/2,t.ty=e.scaleY(t.color),t.val=t.radius,t.r=t.radius,t.c=t.color,t});this.area=this.box.width*this.box.height;this.rate=.5;return this.start()},render:function(){var r,t,e,i,n,s=this;r=this.rate;this.scale={color:u,r:o.linear().domain(this.rextent).range([0,1]),c:o.linear().domain(this.cextent).range([0,1])};t=this.cfg.palette?this.cfg.palette.colors.map(function(t){return a.web(t.value||t)}):["#f00","#0f0","#00f","#f90","#9f0","#0f9"];e=h(t);this.scale.color=function(t){return e(s.scale.c(t))};i=l({root:this.svg,tag:"circle",cls:"bubble",data:this.data});i.exit.map(function(t){return t.remove()});i.enter.map(function(t){t.setAttribute("r",0);return t.setAttribute("fill",s.scale.color(t.__data__.c))});f(this.svg,"circle.bubble").map(function(t){var e,i;e=t.__data__;t.setAttribute("cx",e.x);t.setAttribute("cy",e.y);t.setAttribute("fill",s.scale.color(e.c));return t.setAttribute("r",((i=e.r)>2?i:2)*s.rate)});n=l({root:this.svg,tag:"g",cls:"label",data:this.data});n.exit.map(function(t){return t.remove()});n.enter.map(function(t){var e;e=t.appendChild(document.createElementNS(d,"text"));e.setAttribute("dy","-.28em");e.setAttribute("text-anchor","middle");e.setAttribute("font-size",".7em");e.setAttribute("font-family","Rubik");e.style.pointerEvents="none";return e});return f(this.svg,"g.label").map(function(t){var i;i=t.__data__;t.setAttribute("transform","translate("+i.x+","+i.y+")");return f(t,"text").map(function(t,e){t.__data__=i;t.setAttribute("opacity",i.r*2*r<(i.val.toFixed(2)+"").length*7?0:1);t.setAttribute("dy",".38em");return t.textContent=e===0?i.val>1e6?(i.val/1e6).toFixed(2)+"M":i.val>1e3?(i.val/1e3).toFixed(2)+"K":i.val.toFixed(2):i._idx})})},tick:function(){var t,e,i,r=this;if(!this.data||!this.box){return}if(!this.sim){t=true;this.fc=e=n.forceCollide();this.sim=n.forceSimulation().force("center",this.fg=n.forceCenter(this.box.width/2,this.box.height/2)).force("x",this.fx=n.forceX(this.box.width/2).strength(.15)).force("y",this.fy=n.forceY(this.box.height/2).strength(.1)).force("b",this.fb=s(function(t){return t.r},function(t){return t.r},function(t){return r.box.width-t.r},function(t){return r.box.height-t.r})).force("collide",e);this.sim.stop();this.sim.alpha(.9);this.sim.nodes(this.data)}this.fc.strength(1);this.fc.radius(function(t){return r.rate*t.r+2});this.fg.x(this.box.width/2);this.fg.y(this.box.height/2);this.fx.strength(.15);this.fy.strength(.01);this.sim.tick(t?20:1);i=this.sim.alpha();if(i<.001){this.stop()}this.data.map(function(t){return t.y=t.y+(t.ty-t.y)*i*.1});return this.render()}}};</script></div>
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@makechart/axis-bubble","version":"0.0.
|
|
1
|
+
{"name":"@makechart/axis-bubble","version":"0.0.2","description":"","scripts":{"test":"mctest","test:serve":"mctest serve -o","test:dev":"mctest -l \"@makechart/base:../base;@plotdb/chart:../../../plotdb/projects/chart;@plotdb/dash:../../../plotdb/projects/dash\"","test:dev:serve":"mctest serve -o -l \"@makechart/base:../base;@plotdb/chart:../../../plotdb/projects/chart;@plotdb/dash:../../../plotdb/projects/dash\""},"keywords":[],"author":"zbryikt","license":"MIT","dependencies":{"@plotdb/srcbuild":"^0.0.69","fedep":"1.6.0","livescript":"^1.6.0"},"devDependencies":{"@makechart/viewer":"^0.0.3"}}
|