我的R中的數據集如下所示: a <- c("M","F","F","F","M","M","F","F","F","M","F","F","M","M","F")
p <- c("P","P","W","W","P","P","W","W","W","W","P","P","P","W","W")
y1 <- c("yes","yes","null","no","no","no","yes",
我正在嘗試使用來自IMF的數據製作一些條形圖。我試圖用讀函數read.table()的XLS文件: base <- read.table("http://www.imf.org/external/pubs/ft/weo/2017/02/weodata/WEOOct2017all.xls", header=TRUE, sep="\t", fill=TRUE)
但是,這些數據被保存爲一個列表: t
以下代碼每次點擊按鈕或下拉菜單中的選項時都會調用以更新我的d3條形圖圖形新數據。 圖表中的條形根據新數據進行了適當更新,但條形圖的標籤沒有被替換爲新條形,而是顯示了新舊標籤。 請建議一些東西,以防止舊標籤顯示在條上。 function updateGraph(data) {
// scale the range of the data
x.domain(data.ma