Reputation: 199
In my application I use highchart for report purpose.I set div height and width to be 100% but data to be hidden .So I need highchart data based to automatically set div width and height to be a possible?
In below chart I have 40 user data but in chart even number user data to be a missing i.e user2,user4,user6
Upvotes: 0
Views: 461
Reputation: 94
$(function()
{
(function(H)
{
H.wrap(H.Axis.prototype, 'setAxisSize', function(proceed)
{
var chart = this.chart,
staticScale = this.options.staticScale,height,diff;
var defaultWidth=20;
// For each series destroy trackball
if (staticScale !== undefined) {
var widthDiff;
if (chart.xAxis[0].max !== null)
{
widthDiff = chart.xAxis[0].max * defaultWidth;
}
height = (this.max - this.min) * staticScale;
diff = height - chart.plotHeight;
chart.plotHeight = height;
if (Math.abs(diff) >= 1 && chart.xAxis[0].max !== null) {
chart.setSize(
chart.chartWidth + widthDiff,
chart.chartHeight + diff,
!chart.hasRendered
);
}
}
proceed.call(this);
});
}(Highcharts));
Upvotes: 1