- 移除 iris.csv 和 marketing.sql 文件 - 新增 sales_manager.csv 和 sales_month.csv 文件 - 添加 sales_manager.js 文件,实现销售数据的图表展示
36 lines
764 B
HTML
36 lines
764 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
|
|
<script src="d3.min.js"></script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<script>
|
|
d3.csv("../data/sales_month.csv", function (error, data) {
|
|
console.log(data);
|
|
var month = [];
|
|
var sales = [];
|
|
var profit = [];
|
|
for (i = 0; i < data.length; i++){
|
|
month.push(data[i].month);
|
|
sales.push(Math.round(data[i].sales / 100) / 100);
|
|
profit.push(Math.round(data[i].profit / 100) / 100);
|
|
}
|
|
console.log("---month---")
|
|
console.log(month)
|
|
console.log("---sales---")
|
|
console.log(sales)
|
|
console.log("---profit---")
|
|
console.log(profit)
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html> |