-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>ac-learn charts</title> | ||
</head> | ||
<body> | ||
<!-- <canvas id="labels" width="400" height="400"></canvas> --> | ||
<div id="plot"></div> | ||
<script src="https://cdn.plot.ly/plotly-latest.min.js" charset="utf-8"></script> | ||
<script src="plot.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable no-console */ | ||
const loadData = async () => { | ||
try { | ||
const data = await Promise.all([ | ||
// fetch('../src/categories.json').then(res => res.json(), console.error), | ||
// fetch('../src/labels.json').then(res => res.json(), console.error), | ||
fetch('../playground/categoryPartitions.json').then( | ||
res => res.json(), | ||
console.error, | ||
), | ||
]) | ||
|
||
return data //[categories, dataset, categoryPartitions] | ||
} catch (error) { | ||
console.log('Error downloading one or more files:', error) | ||
} | ||
} | ||
|
||
const build = async () => { | ||
const [/* categories, */ data] = await loadData() | ||
console.log(data) | ||
const q1Plot = { | ||
x: Object.keys(data), | ||
y: Object.values(data).map(ctr => ctr.overall), | ||
type: 'bar', | ||
} | ||
|
||
const vizData = [q1Plot] | ||
const layout = { | ||
title: 'Label Distribution', | ||
} | ||
|
||
// eslint-disable-next-line no-undef | ||
Plotly.newPlot('plot', vizData, layout, {scrollZoom: true}) | ||
} | ||
|
||
build() |