I am utilizing the C3 JavaScript library to showcase graph data on my webpage. Initially, when the page loads, the graphs remain hidden until a specific "tab" is selected. However, I am encountering an issue where the first graph does not fit within its designated div tag upon initial load. Changing the date range by clicking a button corrects this sizing problem.
Below is the HTML code snippet that includes the AngularJS framework for rendering the graphs:
<div class="chartgrouping">
<div ng-show="showGraphSection" class="graphA">
<h2 class="section-main-heading">Data A</h2>
<div id="dataAChart" class="chart c3"></div>
</div>
<div ng-show="showGraphSection" class="graphB">
<h2 class="section-main-heading">Data B</h2>
<div class="stats">
<div class="highest-value">Data Breakdown<span>{{percentageOfSubstance}}%</span></div>
<div class="goals">GOAL: 20%</div>
</div>
<div id="dataBChart" class="c3" style="max-height: 320px; position: relative;"></div>
</div>
</div>
Initially, the display is incorrect with the first graph stretching across completely. After loading new data and adjusting the display, the graphs resize appropriately. Is there a recommended solution for solving this issue?