score:1
In your style sheet replace the rule for the class selector .ui-tabs .ui-tabs-hide
with
.ui-tabs .ui-tabs-hide {
position: absolute;
left: -10000px;
}
Solution taken from: jQuery UI - Tabs
score:3
You can set the width of the graph's container div with a percentage.
Something like this should work.
<div id = "tab1">
<div id="graphContainer1" style= "width: 90%"></div>
</div>
<div id = "tab2" style = "display:none">
<div id="graphContainer2" style= "width: 60%"></div>
</div>
score:6
I know this is a long while after you asked your question but I had a similar issue in that my charts were rendering on the client with zero width whenever the chart was on a tab that was not activated by default. This is because, as @brent indicated, highcharts uses the parent's width and, as of jQuery UI 1.9, the tab widget uses an inline style of display: none
to hide the inactive tabs.
Instead of using the document ready event of jQuery to initialize your highchart, you should instead use the activate event of your the tab your chart is on. This has the added benefit of doing the snazzy chart animation each time the user clicks the tab.
Instead of:
$(document).ready(function() {
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
});
Use:
$('#tabcontainer').on('tabsactivate', function (event, ui) {
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
});
score:10
Highcharts sets the width of the chart to the width of the containing element. So if the containing element is hidden, it can't get a width.
To fix this you can set the width option when initializing your chart:
Chart = new Highcharts.StockChart({
Chart = new Highcharts.StockChart({
chart: {
renderTo: ...,
width: <SOME WIDTH>
},
xAxis: { .......... },
yAxis: [{ ....... }],
series : [{ .......... }]
});
If you aren't able to set the chart to a proper width I've used this trick to be able to get the width of a hidden element:
score:21
You could also trigger the window.resize Event
$(window).trigger('resize');
And Highcharts should update the Chart size
Source: stackoverflow.com
Related Query
- Highstocks graph width not correctly rendered
- Stack labels not rendered correctly when exporting Highcharts graph
- Highcharts 's width is not correctly rendered at a hidden div
- R HighCharter Stock Graph not correctly pulling dates
- Highcharts - setData() not updating Column Graph Correctly - stumped
- Graph not rendering series correctly using angular 4
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- Stacked highchart graph not working correctly for 0 values
- Why chart is not rendered correctly after export?
- The graph is not equal on the basis of the addition code in Highcharts
- Responsive Highcharts not sizing correctly until window resize
- Highchart specific width stack column bar graph
- x-axis tickInterval not working correctly in highstock chart
- Code works on fiddle but not when I do /show
- Highcharts Server not loading infile correctly
- Legend and Axis titles not showing in Highcharts Graph
- Legend and Axis titles not showing in Highcharts Graph
- Highcharts - Multiple Axis Graph not displaying labels
- Highcharts not displaying series data for graph with multiple Y-axes
- 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
- Highcharts - update column graph with setData() not working
- HighCharts scatter plot with Datetime on X Axis not plotting values correctly
- Highcharts.js variable pie chart not rendering data correctly along percentage dataLabels
- wkhtmltoimage does not show gridlines of highcharts graph
- Highcharts - Gauge chart data label not positioning correctly
- Highcharts item width not 100% in carousel
- Highcharts legend title border not full width
- Highcharts Graph displays correctly ONLY on Window Resize
More Query from same tag
- HighChart Pie Chart click on legend item to trigger drilldown
- Angular: HighChart TreeMap is not updating with the new data
- Meteor + React + Highchart
- Highstock navigator add drag-end event
- Background color to highcharts
- Hightchart change design and functionality
- Does the Highcharts-Vue wrapper support 'gauge' and 'heatmap' chart types?
- How to show horizontal line instead of a dot for a single value data in highcharts
- HighStock BaseSeries
- highcharts tooltip not moving next point
- Highcharts tooltip image
- Trigger mousedown and include e.which in the event
- How to increase the height of highchart?
- Crispy GridLineDashStyle
- maxPadding on highstocks
- how to make custom directive or pass variable in directive in angular js
- Can we show the title hover over x axis/y axis text in highcharts dumbbell chart?
- Highcharts Tooltip - Returns unwanted empty string causing render problems
- Highstock add points to dynamically added series
- Windows Forms WebBrowser control in different target platform
- Highcharts: Duplicate X-Axis Labels when dataGrouping is enabled (by Month)
- Code works on fiddle but not when I do /show
- highchart bargraph rectangles remove stroke
- UseHTML=True in legend ignores itemWidth on click
- Group vertically and Horizontally in HighCharts Gantt
- PHP spontaneously creates associative array where indexed array is required - using PHP arrays with Highcharts
- How to click on SVG element in highcharts to download file using Selenium
- Auto setting time axis range in highcharts
- How can I achieve this type of marker in highcharts?
- Rendering chart in the background