Skip to content

Commit

Permalink
Take data from gist
Browse files Browse the repository at this point in the history
  • Loading branch information
paolobrasolin committed Jan 23, 2024
1 parent b0232a4 commit b485822
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/controllers/main_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ export default class extends Controller {
declare readonly fileInputTarget: HTMLInputElement;

connect(): void {
//setTimeout(() => {
// // TODO: remove sleep
// d3.csv(
// "/frustum-demo.csv",
// ({ timestamp, latitude, longitude, word }) => ({
// timestamp: new Date(timestamp),
// day: d3.timeFormat("%Y-%m-%d")(new Date(timestamp)),
// latitude: +latitude,
// longitude: +longitude,
// word: word,
// epoch: new Date(timestamp).getTime(),
// })
// ).then((data) => {
// this.dispatch("datasetChanged", {
// detail: { data },
// });
// });
//}, 500);
setTimeout(() => {
d3.csv(
"https://gist.githubusercontent.com/paolobrasolin/ca6595469258bca83937edd4f5770f5d/raw/frustum-demo-large.csv",
({ timestamp, latitude, longitude, word }) => ({
timestamp: new Date(timestamp),
day: d3.timeFormat("%Y-%m-%d")(new Date(timestamp)),
latitude: +latitude,
longitude: +longitude,
word: word,
epoch: new Date(timestamp).getTime(),
}),
).then((data) => {
this.dispatch("datasetChanged", {
detail: { data },
});
});
}, 500);
}

async changeDataset(event: Event) {
Expand Down Expand Up @@ -52,7 +51,7 @@ export default class extends Controller {
longitude: +longitude,
word: word,
epoch: new Date(timestamp).getTime(),
})
}),
);
this.dispatch("datasetChanged", {
detail: { data },
Expand Down

0 comments on commit b485822

Please sign in to comment.