我有一个名为geneexp的列表,其中包含作为JSON的字典。
我试图通过更改数据来模仿它,但它没有用。这是我试过的
var geneexp = [{"chr":"1","end":79110897,"fpkm1":4.50805,"fpkm2":17.1285,"gene":"IFI44L","log2ratio":1.92583,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":79085606},{"chr":"1","end":109749401,"fpkm1":17.2746,"fpkm2":42.2573,"gene":"KIAA1324","log2ratio":1.29055,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":109648572},{"chr":"1","end":149783928,"fpkm1":3.79975,"fpkm2":18.0374,"gene":"FCGR1A","log2ratio":2.24701,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":149754226},{"chr":"1","end":663527,"fpkm1":2.0079,"fpkm2":0,"gene":"RP11-206L10.1","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":661610},{"chr":"1","end":26701013,"fpkm1":7.31716,"fpkm2":22.1062,"gene":"ZNF683","log2ratio":1.5951,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":26688124},{"chr":"1","end":40261668,"fpkm1":87.1441,"fpkm2":0,"gene":"RP1-118J21.24","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":40261514},{"chr":"1","end":68698803,"fpkm1":116.196,"fpkm2":40.7994,"gene":"WLS","log2ratio":-1.50993,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":68167148},{"chr":"1","end":153348125,"fpkm1":334.978,"fpkm2":986.306,"gene":"S100A12","log2ratio":1.55797,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":153346183},{"chr":"1","end":243265046,"fpkm1":2.09012,"fpkm2":8.19733,"gene":"RP11-261C10.3","log2ratio":1.97157,"pvalue":0.0002,"qvalue":0.0396421,"sample1":"q1","sample2":"q2","significant":true,"start":243218159},{"chr":"1","end":243265046,"fpkm1":2.09012,"fpkm2":8.19733,"gene":"RP11-261C10.6","log2ratio":1.97157,"pvalue":0.0002,"qvalue":0.0396421,"sample1":"q1","sample2":"q2","significant":true,"start":243218159},{"chr":"10","end":6277513,"fpkm1":21.6928,"fpkm2":46.1653,"gene":"PFKFB3","log2ratio":1.08959,"pvalue":0.00025,"qvalue":0.047075,"sample1":"q1","sample2":"q2","significant":true,"start":6186880},{"chr":"10","end":1779670,"fpkm1":0.0869107,"fpkm2":4.44899,"gene":"ADARB2","log2ratio":5.6778,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":1228072},{"chr":"11","end":44105772,"fpkm1":11.185,"fpkm2":35.0837,"gene":"ACCS","log2ratio":1.64924,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":44087474},{"chr":"11","end":59634048,"fpkm1":2.72747,"fpkm2":10.5967,"gene":"TCN1","log2ratio":1.95799,"pvalue":0.00025,"qvalue":0.047075,"sample1":"q1","sample2":"q2","significant":true,"start":59620272},{"chr":"11","end":102597781,"fpkm1":2.085,"fpkm2":21.2457,"gene":"MMP8","log2ratio":3.34905,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":102582472},{"chr":"12","end":58212487,"fpkm1":48.7468,"fpkm2":11.4797,"gene":"AVIL","log2ratio":-2.08622,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":58156116},{"chr":"12","end":58212487,"fpkm1":48.7468,"fpkm2":11.4797,"gene":"U6","log2ratio":-2.08622,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":58156116},{"chr":"13","end":53626196,"fpkm1":1.30126,"fpkm2":10.4113,"gene":"OLFM4","log2ratio":3.00017,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":53602467},{"chr":"14","end":21250626,"fpkm1":61.36,"fpkm2":28.3291,"gene":"RNASE6","log2ratio":-1.11501,"pvalue":0.00025,"qvalue":0.047075,"sample1":"q1","sample2":"q2","significant":true,"start":21249209},{"chr":"14","end":106725733,"fpkm1":244.435,"fpkm2":94.9557,"gene":"IGHV3-23","log2ratio":-1.36413,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":106725200},{"chr":"15","end":40569688,"fpkm1":1.13809,"fpkm2":4.07193,"gene":"BUB1B","log2ratio":1.8391,"pvalue":0.00015,"qvalue":0.0309534,"sample1":"q1","sample2":"q2","significant":true,"start":40453223},{"chr":"15","end":40569688,"fpkm1":1.13809,"fpkm2":4.07193,"gene":"PAK6","log2ratio":1.8391,"pvalue":0.00015,"qvalue":0.0309534,"sample1":"q1","sample2":"q2","significant":true,"start":40453223},{"chr":"15","end":40569688,"fpkm1":1.13809,"fpkm2":4.07193,"gene":"RP11-133K1.2","log2ratio":1.8391,"pvalue":0.00015,"qvalue":0.0309534,"sample1":"q1","sample2":"q2","significant":true,"start":40453223},{"chr":"15","end":82577271,"fpkm1":4.60645,"fpkm2":0.0831472,"gene":"FAM154B","log2ratio":-5.79184,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":82555150},{"chr":"15","end":41806085,"fpkm1":12.6574,"fpkm2":3.4051,"gene":"LTK","log2ratio":-1.89421,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":41795835},{"chr":"17","end":20947073,"fpkm1":3.0439,"fpkm2":0,"gene":"AC090774.2","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":20717932},{"chr":"17","end":20947073,"fpkm1":3.0439,"fpkm2":0,"gene":"RP11-344E13.3","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":20717932},{"chr":"17","end":20947073,"fpkm1":3.0439,"fpkm2":0,"gene":"RP11-381P6.1","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":20717932},{"chr":"17","end":20947073,"fpkm1":3.0439,"fpkm2":0,"gene":"RP11-746M1.2","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":20717932},{"chr":"17","end":56358296,"fpkm1":2.22762,"fpkm2":10.5089,"gene":"MPO","log2ratio":2.23803,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":56347216},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"PLEKHM1P","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"RP11-927P21.4","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"RP11-927P21.5","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"RP11-927P21.6","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"RP13-104F24.1","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"17","end":62936347,"fpkm1":66.2861,"fpkm2":537.599,"gene":"hsa-mir-6080","log2ratio":3.01975,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62745654},{"chr":"19","end":832017,"fpkm1":2.30561,"fpkm2":12.5563,"gene":"AZU1","log2ratio":2.44519,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":825096},{"chr":"19","end":51308186,"fpkm1":927.54,"fpkm2":5.58845,"gene":"C19orf48","log2ratio":-7.37482,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":51300960},{"chr":"19","end":51308186,"fpkm1":927.54,"fpkm2":5.58845,"gene":"SNORD88B","log2ratio":-7.37482,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":51300960},{"chr":"19","end":51308186,"fpkm1":927.54,"fpkm2":5.58845,"gene":"SNORD88C","log2ratio":-7.37482,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":51300960},{"chr":"19","end":55660722,"fpkm1":0.904421,"fpkm2":4.90537,"gene":"TNNT1","log2ratio":2.4393,"pvalue":0.0002,"qvalue":0.0396421,"sample1":"q1","sample2":"q2","significant":true,"start":55644161},{"chr":"2","end":103069345,"fpkm1":26.8634,"fpkm2":79.7291,"gene":"AC007278.3","log2ratio":1.56946,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":103034998},{"chr":"2","end":103069345,"fpkm1":26.8634,"fpkm2":79.7291,"gene":"IL18RAP","log2ratio":1.56946,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":103034998},{"chr":"2","end":119752236,"fpkm1":3.81979,"fpkm2":14.0364,"gene":"MARCO","log2ratio":1.87761,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":119699741},{"chr":"2","end":162841792,"fpkm1":3.96841,"fpkm2":0.485637,"gene":"AC009487.5","log2ratio":-3.03061,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":162272604},{"chr":"2","end":162841792,"fpkm1":3.96841,"fpkm2":0.485637,"gene":"SLC4A10","log2ratio":-3.03061,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":162272604},{"chr":"2","end":162841792,"fpkm1":3.96841,"fpkm2":0.485637,"gene":"TBR1","log2ratio":-3.03061,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":162272604},{"chr":"20","end":24940564,"fpkm1":119.63,"fpkm2":349.159,"gene":"CST7","log2ratio":1.5453,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":24929865},{"chr":"20","end":36965907,"fpkm1":4.81264,"fpkm2":23.3885,"gene":"BPI","log2ratio":2.2809,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":36838889},{"chr":"20","end":43805185,"fpkm1":89.1047,"fpkm2":418.219,"gene":"PI3","log2ratio":2.23068,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":43803516},{"chr":"20","end":3687775,"fpkm1":0.740776,"fpkm2":3.19236,"gene":"SIGLEC1","log2ratio":2.10751,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":3667616},{"chr":"20","end":49493714,"fpkm1":18196.3,"fpkm2":8056.63,"gene":"TMSB4XP6","log2ratio":-1.1754,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":49411430},{"chr":"20","end":62587775,"fpkm1":17.0093,"fpkm2":292.901,"gene":"MIR1914","log2ratio":4.10602,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62571185},{"chr":"20","end":62587775,"fpkm1":17.0093,"fpkm2":292.901,"gene":"MIR647","log2ratio":4.10602,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62571185},{"chr":"20","end":62587775,"fpkm1":17.0093,"fpkm2":292.901,"gene":"UCKL1","log2ratio":4.10602,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":62571185},{"chr":"21","end":42831141,"fpkm1":24.1349,"fpkm2":55.4697,"gene":"MX1","log2ratio":1.20058,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":42792230},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"D86994.1","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"D87015.1","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"IGLV2-14","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"IGLV2-23","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"IGLV2-8","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"IGLV3-12","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23165787,"fpkm1":40.261,"fpkm2":377.429,"gene":"MIR650","log2ratio":3.22875,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":23040273},{"chr":"22","end":23243617,"fpkm1":49.5145,"fpkm2":11.3554,"gene":"IGLC2","log2ratio":-2.12448,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":23243155},{"chr":"22","end":29564321,"fpkm1":11.9594,"fpkm2":27.9691,"gene":"KREMEN1","log2ratio":1.22568,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":29469065},{"chr":"3","end":48266981,"fpkm1":25.9102,"fpkm2":98.0926,"gene":"CAMP","log2ratio":1.92062,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":48264836},{"chr":"3","end":101489406,"fpkm1":3.09138,"fpkm2":622.79,"gene":"CEP97","log2ratio":7.65435,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":101442768},{"chr":"3","end":46546365,"fpkm1":20.1568,"fpkm2":149.34,"gene":"LTF","log2ratio":2.88926,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":46477135},{"chr":"3","end":146262651,"fpkm1":31.9606,"fpkm2":82.6978,"gene":"PLSCR1","log2ratio":1.37156,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":146232966},{"chr":"4","end":6698897,"fpkm1":92.3842,"fpkm2":24.0847,"gene":"S100P","log2ratio":-1.93953,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":6694795},{"chr":"4","end":79531597,"fpkm1":26.8309,"fpkm2":114.07,"gene":"ANXA3","log2ratio":2.08795,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":79472672},{"chr":"6","end":29865563,"fpkm1":7.44281,"fpkm2":0,"gene":"HLA-T","log2ratio":-10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":29864430},{"chr":"6","end":29897009,"fpkm1":19.3003,"fpkm2":107.257,"gene":"HLA-K","log2ratio":2.47438,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":29892499},{"chr":"6","end":35992645,"fpkm1":3.06182,"fpkm2":9.49569,"gene":"SLC26A8","log2ratio":1.63288,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":35911290},{"chr":"6","end":49712150,"fpkm1":1.15836,"fpkm2":10.0617,"gene":"CRISP3","log2ratio":3.11871,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":49695096},{"chr":"7","end":10516505,"fpkm1":0,"fpkm2":6.30144,"gene":"AC009945.4","log2ratio":10000000000,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":10516207},{"chr":"7","end":129396922,"fpkm1":12.534,"fpkm2":48.0358,"gene":"NRF1","log2ratio":1.93826,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":129251554},{"chr":"7","end":129396922,"fpkm1":12.534,"fpkm2":48.0358,"gene":"RNA5SP244","log2ratio":1.93826,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":129251554},{"chr":"7","end":142428984,"fpkm1":27.6122,"fpkm2":247.735,"gene":"TRBV28","log2ratio":3.16542,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":142428483},{"chr":"7","end":56119297,"fpkm1":5.02525,"fpkm2":1.00895,"gene":"PSPH","log2ratio":-2.31634,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":56078743},{"chr":"7","end":150502208,"fpkm1":47.706,"fpkm2":15.0642,"gene":"TMEM176B","log2ratio":-1.66304,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":150488372},{"chr":"8","end":6795860,"fpkm1":6.34889,"fpkm2":30.9513,"gene":"DEFA4","log2ratio":2.28542,"pvalue":0.0002,"qvalue":0.0396421,"sample1":"q1","sample2":"q2","significant":true,"start":6793343},{"chr":"8","end":99306621,"fpkm1":3.74493,"fpkm2":41.811,"gene":"NIPAL2","log2ratio":3.48087,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":99202060},{"chr":"8","end":99306621,"fpkm1":3.74493,"fpkm2":41.811,"gene":"U6","log2ratio":3.48087,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":99202060},{"chr":"9","end":130915734,"fpkm1":16.756,"fpkm2":102.235,"gene":"LCN2","log2ratio":2.60914,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":130911349},{"chr":"9","end":125667813,"fpkm1":13.5883,"fpkm2":47.7743,"gene":"RC3H2","log2ratio":1.81387,"pvalue":0.0001,"qvalue":0.0209222,"sample1":"q1","sample2":"q2","significant":true,"start":125606559},{"chr":"Y","end":7249743,"fpkm1":31.7483,"fpkm2":7.34532,"gene":"PRKY","log2ratio":-2.11178,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":7142012},{"chr":"Y","end":7249743,"fpkm1":31.7483,"fpkm2":7.34532,"gene":"U6","log2ratio":-2.11178,"pvalue":5e-05,"qvalue":0.0115877,"sample1":"q1","sample2":"q2","significant":true,"start":7142012}],
margin = {
top: 30,
right: 10,
bottom: 10,
left: 10
},
width = 1200 - margin.left - margin.right,
height = 1200 - margin.top - margin.bottom;
var x = d3.scale.linear()
.range([0, width])
var y = d3.scale.ordinal()
.rangeRoundBands([0, height], .2);
var xAxis = d3.svg.axis()
.scale(x)
.orient("top");
var svg = d3.select("body").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
x.domain([-800,800])
y.domain(data.map(function (d) {return d.gene;}));
svg.selectAll(".bar")
.data(geneexp) //changed as data to geneexp
.enter().append("rect")
.attr("class", "bar")
.attr("x", function (d) {
return x(Math.min(0, d.fpkm2)); //changed as value to fpkm2
})
.attr("y", function (d) {
return y(d.gene); //changed as name to fpmk1
})
.attr("width", function (d) {
return Math.abs(x(d.fpkm2) - x(0));
})
.attr("height", y.rangeBand());
svg.selectAll(".bar2")
.data(geneexp)
.enter().append("rect")
.attr("class", "bar2")
.attr("x", function (d) {
return x(Math.min(0, -d.fpkm1));
})
.attr("y", function (d) {
return y(d.gene);
})
.attr("width", function (d) {
return Math.abs(x(-d.fpkm1) - x(0));
})
.attr("height", y.rangeBand());
svg.append("g")
.attr("class", "x axis")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.append("line")
.attr("x1", x(0))
.attr("x2", x(0))
.attr("y2", height);
function type(d) {
d.value = +d.value;
return d;
}
任何帮助将不胜感激。 非常感谢。
答案 0 :(得分:1)