Best JavaScript code snippet using testcafe
tamr.js
Source:tamr.js
...152 bottom();153 callSource();154 callNon();155 // for (i=0; i<dataTypes.length; i++){ 156 // d3.selectAll("."+dataTypes[i]+"text").transition().attr("opacity",0)157 // }158 // center();159 // callMidSource();160 // callMidNon();161}, del / 10)162// setTimeout(function() {163// sortEntries();164// }, del * 4)165var uniHeight = 15;166var textSpace = 10;167// //max possible sizing for rectangle168// var uniHeight = 65;169// var textSpace = 36;170var recordsAre = [];171var indexes = [];172var key;173var key = function(d) {174 return d.key;175};176var minRecords;177var maxRecords;178d3.csv("entity.csv", function(error, data) {179 for (i = 0; i < data.length; i++) {180 dataIs.push(data[i]);181 recordsAre.push(parseInt(data[i].Records));182 recordsAre.sort(d3.descending);183minRecords = d3.min(recordsAre);184maxRecords = d3.max(recordsAre);185 var uniScale = d3.scale.linear()186 .domain([0, data.length])187 .range([65, 15]);188 var txtScale = d3.scale.linear()189 .domain([15, 65])190 .range([12, 50]);191 uniHeight = uniScale(data.length);192 textSpace = txtScale(uniHeight);193 if (Object.getOwnPropertyNames(data[i]) == "Source") {} else {194 saveOne.push(Object.getOwnPropertyNames(data[i]));195 }196 Object.getOwnPropertyNames(data[i]).forEach(function(val, idx, array) {197 if (val == "City") {198 // console.log(val + ' -> ' + data[i][val]);199 cityData.push(data[i][val])200 }201 if (val == "Age") {202 ageData.push(data[i][val])203 }204 if (val == "Country") {205 countryData.push(data[i][val])206 }207 if (val == "EmailAddress") {208 emailData.push(data[i][val])209 }210 if (val == "FirstName") {211 firstData.push(data[i][val])212 }213 if (val == "LastName") {214 lastData.push(data[i][val])215 }216 if (val == "ID") {217 idData.push(data[i][val])218 }219 if (val == "PhoneNumber") {220 phoneData.push(data[i][val])221 }222 if (val == "Sex") {223 sexData.push(data[i][val])224 }225 if (val == "State") {226 stateData.push(data[i][val])227 }228 if (val == "StreetAddress") {229 stData.push(data[i][val])230 }231 if (val == "Suffix") {232 suffixData.push(data[i][val])233 }234 if (val == "Title") {235 titleData.push(data[i][val])236 }237 if (val == "ZipCode") {238 zipData.push(data[i][val])239 }240 if (val == "City" && data[i][val].length > 0) {241 city++;242 cityTotal = city;243 }244 if (val == "Age" && data[i][val].length > 0) {245 age++;246 ageTotal = age;247 }248 if (val == "Country" && data[i][val].length > 0) {249 country++;250 countryTotal = country;251 }252 if (val == "EmailAddress" && data[i][val].length > 0) {253 email++;254 emailTotal = email;255 }256 if (val == "FirstName" && data[i][val].length > 0) {257 first++;258 firstTotal = first;259 }260 if (val == "LastName" && data[i][val].length > 0) {261 last++;262 lastTotal = last;263 }264 if (val == "ID" && data[i][val].length > 0) {265 id++;266 idTotal = id;267 }268 if (val == "PhoneNumber" && data[i][val].length > 0) {269 phone++;270 phoneTotal = phone;271 }272 if (val == "Sex" && data[i][val].length > 0) {273 sex++;274 sexTotal = sex;275 }276 if (val == "State" && data[i][val].length > 0) {277 state++;278 stateTotal = state;279 }280 if (val == "StreetAddress" && data[i][val].length > 0) {281 st++;282 stTotal = st;283 }284 if (val == "Suffix" && data[i][val].length > 0) {285 suf++;286 sufTotal = suf;287 }288 if (val == "Title" && data[i][val].length > 0) {289 tit++;290 titTotal = tit;291 }292 if (val == "ZipCode" && data[i][val].length > 0) {293 zip++;294 zipTotal = zip;295 }296 })297 for (j = 0; j < saveOne[i].length; j++) {298 if (saveOne[i][j] == "Source") {299 saveOne[i].splice(0, 1)300 }301 if (saveOne[i][j] == "Records") {302 saveOne[i].splice(0, 1)303 }304 if (saveOne[i][j] == "key") {305 saveOne[i].splice(j, 1)306 }307 dataTypes[j] = (saveOne[i][j]);308 }309 }310 xScale = d3.scale.ordinal()311 .domain(dataTypes)312 .rangeBands([lMargin * 5, width - lMargin * 9], 1) //.2)313 wide = (width - 350) / parseInt(dataTypes.length);314 widthBottom = (width - 350) / parseInt(dataTypes.length);315})316var topMargin = 100;317var topSpace = topMargin - 20;318var topSpaceText = topMargin - 8;319var topSpaceRect = (topMargin) / 2;320var topSpaceText3 = (topMargin + 12) / 2;321var fontAdjust = 12;322function topPart() {323 dataTypes.splice(dataTypes.length-2,1)324 // dataTypes.splice(dataTypes.length-3,4)325 var factor = 4;326 topMargin = 10;327 oheightScale = d3.scale.linear()328 .domain([0, dataIs.length])329 .range([topSpaceText3-2, dataIs.length*(factor+2)])330 var heightScale = d3.scale.linear()331 .domain([0, dataIs.length])332 .range([topSpaceText3, topSpaceText3 + 50])333 xScale = d3.scale.ordinal()334 .domain(dataTypes)335 .rangeBands([lMargin * 5, width - lMargin * 9], 1) //.2)336 var j = 0;337 var theserects = svg.selectAll("rects")338 .data(dataTypes)339 .enter()340 .append("rect")341 .attr("class", function(d, i) {342 return d;343 })344 .attr("x", function(d, i) {345 return xScale(d)346 })347 .attr("y", topSpaceRect)348 .attr("width", 1)349 .attr("height", 0)350 .attr("stroke", "white")351 .attr("fill", tamR)352 .attr("opacity", function(d, i) {353 return 1;354 })355 .attr("width", wide)356 .transition()357 .duration(1000)358 .each("end", function() {359 d3.selectAll(".ID").transition().attr("height", idTotal * factor)360 d3.selectAll(".Title").transition().attr("height", titTotal * factor)361 d3.selectAll(".FirstName").transition().attr("height", firstTotal * factor)362 d3.selectAll(".LastName").transition().attr("height", lastTotal * factor)363 d3.selectAll(".Suffix").transition().attr("height", sufTotal * factor)364 d3.selectAll(".EmailAddress").transition().attr("height", emailTotal * factor)365 d3.selectAll(".PhoneNumber").transition().attr("height", phoneTotal * factor)366 d3.selectAll(".StreetAddress").transition().attr("height", stTotal * factor)367 d3.selectAll(".City").transition().attr("height", cityTotal * factor)368 d3.selectAll(".ZipCode").transition().attr("height", zipTotal * factor)369 d3.selectAll(".State").transition().attr("height", stateTotal * factor)370 d3.selectAll(".Country").transition().attr("height", countryTotal * factor)371 d3.selectAll(".Sex").transition().attr("height", sexTotal * factor);372 d3.selectAll(".Age").transition().attr("height", ageTotal * factor);373 svg.selectAll("topLine")374 .data(d3.range(dataIs.length))375 .enter()376 .append("line")377 .attr("class", "topLine")378 .attr("x1", function() {379 x1 = d3.select(".back0").attr("x");380 // x1 = d3.select("rect.ID").attr("x");381 return x1;382 })383 .attr("y1", function(d, i) {384 return oheightScale(i); //i*10;385 })386 .attr("x2", function() {387 x2 = d3.select(".back" + parseInt(dataTypes.length - 1)).attr("x");388 // x2 = d3.select("rect.Age").attr("x");389 // return wide+x2;390 return parseInt(wide) + parseInt(x2);391 })392 .attr("y2", function(d, i) {393 return oheightScale(i);394 })395 .attr("stroke", "white")396 .attr("opacity", 1)397 .attr("stroke-width", .2)398 })399 // svg.selectAll("rectBack")400 // .data(dataTypes)401 // .enter()402 // .append("rect")403 // .attr("class", "rectBack")404 // .attr("x", function(d,i){405 // return xScale(d);406 // })407 // .attr("y",topMargin)408 // .attr("fill","none")409 // .attr("opacity",.5)410 // .attr("stroke","lightgray")411 // .attr("width", wide)412 // .attr("height",20)413 // svg.selectAll("text")414 // .data(dataTypes)415 // .enter()416 // .append("text")417 // .attr("class", "topText")418 // .style("text-anchor", "middle")419 // .attr("x", function(d,i){420 // return xScale(d)+wide/2;421 // })422 // .attr("y",topMargin+fontAdjust)423 // .text(function(d){ return d })424 // .attr("opacity",1);425}426function center() {427 xScale = d3.scale.ordinal()428 .domain(dataTypes)429 .rangeBands([lMargin * 5, width - lMargin * 9], 1) //.2)430 var j = 0;431 svg.selectAll("rect2")432 .data(dataTypes)433 .enter()434 .append("rect")435 .attr("class", "rect2")436 .attr("x", function(d, i) {437 return xScale(d);438 })439 .attr("y", topSpaceRect)440 .attr("fill", tamR)441 .attr("stroke", "white")442 .attr("width", wide)443 .attr("height", uniHeight)444 var height2Scale = d3.scale.linear()445 .domain([0, 1])446 .range([topMargin * topFactor, topMargin * topFactor * topFactor])447 // svg.selectAll("text3")448 // .data(dataTypes)449 // .enter()450 // .append("text")451 // .attr("class", "text3")452 // .style("text-anchor", "middle")453 // .attr("x", function(d,i){454 // return xScale(d);455 // })456 // .attr("y",topSpaceText3)457 // .attr("opacity",1)458 // .attr("fill","white")459 // .text(function(d,i){ 460 // return oneData[i];461 // })462 // .transition()463 // .duration(2000)464 // .attr("x", function(d,i){465 // return xScale(d)+wide/2466 // })467}468var recordScale = d3.scale.linear()469 .domain([0, 2000000])470 .range([2, uniHeight])471function callMidSource() {472 var randoScale = d3.scale.linear()473 .domain([0, 20])474 .range([2, 10])475 var hScale = d3.scale.linear()476 .domain([0, dataIs.length])477 .range([topSpaceRect + 3, height - 40])478 var thisOne = 0;479 svg.selectAll("source1Rect")480 .data(d3.range(1))481 .enter()482 .append("rect")483 .attr("class", "source1Rect")484 .attr("x", lMargin)485 .attr("y", function(d, i) {486 return hScale(i); //fold/2 + i*25+10;487 })488 .attr("opacity", .5)489 .attr("fill", tamR)490 .attr("width", 0)491 .attr("height", 0)492 .transition()493 .duration(2000)494 .attr("width", function(d, i) {495 return 8;496 })497 .attr("height", function(d, i) {498 return recordScale(dataIs[0].Records);499 })500 svg.selectAll("outline1Rects")501 .data(d3.range(1))502 .enter()503 .append("rect")504 .attr("class", "outline1Rects")505 .attr("x", lMargin)506 .attr("y", function(d, i) {507 return hScale(i); //fold/2 + i*25+10;508 })509 .attr("stroke", "white")510 .attr("opacity", .2)511 .attr("fill", tamR)512 .attr("width", 0)513 .attr("height", 0)514 .transition()515 .duration(2000)516 .attr("width", function(d, i) {517 return 18;518 })519 .attr("height", function(d, i) {520 return recordScale(dataIs[0].Records) + 10;521 })522 // var sourceText = "Source"523 svg.selectAll("source1Text")524 .data(d3.range(1))525 .enter()526 .append("text")527 .attr("class", "source1Text")528 .attr("x", lMargin)529 .attr("y", function(d, i) {530 return hScale(i) + 10; //fold/2+i*25+20;531 })532 .transition()533 .delay(1000)534 .duration(2000)535 .attr("x", function(d, i) {536 return lMargin + 8 + 14;537 })538 .text("Excel Sheet");539 // svg.append("text")540 // .attr("class","sourceLabel")541 // .attr("x", lMargin)542 // .attr("y", topSpaceText)543 // .text("Source") 544}545function callMidNon() {546 var hScale = d3.scale.linear()547 .domain([0, dataIs.length])548 .range([topSpaceRect, height - 40])549 var rMargin = 130;550 svg.selectAll("nonMid")551 .data(d3.range(1))552 .enter()553 .append("rect")554 .attr("class", "nonMid")555 .attr("x", width - 130)556 .attr("y", function(d, i) {557 return hScale(i); //fold/2 + i*25+10;558 })559 .attr("opacity", .5)560 .attr("fill", tamR)561 .attr("width", 0)562 .attr("height", 0)563 .attr("stroke", "white")564 .transition()565 .duration(2000)566 .attr("width", 10)567 .attr("height", uniHeight);568 svg.selectAll("nonMid")569 .data(d3.range(1))570 .enter()571 .append("rect")572 .attr("class", "nonMid")573 .attr("x", width - 120)574 .attr("y", function(d, i) {575 return hScale(i); //fold/2 + i*25+10;576 })577 .attr("opacity", .5)578 .attr("fill", tamR)579 .attr("width", 0)580 .attr("height", uniHeight)581 .attr("stroke", "white")582 .transition()583 .duration(2000)584 .attr("width", 10);585 svg.selectAll("nonMid")586 .data(d3.range(1))587 .enter()588 .append("rect")589 .attr("class", "nonMid")590 .attr("x", width - 110)591 .attr("y", function(d, i) {592 return hScale(i); //fold/2 + i*25+10;593 })594 .attr("opacity", .5)595 .attr("fill", tamR)596 .attr("width", 0)597 .attr("height", uniHeight)598 .attr("stroke", "white")599 .transition()600 .duration(2000)601 .attr("width", function(d, i) {602 if (i % 3 == 1) {603 return 10604 } else {605 return 0;606 }607 })608}609function callTopSource() {610 var randoScale = d3.scale.linear()611 .domain([0, 20])612 .range([2, 10])613 var recordScale = d3.scale.linear()614 .domain([0, 2000000])615 .range([2, uniHeight])616 // var hScale = d3.scale.linear()617 // .domain([0, dataIs.length])618 // .range([(12+topMargin*2), height-40])619 var hScale = d3.scale.linear()620 .domain([0, dataIs.length])621 .range([topSpaceRect, height])622 var thisOne = 0;623 svg.selectAll("sourceTop")624 .data(d3.range(1))625 .enter()626 .append("rect")627 .attr("class", "sourceTop")628 .attr("x", lMargin)629 .attr("y", function(d, i) {630 return hScale(i); //fold/2 + i*25+10;631 })632 .attr("opacity", .5)633 .attr("fill", tamR)634 .attr("width", 0)635 .attr("height", 0)636 .transition()637 .duration(2000)638 .attr("width", function(d, i) {639 return 8;640 })641 .attr("height", function(d, i) {642 return recordScale(dataIs[1].Records);643 })644 svg.selectAll("outlineTop")645 .data(d3.range(1))646 .enter()647 .append("rect")648 .attr("class", "outlineTop")649 .attr("x", lMargin)650 .attr("y", function(d, i) {651 return hScale(i); //fold/2 + i*25+10;652 })653 .attr("stroke", "white")654 .attr("opacity", .2)655 .attr("fill", tamR)656 .attr("width", 0)657 .attr("height", 0)658 .transition()659 .duration(2000)660 .attr("width", function(d, i) {661 return 18;662 })663 .attr("height", function(d, i) {664 return recordScale(dataIs[1].Records) + 10;665 })666 // svg.append("text")667 // .attr("class","sourceLabel")668 // .attr("x", lMargin)669 // .attr("y", topMargin+12)670 // .text("Source") 671}672svg.append("text")673 .attr("class", "sourceLabel")674 .attr("x", lMargin)675 .attr("y", topSpaceText3 - 18)676 .text("Source")677function callTopNon() {678 var hScale = d3.scale.linear()679 .domain([0, dataIs.length])680 .range([topSpaceRect, height])681 // var hScale = d3.scale.linear()682 // .domain([0, dataIs.length])683 // .range([(12+topMargin*2), height-40])684 var rMargin = 130;685 svg.selectAll("nonTop")686 .data(d3.range(4))687 .enter()688 .append("rect")689 .attr("class", "nonTop")690 .attr("x", function(d, i) {691 return width - 130 + i * 10;692 })693 .attr("y", function(d, i) {694 return hScale(0); //fold/2 + i*25+10;695 })696 .attr("opacity", .5)697 .attr("fill", tamR)698 .attr("width", 0)699 .attr("height", 0)700 .attr("stroke", "white")701 .transition()702 .duration(2000)703 .attr("width", 10)704 .attr("height", uniHeight);705 // svg.append("text")706 // .attr("class","sourceLabel")707 // .attr("x", width-130)708 // .attr("y", topMargin+12)709 // .text("Non-unified") 710}711svg.append("text")712 .attr("class", "sourceLabel")713 .attr("x", width - 130)714 .attr("y", topSpaceText3 - 18)715 .text("Non-unified")716// var line = svg.append("line")717// .attr("class", "crossLine")718// .attr("x1", 0)719// .attr("y1", height/2)720// .attr("x2", width+200)721// .attr("y2", height/2)722// .attr("stroke","grey")723// .attr("stroke-dasharray", "2,2")724// .attr("stroke-width", .1);725var sourceHeight = [];726var sourceWidth = [];727function callSource() {728 var randoScale = d3.scale.linear()729 .domain([0, 20])730 .range([2, 10])731 var hScale = d3.scale.linear()732 .domain([0, dataIs.length])733 .range([topSpaceText3, height])734 var recordScale = d3.scale.linear()735 .domain([0, 2000000])736 .range([2, uniHeight])737 var thisOne = 0;738 svg.selectAll("sourceRect")739 .data(dataIs)740 .enter()741 .append("rect")742 .attr("class", "sourceRect")743 .attr("x", lMargin)744 .attr("y", function(d, i) {745 return hScale(i); //fold/2 + i*25+10;746 })747 .attr("opacity", .5)748 .attr("fill", tamR)749 .attr("width", 0)750 .attr("height", 0)751 .transition()752 .duration(2000)753 .attr("width", function(d, i) {754 Object.getOwnPropertyNames(d).forEach(function(val, idx, array) {755 // if (d[val].length!="undefined"){}756 if(d[val].length > 0) {757 // console.log(d[val])758 thisOne++;759 sourceWidth[i] = (thisOne);760 }761 // }762 })763 thisOne = 0;764 return sourceWidth[i];765 })766 .attr("height", function(d, i) {767 sourceHeight.push(recordScale(d.Records));768 return recordScale(d.Records);769 })770 svg.selectAll("outlineRects")771 .data(dataIs)772 .enter()773 .append("rect")774 .attr("class", "outlineRects")775 .attr("x", lMargin)776 .attr("y", function(d, i) {777 return hScale(i); //fold/2 + i*25+10;778 })779 .attr("stroke", "white")780 .attr("opacity", .2)781 .attr("fill", tamR)782 .attr("width", 0)783 .attr("height", 0)784 .transition()785 .duration(2000)786 .attr("width", function(d, i) {787 return sourceWidth[i] + 10;788 })789 .attr("height", function(d, i) {790 return sourceHeight[i] + 10;791 })792 var sortScale = d3.scale.ordinal()793 .domain(d3.range(dataIs.length))794 .rangeRoundBands([topSpaceText3 - 5, height], 0.05);795 // var sourceText = "Source"796 svg.selectAll("sourceText")797 .data(dataIs, key)798 .enter()799 .append("text")800 .attr("class", "sourceText")801 .attr("x", lMargin)802 .attr("y", function(d, i) {803 return sortScale(i) + 10; //fold/2+i*25+20;804 })805 .transition()806 .delay(1000)807 .duration(2000)808 .attr("x", function(d, i) {809 return lMargin + sourceWidth[i] + 14;810 })811 .text(function(d, i) {812 // if(i>0){813 return d.Source;814 // } else{} 815 })816 // svg.append("text")817 // .attr("class","sourceLabel")818 // .attr("x", lMargin)819 // .attr("y", fold/2-10)820 // .text("Source") 821}822function sortSource() {823 var hScale = d3.scale.linear()824 .domain([0, dataIs.length])825 .range([topSpaceText3 - 5, height])826 d3.selectAll(".sourceRect, .outlineRects")827 .transition()828 .attr("y", function(d, i) {829 return hScale(d.key);830 })831 d3.selectAll(".sourceText")832 .transition()833 .attr("y", function(d, i) {834 console.log(d.key)835 return hScale(d.key) + 10;836 })837 d3.selectAll(".source1Text").transition().attr("opacity", 0);838}839function sortNon() {840 var hScale = d3.scale.linear()841 .domain([0, dataIs.length])842 .range([topSpaceText3 - 5, height])843 var rHScale = d3.scale.linear()844 .domain([minRecords, maxRecords])845 .range([5, uniHeight])846 d3.selectAll(".nonRect")847 .transition()848 .attr("height", function(d, i) {849 if (i < 25) {850 return rHScale(dataIs[i].Records)851 } else {852 return uniHeight;853 }854 })855 .attr("y", function(d,i) {856 console.log(dataIs[i].key)857 return hScale(dataIs[i].key);858 })859 // , .nonRect2, .nonRect3860 d3.selectAll(".nonRect2")861 .transition()862 .attr("height", function(d, i) {863 if (i < 25) {864 return rHScale(dataIs[i].Records)865 } else {866 return uniHeight;867 }868 })869 .attr("y", function(d,i) {870 return hScale(dataIs[i].key);871 })872 d3.selectAll(".nonRect3")873 .transition()874 .attr("height", function(d, i) {875 if (i < 25) {876 return rHScale(dataIs[i].Records)877 } else {878 return uniHeight;879 }880 })881 .attr("y", function(d,i) {882 return hScale(dataIs[i].key);883 })884}885function unsortNon() {886 var hScale = d3.scale.linear()887 .domain([0, dataIs.length])888 .range([topSpaceText3 - 5, height])889 d3.selectAll(".nonRect3")890 .transition()891 .attr("y", function(d,i){892 return hScale(i);893 })894 d3.selectAll(".nonRect2")895 .transition()896 .attr("y", function(d,i){897 return hScale(i);898 })899 d3.selectAll(".nonRect3")900 .transition()901 .attr("y", function(d,i){902 return hScale(i);903 })904 d3.selectAll(".nonRect3, .nonRect2, .nonRect")905 .transition()906 .delay(1000)907 .attr("height", function(d, i) {908 return uniHeight;909 })910 }911function showDetails() {912 var on = 1;913 d3.selectAll(".Citytext")914 .transition()915 .attr("opacity", function(d, i) {916 if (d.length > 0) {917 return .9;918 } else {919 return 0;920 }921 })922 d3.selectAll(".Agetext")923 .transition()924 .attr("opacity", function(d, i) {925 if (d.length > 0) {926 return .9;927 } else {928 return 0;929 }930 })931 d3.selectAll(".Countrytext")932 .transition()933 .attr("opacity", function(d, i) {934 if (d.length > 0) {935 return .9;936 } else {937 return 0;938 }939 })940 d3.selectAll(".Emailtext")941 .transition()942 .attr("opacity", function(d, i) {943 if (d.length > 0) {944 return .9;945 } else {946 return 0;947 }948 })949 d3.selectAll(".Firsttext")950 .transition()951 .attr("opacity", function(d, i) {952 if (d.length > 0) {953 return .9;954 } else {955 return 0;956 }957 })958 d3.selectAll(".Lasttext")959 .transition()960 .attr("opacity", function(d, i) {961 if (d.length > 0) {962 return .9;963 } else {964 return 0;965 }966 })967 d3.selectAll(".IDtext")968 .transition()969 .attr("opacity", function(d, i) {970 if (d.length > 0) {971 return .9;972 } else {973 return 0;974 }975 })976 d3.selectAll(".Phonetext")977 .transition()978 .attr("opacity", function(d, i) {979 if (d.length > 0) {980 return .9;981 } else {982 return 0;983 }984 })985 d3.selectAll(".Sextext")986 .transition()987 .attr("opacity", function(d, i) {988 if (d.length > 0) {989 return .9;990 } else {991 return 0;992 }993 })994 d3.selectAll(".Statetext")995 .transition()996 .attr("opacity", function(d, i) {997 if (d.length > 0) {998 return .9;999 } else {1000 return 0;1001 }1002 })1003 d3.selectAll(".Streettext")1004 .transition()1005 .attr("opacity", function(d, i) {1006 if (d.length > 0) {1007 return .9;1008 } else {1009 return 0;1010 }1011 })1012 d3.selectAll(".Suffixtext")1013 .transition()1014 .attr("opacity", function(d, i) {1015 if (d.length > 0) {1016 return .9;1017 } else {1018 return 0;1019 }1020 })1021 d3.selectAll(".Titletext")1022 .transition()1023 .attr("opacity", function(d, i) {1024 if (d.length > 0) {1025 return .9;1026 } else {1027 return 0;1028 }1029 })1030 d3.selectAll(".Ziptext")1031 .transition()1032 .attr("opacity", function(d, i) {1033 if (d.length > 0) {1034 return .9;1035 } else {1036 return 0;1037 }1038 })1039 // d3.selectAll(".Agetext")1040 // .transition()1041 // .attr("opacity", on)1042 // d3.selectAll(".Citytext")1043 // .transition()1044 // .attr("opacity", on)1045 // d3.selectAll(".Ziptext")1046 // .transition()1047 // .attr("opacity", on)1048 // d3.selectAll(".Suffixtext")1049 // .transition()1050 // .attr("opacity", on)1051 // d3.selectAll(".Titletext")1052 // .transition()1053 // .attr("opacity", on)1054 // d3.selectAll(".Streettext")1055 // .transition()1056 // .attr("opacity", on)1057 // d3.selectAll(".Statetext")1058 // .transition()1059 // .attr("opacity", on)1060 // d3.selectAll(".Sextext")1061 // .transition()1062 // .attr("opacity", on)1063 // d3.selectAll(".Phonetext")1064 // .transition()1065 // .attr("opacity", on)1066 // d3.selectAll(".IDtext")1067 // .transition()1068 // .attr("opacity", on)1069 // d3.selectAll(".Lasttext")1070 // .transition()1071 // .attr("opacity", on)1072 // d3.selectAll(".Firsttext")1073 // .transition()1074 // .attr("opacity", on)1075 // d3.selectAll(".Emailtext")1076 // .transition()1077 // .attr("opacity", on)1078 // d3.selectAll(".Countrytext")1079 // .transition()1080 // .attr("opacity", on)1081 d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")1082 .transition()1083 .delay(500)1084 .duration(1000)1085 .attr("width", uniHeight/3)1086}1087function hideDetails() {1088 var rHScale = d3.scale.linear()1089 .domain([minRecords, maxRecords])1090 .range([5, uniHeight])1091 var hScale = d3.scale.linear()1092 .domain([0, dataIs.length])1093 .range([topSpaceRect, height])1094 d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")1095 .transition()1096 .delay(500)1097 .duration(1000)1098 .attr("width", widthBottom) 1099 // d3.selectAll(".ID2")1100 // .transition()1101 // .attr("height", function(d,i){1102 // if (i < 25) {1103 // return rHScale(parseInt(dataIs[i].Records));1104 // } else {1105 // return uniHeight;1106 // }1107 // })1108 // d3.selectAll(".Title2")1109 // .transition()1110 // .attr("height", function(d,i){1111 // if (i < 25) {1112 // return rHScale(parseInt(dataIs[i].Records));1113 // } else {1114 // return uniHeight;1115 // }1116 // }) 1117 // d3.selectAll(".FirstName2")1118 // .transition()1119 // .attr("height", function(d,i){1120 // if (i < 25) {1121 // return rHScale(parseInt(dataIs[i].Records));1122 // } else {1123 // return uniHeight;1124 // }1125 // })1126 // d3.selectAll(".LastName2")1127 // .transition()1128 // .attr("height", function(d,i){1129 // if (i < 25) {1130 // return rHScale(parseInt(dataIs[i].Records));1131 // } else {1132 // return uniHeight;1133 // }1134 // })1135 // d3.selectAll(".Suffix2")1136 // .transition()1137 // .attr("height", function(d,i){1138 // if (i < 25) {1139 // return rHScale(parseInt(dataIs[i].Records));1140 // } else {1141 // return uniHeight;1142 // }1143 // })1144 // d3.selectAll(".EmailAddress2")1145 // .transition()1146 // .attr("height", function(d,i){1147 // if (i < 25) {1148 // return rHScale(parseInt(dataIs[i].Records));1149 // } else {1150 // return uniHeight;1151 // }1152 // })1153 // d3.selectAll(".PhoneNumber2")1154 // .transition()1155 // .attr("height", function(d,i){1156 // if (i < 25) {1157 // return rHScale(parseInt(dataIs[i].Records));1158 // } else {1159 // return uniHeight;1160 // }1161 // })1162 // d3.selectAll(".StreetAddress2")1163 // .transition()1164 // .attr("height", function(d,i){1165 // if (i < 25) {1166 // return rHScale(parseInt(dataIs[i].Records));1167 // } else {1168 // return uniHeight;1169 // }1170 // })1171 // d3.selectAll(".City2")1172 // .transition()1173 // .attr("height", function(d,i){1174 // if (i < 25) {1175 // return rHScale(parseInt(dataIs[i].Records));1176 // } else {1177 // return uniHeight;1178 // }1179 // })1180 // d3.selectAll(".ZipCode2")1181 // .transition()1182 // .attr("height", function(d,i){1183 // if (i < 25) {1184 // return rHScale(parseInt(dataIs[i].Records));1185 // } else {1186 // return uniHeight;1187 // }1188 // })1189 // d3.selectAll(".State2")1190 // .transition()1191 // .attr("height", function(d,i){1192 // if (i < 25) {1193 // return rHScale(parseInt(dataIs[i].Records));1194 // } else {1195 // return uniHeight;1196 // }1197 // })1198 // d3.selectAll(".Country2")1199 // .transition()1200 // .attr("height", function(d,i){1201 // if (i < 25) {1202 // return rHScale(parseInt(dataIs[i].Records));1203 // } else {1204 // return uniHeight;1205 // }1206 // })1207 // d3.selectAll(".Sex2")1208 // .transition()1209 // .attr("height", function(d,i){1210 // if (i < 25) {1211 // return rHScale(parseInt(dataIs[i].Records));1212 // } else {1213 // return uniHeight;1214 // }1215 // })1216 // d3.selectAll(".Age2")1217 // .transition()1218 // .attr("height", function(d,i){1219 // if (i < 25) {1220 // return rHScale(parseInt(dataIs[i].Records));1221 // } else {1222 // return uniHeight;1223 // }1224 // })1225 // hideDetails();1226 d3.selectAll(".Citytext")1227 .transition()1228 .attr("y", function(d,i) {1229 return hScale(dataIs[i].key)+ textSpace;1230 }) 1231 d3.selectAll(".Agetext")1232 .transition()1233 .attr("y", function(d,i) {1234 return hScale(dataIs[i].key)+textSpace;1235 }) 1236 d3.selectAll(".Countrytext")1237 .transition()1238 .attr("y", function(d,i) {1239 return hScale(dataIs[i].key)+textSpace;1240 }) 1241 d3.selectAll(".Emailtext")1242 .transition()1243 .attr("y", function(d,i) {1244 return hScale(dataIs[i].key)+textSpace;1245 }) 1246 d3.selectAll(".Firsttext")1247 .transition()1248 .attr("y", function(d,i) {1249 return hScale(dataIs[i].key)+textSpace;1250 }) 1251 d3.selectAll(".Lasttext")1252 .transition()1253 .attr("y", function(d,i) {1254 return hScale(dataIs[i].key)+textSpace;1255 }) 1256 d3.selectAll(".IDtext")1257 .transition()1258 .attr("y", function(d,i) {1259 return hScale(dataIs[i].key)+textSpace;1260 }) 1261 d3.selectAll(".Phonetext")1262 .transition()1263 .attr("y", function(d,i) {1264 return hScale(dataIs[i].key)+textSpace;1265 }) 1266 d3.selectAll(".Sextext")1267 .transition()1268 .attr("y", function(d,i) {1269 return hScale(dataIs[i].key)+textSpace;1270 }) 1271 d3.selectAll(".Statetext")1272 .transition()1273 .attr("y", function(d,i) {1274 return hScale(dataIs[i].key)+textSpace;1275 }) 1276 d3.selectAll(".Streettext")1277 .transition()1278 .attr("y", function(d,i) {1279 return hScale(dataIs[i].key)+textSpace;1280 }) 1281 d3.selectAll(".Suffixtext")1282 .transition()1283 .attr("y", function(d,i) {1284 return hScale(dataIs[i].key)+textSpace;1285 }) 1286 d3.selectAll(".Titletext")1287 .transition()1288 .attr("y", function(d,i) {1289 return hScale(dataIs[i].key)+textSpace;1290 }) 1291 d3.selectAll(".Ziptext")1292 .transition()1293 .attr("y", function(d,i) {1294 return hScale(dataIs[i].key)+textSpace;1295 }) 1296 d3.selectAll(".Agetext")1297 .transition()1298 .attr("opacity", 0)1299 d3.selectAll(".Citytext")1300 .transition()1301 .attr("opacity", 0)1302 d3.selectAll(".Ziptext")1303 .transition()1304 .attr("opacity", 0)1305 d3.selectAll(".Suffixtext")1306 .transition()1307 .attr("opacity", 0)1308 d3.selectAll(".Titletext")1309 .transition()1310 .attr("opacity", 0)1311 d3.selectAll(".Streettext")1312 .transition()1313 .attr("opacity", 0)1314 d3.selectAll(".Statetext")1315 .transition()1316 .attr("opacity", 0)1317 d3.selectAll(".Sextext")1318 .transition()1319 .attr("opacity", 0)1320 d3.selectAll(".Phonetext")1321 .transition()1322 .attr("opacity", 0)1323 d3.selectAll(".IDtext")1324 .transition()1325 .attr("opacity", 0)1326 d3.selectAll(".Lasttext")1327 .transition()1328 .attr("opacity", 0)1329 d3.selectAll(".Firsttext")1330 .transition()1331 .attr("opacity", 0)1332 d3.selectAll(".Emailtext")1333 .transition()1334 .attr("opacity", 0)1335 d3.selectAll(".Countrytext")1336 .transition()1337 .attr("opacity", 0)1338}1339var amtDel = 2000;1340function sortUnifiedAttributes() {1341 var hScale = d3.scale.linear()1342 .domain([0, dataIs.length])1343 .range([topSpaceRect, height])1344 var rHScale = d3.scale.linear()1345 .domain([minRecords, maxRecords])1346 .range([5, uniHeight])1347 d3.selectAll(".ID2")1348 .transition()1349 .attr("y", function(d,i) {1350 return hScale(dataIs[i].keyU);1351 })1352 d3.selectAll(".Title2")1353 .transition()1354 .attr("y", function(d,i) {1355 return hScale(dataIs[i].keyU);1356 }) 1357 d3.selectAll(".FirstName2")1358 .transition()1359 .attr("y", function(d,i) {1360 return hScale(dataIs[i].keyU);1361 })1362 d3.selectAll(".LastName2")1363 .transition()1364 .attr("y", function(d,i) {1365 return hScale(dataIs[i].keyU);1366 })1367 d3.selectAll(".Suffix2")1368 .transition()1369 .attr("y", function(d,i) {1370 return hScale(dataIs[i].keyU);1371 })1372 d3.selectAll(".EmailAddress2")1373 .transition()1374 .attr("y", function(d,i) {1375 return hScale(dataIs[i].keyU);1376 })1377 d3.selectAll(".PhoneNumber2")1378 .transition()1379 .attr("y", function(d,i) {1380 return hScale(dataIs[i].keyU);1381 })1382 d3.selectAll(".StreetAddress2")1383 .transition()1384 .attr("y", function(d,i) {1385 return hScale(dataIs[i].keyU);1386 })1387 d3.selectAll(".City2")1388 .transition()1389 .attr("y", function(d,i) {1390 return hScale(dataIs[i].keyU);1391 })1392 d3.selectAll(".ZipCode2")1393 .transition()1394 .attr("y", function(d,i) {1395 return hScale(dataIs[i].keyU);1396 })1397 d3.selectAll(".State2")1398 .transition()1399 .attr("y", function(d,i) {1400 return hScale(dataIs[i].keyU);1401 })1402 d3.selectAll(".Country2")1403 .transition()1404 .attr("y", function(d,i) {1405 return hScale(dataIs[i].keyU);1406 })1407 d3.selectAll(".Sex2")1408 .transition()1409 .attr("y", function(d,i) {1410 return hScale(dataIs[i].keyU);1411 })1412 d3.selectAll(".Age2")1413 .transition()1414 .attr("y", function(d,i) {1415 return hScale(dataIs[i].keyU);1416 })1417 // hideDetails();1418 d3.selectAll(".Citytext")1419 .transition()1420 .attr("y", function(d,i) {1421 return hScale(dataIs[i].keyU);1422 }) 1423 d3.selectAll(".Agetext")1424 .transition()1425 .attr("y", function(d,i) {1426 return hScale(dataIs[i].keyU);1427 }) 1428 d3.selectAll(".Countrytext")1429 .transition()1430 .attr("y", function(d,i) {1431 return hScale(dataIs[i].keyU);1432 }) 1433 d3.selectAll(".Emailtext")1434 .transition()1435 .attr("y", function(d,i) {1436 return hScale(dataIs[i].keyU);1437 }) 1438 d3.selectAll(".Firsttext")1439 .transition()1440 .attr("y", function(d,i) {1441 return hScale(dataIs[i].keyU);1442 }) 1443 d3.selectAll(".Lasttext")1444 .transition()1445 .attr("y", function(d,i) {1446 return hScale(dataIs[i].keyU);1447 }) 1448 d3.selectAll(".IDtext")1449 .transition()1450 .attr("y", function(d,i) {1451 return hScale(dataIs[i].keyU);1452 }) 1453 d3.selectAll(".Phonetext")1454 .transition()1455 .attr("y", function(d,i) {1456 return hScale(dataIs[i].keyU);1457 }) 1458 d3.selectAll(".Sextext")1459 .transition()1460 .attr("y", function(d,i) {1461 return hScale(dataIs[i].keyU);1462 }) 1463 d3.selectAll(".Statetext")1464 .transition()1465 .attr("y", function(d,i) {1466 return hScale(dataIs[i].keyU);1467 }) 1468 d3.selectAll(".Streettext")1469 .transition()1470 .attr("y", function(d,i) {1471 return hScale(dataIs[i].keyU);1472 }) 1473 d3.selectAll(".Suffixtext")1474 .transition()1475 .attr("y", function(d,i) {1476 return hScale(dataIs[i].keyU);1477 }) 1478 d3.selectAll(".Titletext")1479 .transition()1480 .attr("y", function(d,i) {1481 return hScale(dataIs[i].keyU);1482 }) 1483 d3.selectAll(".Ziptext")1484 .transition()1485 .attr("y", function(d,i) {1486 return hScale(dataIs[i].keyU);1487 }) 1488 d3.selectAll(".rect2").transition().attr("opacity", 0);1489}1490function sortEntries() {1491 var hScale = d3.scale.linear()1492 .domain([0, dataIs.length])1493 .range([topSpaceRect, height])1494 var rHScale = d3.scale.linear()1495 .domain([minRecords, maxRecords])1496 .range([5, uniHeight])1497 d3.selectAll(".ID2")1498 .transition()1499 .attr("y", function(d,i) {1500 return hScale(dataIs[i].key);1501 })1502 d3.selectAll(".Title2")1503 .transition()1504 .attr("y", function(d,i) {1505 return hScale(dataIs[i].key);1506 }) 1507 d3.selectAll(".FirstName2")1508 .transition()1509 .attr("y", function(d,i) {1510 return hScale(dataIs[i].key);1511 })1512 d3.selectAll(".LastName2")1513 .transition()1514 .attr("y", function(d,i) {1515 return hScale(dataIs[i].key);1516 })1517 d3.selectAll(".Suffix2")1518 .transition()1519 .attr("y", function(d,i) {1520 return hScale(dataIs[i].key);1521 })1522 d3.selectAll(".EmailAddress2")1523 .transition()1524 .attr("y", function(d,i) {1525 return hScale(dataIs[i].key);1526 })1527 d3.selectAll(".PhoneNumber2")1528 .transition()1529 .attr("y", function(d,i) {1530 return hScale(dataIs[i].key);1531 })1532 d3.selectAll(".StreetAddress2")1533 .transition()1534 .attr("y", function(d,i) {1535 return hScale(dataIs[i].key);1536 })1537 d3.selectAll(".City2")1538 .transition()1539 .attr("y", function(d,i) {1540 return hScale(dataIs[i].key);1541 })1542 d3.selectAll(".ZipCode2")1543 .transition()1544 .attr("y", function(d,i) {1545 return hScale(dataIs[i].key);1546 })1547 d3.selectAll(".State2")1548 .transition()1549 .attr("y", function(d,i) {1550 return hScale(dataIs[i].key);1551 })1552 d3.selectAll(".Country2")1553 .transition()1554 .attr("y", function(d,i) {1555 return hScale(dataIs[i].key);1556 })1557 d3.selectAll(".Sex2")1558 .transition()1559 .attr("y", function(d,i) {1560 return hScale(dataIs[i].key);1561 })1562 d3.selectAll(".Age2")1563 .transition()1564 .attr("y", function(d,i) {1565 return hScale(dataIs[i].key);1566 })1567 // hideDetails();1568 d3.selectAll(".Citytext")1569 .transition()1570 .attr("y", function(d,i) {1571 return hScale(dataIs[i].key)+textSpace;1572 }) 1573 d3.selectAll(".Agetext")1574 .transition()1575 .attr("y", function(d,i) {1576 return hScale(dataIs[i].key)+textSpace;1577 }) 1578 d3.selectAll(".Countrytext")1579 .transition()1580 .attr("y", function(d,i) {1581 return hScale(dataIs[i].key)+textSpace;1582 }) 1583 d3.selectAll(".Emailtext")1584 .transition()1585 .attr("y", function(d,i) {1586 return hScale(dataIs[i].key)+textSpace;1587 }) 1588 d3.selectAll(".Firsttext")1589 .transition()1590 .attr("y", function(d,i) {1591 return hScale(dataIs[i].key)+textSpace;1592 }) 1593 d3.selectAll(".Lasttext")1594 .transition()1595 .attr("y", function(d,i) {1596 return hScale(dataIs[i].key)+textSpace;1597 }) 1598 d3.selectAll(".IDtext")1599 .transition()1600 .attr("y", function(d,i) {1601 return hScale(dataIs[i].key)+textSpace;1602 }) 1603 d3.selectAll(".Phonetext")1604 .transition()1605 .attr("y", function(d,i) {1606 return hScale(dataIs[i].key)+textSpace;1607 }) 1608 d3.selectAll(".Sextext")1609 .transition()1610 .attr("y", function(d,i) {1611 return hScale(dataIs[i].key)+textSpace;1612 }) 1613 d3.selectAll(".Statetext")1614 .transition()1615 .attr("y", function(d,i) {1616 return hScale(dataIs[i].key)+textSpace;1617 }) 1618 d3.selectAll(".Streettext")1619 .transition()1620 .attr("y", function(d,i) {1621 return hScale(dataIs[i].key)+textSpace;1622 }) 1623 d3.selectAll(".Suffixtext")1624 .transition()1625 .attr("y", function(d,i) {1626 return hScale(dataIs[i].key)+textSpace;1627 }) 1628 d3.selectAll(".Titletext")1629 .transition()1630 .attr("y", function(d,i) {1631 return hScale(dataIs[i].key)+textSpace;1632 }) 1633 d3.selectAll(".Ziptext")1634 .transition()1635 .attr("y", function(d,i) {1636 return hScale(dataIs[i].keyU);1637 }) 1638 d3.selectAll(".rect2").transition().attr("opacity", 0);1639}1640function unsortEntries() {1641 var hScale = d3.scale.linear()1642 .domain([0, dataIs.length])1643 .range([topSpaceRect, height])1644 var delValunSort = 1;//amtDel+1000;1645 1646 // d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")1647 // .transition()1648 // // .duration(1000)1649 // .attr("height", uniHeight);1650 d3.selectAll(".rect2").transition().attr("opacity", 1)1651 d3.selectAll(".Citytext")1652 .transition()1653 .attr("y", function(d,i) {1654 return hScale(i)+textSpace;1655 }) 1656 d3.selectAll(".Agetext")1657 .transition()1658 .attr("y", function(d,i) {1659 return hScale(i)+textSpace;1660 }) 1661 d3.selectAll(".Countrytext")1662 .transition()1663 .attr("y", function(d,i) {1664 return hScale(i)+textSpace;1665 }) 1666 d3.selectAll(".Emailtext")1667 .transition()1668 .attr("y", function(d,i) {1669 return hScale(i)+textSpace;1670 }) 1671 d3.selectAll(".Firsttext")1672 .transition()1673 .attr("y", function(d,i) {1674 return hScale(i)+textSpace;1675 }) 1676 d3.selectAll(".Lasttext")1677 .transition()1678 .attr("y", function(d,i) {1679 return hScale(i)+textSpace;1680 }) 1681 d3.selectAll(".IDtext")1682 .transition()1683 .attr("y", function(d,i) {1684 return hScale(i)+textSpace;1685 }) 1686 d3.selectAll(".Phonetext")1687 .transition()1688 .attr("y", function(d,i) {1689 return hScale(i)+textSpace;1690 }) 1691 d3.selectAll(".Sextext")1692 .transition()1693 .attr("y", function(d,i) {1694 return hScale(i)+textSpace;1695 }) 1696 d3.selectAll(".Statetext")1697 .transition()1698 .attr("y", function(d,i) {1699 return hScale(i)+textSpace;1700 }) 1701 d3.selectAll(".Streettext")1702 .transition()1703 .attr("y", function(d,i) {1704 return hScale(i)+textSpace;1705 }) 1706 d3.selectAll(".Suffixtext")1707 .transition()1708 .attr("y", function(d,i) {1709 return hScale(i)+textSpace;1710 }) 1711 d3.selectAll(".Titletext")1712 .transition()1713 .attr("y", function(d,i) {1714 return hScale(i)+textSpace;1715 }) 1716 d3.selectAll(".Ziptext")1717 .transition()1718 .attr("y", function(d,i) {1719 return hScale(i)+textSpace;1720 }) 1721 1722 d3.selectAll(".ID2").transition().delay(delValunSort)1723 .attr("y",function(d,i){1724 return hScale(i);1725 }) 1726 d3.selectAll(".Title2").transition().delay(delValunSort)1727 .attr("y",function(d,i){1728 return hScale(i);1729 }) 1730 d3.selectAll(".FirstName2").transition().delay(delValunSort)1731 .attr("y",function(d,i){1732 return hScale(i);1733 }) 1734 d3.selectAll(".LastName2").transition().delay(delValunSort) 1735 .attr("y",function(d,i){1736 return hScale(i);1737 }) 1738 d3.selectAll(".Suffix2").transition().delay(delValunSort) 1739 .attr("y",function(d,i){1740 return hScale(i);1741 }) 1742 d3.selectAll(".EmailAddress2").transition().delay(delValunSort) 1743 .attr("y",function(d,i){1744 return hScale(i);1745 }) 1746 d3.selectAll(".PhoneNumber2").transition().delay(delValunSort) 1747 .attr("y",function(d,i){1748 return hScale(i);1749 }) 1750 d3.selectAll(".StreetAddress2").transition().delay(delValunSort) 1751 .attr("y",function(d,i){1752 return hScale(i);1753 }) 1754 d3.selectAll(".City2").transition().delay(delValunSort) 1755 .attr("y",function(d,i){1756 return hScale(i);1757 }) 1758 d3.selectAll(".ZipCode2").transition().delay(delValunSort) 1759 .attr("y",function(d,i){1760 return hScale(i);1761 }) 1762 d3.selectAll(".State2").transition().delay(delValunSort) 1763 .attr("y",function(d,i){1764 return hScale(i);1765 }) 1766 d3.selectAll(".Country2").transition().delay(delValunSort) 1767 .attr("y",function(d,i){1768 return hScale(i);1769 }) 1770 d3.selectAll(".Sex2").transition().delay(delValunSort) 1771 .attr("y",function(d,i){1772 return hScale(i);1773 }) 1774 d3.selectAll(".Age2").transition().delay(delValunSort) 1775 .attr("y",function(d,i){1776 return hScale(i);1777 }) 1778}1779function unsortSource() {1780 var hScale = d3.scale.linear()1781 .domain([0, dataIs.length])1782 .range([topSpaceText3 - 5, height])1783 d3.selectAll(".outlineRects")1784 .transition()1785 .attr("y", function(d, i) {1786 return hScale(i)1787 })1788 .attr("height", function(d, i) {1789 return sourceHeight[i] + 10;1790 })1791 d3.selectAll(".sourceRect")1792 .transition()1793 .attr("height", function(d, i) {1794 return sourceHeight[i];1795 })1796 .attr("y", function(d, i) {1797 return hScale(i)1798 })1799 d3.selectAll(".source1Text").transition().attr("opacity", 1);1800 d3.selectAll(".sourceText")1801 .transition()1802 .attr("y", function(d, i) {1803 // console.log(d.key)1804 return hScale(i) + 10;1805 })1806 // d3.selectAll(".sourceText")1807 // .transition()1808 .attr("opacity", 1);1809}1810function callNon() {1811 var rHScale = d3.scale.linear()1812 .domain([minRecords, maxRecords])1813 .range([5, uniHeight])1814 var hScale = d3.scale.linear()1815 .domain([0, dataIs.length])1816 .range([topSpaceText3 - 5, height])1817 var rMargin = 130;1818 svg.selectAll("nonRect")1819 .data(d3.range(dataIs.length))1820 .enter()1821 .append("rect")1822 .attr("class", "nonRect")1823 .attr("x", width - 130)1824 .attr("y", function(d, i) {1825 return hScale(i); //fold/2 + i*25+10;1826 })1827 .attr("opacity", .5)1828 // function(d,i){1829 // if(i>0){1830 // return .5;1831 // }else{1832 // return 0;1833 // }1834 // })1835 .attr("fill", tamR)1836 .attr("width", 0)1837 .attr("height", 0)1838 .attr("stroke", "white")1839 .transition()1840 .duration(2000)1841 .attr("width", 10)1842 .attr("height", function(d, i) {1843 if (i < 25) {1844 return rHScale(dataIs[i].Records)1845 } else {1846 return uniHeight;1847 }1848 });1849 svg.selectAll("nonRect2")1850 .data(d3.range(dataIs.length))1851 .enter()1852 .append("rect")1853 .attr("class", "nonRect2")1854 .attr("x", width - 120)1855 .attr("y", function(d, i) {1856 return hScale(i); //fold/2 + i*25+10;1857 })1858 .attr("opacity", .5)1859 // function(d,i){1860 // if(i>0){1861 // return .5;1862 // }else{1863 // return 0;1864 // }1865 // })1866 .attr("fill", tamR)1867 .attr("width", 0)1868 .attr("height", function(d, i) {1869 if (i < 25) {1870 return rHScale(dataIs[i].Records)1871 } else {1872 return uniHeight;1873 }1874 })1875 .attr("stroke", "white")1876 .transition()1877 .duration(2000)1878 .attr("width", 10);1879 svg.selectAll("nonRect3")1880 .data(d3.range(dataIs.length))1881 .enter()1882 .append("rect")1883 .attr("class", "nonRect3")1884 .attr("x", width - 110)1885 .attr("y", function(d, i) {1886 return hScale(i); //fold/2 + i*25+10;1887 })1888 .attr("opacity", .5)1889 // function(d,i){1890 // if(i>0){1891 // return .5;1892 // }else{1893 // return 0;1894 // }1895 // })1896 .attr("fill", tamR)1897 .attr("width", 0)1898 .attr("height", function(d, i) {1899 if (i < 25) {1900 return rHScale(dataIs[i].Records)1901 } else {1902 return uniHeight;1903 }1904 })1905 .attr("stroke", "white")1906 .transition()1907 .duration(2000)1908 .attr("width", function(d, i) {1909 if (i % 3 == 1) {1910 return 101911 } else {1912 return 0;1913 }1914 })1915 // svg.append("text")1916 // .attr("class","sourceLabel")1917 // .attr("x", width-130)1918 // .attr("y", fold/2-10)1919 // .text("Non-unified") 1920}1921// })1922// .transition()1923// .duration(1000)1924// .attr("x", function(d,i){1925// return 100 * Math.cos( i ) + 200;1926// })1927// .attr("y", function(d,i){1928// return 100 * Math.sin( i ) + 200;1929// })1930// city1931// city1932// city1933// city1934// City1935// city1936// City1937// CITY1938// CITY1939// CITY1940// CITY1941// City1942// City1943// city1944// city1945// city1946// City, city, City, CITY, CITY, "CITY","city","city"]1947var backHeight = 20;1948function bottom() {1949 // d3.selectAll(".text3").transition().duration(2000).attr("opacity",0)1950 var off = 0;1951 var hScale = d3.scale.linear()1952 .domain([0, dataIs.length])1953 .range([topSpaceRect, height]) //+400])1954 var rHScale = d3.scale.linear()1955 .domain([minRecords, maxRecords])1956 .range([5, uniHeight])1957 var height3Scale = d3.scale.linear()1958 .domain([0, dataIs.length])1959 .range([topSpaceRect, height]) //+100])1960 var xScale = d3.scale.ordinal()1961 .domain(dataNames)1962 .rangeBands([lMargin * 5, width - lMargin * 9], 1) //.2)1963 // svg.selectAll("textBottom")1964 // .data(dataTypes)1965 // .enter()1966 // .append("text")1967 // .attr("class", "label")1968 // .style("text-anchor", "middle")1969 // .attr("x", function(d,i){1970 // return xScale(d)+widthBottom/2;1971 // })1972 // .attr("y", (fold/2)-10)1973 // .text(function(d){ return d });1974 city = 0;1975 var j = 0;1976 svg.selectAll("rectBack")1977 .data(dataNames)1978 .enter()1979 .append("rect")1980 .attr("class", function(d, i) {1981 return "back" + i;1982 })1983 .attr("x", function(d, i) {1984 return xScale(d);1985 })1986 .attr("y", topSpaceText3 - 30)1987 .attr("fill", "none")1988 .attr("opacity", .5)1989 .attr("stroke", "lightgray")1990 .attr("width", wide)1991 .attr("height", backHeight)1992 svg.selectAll("topText")1993 .data(dataNames)1994 .enter()1995 .append("text")1996 .attr("class", "topText")1997 .style("text-anchor", "middle")1998 .attr("x", function(d, i) {1999 return xScale(d) + wide / 2;2000 })2001 .attr("y", topSpaceText3 - 16)2002 .text(function(d) {2003 return d;2004 })2005 svg.selectAll("City2")2006 .data(cityData)2007 .enter()2008 .append("rect")2009 .attr("class", "City2")2010 .attr("opacity", function(d, i) {2011 if (d.length > 0) {2012 return .9;2013 } else {2014 return 0;2015 }2016 })2017 .attr("fill", tamR)2018 .attr("stroke", "white")2019 .attr("height", 0)2020 .attr("y", topSpaceRect)2021 .attr("x", function(d, i) {2022 return xScale("City");2023 })2024 .attr("width", widthBottom)2025 .transition()2026 .delay(del)2027 .duration(2000)2028 .attr("height", function(d, i) {2029 if (i < 25) {2030 return rHScale(parseInt(dataIs[i].Records));2031 } else {2032 return uniHeight;2033 }2034 })2035 // .attr("height", function(d, i) {2036 // return uniHeight; //heightScale(i);2037 // })2038 .attr("y", function(d, i) {2039 return hScale(i)2040 })2041 svg.selectAll("Citytext")2042 .data(cityData)2043 .enter()2044 .append("text")2045 .attr("class", "Citytext")2046 .style("text-anchor", "middle")2047 .attr("opacity", off)2048 .attr("fill", "black")2049 .attr("y", topSpaceRect)2050 .attr("x", function(d, i) {2051 return xScale("City") + wide / 2;2052 })2053 .transition()2054 .delay(del)2055 .duration(2000)2056 .attr("y", function(d, i) {2057 return hScale(i) + textSpace;2058 })2059 .text(function(d, i) {2060 return d;2061 })2062 svg.selectAll("Age2")2063 .data(ageData)2064 .enter()2065 .append("rect")2066 .attr("class", "Age2")2067 .attr("opacity", function(d, i) {2068 if (d.length > 0) {2069 return .9;2070 } else {2071 return 0;2072 }2073 })2074 .attr("fill", tamR)2075 .attr("stroke", "white")2076 .attr("height", 0)2077 .attr("y", topSpaceRect)2078 .attr("x", function(d, i) {2079 return xScale("Age");2080 })2081 .attr("width", widthBottom)2082 .transition()2083 .delay(del)2084 .duration(2000)2085 .attr("height", function(d, i) {2086 if (i < 25) {2087 return rHScale(parseInt(dataIs[i].Records));2088 } else {2089 return uniHeight;2090 }2091 })2092 // .attr("height", function(d, i) {2093 // return uniHeight; //heightScale(i);2094 // })2095 .attr("y", function(d, i) {2096 return hScale(i)2097 })2098 svg.selectAll("Agetext")2099 .data(ageData)2100 .enter()2101 .append("text")2102 .attr("class", "Agetext")2103 .style("text-anchor", "middle")2104 .attr("opacity", off)2105 .attr("fill", "black")2106 .attr("y", topSpaceRect)2107 .attr("x", function(d, i) {2108 return xScale("Age") + wide / 2;2109 })2110 .transition()2111 .delay(del)2112 .duration(2000)2113 .attr("y", function(d, i) {2114 return hScale(i) + textSpace;2115 })2116 .text(function(d, i) {2117 return d;2118 })2119 svg.selectAll("Country2")2120 .data(countryData)2121 .enter()2122 .append("rect")2123 .attr("class", "Country2")2124 .attr("opacity", function(d, i) {2125 if (d.length > 0) {2126 return .9;2127 } else {2128 return 0;2129 }2130 })2131 .attr("fill", tamR)2132 .attr("stroke", "white")2133 .attr("height", 0)2134 .attr("y", topSpaceRect)2135 .attr("x", function(d, i) {2136 return xScale("Country");2137 })2138 .attr("width", widthBottom)2139 .transition()2140 .delay(del)2141 .duration(2000)2142 // .attr("height", function(d, i) {2143 // return uniHeight; //heightScale(i);2144 // })2145 .attr("height", function(d, i) {2146 if (i < 25) {2147 return rHScale(parseInt(dataIs[i].Records));2148 } else {2149 return uniHeight;2150 }2151 })2152 .attr("y", function(d, i) {2153 return hScale(i)2154 })2155 svg.selectAll("Countrytext")2156 .data(countryData)2157 .enter()2158 .append("text")2159 .attr("class", "Countrytext")2160 .style("text-anchor", "middle")2161 .attr("opacity", off)2162 .attr("fill","black")2163 .attr("y", topSpaceRect)2164 .attr("x", function(d, i) {2165 return xScale("Country") + wide / 2;2166 })2167 .transition()2168 .delay(del)2169 .duration(2000)2170 .attr("y", function(d, i) {2171 return hScale(i) + textSpace;2172 })2173 .text(function(d, i) {2174 return d;2175 })2176 svg.selectAll("EmailAddress2")2177 .data(emailData)2178 .enter()2179 .append("rect")2180 .attr("class", "EmailAddress2")2181 .attr("opacity", function(d, i) {2182 if (d.length > 0) {2183 return .9;2184 } else {2185 return 0;2186 }2187 })2188 .attr("fill", tamR)2189 .attr("stroke", "white")2190 .attr("height", 0)2191 .attr("y", topSpaceRect)2192 .attr("x", function(d, i) {2193 return xScale("Email Address");2194 })2195 .attr("width", widthBottom)2196 .transition()2197 .delay(del)2198 .duration(2000)2199 // .attr("height", function(d, i) {2200 // return uniHeight; //heightScale(i);2201 // })2202 .attr("height", function(d, i) {2203 if (i < 25) {2204 return rHScale(parseInt(dataIs[i].Records));2205 } else {2206 return uniHeight;2207 }2208 })2209 .attr("y", function(d, i) {2210 return hScale(i)2211 })2212 svg.selectAll("Emailtext")2213 .data(emailData)2214 .enter()2215 .append("text")2216 .attr("class", "Emailtext")2217 .style("text-anchor", "middle")2218 .attr("opacity", off)2219 .attr("fill","black")2220 .attr("y", topSpaceRect)2221 .attr("x", function(d, i) {2222 return xScale("Email Address") + wide / 2;2223 })2224 .transition()2225 .delay(del)2226 .duration(2000)2227 .attr("y", function(d, i) {2228 return hScale(i) + textSpace;2229 })2230 .text(function(d, i) {2231 return d;2232 })2233 svg.selectAll("FirstName2")2234 .data(firstData)2235 .enter()2236 .append("rect")2237 .attr("class", "FirstName2")2238 .attr("opacity", function(d, i) {2239 if (d.length > 0) {2240 return .9;2241 } else {2242 return 0;2243 }2244 })2245 .attr("fill", tamR)2246 .attr("stroke", "white")2247 .attr("height", 0)2248 .attr("y", topSpaceRect)2249 .attr("x", function(d, i) {2250 return xScale("First Name");2251 })2252 .attr("width", widthBottom)2253 .transition()2254 .delay(del)2255 .duration(2000)2256 .attr("height", function(d, i) {2257 if (i < 25) {2258 return rHScale(parseInt(dataIs[i].Records));2259 } else {2260 return uniHeight;2261 }2262 })2263 // .attr("height", function(d, i) {2264 // return uniHeight; //heightScale(i);2265 // })2266 .attr("y", function(d, i) {2267 return hScale(i)2268 })2269 svg.selectAll("Firsttext")2270 .data(firstData)2271 .enter()2272 .append("text")2273 .attr("class", "Firsttext")2274 .style("text-anchor", "middle")2275 .attr("opacity", off)2276 .attr("fill","black")2277 .attr("y", topSpaceRect)2278 .attr("x", function(d, i) {2279 return xScale("First Name") + wide / 2;2280 })2281 .transition()2282 .delay(del)2283 .duration(2000)2284 .attr("y", function(d, i) {2285 return hScale(i) + textSpace;2286 })2287 .text(function(d, i) {2288 return d;2289 })2290 svg.selectAll("LastName2")2291 .data(lastData)2292 .enter()2293 .append("rect")2294 .attr("class", "LastName2")2295 .attr("opacity", function(d, i) {2296 if (d.length > 0) {2297 return .9;2298 } else {2299 return 0;2300 }2301 })2302 .attr("fill", tamR)2303 .attr("stroke", "white")2304 .attr("height", 0)2305 .attr("y", topSpaceRect)2306 .attr("x", function(d, i) {2307 return xScale("Last Name");2308 })2309 .attr("width", widthBottom)2310 .transition()2311 .delay(del)2312 .duration(2000)2313 .attr("height", function(d, i) {2314 if (i < 25) {2315 return rHScale(parseInt(dataIs[i].Records));2316 } else {2317 return uniHeight;2318 }2319 })2320 // .attr("height", function(d, i) {2321 // return uniHeight; //heightScale(i);2322 // })2323 .attr("y", function(d, i) {2324 return hScale(i)2325 })2326 svg.selectAll("Lasttext")2327 .data(lastData)2328 .enter()2329 .append("text")2330 .attr("class", "Lasttext")2331 .style("text-anchor", "middle")2332 .attr("opacity", off)2333 .attr("fill","black")2334 .attr("y", topSpaceRect)2335 .attr("x", function(d, i) {2336 return xScale("Last Name") + wide / 2;2337 })2338 .transition()2339 .delay(del)2340 .duration(2000)2341 .attr("y", function(d, i) {2342 return hScale(i) + textSpace;2343 })2344 .text(function(d, i) {2345 return d;2346 })2347 svg.selectAll("ID2")2348 .data(idData)2349 .enter()2350 .append("rect")2351 .attr("class", "ID2")2352 .attr("opacity", function(d, i) {2353 if (d.length > 0) {2354 return .9;2355 } else {2356 return 0;2357 }2358 })2359 .attr("fill", tamR)2360 .attr("stroke", "white")2361 .attr("height", 0)2362 .attr("y", topSpaceRect)2363 .attr("x", function(d, i) {2364 return xScale("ID");2365 })2366 .attr("width", widthBottom)2367 .transition()2368 .delay(del)2369 .duration(2000)2370 .attr("height", function(d, i) {2371 if (i < 25) {2372 return rHScale(parseInt(dataIs[i].Records));2373 } else {2374 return uniHeight;2375 }2376 })2377 // .attr("height", function(d, i) {2378 // return uniHeight; //heightScale(i);2379 // })2380 .attr("y", function(d, i) {2381 return hScale(i)2382 })2383 svg.selectAll("IDtext")2384 .data(idData)2385 .enter()2386 .append("text")2387 .attr("class", "IDtext")2388 .style("text-anchor", "middle")2389 .attr("opacity", off)2390 .attr("fill","black")2391 .attr("y", topSpaceRect)2392 .attr("x", function(d, i) {2393 return xScale("ID") + wide / 2;2394 })2395 .transition()2396 .delay(del)2397 .duration(2000)2398 .attr("y", function(d, i) {2399 return hScale(i) + textSpace;2400 })2401 .text(function(d, i) {2402 return d;2403 })2404 svg.selectAll("PhoneNumber2")2405 .data(phoneData)2406 .enter()2407 .append("rect")2408 .attr("class", "PhoneNumber2")2409 .attr("opacity", function(d, i) {2410 if (d.length > 0) {2411 return .9;2412 } else {2413 return 0;2414 }2415 })2416 .attr("fill", tamR)2417 .attr("stroke", "white")2418 .attr("height", 0)2419 .attr("y", topSpaceRect)2420 .attr("x", function(d, i) {2421 return xScale("Phone Number");2422 })2423 .attr("width", widthBottom)2424 .transition()2425 .delay(del)2426 .duration(2000)2427 // .attr("height", function(d, i) {2428 // return uniHeight; //heightScale(i);2429 // })2430 .attr("height", function(d, i) {2431 if (i < 25) {2432 return rHScale(parseInt(dataIs[i].Records));2433 } else {2434 return uniHeight;2435 }2436 })2437 .attr("y", function(d, i) {2438 return hScale(i)2439 })2440 svg.selectAll("Phonetext")2441 .data(phoneData)2442 .enter()2443 .append("text")2444 .attr("class", "Phonetext")2445 .style("text-anchor", "middle")2446 .attr("opacity", off)2447 .attr("fill","black")2448 .attr("y", topSpaceRect)2449 .attr("x", function(d, i) {2450 return xScale("Phone Number") + wide / 2;2451 })2452 .transition()2453 .delay(del)2454 .duration(2000)2455 .attr("y", function(d, i) {2456 return hScale(i) + textSpace;2457 })2458 .text(function(d, i) {2459 return d;2460 })2461 svg.selectAll("Sex2")2462 .data(sexData)2463 .enter()2464 .append("rect")2465 .attr("class", "Sex2")2466 .attr("opacity", function(d, i) {2467 if (d.length > 0) {2468 return .9;2469 } else {2470 return 0;2471 }2472 })2473 .attr("fill", tamR)2474 .attr("stroke", "white")2475 .attr("height", 0)2476 .attr("y", topSpaceRect)2477 .attr("x", function(d, i) {2478 return xScale("Sex");2479 })2480 .attr("width", widthBottom)2481 .transition()2482 .delay(del)2483 .duration(2000)2484 // .attr("height", function(d, i) {2485 // return uniHeight; //heightScale(i);2486 // })2487 .attr("height", function(d, i) {2488 if (i < 25) {2489 return rHScale(parseInt(dataIs[i].Records));2490 } else {2491 return uniHeight;2492 }2493 })2494 .attr("y", function(d, i) {2495 return hScale(i)2496 })2497 svg.selectAll("Sextext")2498 .data(sexData)2499 .enter()2500 .append("text")2501 .attr("class", "Sextext")2502 .style("text-anchor", "middle")2503 .attr("opacity", off)2504 .attr("fill","black")2505 .attr("y", topSpaceRect)2506 .attr("x", function(d, i) {2507 return xScale("Sex") + wide / 2;2508 })2509 .transition()2510 .delay(del)2511 .duration(2000)2512 .attr("y", function(d, i) {2513 return hScale(i) + textSpace;2514 })2515 .text(function(d, i) {2516 return d;2517 })2518 svg.selectAll("State2")2519 .data(stateData)2520 .enter()2521 .append("rect")2522 .attr("class", "State2")2523 .attr("opacity", function(d, i) {2524 if (d.length > 0) {2525 return .9;2526 } else {2527 return 0;2528 }2529 })2530 .attr("fill", tamR)2531 .attr("stroke", "white")2532 .attr("height", 0)2533 .attr("y", topSpaceRect)2534 .attr("x", function(d, i) {2535 return xScale("State");2536 })2537 .attr("width", widthBottom)2538 .transition()2539 .delay(del)2540 .duration(2000)2541 // .attr("height", function(d, i) {2542 // return uniHeight; //heightScale(i);2543 // })2544 .attr("height", function(d, i) {2545 if (i < 25) {2546 return rHScale(parseInt(dataIs[i].Records));2547 } else {2548 return uniHeight;2549 }2550 })2551 .attr("y", function(d, i) {2552 return hScale(i)2553 })2554 svg.selectAll("Statetext")2555 .data(stateData)2556 .enter()2557 .append("text")2558 .attr("class", "Statetext")2559 .style("text-anchor", "middle")2560 .attr("opacity", off)2561 .attr("fill","black")2562 .attr("y", topSpaceRect)2563 .attr("x", function(d, i) {2564 return xScale("State") + wide / 2;2565 })2566 .transition()2567 .delay(del)2568 .duration(2000)2569 .attr("y", function(d, i) {2570 return hScale(i) + textSpace;2571 })2572 .text(function(d, i) {2573 return d;2574 })2575 svg.selectAll("StreetAdress2")2576 .data(stData)2577 .enter()2578 .append("rect")2579 .attr("class", "StreetAddress2")2580 .attr("opacity", function(d, i) {2581 if (d.length > 0) {2582 return .9;2583 } else {2584 return 0;2585 }2586 })2587 .attr("fill", tamR)2588 .attr("stroke", "white")2589 .attr("height", 0)2590 .attr("y", topSpaceRect)2591 .attr("x", function(d, i) {2592 return xScale("Street Address");2593 })2594 .attr("width", widthBottom)2595 .transition()2596 .delay(del)2597 .duration(2000)2598 // .attr("height", function(d, i) {2599 // return uniHeight; //heightScale(i);2600 // })2601 .attr("height", function(d, i) {2602 if (i < 25) {2603 return rHScale(parseInt(dataIs[i].Records));2604 } else {2605 return uniHeight;2606 }2607 })2608 .attr("y", function(d, i) {2609 return hScale(i)2610 })2611 svg.selectAll("Streettext")2612 .data(stData)2613 .enter()2614 .append("text")2615 .attr("class", "Streettext")2616 .style("text-anchor", "middle")2617 .attr("opacity", off)2618 .attr("fill","black")2619 .attr("y", topSpaceRect)2620 .attr("x", function(d, i) {2621 return xScale("Street Address") + wide / 2;2622 })2623 .transition()2624 .delay(del)2625 .duration(2000)2626 .attr("y", function(d, i) {2627 return hScale(i) + textSpace;2628 })2629 .text(function(d, i) {2630 return d;2631 })2632 svg.selectAll("Suffix2")2633 .data(suffixData)2634 .enter()2635 .append("rect")2636 .attr("class", "Suffix2")2637 .attr("opacity", function(d, i) {2638 if (d.length > 0) {2639 return .9;2640 } else {2641 return 0;2642 }2643 })2644 .attr("fill", tamR)2645 .attr("stroke", "white")2646 .attr("height", 0)2647 .attr("y", topSpaceRect)2648 .attr("x", function(d, i) {2649 return xScale("Suffix");2650 })2651 .attr("width", widthBottom)2652 .transition()2653 .delay(del)2654 .duration(2000)2655 // .attr("height", function(d, i) {2656 // return uniHeight; //heightScale(i);2657 // })2658 .attr("height", function(d, i) {2659 if (i < 25) {2660 return rHScale(parseInt(dataIs[i].Records));2661 } else {2662 return uniHeight;2663 }2664 })2665 .attr("y", function(d, i) {2666 return hScale(i)2667 })2668 svg.selectAll("Suffixtext")2669 .data(suffixData)2670 .enter()2671 .append("text")2672 .attr("class", "Suffixtext")2673 .style("text-anchor", "middle")2674 .attr("opacity", off)2675 .attr("fill","black")2676 .attr("y", topSpaceRect)2677 .attr("x", function(d, i) {2678 return xScale("Suffix") + wide / 2;2679 })2680 .transition()2681 .delay(del)2682 .duration(2000)2683 .attr("y", function(d, i) {2684 return hScale(i) + textSpace;2685 })2686 .text(function(d, i) {2687 return d;2688 })2689 svg.selectAll("Title2")2690 .data(titleData)2691 .enter()2692 .append("rect")2693 .attr("class", "Title2")2694 .attr("opacity", function(d, i) {2695 if (d.length > 0) {2696 return .9;2697 } else {2698 return 0;2699 }2700 })2701 .attr("fill", tamR)2702 .attr("stroke", "white")2703 .attr("height", 0)2704 .attr("y", topSpaceRect)2705 .attr("x", function(d, i) {2706 return xScale("Title");2707 })2708 .attr("width", widthBottom)2709 .transition()2710 .delay(del)2711 .duration(2000)2712 // .attr("height", function(d, i) {2713 // return uniHeight; //heightScale(i);2714 // })2715 .attr("height", function(d, i) {2716 if (i < 25) {2717 return rHScale(parseInt(dataIs[i].Records));2718 } else {2719 return uniHeight;2720 }2721 })2722 .attr("y", function(d, i) {2723 return hScale(i)2724 })2725 svg.selectAll("Titletext")2726 .data(titleData)2727 .enter()2728 .append("text")2729 .attr("class", "Titletext")2730 .style("text-anchor", "middle")2731 .attr("opacity", off)2732 .attr("fill","black")2733 .attr("y", topSpaceRect)2734 .attr("x", function(d, i) {2735 return xScale("Title") + wide / 2;2736 })2737 .transition()2738 .delay(del)2739 .duration(2000)2740 .attr("y", function(d, i) {2741 return hScale(i) + textSpace;2742 })2743 .text(function(d, i) {2744 return d;2745 })2746 svg.selectAll("ZipCode2")2747 .data(zipData)2748 .enter()2749 .append("rect")2750 .attr("class", "ZipCode2")2751 .attr("opacity", function(d, i) {2752 if (d.length > 0) {2753 return .9;2754 } else {2755 return 0;2756 }2757 })2758 .attr("fill", tamR)2759 .attr("stroke", "white")2760 .attr("height", 0)2761 .attr("y", topSpaceRect)2762 .attr("x", function(d, i) {2763 return xScale("Zip Code");2764 })2765 .attr("width", widthBottom)2766 .transition()2767 .delay(del)2768 .duration(2000)2769 // .attr("height", function(d, i) {2770 // return uniHeight; //heightScale(i);2771 // })2772 .attr("height", function(d, i) {2773 if (i < 25) {2774 return rHScale(parseInt(dataIs[i].Records));2775 } else {2776 return uniHeight;2777 }2778 })2779 .attr("y", function(d, i) {2780 return hScale(i)2781 })2782 svg.selectAll("Ziptext")2783 .data(zipData)2784 .enter()2785 .append("text")2786 .attr("class", "Ziptext")2787 .style("text-anchor", "middle")2788 .attr("opacity", off)2789 .attr("fill","black")2790 .attr("y", topSpaceRect)2791 .attr("x", function(d, i) {2792 return xScale("Zip Code") + wide / 2;2793 })2794 .transition()2795 .delay(del)2796 .duration(2000)2797 .attr("y", function(d, i) {2798 return hScale(i) + textSpace;2799 })2800 .text(function(d, i) {2801 return d;2802 })2803 .each("end", function() {2804 var factor = 10;2805 svg.selectAll("line2")2806 .data(dataIs)2807 .enter()2808 .append("line")2809 .attr("class", "line2")2810 .attr("x1", function() {2811 x3 = d3.select(".ID2").attr("x");2812 return parseInt(x3);2813 // return lMargin*2;2814 })2815 .attr("y1", function(d, i) {2816 return hScale(i); //i*10;2817 })2818 .attr("x2", function() {2819 x4 = d3.select(".Age2").attr("x");2820 // return wide+x2;2821 return parseInt(widthBottom) + parseInt(x4);2822 })2823 .attr("y2", function(d, i) {2824 return hScale(i); //height3Scale(i);2825 })2826 .attr("opacity", 1)2827 .attr("stroke", "white")2828 .attr("stroke-width", .2)2829 })2830 // d3.selectAll("rect").attr("stroke","white"); 2831}2832function undo() {2833 // d3.selectAll(".text3").transition().duration(2000).attr("opacity",0);2834 d3.selectAll(".line2").transition().duration(2000).attr("opacity", 0);2835 d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")2836 .transition()2837 .duration(1000)2838 .attr("height", 0)2839 // .attr("y",topSpaceRect)2840 d3.selectAll(".sourceText").transition().duration(1000).attr("opacity", 0);2841 d3.selectAll(".sourceRect, .nonRect, .nonRect2, .nonRect3, .outlineRects")2842 .transition().duration(1000).attr("height", 0)2843}2844function redo() {2845 d3.selectAll(".sourceTop, .outlineTop, .nonTop").remove();2846 d3.selectAll(".topLine").transition().attr("opacity", 0);2847 var factor = 0;2848 d3.selectAll(".ID").transition().attr("height", idTotal * factor)2849 d3.selectAll(".Title").transition().attr("height", titTotal * factor)2850 d3.selectAll(".FirstName").transition().attr("height", firstTotal * factor)2851 d3.selectAll(".LastName").transition().attr("height", lastTotal * factor)2852 d3.selectAll(".Suffix").transition().attr("height", sufTotal * factor)2853 d3.selectAll(".EmailAddress").transition().attr("height", emailTotal * factor)2854 d3.selectAll(".PhoneNumber").transition().attr("height", phoneTotal * factor)2855 d3.selectAll(".StreetAddress").transition().attr("height", stTotal * factor)2856 d3.selectAll(".City").transition().attr("height", cityTotal * factor)2857 d3.selectAll(".ZipCode").transition().attr("height", zipTotal * factor)2858 d3.selectAll(".State").transition().attr("height", stateTotal * factor)2859 d3.selectAll(".Country").transition().attr("height", countryTotal * factor)2860 d3.selectAll(".Sex").transition().attr("height", sexTotal * factor);2861 d3.selectAll(".Age").transition().attr("height", ageTotal * factor);2862 // d3.selectAll(".text3").transition().duration(1000).attr("opacity",0);2863 d3.selectAll(".line2").transition().duration(2000).attr("opacity", 1);2864 d3.selectAll(".sourceText").transition().duration(1000).attr("opacity", 1);2865 var hScale = d3.scale.linear()2866 .domain([0, dataIs.length])2867 .range([topSpaceRect, height]) //+400])2868 // d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")2869 // .transition()2870 // .duration(1000)2871 // .attr("y",function(d,i){2872 // return hScale(i);2873 // }) 2874 d3.selectAll(".ID2, .Title2, .FirstName2, .LastName2, .Suffix2, .EmailAddress2, .PhoneNumber2, .StreetAddress2, .City2, .ZipCode2, .State2, .Country2, .Sex2, .Age2")2875 .transition()2876 .attr("height", uniHeight)2877 d3.selectAll(".sourceRect").transition().duration(1000)2878 .attr("height", function(d, i) {2879 return sourceHeight[i];2880 })2881 d3.selectAll(".outlineRects").transition().duration(1000)2882 .attr("height", function(d, i) {2883 return sourceHeight[i] + 10;2884 })2885 d3.selectAll(".nonRect, .nonRect2, .nonRect3").transition().duration(1000)2886 .attr("height", function(d, i) {2887 return uniHeight;2888 })2889 // d3.selectAll(".sourceMid").transition().duration(1000)2890 // .attr("height", uniHeight);2891 d3.selectAll(".outlineTop").transition().duration(1000)2892 .attr("height", function(d, i) {2893 return recordScale(dataIs[1].Records) + 10;2894 })2895 // .sourceMid, .outlineTop 2896 d3.selectAll(".sourceText").transition().duration(1000).attr("opacity", 1)...
query-command-state.js
Source:query-command-state.js
...15 testFailed(action + ' but queryCommandValue returned ' + actualValue);16 else17 testPassed(action);18}19function selectAll(container) {20 window.getSelection().selectAllChildren(container);21 return 'all';22}23function selectSecondWord(container) {24 window.getSelection().setPosition(container, 0);25 window.getSelection().modify('move', 'forward', 'word');26 window.getSelection().modify('move', 'forward', 'word');27 window.getSelection().modify('move', 'backward', 'word');28 window.getSelection().modify('extend', 'forward', 'word');29 return 'second word';30}31function selectFirstTwoWords(container) {32 window.getSelection().setPosition(container, 0);33 window.getSelection().modify('move', 'forward', 'word');...
bar_plot1.js
Source:bar_plot1.js
...43 .call(d3.axisBottom(x));44 g.append("g")45 .attr("class", "axis y_axis")46 .call(d3.axisLeft(y));47 g.selectAll(".rect")48 .data(filtered)49 .enter().append("rect")50 .attr("class", function(d) {51 return "bar" + ind_list.indexOf(d.ind_list)} )52 .attr("y", function(d) { 53 console.log(+d.value)54 return y(+d.value)})55 .attr("x", function(d) { return x(d.type)+8 * ind_list.indexOf(d.ind_list); })56 .attr("height", function(d) { return height - y(+d.value); })57 .attr("width", x.bandwidth()/4)58 59 60 var legend = g.selectAll(".legend")61 .data(filtered)62 .enter()63 .append("g")64 .attr("class", "legend")65 var legend_keys = ["AllIndustries", "AI", "Ecommerce", "Education", "F&B", "Financial","Healthcare","Manufacturing","Security","Software","Transportation"]66 var lineLegend = svg.selectAll(".legend").data(legend_keys)67 .enter()68 .append("g")69 .attr("class", "legend")70 71 lineLegend.append("text").text(function(d) {return d;})72 .attr("transform", "translate(15,9")73 lineLegend.append("rect").attr("fill", function (d,i) {74 return "bar"+ind_list.indexOf(d).style("fill")75 })76 .attr("width", 10)77 .attr("height", 10)78 function update() {79 d3.selectAll(".industry1").each(function(d) {80 cb = d3.select(this)81 82 grp = cb.property("value")83 84 85 if(cb.property("checked")) {86 num = ind_list.indexOf(cb.property("value")) + 187 g.selectAll(".bar"+num).transition().style("opacity",0.2)88 }89 else {90 num = ind_list.indexOf(cb.property("value")) + 191 g.selectAll(".bar"+num).transition().style("opacity",0)92 93 }94 95 96 })97 d3.selectAll(".industry2").each(function(d) {98 cb = d3.select(this)99 100 grp = cb.property("value")101 102 103 if(cb.property("checked")) {104 console.log(cb.property("value"))105 num = ind_list.indexOf(cb.property("value")) + 1106 g.selectAll(".bar"+num).transition().style("opacity",1)107 }108 })109 }110 }111 function update() {112 d3.selectAll(".filter").each(function(d) {113 bt = d3.select(this)114 if(bt.property("checked")) {115 g.select(".bar0").transition().style("opacity",0)116 g.select(".bar1").transition().style("opacity",0)117 g.select(".bar2").transition().style("opacity",0)118 g.selectAll(".bar3").transition().style("opacity",0)119 g.selectAll(".bar4").transition().style("opacity",0)120 g.selectAll(".bar5").transition().style("opacity",0)121 g.selectAll(".bar6").transition().style("opacity",0)122 g.selectAll(".bar7").transition().style("opacity",0)123 124 125 126 d3.selectAll(".industry1").each(function(d) {127 cb = d3.select(this)128 129 grp = cb.property("value")130 131 132 if(cb.property("checked")) {133 134 num = ind_list.indexOf(cb.property("value")) 135 136 g.selectAll(".bar"+num).transition().style("opacity",0.25)137 138 }139 else {140 num = ind_list.indexOf(cb.property("value")) 141 g.selectAll(".bar"+num).transition().style("opacity",0)142 143 }144 145 146 })147 d3.selectAll(".industry2").each(function(d) {148 cb = d3.select(this)149 150 grp = cb.property("value")151 152 153 if(cb.property("checked")) {154 //g.selectAll("."+grp).transition().style("opacity", 1)155 console.log(cb.property("value"))156 //console.log(ind_list.indexOf(cb.property("value")))157 num = ind_list.indexOf(cb.property("value")) 158 //console.log(num)159 //var b = document.getElementsByClassName("bar"+num)160 //bar.style["opacity"] = 1;161 //b.opacity = 1162 g.selectAll(".bar"+num).transition().style("opacity",1)163 164 165 166 //elem.style.setProperty('opacity', 1)167 168 169 }170 171 })172 173 174 175 }176 }177 )}178 d3.selectAll("filter").on("change",update)179 update()180 d3.selectAll(".industry1").on("change",update)181 update()182 d3.selectAll(".industry2").on("change",update)183 update()184 }...
selectall.js
Source:selectall.js
1/* automatically generated by JSCoverage - do not edit */2try {3 if (typeof top === 'object' && top !== null && typeof top.opener === 'object' && top.opener !== null) {4 // this is a browser window that was opened from another window5 if (! top.opener._$jscoverage) {6 top.opener._$jscoverage = {};7 }8 }9}10catch (e) {}11try {12 if (typeof top === 'object' && top !== null) {13 // this is a browser window14 try {15 if (typeof top.opener === 'object' && top.opener !== null && top.opener._$jscoverage) {16 top._$jscoverage = top.opener._$jscoverage;17 }18 }19 catch (e) {}20 if (! top._$jscoverage) {21 top._$jscoverage = {};22 }23 }24}25catch (e) {}26try {27 if (typeof top === 'object' && top !== null && top._$jscoverage) {28 _$jscoverage = top._$jscoverage;29 }30}31catch (e) {}32if (typeof _$jscoverage !== 'object') {33 _$jscoverage = {};34}35if (! _$jscoverage['plugins/selectall.js']) {36 _$jscoverage['plugins/selectall.js'] = [];37 _$jscoverage['plugins/selectall.js'][17] = 0;38 _$jscoverage['plugins/selectall.js'][18] = 0;39 _$jscoverage['plugins/selectall.js'][19] = 0;40 _$jscoverage['plugins/selectall.js'][22] = 0;41 _$jscoverage['plugins/selectall.js'][24] = 0;42 _$jscoverage['plugins/selectall.js'][25] = 0;43 _$jscoverage['plugins/selectall.js'][27] = 0;44 _$jscoverage['plugins/selectall.js'][28] = 0;45 _$jscoverage['plugins/selectall.js'][30] = 0;46 _$jscoverage['plugins/selectall.js'][32] = 0;47 _$jscoverage['plugins/selectall.js'][39] = 0;48}49_$jscoverage['plugins/selectall.js'].source = ["<span class=\"c\">/**</span>","<span class=\"c\"> * 全选</span>","<span class=\"c\"> * @file</span>","<span class=\"c\"> * @since 1.2.6.1</span>","<span class=\"c\"> */</span>","","<span class=\"c\">/**</span>","<span class=\"c\"> * 选中编辑器里的所有内容</span>","<span class=\"c\"> * @command selectall</span>","<span class=\"c\"> * @method execCommand</span>","<span class=\"c\"> * @param { String } cmd 命令字符串</span>","<span class=\"c\"> * @example</span>","<span class=\"c\"> * ```javascript</span>","<span class=\"c\"> * editor.execCommand( 'selectall' );</span>","<span class=\"c\"> * ```</span>","<span class=\"c\"> */</span>","UE<span class=\"k\">.</span>plugins<span class=\"k\">[</span><span class=\"s\">'selectall'</span><span class=\"k\">]</span> <span class=\"k\">=</span> <span class=\"k\">function</span><span class=\"k\">()</span><span class=\"k\">{</span>"," <span class=\"k\">var</span> me <span class=\"k\">=</span> <span class=\"k\">this</span><span class=\"k\">;</span>"," me<span class=\"k\">.</span>commands<span class=\"k\">[</span><span class=\"s\">'selectall'</span><span class=\"k\">]</span> <span class=\"k\">=</span> <span class=\"k\">{</span>"," execCommand <span class=\"k\">:</span> <span class=\"k\">function</span><span class=\"k\">()</span><span class=\"k\">{</span>"," <span class=\"c\">//去掉了原生的selectAll,因为会出现报错和当内容为空时,不能出现闭合状态的光标</span>"," <span class=\"k\">var</span> me <span class=\"k\">=</span> <span class=\"k\">this</span><span class=\"k\">,</span>body <span class=\"k\">=</span> me<span class=\"k\">.</span>body<span class=\"k\">,</span>"," range <span class=\"k\">=</span> me<span class=\"k\">.</span>selection<span class=\"k\">.</span>getRange<span class=\"k\">();</span>"," range<span class=\"k\">.</span>selectNodeContents<span class=\"k\">(</span>body<span class=\"k\">);</span>"," <span class=\"k\">if</span><span class=\"k\">(</span>domUtils<span class=\"k\">.</span>isEmptyBlock<span class=\"k\">(</span>body<span class=\"k\">))</span><span class=\"k\">{</span>"," <span class=\"c\">//opera不能自动合并到元素的里边,要手动处理一下</span>"," <span class=\"k\">if</span><span class=\"k\">(</span>browser<span class=\"k\">.</span>opera <span class=\"k\">&&</span> body<span class=\"k\">.</span>firstChild <span class=\"k\">&&</span> body<span class=\"k\">.</span>firstChild<span class=\"k\">.</span>nodeType <span class=\"k\">==</span> <span class=\"s\">1</span><span class=\"k\">)</span><span class=\"k\">{</span>"," range<span class=\"k\">.</span>setStartAtFirst<span class=\"k\">(</span>body<span class=\"k\">.</span>firstChild<span class=\"k\">);</span>"," <span class=\"k\">}</span>"," range<span class=\"k\">.</span>collapse<span class=\"k\">(</span><span class=\"k\">true</span><span class=\"k\">);</span>"," <span class=\"k\">}</span>"," range<span class=\"k\">.</span>select<span class=\"k\">(</span><span class=\"k\">true</span><span class=\"k\">);</span>"," <span class=\"k\">}</span><span class=\"k\">,</span>"," notNeedUndo <span class=\"k\">:</span> <span class=\"s\">1</span>"," <span class=\"k\">}</span><span class=\"k\">;</span>","",""," <span class=\"c\">//快捷键</span>"," me<span class=\"k\">.</span>addshortcutkey<span class=\"k\">(</span><span class=\"k\">{</span>"," <span class=\"s\">\"selectAll\"</span> <span class=\"k\">:</span> <span class=\"s\">\"ctrl+65\"</span>"," <span class=\"k\">}</span><span class=\"k\">);</span>","<span class=\"k\">}</span><span class=\"k\">;</span>"];50_$jscoverage['plugins/selectall.js'][17]++;51UE.plugins.selectall = (function () {52 _$jscoverage['plugins/selectall.js'][18]++;53 var me = this;54 _$jscoverage['plugins/selectall.js'][19]++;55 me.commands.selectall = {execCommand: (function () {56 _$jscoverage['plugins/selectall.js'][22]++;57 var me = this, body = me.body, range = me.selection.getRange();58 _$jscoverage['plugins/selectall.js'][24]++;59 range.selectNodeContents(body);60 _$jscoverage['plugins/selectall.js'][25]++;61 if (domUtils.isEmptyBlock(body)) {62 _$jscoverage['plugins/selectall.js'][27]++;63 if ((browser.opera && body.firstChild && (body.firstChild.nodeType == 1))) {64 _$jscoverage['plugins/selectall.js'][28]++;65 range.setStartAtFirst(body.firstChild);66 }67 _$jscoverage['plugins/selectall.js'][30]++;68 range.collapse(true);69 }70 _$jscoverage['plugins/selectall.js'][32]++;71 range.select(true);72}), notNeedUndo: 1};73 _$jscoverage['plugins/selectall.js'][39]++;74 me.addshortcutkey({"selectAll": "ctrl+65"});...
bubble-overlay-spec.js
Source:bubble-overlay-spec.js
...33 it('should be registered', function() {34 expect(dc.hasChart(chart)).toBeTruthy();35 });36 it('should generate the correct number of overlay groups', function() {37 expect(chart.selectAll("g.node")[0].length).toEqual(6);38 });39 it('should generate a correct class name for the overlay groups', function() {40 expect(d3.select(chart.selectAll("g.node")[0][0]).attr("class")).toEqual("node california");41 expect(d3.select(chart.selectAll("g.node")[0][3]).attr("class")).toEqual("node ontario");42 });43 it('should generate the correct number of overlay bubbles', function() {44 expect(chart.selectAll("circle.bubble")[0].length).toEqual(6);45 });46 it('should generate a correct translate for overlay groups', function() {47 expect(d3.select(chart.selectAll("g.node")[0][0]).attr("transform")).toMatchTranslate(100, 120);48 expect(d3.select(chart.selectAll("g.node")[0][3]).attr("transform")).toMatchTranslate(180, 90);49 });50 it('should generate correct radii for circles', function() {51 expect(d3.select(chart.selectAll("circle.bubble")[0][0]).attr("r")).toEqual("34.64");52 expect(d3.select(chart.selectAll("circle.bubble")[0][3]).attr("r")).toEqual("22.32");53 });54 it('should generate correct labels', function() {55 expect(d3.select(chart.selectAll("g.node text")[0][0]).text()).toEqual("California");56 expect(d3.select(chart.selectAll("g.node text")[0][3]).text()).toEqual("Ontario");57 });58 it('should generate the label only once', function() {59 chart.redraw();60 expect(chart.selectAll("g.node text")[0].length).toEqual(6);61 });62 it('generate the correct titles', function() {63 expect(d3.select(chart.selectAll("g.node title")[0][0]).text()).toEqual("Title: California");64 expect(d3.select(chart.selectAll("g.node title")[0][3]).text()).toEqual("Title: Ontario");65 });66 it('should only generate titles once', function() {67 chart.redraw();68 expect(chart.selectAll("g.node title")[0].length).toEqual(6);69 });70 it('should fill circles with the specified colors', function() {71 expect(d3.select(chart.selectAll("circle.bubble")[0][0]).attr("fill")).toEqual("blue");72 expect(d3.select(chart.selectAll("circle.bubble")[0][3]).attr("fill")).toEqual("blue");73 });74 it('should highlight the filtered bubbles', function() {75 chart.filter("Colorado");76 chart.filter("California");77 chart.redraw();78 expect(d3.select(chart.selectAll("g.node")[0][0]).attr("class")).toEqual("node california selected");79 expect(d3.select(chart.selectAll("g.node")[0][1]).attr("class")).toEqual("node colorado selected");80 expect(d3.select(chart.selectAll("g.node")[0][3]).attr("class")).toEqual("node ontario deselected");81 });82 });...
trigger.js
Source:trigger.js
1 // d3.selectAll(".ID").transition().attr("opacity",0)2 // d3.selectAll(".Title").transition().attr("opacity",0)3 // d3.selectAll(".First.Name").transition().attr("opacity",0)4 // d3.selectAll(".Last.Name").transition().attr("opacity",0)5 // d3.selectAll(".Suffix").transition().attr("opacity",0)6 // d3.selectAll(".Email.Address").transition().attr("opacity",0)7 // d3.selectAll(".Phone.Number").transition().attr("opacity",0)8 // d3.selectAll(".Street.Address").transition().attr("opacity",0)9 // d3.selectAll(".City").transition().attr("opacity",0)10 // d3.selectAll(".Zip.Code").transition().attr("opacity",0)11 // d3.selectAll(".State").transition().attr("opacity",0)12 // d3.selectAll(".Country").transition().attr("opacity",0)13 // d3.selectAll(".Sex").transition().attr("opacity",0)14 // d3.selectAll(".Age").transition().attr("opacity",0)15 // d3.selectAll(".topLine").attr("opacity",0)16 // d3.selectAll(".topText").attr("opacity",0)17d3.selectAll(".ID, .Title, .First.Name, .Last.Name, .Suffix, .Email.Address, .Phone.Number, .Street.Address, .City, .Zip.Code, .State, .Country, .Sex, .Age").transition().attr("opacity",0)18d3.selectAll(".topLine").attr("opacity",0)19d3.selectAll(".topText").attr("opacity",0)20d3.selectAll(".ID, .Title, .First.Name, .Last.Name, .Suffix, .Email.Address, .Phone.Number, .Street.Address, .City, .Zip.Code, .State, .Country, .Sex, .Age").transition().attr("opacity",1)21d3.selectAll(".topLine").attr("opacity",1)22d3.selectAll(".topText").attr("opacity",1)23d3.selectAll(".ID, .Title, .First.Name, .Last.Name, .Suffix, .Email.Address, .Phone.Number, .Street.Address, .City, .Zip.Code, .State, .Country, .Sex, .Age").transition().attr("opacity",1)24 .transition()25 .duration(2000)26 .attr("width",wide);27d3.selectAll(".topLine").attr("opacity",1)28d3.selectAll(".topText").attr("opacity",1)29 bottom();30 callSource();31 callNon();32// var on = 1;33// var off = 0;34// d3.selectAll(".ID, .Title, .First.Name, .Last.Name, .Suffix, .Email.Address, .Phone.Number, .Street.Address,35// .City,.Zip.Code,.State, .Country,.Sex,.Age").transition().attr("opacity",1)36// d3.selectAll(".Title").transition().attr("opacity",1)37// d3.selectAll(".First.Name").transition().attr("opacity",1)38// d3.selectAll(".Last.Name").transition().attr("opacity",1)39// d3.selectAll(".Suffix").transition().attr("opacity",0)40// d3.selectAll(".Email.Address").transition().attr("opacity",0)41// d3.selectAll(".Phone.Number").transition().attr("opacity",0)42// d3.selectAll(".Street.Address").transition().attr("opacity",0)43// d3.selectAll(".City").transition().attr("opacity",0)44// d3.selectAll(".Zip.Code").transition().attr("opacity",0)45// d3.selectAll(".State").transition().attr("opacity",0)46// d3.selectAll(".Country").transition().attr("opacity",0)47// d3.selectAll(".Sex").transition().attr("opacity",0)48// d3.selectAll(".Age").transition().attr("opacity",0)49// d3.selectAll(".topLine").attr("opacity",0)...
ScrollingSteps.js
Source:ScrollingSteps.js
2import {select, selectAll} from "d3";3const ScrollingSteps = {4 "explain": (direction) => {5 if (direction == "down") {6 selectAll(".radar-path").classed("show", true)7 selectAll(".radar-circle").classed("show", true)8 } else {9 selectAll(".radar-path").classed("show", false)10 selectAll(".radar-circle").classed("show", false)11 }12 },13 "parks": (direction) => {14 if (direction == "down") {15 selectAll(".radar-path").classed("show", false)16 selectAll(".radar-circle").classed("show", false)17 selectAll(".radar-circle-parks_change_diff").classed("show", true)18 selectAll(".ak-legend").classed("show", true)19 } else {20 selectAll(".radar-circle-parks_change_diff").classed("show", false)21 selectAll(".radar-path").classed("show", true)22 selectAll(".radar-circle").classed("show", true)23 }24 },25 "workplaces": (direction) => {26 if (direction == "down") {27 selectAll(".radar-circle-parks_change_diff").classed("show", false)28 selectAll(".radar-circle-workplaces_change_diff").classed("show", true)29 } else {30 selectAll(".radar-circle-workplaces_change_diff").classed("show", false)31 selectAll(".radar-circle-parks_change_diff").classed("show", true)32 }33 },34 "dc": (direction) => {35 if (direction == "down") {36 selectAll(".radar-circle-workplaces_change_diff").classed("show", false)37 selectAll(".DC-radar path, .DC-radar circle").classed("show", true)38 } else {39 selectAll(".DC-radar path, .DC-radar circle").classed("show", false)40 selectAll(".radar-circle-workplaces_change_diff").classed("show", true)41 }42 },43 "ne": (direction) => {44 if (direction == "down") {45 selectAll(".DC-radar path, .DC-radar circle").classed("show", false)46 selectAll(".ne path, .ne circle").classed("show", true)47 } else {48 selectAll(".ne path, .ne circle").classed("show", false)49 selectAll(".DC-radar path, .DC-radar circle").classed("show", true)50 }51 },52 "west": (direction) => {53 if (direction == "down") {54 selectAll(".ne path, .ne circle").classed("show", false)55 selectAll(".west path, .west circle").classed("show", true)56 } else {57 selectAll(".west path, .west circle").classed("show", false)58 selectAll(".ne path, .ne circle").classed("show", true)59 }60 },61 "mw-s": (direction) => {62 if (direction == "down") {63 selectAll(".west path, .west circle").classed("show", false)64 selectAll(".mw-s path, .mw-s circle").classed("show", true)65 } else {66 selectAll(".mw-s path, .mw-s circle").classed("show", false)67 selectAll(".west path, .west circle").classed("show", true)68 }69 },70 "vac": (direction) => {71 if (direction == "down") {72 selectAll(".west path, .west circle").classed("show", false)73 selectAll(".radar-path").classed("show", true)74 selectAll(".radar-circle").classed("show", true)75 } else {76 selectAll(".radar-path").classed("show", false)77 selectAll(".radar-circle").classed("show", false)78 selectAll(".west path, .west circle").classed("show", true)79 }80 },81 "telework": (direction) => {82 return;83 },84 "invisible": (direction) => {85 if (direction == "down") {86 selectAll(".mobility-chart").style("z-index", 1)87 } else {88 selectAll(".mobility-chart").style("z-index", -1)89 }90 }91}...
demo.js
Source:demo.js
1// 1-.each()2d3.select("ul").selectAll("li");3d3.select("ul").selectAll("li")4 .each(function(d, i) {5 console.log("element", this);6 console.log("data", d);7 console.log("index", i);8 });9// 2-.data()10// Access elements' data11// returns an array of undefined items12d3.select("ul").selectAll("li").data();13// Assign data to elements in the selector object14// not enough15var arr = [50, 55];16d3.select("ul").selectAll("li").data(arr);17d3.select("ul").selectAll("li").data();18// just right19var arr = [50, 55, 53];20d3.select("ul").selectAll("li").data(arr);21d3.select("ul").selectAll("li").data();22// too many23var arr = [50, 55, 53, 56, 68];24d3.select("ul").selectAll("li").data(arr);25d3.select("ul").selectAll("li").data();26// trying to reassign with not enough27var arr = [1, 2];28d3.select("ul").selectAll("li").data(arr);29d3.select("ul").selectAll("li").data();30// 3-Multiple Methods31var arr = [50, 55, 53];32d3.select("ul").selectAll("li")33 .data(arr)34 .text(function(d) {35 return d;36 });37// Modify the returned data38d3.select("ul").selectAll("li")39 .data(arr)40 .text(function(d) {41 return d + 1000;42 });43// 4-.enter()44// New data points are ignored here45var arr = [50, 55, 53, 56, 68];46d3.select("ul").selectAll("li")47 .data(arr)48 .text(function(d) {49 return d;50 });51// append affects existing elements = FAIL!52var arr = [50, 55, 53, 56, 68];53d3.select("ul").selectAll("li")54 .data(arr)55 .append("li")56 .text(function(d) {57 return d;58 });59// Use `enter` to create new elements60var arr = [50, 55, 53, 56, 68];61// First, update existing elements62d3.select("ul")63 .selectAll("li")64 .data(arr)65 .text(function(d) {66 return d;67 });68// Second, create new elements for extra data points69d3.select("ul")70 .selectAll("li")71 .data(arr)72 .enter()73 .append("li")74 .text(function(d) {75 return d;76 });77// 5-.exit()78// Finally, what if we remove an item?79var arr = [50, 55];80d3.select("ul")81 .selectAll("li")82 .data(arr)83 .exit()...
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .click('#tried-test-cafe')6 .click(Selector('label').withText('JavaScript API'));7});
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')22 .click('#submit-button')23 .click('#tried-test-cafe')24 .click(Selector('label').withText('JavaScript API'));25});26import { Selector } from 'testcafe';27test('My first test', async
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button')5 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 .typeText('#developer-name', 'John Smith')10 .click('#submit-button')11 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');12});13import { Selector } from 'testcafe';14test('My first test', async t => {15 .typeText('#developer-name', 'John Smith')16 .click('#submit-button')17 .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');18});19import { Selector } from 'testcafe';20test('My first test', async t => {21 .typeText('#developer-name', 'John Smith')
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 .typeText('#developer-name', 'John Smith')4 .click('#submit-button');5 const articleHeader = await Selector('.result-content').find('h1');6 let headerText = await articleHeader.innerText;7});8import { Selector } from 'testcafe';9test('My first test', async t => {10 .typeText('#developer-name', 'John Smith')11 .click('#submit-button');12 const articleHeader = await Selector('.result-content').find('h1');13 let headerText = await articleHeader.innerText;14});15TestCafe provides a set of built-in assertions that allow you to ver');
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My Test', async t => {3 const developerNameInput = Selector('#developer-name');4 const osOption = Selector('label').withText('Windows');5The .typeText(developerNameInput, 'Peter')6 .click(osOption)7 .click(submitButton);8});9import { Selector } from 'testcafe';10test('My Test', async t => {11 const developerNameInput = Selector('#developer-name');12 const osOption = Selector('label').withText('Windows');13 const submitButton = Selector('#submit-button');14 .typeText(developerNameInput, 'Peter')15 .click(osOption)16 .click(submitButton);17});18import { Selector } from 'testcafe';19test('My Test', async t => {20 const developerNameInput = Selector('#developer-name');21 const osOption = Selector('label').withText('Windows');22 const submitButton = Selector('#submit-button');23 .typeText(developerNameInput, 'Peter')24 .click(osOption)25 .click(submitButton);26});27import { Selector } from 'testcafe';28test('My Test', async t => {29 const developerNameInput = Selector('#developer-name');30 const osOption = Selector('label').withText('Windows');31 const submitButton = Selector('#submit-button');32 .typeText(developerNameInput, 'Peter')33 .click(osOption)34 .click(submitButton);35});36import { Selector } from 'testcafe';37test('Myllowing example shows how to use assertions to verify that the article header contains the text 'Thank you, John Smith!':38import { Selector } from 'testcafe';39test('My first test', async t => {40 .typeText('#developer-name', 'John Smith')41 .click('#submit-button');42 const articleHeader = await Selector('.result-content').find('h1');
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My Test', async t => {3 const developerNameInput = Selector('#developer-name');4 const osOption = Selector('label').withText('Windows');5 const submitButton = Selector('#submit-button');6 .typeText(developerNameInput, 'Peter')7 .click(osOption)8 .click(submitButton);9});10import { Selector } from 'testcafe';11test('My Test', async t => {12 const developerNameInput = Selector('#developer-name');13 const osOption = Selector('label').withText('Windows');14 const submitButton = Selector('#submit-button');15 .typeText(developerNameInput, 'Peter')16 .click(osOption)17 .click(submitButton);18});19import { Selector } from 'testcafe';20test('My Test', async t => {21 const developerNameInput = Selector('#developer-name');22 const osOption = Selector('label').withText('Windows');23 const submitButton = Selector('#submit-button');24 .typeText(developerNameInput, 'Peter')25 .click(osOption)26 .click(submitButton);27});28import { Selector } from 'testcafe';29test('My Test', async t => {30 const developerNameInput = Selector('#developer-name');31 const osOption = Selector('label').withText('Windows');32 const submitButton = Selector('#submit-button');33 .typeText(developerNameInput, 'Peter')34 .click(osOption)35 .click(submitButton);36});37import { Selector } from 'testcafe';38test('My
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 const developerNameInput = Selector('#developer-name');4 .typeText(developerNameInput, 'Peter Parker')5 .expect(developerNameInput.value).eql('Peter Parker');6});7import { Selector } from 'testcafe';8test('My first test', async t => {9 const developerNameInput = Selector('#developer-name');10 .typeText(developerNameInput, 'Peter Parker')11 .expect(developerNameInput.value).eql('Peter Parker');12});
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My first test', async t => {3 const selectElements = Selector('select').with({ boundTestRun: t });4 const options = await selectElements.find('option');5 .click(selectElements)6 .click(options.withText('JavaScript API'));7});8import { Selector } from 'testcafe';9test('My first test', async t => {10 const selectElements = Selector('select').with({ boundTestRun: t });11 const options = await selectElements.find('option');12 .click(selectElements)13 .click(options.withText('JavaScript API'));14});15import { Selector } from 'testcafe';16test('My first test', async t => {17 const selectElements = Selector('select').with({ boundTestRun: t });18 const options = await selectElements.find('option');19 .click(selectElements)20 .click(options.withText('JavaScript API'));21});22import { Selector } from 'testcafe';23test('My first test', async t => {24 const selectElements = Selector('select').with({ boundTestRun: t });25 const options = await selectElements.find('option');26 .click(selectElements)27 .click(options.withText('JavaScript API'));28});29import { Selector } from 'testcafe';30test('My first test', async t => {31 const selectElements = Selector('select').with({ boundTestRun: t });32 const options = await selectElements.find('option');
Using AI Code Generation
1import { Selector } from 'testcafe';2test('My Test', async t => {3 const selectElements = Selector('select').find('option');4 .click(selectElements.nth(2))5 .expect(selectElements.count).eql(4)6 .expect(selectElements.nth(1).value).eql('saab')7 .expect(selectElements.nth(2).value).eql('mercedes')8 .expect(selectElements.nth(3).value).eql('audi')9 .expect(selectElements.nth(4).value).eql('volvo');10});11import { Selector } from 'testcafe';12test('My Test', async t => {13 const selectElements = Selector('select').find('option');14 .click(selectElements.nth(2))15 .expect(selectElements.count).eql(4)16 .expect(selectElements.nth(1).value).eql('saab')17 .expect(selectElements.nth(2).value).eql('mercedes')18 .expect(selectElements.nth(3).value).eql('audi')19 .expect(selectElements.nth(4).value).eql('volvo');20});21import { Selector } from 'testcafe';22test('My Test', async t => {23 const selectElements = Selector('select').find('option');24 .click(selectElements.nth(2))25 .expect(selectElements.count).eql(4)26 .expect(selectElements.nth(1).value).eql('saab')27 .expect(selectElements.nth(2).value).eql('mercedes')28 .expect(selectElements.nth(3).value).eql('audi')
Using AI Code Generation
1import { Selector } from 'testcafe';2const selector = Selector('div').withText('Hello world!');3const selector = Selector('div').withText(/Hello/);4import { Selector } from 'testcafe';5const selector = Selector('select').addCustomMethods({6 selectOptions: (element, options) => {7 const optionsToSelect = Array.isArray(options) ? options : [options];8 return Array.from(element.options)9 .filter(option => optionsToSelect.includes(option.textContent))10 .forEach(option => {11 option.selected = true;12 });13 }14});15test('My test', async t => {16 .click(selector)17 .selectOptions(selector, ['Option 1', 'Option 2']);18});19const selector = Selector('div').with({ boundTestRun: testController });20const selector = Selector('div').with({ dependencies: { foo: 'bar' } });
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!