1
A
回答
2
這是因爲痛苦的如何d3plus
動畫(即轉變)的圖表的各種部件,因爲它們加載。 但您可以將自己的傳奇的東西,如:
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var data = [{
"year": 1991,
"name": "alpha",
"value": 15
}, {
"year": 1991,
"name": "beta",
"value": 10
}, {
"year": 1991,
"name": "gamma",
"value": 5
}, {
"year": 1991,
"name": "delta",
"value": 50
}, {
"year": 1992,
"name": "alpha",
"value": 20
}, {
"year": 1992,
"name": "beta",
"value": 10
}, {
"year": 1992,
"name": "gamma",
"value": 10
}, {
"year": 1992,
"name": "delta",
"value": 43
}, {
"year": 1993,
"name": "alpha",
"value": 30
}, {
"year": 1993,
"name": "beta",
"value": 40
}, {
"year": 1993,
"name": "gamma",
"value": 20
}, {
"year": 1993,
"name": "delta",
"value": 17
}, {
"year": 1994,
"name": "alpha",
"value": 60
}, {
"year": 1994,
"name": "beta",
"value": 60
}, {
"year": 1994,
"name": "gamma",
"value": 25
}, {
"year": 1994,
"name": "delta",
"value": 32
}]
var visualization = d3plus.viz()
.container("#viz")
.data(data)
.type("bar")
.id("name")
.x("year")
.y("value")
.color("name")
.legend(true)
.draw();
moveLegend();
function moveLegend() {
var l = d3.select("#key"),
c = d3.select("#container");
// wait for the legend and container to appear
// if not wait 200 milliseconds and try again
if (!l.size() || !c.size()) {
setTimeout(moveLegend, 200);
} else {
// both now exist
// move legend to top
l.transition()
.attr("transform","translate(0,0)");
// move chart down height of legen
var lh = l.node().getBBox().height;
c.attr("transform", "translate(0," + lh + ")");
}
}
</script>
相關問題
- 1. 將UITabBar移動到UITabBarController的頂部?
- 2. 將Listitem移動到列表框頂部
- 3. 將框移動到頂部(z-index)
- 4. 將項目移動到FutureAccessList頂部
- 5. 將子控件移動到頂部
- 6. 移動圖像到電池的頂部
- 7. 如何將底部視圖移動到UIKeyboard頂部
- 8. 移動一行到頂部
- 9. 移動到頂部內表
- 10. 將特定覆蓋圖移動到頂部
- 11. 將x軸移動到matplotlib中的圖的頂部
- 12. jQuery remove()將視圖移動到屏幕頂部執行
- 13. 如何將分面標籤移動到圖形頂部?
- 14. 如何將特定的UIImageview移動到視圖頂部?
- 15. 如何動畫簡單視圖從底部移動到頂部?
- 16. 將頂部菜單欄移到底部
- 17. 從底部到頂部動畫示例
- 18. 移動imageview頂部
- 19. 動畫按鈕移動到頂部
- 20. 如何將第二個Activity從底部移動到頂部?
- 21. 將元素移動到sortable_element中的頂部/底部
- 22. 如何將頂部div移動到堆棧的底部
- 23. 如何將div移動到絕對div的底部和頂部
- 24. 將數據移動到頂部或底部的W/Java腳本
- 25. 如何在Xamarin iOS中將UITableViewCell從底部移動到頂部?
- 26. Excel 2013 |試圖從列的底部移動到列的頂部
- 27. 將導航欄移動到頂部,同時向下滾動HTML
- 28. 將可變字符串移動到頂部的自動方式
- 29. 將滾動條移動到數據表Primafaces頂部
- 30. 。動畫jquery移動到頁面頂部(可篩選圖片庫)
據d3Plus文件,'.legend()'沒有'position'屬性。 https://github.com/alexandersimoes/d3plus/wiki/Visualizations#legend – McNets