在我的应用程序中,我使用高图进行报告。我将div高度和宽度设置为100%但是要隐藏数据。所以我需要基于高图数据来自动设置div宽度和高度是可能的吗? 在下面的图表中,我有40个用户数据但在图表中偶数用户数据是缺失的,即user2,user4,user6
答案 0 :(得分:1)
$(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));