score:0
So this is a bit old, but for anyone stumbling across this, I was having a similar issue with the highchart sizes being incorrect in a bootstrap tabbed display. The solution I came up with was to just delay creating the chart by 100ms using setTimeout().
setTimeout(function() {
drawBarChart();
}, 100);
Note: drawBarChart is a custom function I created to generate the charts I needed. The issue (at least in my case) seemed to be that the chart was being created before (or at the same time) as the container and was therefore choosing some default width instead of the width of the container.
score:0
I have 2 tabs , met same problem. I changed only 2 rows codes of Druska, and it worked.
function anyname() {
$("[data-highcharts-chart]").each(function () {
var highChart = Highcharts.charts[$(this).data('highchartsChart')];
var highChartCont = $(highChart.container).parent();
highChart.reflow();
});
}
and add one onclick event to you HTML tab codes like below:
<input type="radio" id="tab1_1" checked onclick="anyname();" >
score:1
i fix this problem with the next code.
$('#yourDivChart').highcharts({
chart: {
type: data.EjeX.Tipo,
//width: width,
//height: height,
options3d: {
enabled: true,
alpha: 15,
beta: 15,
viewDistance: 25,
depth: 40
},
width: $('#DivContainerWithYourTabs').width() - 150
},
in my case is a partial "_partialDetalleProyecto"
I hope works you.
score:2
I had a similar issue and I found that the best thing was not to load the chart until the tab was shown. So in the tab shown event I was quickly loading the chart (but only once)
score:2
I just solved this issue with the following. Using bootstrap version 3.3.5
I am leaving this here because this link showed up when I googled the issue at the beginning. I hope it helps.
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$(e.target.hash).highcharts().reflow();
});
HTML
<!-- Nav tabs -->
<ul class="nav nav-pills nav-justified" role="tablist" id="taks-tabs">
<li role="presentation" class="active"><a href="#taks_met_std" aria-controls="taks_met_std" role="tab" data-toggle="tab">Met Standard</a></li>
<li role="presentation"><a href="#taks_comm_perf" aria-controls="taks_comm_perf" role="tab" data-toggle="tab">Commended Performance</a></li>
<li role="presentation"><a href="#taks_m_met_std" aria-controls="taks_m_met_std" role="tab" data-toggle="tab">TAKS-M Met Standard</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="taks_met_std"></div>
<div role="tabpanel" class="tab-pane" id="taks_comm_perf"></div>
<div role="tabpanel" class="tab-pane" id="taks_m_met_std"></div>
</div>
score:2
add class="chart"
to all highcharts containers inside tabs.
add this jQuery code:
jQuery(document).on( 'shown.bs.tab', 'a[data-toggle="tab"]', function () {
$( '.chart' ).each(function() {
$(this).highcharts().reflow();
});
})
score:2
I found the answer after looking for sometime. This was driving me crazy so I want to share it with you all since nothing here worked for me.
Add this to your CSS
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: block;
height: 0;
overflow-y: hidden;
}
.tab-content > .active,
.pill-content > .active {
height: auto;
}
For more details visit the page I found the solution at https://jonpolygon.com/bootstrap-tabs-100-percent-width-charts/
score:4
This is my fix for this (using jQuery):
$("[data-highcharts-chart]").each(function () {
var highChart = Highcharts.charts[$(this).data('highchartsChart')];
var highChartCont = $(highChart.container).parent();
highChart.setSize(highChartCont.width(), highChartCont.height());
highChart.hasUserSize = undefined;
});
Call this function whenever the chart gains focus to make sure it is resized properly.
score:23
Here is a working example:
http://codepen.io/colinsteinmann/pen/BlGfE
Basically the .reflow() function is called on each chart when a tab is clicked. That way the chart gets redrawn based on the new dimensions which are applied to the container when it becomes visible.
This is the most important snippet of code:
// fix dimensions of chart that was in a hidden element
jQuery(document).on( 'shown.bs.tab', 'a[data-toggle="tab"]', function (e) { // on tab selection event
jQuery( ".contains-chart" ).each(function() { // target each element with the .contains-chart class
var chart = jQuery(this).highcharts(); // target the chart itself
chart.reflow() // reflow that chart
});
})
Source: stackoverflow.com
Related Query
- Highcharts does not resize charts inside tabs
- Synchronized HighCharts does not work when charts have different width
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- Trying to use highcharts inside native script web-view. Does not work
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Responsive Highcharts not sizing correctly until window resize
- Highcharts charts don't resize properly on window resize
- Highcharts Error #16: charts not showing on the same page
- Highcharts: Chart does not resize properly by making the screen smaller
- Resize highcharts using react-grid-layout not working
- Highcharts does not work with wicked_pdf
- highcharts graphs in bootstrap tabs are not displaying properly
- Highcharts reflow does not work on class selector
- HighCharts error #18: Requested Axis Does not exist
- highcharts not loading in tabs
- HighCharts chart export (screenshot download) does not display Navigator graph
- JavaScript code inside TypeScript file .ts not working
- Hidden Highcharts not sizing correctly until window resize
- wkhtmltoimage does not show gridlines of highcharts graph
- Second yAxis does not scale according to series in Highcharts
- Customise Highcharts Pie Chart Selection State so that slice does not animate out when selected
- Gauge highcharts is not resize with ionic 2
- Highcharts add a serie that does not exist
- Use of DotNet HighCharts dll to make charts in code behind
- Highcharts export menu does not show up fully
- Fourth y axis does not show labels in Highcharts
- Charts rendered using highcharts in angular2 do not take the height of the parent
- Tooltip.followPointer does not work in highcharts 3
- Highcharts graph does not update with firebase
- Not able to render the charts in pdf using Wickedpdf and Highcharts in rails 2.3 app
More Query from same tag
- dynamic marker color highcharts
- Highchart Line chart – data series with multiple axis - 2nd series placed in the middle of X axis
- Setup of Highcharts and PhantomJS on Windows 7. JSON string parse error
- Highchart advance formatting of x-Axis datetime labels
- Unable to populate Highchart at runtime using json data
- Highcharts Maps Drilldown Map From geojson
- highcharts - add label by custom id
- How to display hovered point value in Highcharts Crosshair
- Draw JSON result in highchart
- printing pie's dataLabels numbers with commas
- Highcharts Bullet Chart with 2 x axes... possible?
- Highcharts: How to change colors of all areas except hovered one on MouseOver event in area plot
- Rounding results in highcharts jquery script
- Is it possible to turn boost mode in highcharts only when client's browser starts to jank?
- Highmaps mapbubble
- Highcharts Pie chart multi line labels overlapping
- Additional tooltip in Highcharts using Handlebars
- How to make visible atleast one line inside line chart even though the custom legend clicked to make invisible it
- Highchart: Bubble heading is not showing if two bubbles intersect or comes near one another in Bubble chart
- Highchart tooltip variable width
- HIghchart Area Chart display NULL value in a wrong way
- How to center an image in a gauge
- Array values returning undefined in console/Round array elements to integers
- Hightcharts Display Date month on X-Axis
- How to show multiple HighCharts charts in the same page?
- How To Show All Data Labels For Datetime Axis In Highcharts
- Highcharts pie labels outline mising using styled mode
- Highcharts live data not updating after changing PHP variable
- Highcharts: Access the Series or Axis context in Axis Formatter
- Update High Charts every Minute?