remove other content on chart load

This commit is contained in:
Alfred Melch 2019-08-07 03:51:34 +02:00
parent 7103f96595
commit e6c32fd8bb
2 changed files with 4 additions and 6 deletions

View File

@ -49,13 +49,10 @@
</style>
</head>
<body>
<header>Header <a href="../">Back</a></header>
<main>
<div>
<file-drop id="file-drop" accept="application/json"
>Drop config here</file-drop
>
</div>
<file-drop id="file-drop" accept="application/json"
>Drop config here</file-drop
>
<div><canvas id="myChart" width="600" height="400"></canvas></div>
</main>
<script src="./loadChart.js"></script>

View File

@ -20,4 +20,5 @@ fileDrop.addEventListener('filedrop', e => {
readFile(e.files[0])
.then(JSON.parse)
.then(config => new Chart(ctx, config))
.then(document.getElementsByTagName('file-drop')[0].remove())
})