按照此页面上的示例:Parallel Coordinates
我试图在html页面中添加数据。我使用以下代码:
var cars = [
['AMC Ambassador Brougham',13,8,360,175,3821,11,73],
['AMC Ambassador DPL',15,8,390,190,3850,8.5,70]
];
var dimensions = ['name','economy (mpg)','cylinders','displacement (cc)','power (hp)','weight (lb)','0-60 mph (s)','year'];
但是我的屏幕空白了。
我猜测数据格式不正确。
有人可以就如何格式化html文件中的数据提出建议,以便我能正确显示数据。
由于
答案 0 :(得分:1)
Tkinter.Toplevel(master, class_='ClassName')
将返回一个对象数组,其中文件中的每一行都是数组中的对象,其中包含CSV标头的属性和行值的值。因此,将其直接转换为JSON将如下所示:
d3.csv
运行代码:
var cars = [{
"name": "AMC Ambassador Brougham",
"economy (mpg)": "13",
"cylinders": "8",
"displacement (cc)": "360",
"power (hp)": "175",
"weight (lb)": "3821",
"0-60 mph (s)": "11",
"year": "73"
}, {
"name": "AMC Ambassador DPL",
"economy (mpg)": "15",
"cylinders": "8",
"displacement (cc)": "390",
"power (hp)": "190",
"weight (lb)": "3850",
"0-60 mph (s)": "8.5",
"year": "70"
}];