JSFiddle - React, Tailwind, and code Playground
by Michel Penke
HTML
<button id="btn" type="radio">Grafiken wechseln</button>
<div class="container-grafic">
<iframe id="grafic_1" class="grafic" title="In diesen Branchen gab es die meisten freien Stellen" aria-label="Balken (separat)" id="datawrapper-chart-VRlBf" src="//datawrapper.dwcdn.net/VRlBf/2/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important;" height="362"></iframe>
<iframe id="grafic_2" class="grafic show" title="In diesen Branchen gab es die meisten Jobsuchen" aria-label="Balken (separat)" id="datawrapper-chart-PWKla" src="//datawrapper.dwcdn.net/PWKla/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important;" height="362"></iframe>
</div>
<script type="text/javascript">!function(){"use strict";window.addEventListener("message",function(a){if(void 0!==a.data["datawrapper-height"])for(var t in a.data["datawrapper-height"]){var e=document.getElementById("datawrapper-chart-"+t);e&&(e.style.height=a.data["datawrapper-height"][t]+"px")}})}();</script>
CSS
.grafic {
display: none;
}
.grafic.show {
display: block;
}
.container-grafic {
width: 100%;
max-width: 900px;
height: auto;
margin: 0 calc(50% - 450px) 0 calc(50% - 450px);
}
#btn {
-webkit-tap-highlight-color: transparent;
background-color: #ff5064;
border-radius: 0;
box-shadow: none;
box-sizing: border-box;
color: #fff;
display: inline-block;
font-size: 15px;
font-weight: 700;
line-height: 1;
padding: 12px 24px;
text-align: center;
text-decoration: none;
transition-delay: 0s;
transition-duration: .5s;
transition-property: all;
transition-timing-function: ease;
width: 300px;
display: inline-block;
text-decoration: none;
margin: 30px calc(50% - 150px) 30px calc(50% - 150px);
}
JavaScript
document.getElementById('btn').addEventListener('click',
function () {
document.getElementById('grafic_1')
.classList
.toggle('show');
document.getElementById('grafic_2')
.classList
.toggle('show');
});