Unable to load chart on hidden div

Hello,
I am trying to load chart on a hidden div and then showing the div on a click of a button.
But it doesnt load the chart if div hidden.
Here is the code:

<script>
	window.onload = function(){
        var pieChart =  new dhtmlXChart({
            view:"donut",
            container:"chart",
            value:"#sales#",
            color:"#color#",
            tooltip:"Value <b>#sales#</b>",
            legend:{
                width: 75,
                align:"right",
                valign:"middle",
                template:"#month#"
            },
            gradient:1,
            shadow:false
        });
        pieChart.parse(month_dataset,"json");
	}
	</script>


	<div id="chart" style="display:none;width:400px;height:250px;border:1px solid #A4BED4;"></div>
			
	<a onclick="document.getElementById('chart').style.display='block'"> show me</a>

Any way around or solution?

Thanks

Hi
At first try to load chart in a simple showed div and then hide it.

:smiley:

well i already added the workaround by using z-index.

Actually I m using tabs, and two tabs have two diff. charts loaded by default
So on changing tabs, i m doing the z-index to show/hide tabcontent rather then display:none/block.

Thanks