score:0
Highcharts does not support dynamic height, you can achieve it by $(window).resize
event:
$(window).resize(function()
{
chart.setSize(
$(document).width(),
$(document).height()/2,
false
);
});
See demo fiddle here.
score:0
You can set chart.height dynamically with chart.update method.
http://api.highcharts.com/highcharts/Chart.update
function resizeChartFromValues (chart) {
const pixelsForValue = 10
const axis = chart.yAxis[0]
chart.update({ chart: { height: (axis.max - axis.min) * pixelsForValue } })
}
const options = {
chart: {
events: {
load () {resizeChartFromValues(this)}
}
},
series: [{
data: [30, 70, 100],
}]
}
const chart = Highcharts.chart('container', options)
setTimeout(() => {
chart.series[0].setData([10, 20, 30])
resizeChartFromValues(chart)
}, 1000)
Live example: https://jsfiddle.net/a97fgsmc/
score:0
I had the same problem and I fixed it with:
<div id="container" style="width: 100%; height: 100%; position:absolute"></div>
No special options to the chart. The chart fits perfect to the browser even if I resize it.
score:2
here is one example which is resize chart according screen. http://jsfiddle.net/davide_vallicella/LuxFd/2/
Just don't set the height property in HighCharts and it will handle it dynamically for you so long as you set a height on the chart's containing element. It can be a fixed number or a even a percent if position is absolute.
http://api.highcharts.com/highcharts/chart.height
By default the height is calculated from the offset height of the containing element
find example here:- http://jsfiddle.net/wkkAd/149/
#container {
width:100%;
height:100%;
position:absolute;
}
score:2
hey I was using angular 2+ and highchart/highstock v.5, I think it will work in JS or jQuery also, here is a easy solution
HTML
<div id="container">
<chart type="StockChart" [options]="stockValueOptions"></chart>
</div>
CSS
#container{
height: 90%;
}
TS
this.stockValueOptions = {
chart: {
renderTo: 'container'
},
yAxis: [{
height: '60%'
},{
top: '65%',
height: '35%'
}]
}
Its working, and a easy one. Remove chart height add height in '%' for the yAxis.
Source: stackoverflow.com
Related Query
- Auto chart height
- Highcharts pie chart height auto sized including legend
- Highstock: When legend under the chart has many items, the chart height is small. How can I fix the height?
- Exporting HighCharts chart specific height width
- HighCharts Stock Chart error code 18
- how to sync height & y-axis baseline of multiple chart in highcharts
- Highcharts Image Renderer Auto Height
- using Highcharters in R with Shiny, control highstock chart height failed
- Highcharts increase height of the chart displayed
- Highcharts display label for pie chart using html table as data source
- How can I get highcharts Donut chart to auto calculate percentages
- highcharts chart height apart from legend
- dynamically set height of chart when printing Highcharts
- How do I auto scale an axis with a max height in highcharts?
- Highcharts calculated height on chart on first render incorrect
- Strange character in the Highstock source code
- Fixed plot height in scatter chart
- Highcharts chart keep increasing its height on browser resize
- Highcharts:Column Range chart having height of bar same as the height of interval in y Axis
- How to auto adjust Y axis plot lines in live high chart
- dynamic height of chart of highchart
- How to calculate the height of bar chart
- Highcharts Angular - How to set chart width and height with percentages?
- FusionCharts Failed to draw different chart on same data source
- How to change chart height in hchart() function in R (highcharter package) without using pipe operator?
- In Highcharts, how to avoid auto tick interval in a container with limited height
- x-axis, y-axis lines does not appear, when I include 3D chart library of HighChart in my code
- Utilizing full height in highcharts bubble chart
- Can I have a chart automatically size the height (rather than using 400px) using the Highcharts .NET Wrapper?
- highcharts gauge chart height taking extra space
More Query from same tag
- Highcharts doesn't display data
- Vuejs Data Update
- HighCharts performance degrades dramatically with 'chart' and 'renderer' together
- Highcharts chart with risk color background
- Highcharts 's width is not correctly rendered at a hidden div
- Highcharts X-Axis labels as Text
- Highcharts Label Date Format
- Highchart heatmap grouped category plugin styling issues
- Highchart Color Issue for series with single data with multiple colors
- How to show an additional column from CSV file as a tooltip in Highcharts
- How do I remove the color swatch from my HighCharts legend without affecting the column?
- Highcharts dual yaxis scaling issue
- The type or namespace name 'Highsoft' could not be found
- Highcharts: heatmaps - incorrect colors on reversed colorAxis
- Scrollbar creating overlaping chart div
- Highcharts manually setting legendItemClick event
- How to remove margins in highmaps?
- HighChart pie does not display any data
- Loading string data from table gets parsed as Date on Chrome - Highcharts
- Highcharts - Turning on and off gridlines on show, hide, or legendItemClick
- Add category in HighCharts
- Highstocks - How to change the default Zoom
- Data manipulation for heatmap
- Highcharts conditional DrillDown not hiding DrillUp Button
- highstock.js chart plotting is a bit off
- Dymanically Update Data in Highchart: Load Event is not Working
- Highcharts Export Server - Getting a blank chart
- Highcharts multiple data on single point in series
- Highcharts Data Not Showing on Ajax Call
- Drilldown in two steps, multiple choice in Highcharts