@andyreagan/hedotools 5.0.0 → 6.0.0
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/js/hedotools.barchart.js
CHANGED
|
@@ -264,11 +264,11 @@ hedotools.barchart = function() {
|
|
|
264
264
|
.style('opacity','1.0').style('stroke-width','1.0').style('stroke','rgb(100,100,100)')
|
|
265
265
|
.attr("height",function(d,i) { return 11; } )
|
|
266
266
|
.attr("width",function(d,i) { if (d[3]>0) {return d3.max([x(d[3])-figcenter,0]);} else {return d3.max([figcenter-x(d[3]),0]); } } )
|
|
267
|
-
.on('mouseover', function(d
|
|
267
|
+
.on('mouseover', function(event,d){
|
|
268
268
|
var rectSelection = d3.select(this).style('opacity','1.0').style('stroke','black').style('stroke-width','1.0');
|
|
269
|
-
hedotools.barchartoncall.test(d,
|
|
269
|
+
hedotools.barchartoncall.test(d,d[0]);
|
|
270
270
|
})
|
|
271
|
-
.on('mouseout', function(d){
|
|
271
|
+
.on('mouseout', function(event,d){
|
|
272
272
|
var rectSelection = d3.select(this).style('opacity','1.0').style('stroke','rgb(100,100,100)').style('stroke-width','1.0');
|
|
273
273
|
// var rectSelection = d3.select(this).style({opacity:'0.7'});
|
|
274
274
|
});
|
|
@@ -282,8 +282,8 @@ hedotools.barchart = function() {
|
|
|
282
282
|
.style("text-anchor", function(d,i) { if (d[3]>0) { return "end";} else { return "start";}})
|
|
283
283
|
.attr("y",function(d,i) { return y(i+1)+11; } )
|
|
284
284
|
.text(function(d,i) { return (i+1)+". "+d[2]; })
|
|
285
|
-
.on('mouseover', function(d
|
|
286
|
-
hedotools.barchartoncall.test(d,
|
|
285
|
+
.on('mouseover', function(event,d){
|
|
286
|
+
hedotools.barchartoncall.test(d,d[0]);
|
|
287
287
|
});
|
|
288
288
|
|
|
289
289
|
// d3.select(window).on("resize.shiftplot",resizeshift);
|
package/js/hedotools.lens.js
CHANGED
|
@@ -99,7 +99,7 @@ hedotools.lens = function() {
|
|
|
99
99
|
.range([0,width]);
|
|
100
100
|
|
|
101
101
|
// use d3.layout http://bl.ocks.org/mbostock/3048450
|
|
102
|
-
var data = d3.
|
|
102
|
+
var data = d3.bin()
|
|
103
103
|
.domain(x.domain())
|
|
104
104
|
.thresholds(x.ticks(65))
|
|
105
105
|
(lens);
|
|
@@ -227,11 +227,11 @@ hedotools.lens = function() {
|
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
|
|
230
|
-
function brushended() {
|
|
231
|
-
if (!
|
|
232
|
-
if (!
|
|
230
|
+
function brushended(event) {
|
|
231
|
+
if (!event.sourceEvent) return;
|
|
232
|
+
if (!event.selection) return;
|
|
233
233
|
// selection is in pixels; invert through brushX to data space
|
|
234
|
-
var extent0 =
|
|
234
|
+
var extent0 = event.selection.map(brushX.invert),
|
|
235
235
|
extent1 = extent0; // should round it to bins
|
|
236
236
|
|
|
237
237
|
onredrawfunction();
|
|
@@ -316,7 +316,7 @@ hedotools.lens = function() {
|
|
|
316
316
|
.attr("type","button")
|
|
317
317
|
.attr("class", function(d,i) { return "btn btn-default btn-xs "+defaultnames[i]; })
|
|
318
318
|
.html(function(d,i) { return defaultnames[i]; })
|
|
319
|
-
.on("click",function(d
|
|
319
|
+
.on("click",function(event,d) {
|
|
320
320
|
figure.selectAll("button").attr("class","btn btn-default btn-xs");
|
|
321
321
|
d3.select(this).attr("class","btn btn-primary btn-xs");
|
|
322
322
|
d3.select(".lensbrush") //.transition()
|
package/js/hedotools.map.js
CHANGED
|
@@ -121,7 +121,8 @@ hedotools.map = function() {
|
|
|
121
121
|
.attr("height", 19)
|
|
122
122
|
.attr("fill", "white") //http://www.w3schools.com/html/html_colors.asp
|
|
123
123
|
.attr("opacity", "0.0")
|
|
124
|
-
.on("mousedown", function(d
|
|
124
|
+
.on("mousedown", function(event,d) {
|
|
125
|
+
var i = selarray.indexOf(d);
|
|
125
126
|
if (stateSelType !== d) {
|
|
126
127
|
stateSelType = d;
|
|
127
128
|
activeHover = true;
|
|
@@ -275,7 +276,7 @@ hedotools.map = function() {
|
|
|
275
276
|
.attr("stroke","black")
|
|
276
277
|
.attr("stroke-width",".7");
|
|
277
278
|
|
|
278
|
-
function state_clicked(d
|
|
279
|
+
function state_clicked(event,d) { var i = stateFeatures.indexOf(d);
|
|
279
280
|
// next line verifies that the data and json line up
|
|
280
281
|
// console.log(d.properties.name); console.log(allData[i].name);
|
|
281
282
|
|
|
@@ -331,7 +332,7 @@ hedotools.map = function() {
|
|
|
331
332
|
// }
|
|
332
333
|
}
|
|
333
334
|
|
|
334
|
-
function state_hover(d
|
|
335
|
+
function state_hover(event,d) { var i = stateFeatures.indexOf(d);
|
|
335
336
|
var bbox = this.getBBox();
|
|
336
337
|
var x = Math.floor(bbox.x + bbox.width/2.0);
|
|
337
338
|
var y = Math.floor(bbox.y + bbox.height/2.0);
|
|
@@ -480,7 +481,7 @@ hedotools.map = function() {
|
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
483
|
|
|
483
|
-
function state_unhover(d
|
|
484
|
+
function state_unhover(event,d) {
|
|
484
485
|
|
|
485
486
|
d3.select(".hoverinfogroup").remove();
|
|
486
487
|
|
package/js/hedotools.sankey.js
CHANGED
|
@@ -250,7 +250,7 @@ hedotools.sankey = function() {
|
|
|
250
250
|
.attr("fill", "none")
|
|
251
251
|
.attr("class", function(d,i) { return "r"+classColor(data[i].oldindex)+"-8"; })
|
|
252
252
|
.attr("stroke-width", function(d,i) { return pathwidth(Math.abs(data[i].change)); })
|
|
253
|
-
.on("mouseover", function(d
|
|
253
|
+
.on("mouseover", function(event,d) { var i = sankeydata.indexOf(d);
|
|
254
254
|
// console.log(i);
|
|
255
255
|
// console.log(data[i]);
|
|
256
256
|
// var rectSelection = d3.select(this)
|
|
@@ -276,8 +276,8 @@ hedotools.sankey = function() {
|
|
|
276
276
|
var hoverboxyoffset = 0;
|
|
277
277
|
var hoverboxxoffset = 0;
|
|
278
278
|
|
|
279
|
-
var x = d3.
|
|
280
|
-
var y = d3.
|
|
279
|
+
var x = d3.pointer(event, thispath)[0];
|
|
280
|
+
var y = d3.pointer(event, thispath)[1];
|
|
281
281
|
|
|
282
282
|
var hoverboxheightguess = 190;
|
|
283
283
|
if (refcity.length > 0) {
|
|
@@ -428,7 +428,7 @@ hedotools.sankey = function() {
|
|
|
428
428
|
clearTimeout(popuptimer);
|
|
429
429
|
popuptimer = setTimeout(hidehover,3000);
|
|
430
430
|
})
|
|
431
|
-
.on("mouseout", function(d
|
|
431
|
+
.on("mouseout", function(event,d) {
|
|
432
432
|
var timeout = 500;
|
|
433
433
|
if (useTip) {
|
|
434
434
|
// hovergroup.style({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andyreagan/hedotools",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A collection of D3.js tools in use at hedonometer.org: word shifts (via @andyreagan/d3-shifterator), choropleth maps, sankey diagrams, a frequency lens, and bar charts. Version tracks the supported D3 major version (
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"description": "A collection of D3.js tools in use at hedonometer.org: word shifts (via @andyreagan/d3-shifterator), choropleth maps, sankey diagrams, a frequency lens, and bar charts. Version tracks the supported D3 major version (6.x = D3 v6).",
|
|
5
5
|
"author": "Andy Reagan",
|
|
6
6
|
"license": "BSD-2-Clause",
|
|
7
7
|
"scripts": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"vitest": "3.2.6"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@andyreagan/d3-shifterator": "^
|
|
36
|
-
"d3": "^
|
|
35
|
+
"@andyreagan/d3-shifterator": "^6.0.0",
|
|
36
|
+
"d3": "^6.7.0",
|
|
37
37
|
"jquery": "^3.5.1",
|
|
38
38
|
"topojson-client": "^3.1.0"
|
|
39
39
|
}
|