-1
繪製線串
我目前在過濾了CSV文件中獲得我的數據以這種方式提供過濾後的數據作爲輸入到D3.js
d3.csv("Viz2SampleData.csv", function(data43)
{
links = [];
data43.filter(function(d,i)
{
if (d3.select("#select-owner").node().value == "ALL" && d3.select("#select-contractor").node().value != "ALL" && d3.select("#select-launch").node().value == "ALL")
{
// for(var i=0, len=d.length-1; i<=len; i++)
// {
console.log(d.length)
if (d3.select("#select-contractor").node().value == d.CountryOfContractor)
{
return d;
}
]
})
}
})//closing for filter
現在,我想提請使用下面只代碼的鏈接對於上面根據我的條件選擇的過濾數據。下面的代碼在沒有任何過濾器的情況下爲CSV文件中的所有行繪製線串。該data43元素沒有得到過濾或者我訪問它在一個錯誤的方式
links.push({
type: "LineString",
coordinates: [
[ data43[i].OperatorOwnerLon, data43[i].OperatorOwnerLat ],
[ data43[i].CountryOfContractorLon, data43[i].CountryOfContractorLat ],
[ data43[i].lon, data43[i].lat ]
}
喬納森我不能感謝你纔好。這就像一個魅力:) – sjaikumar