DorkRawk
DorkRawk

Reputation: 770

Resizing HighCharts Chart Causes Changes to Max Y Value

I'm having an issue where the display of the max value on a HighCharts chart is changing depending on the display width of the chart.

For example, the largest value in the series is chart.series[0].yData[426]

When the chart is displayed in a smaller sized browser window I get the following values from the browsers Developer Tools:

> chart.series[0].yData[426]
> 446.528
> chart.series[0].yAxis.dataMax
> 223.43449999999999

And the chart shows the peak value at the 223 point with the y axis to match.

When I maximize the window and run the same commands I get:

> chart.series[0].yData[426]
> 446.528
> chart.series[0].yAxis.dataMax
> 446.528

And the chart displays correctly (y Axis is scaled for max value of ~446, max value shown on the chart is correct).

I am changing the the chart size with the following function:

var chartContainer = $("#highstock-chart"); // #highstock-chart is where the chart is located

var resizeChart = function() {
    window.chart.setSize(chartContainer.width(), chartContainer.height());
  };

$(".fullscreen").click(function() {
    chartContainer.css("z-index", 100);
    chartContainer.css("position", "fixed");
    chartContainer.css("top", 0);
    chartContainer.css("left", 0);
    chartContainer.css("padding", 0);
    chartContainer.css("width", "100%");
    chartContainer.css("height", "100%");
    resizeChart();
  });

Is this an issue with the way I'm resizing the chart? Is this a quirk in HighCharts?

Upvotes: 2

Views: 905

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

It's dataGrouping from Highstock, you can disable it (I don't advice that): http://api.highcharts.com/highstock#plotOptions.series.dataGrouping

Upvotes: 1

Related Questions