Skip to content

Commit

Permalink
convertEdgeCsv
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamlinerm committed Dec 18, 2024
1 parent 5b5db7f commit af43c83
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
12 changes: 8 additions & 4 deletions graph/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,20 @@ convertCsv("chromeUsers");
convertCsv("chromeDownloads");

function convertEdgeCsv(name) {
let file = fs
.readFileSync(path.join(__dirname, name + ".csv"), "utf-8")
let file = fs.readFileSync(path.join(__dirname, name + ".csv"), "utf-8");
const firstLine = file.split("\n")[0];
const userCountPosition = firstLine.split(",").indexOf("userCount");
const datePosition = firstLine.split(",").indexOf("date");

file = file
.split("\n")
// remove the first line
.slice(1)
.map((line) => line.split(","))
.map((line) => {
return {
date: line[4],
count: parseInt(line[5]),
date: line[datePosition],
count: parseInt(line[userCountPosition]),
};
});
fs.writeFileSync(path.join(__dirname, name + ".js"), "let " + name + " = " + JSON.stringify(file));
Expand Down
8 changes: 7 additions & 1 deletion graph/edgeDownloads.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
let edgeDownloads = [{"date":"2024-08-01","count":12},{"date":"2024-09-01","count":152},{"date":"2024-10-01","count":186},{"date":"2024-11-01","count":226},{"date":"2024-12-01","count":164}]
let edgeDownloads = [
{ date: "2024-08-01", count: 12 },
{ date: "2024-09-01", count: 152 },
{ date: "2024-10-01", count: 186 },
{ date: "2024-11-01", count: 226 },
{ date: "2024-12-01", count: 164 },
];
32 changes: 16 additions & 16 deletions graph/edgeUsers.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
let edgeUsers = [
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "", count: 2024 },
{ date: "2024-09-01", count: 15 },
{ date: "2024-09-08", count: 37 },
{ date: "2024-09-15", count: 78 },
{ date: "2024-09-22", count: 104 },
{ date: "2024-09-29", count: 166 },
{ date: "2024-10-06", count: 183 },
{ date: "2024-10-13", count: 200 },
{ date: "2024-10-20", count: 266 },
{ date: "2024-10-27", count: 266 },
{ date: "2024-11-03", count: 308 },
{ date: "2024-11-10", count: 333 },
{ date: "2024-11-17", count: 369 },
{ date: "2024-11-24", count: 424 },
{ date: "2024-12-01", count: 453 },
{ date: "2024-12-08", count: 538 },
{ date: "2024-12-15", count: 537 },
];

0 comments on commit af43c83

Please sign in to comment.