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> </style>
</head> </head>
<body> <body>
<header>Header <a href="../">Back</a></header>
<main> <main>
<div> <file-drop id="file-drop" accept="application/json"
<file-drop id="file-drop" accept="application/json" >Drop config here</file-drop
>Drop config here</file-drop >
>
</div>
<div><canvas id="myChart" width="600" height="400"></canvas></div> <div><canvas id="myChart" width="600" height="400"></canvas></div>
</main> </main>
<script src="./loadChart.js"></script> <script src="./loadChart.js"></script>

View File

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