1
Hey there, guys. I’m having trouble making a chart that is "display:None" in "display: block" through Javascript. The problem is that when I make the graph visible it gets smaller than expected.
The graph is getting this resolution
When should I get this resolution
Below is the code of the graph in question
Html code
<div id="relat_sit_table" style="display:none;">
<div class='tab_title'>Situação UC Sem Medidor <?php echo "($mees/$anoo)"; ?></div><br/>
<div id='table_div_estilo2'><br/>
<div id='table_div3'></div></div><br/>
</div>
<div id="relat_sit_det2" style="display:none"><p class="relat_sit_det2"> Veja comparação entre os últimos meses <a href="#" name="relat_sit2" onClick="optionCheck4()">aqui</a></p></div>
Javascript
function optionCheck1(){
document.getElementById("columnchart_material_2").style.display ="none";
document.getElementById("piechart").style.display ="block";
document.getElementById("relat_class_det1").style.display ="none";
document.getElementById("relat_class_det2").style.display ="block";
}
The whole chart or just the pizza?
– Sam
Only the pizza.....
– Richard Palmas
Do the following: instead of initializing it with display: None, put invisible and with position: Absolute, like this:
style="visibility: hidden; position: absolute;"
... then with JS you change withELEMENTO.style.visibility = "visible"
andELEMENTO.style.position = "relative"
– Sam
Perfect, buddy! It worked, thank you!
– Richard Palmas