Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yAxis scrollbars don't work correctly with boost #12889

Open
mateuszkornecki opened this issue Feb 4, 2020 · 7 comments
Open

yAxis scrollbars don't work correctly with boost #12889

mateuszkornecki opened this issue Feb 4, 2020 · 7 comments

Comments

@mateuszkornecki
Copy link
Contributor

mateuszkornecki commented Feb 4, 2020

Expected behaviour

Scrolling should work in the same way as without.

Actual behaviour

Scrollbar shows that the content is zoomed out to its full extent, but it’s not.
It is happening when we have more points that’s boostThreshold (5k by default) or while using both yAxis.min and yAxis.max properties.

Live demo with steps to reproduce

Try to use yAxis scrollbar
https://jsfiddle.net/BlackLabel/fbd42ro9/

Product version

Highstock JS v8.0.0 (2019-12-10)

Affected browser(s)

All

@mateuszkornecki mateuszkornecki changed the title yAxis scrollbar doesn’t work correctly with boost yAxis scrollbars doesn’t work correctly with boost Feb 4, 2020
@mateuszkornecki mateuszkornecki changed the title yAxis scrollbars doesn’t work correctly with boost yAxis scrollbars don't work correctly with boost Feb 4, 2020
@pawelfus
Copy link
Contributor

pawelfus commented Feb 4, 2020

Internal note:
Scrollbar is rendered according to Axis.min/max and Axis.dataMin/dataMax relation. In the demo above, dataMin and dataMax are not defined for yAxis (they're nulls), to it's falling back to Axis.min and renders full scrollbar:

scrollMin = Math.min(
pick(axis.options.min, axis.min as any),
axis.min as any,
pick(axis.dataMin, axis.min as any) // #6930
),
scrollMax = Math.max(
pick(axis.options.max, axis.max as any),
axis.max as any,
pick(axis.dataMax, axis.max as any) // #6930
),

I'm not sure why boost does node set dataMin and dataMax only for yAxis, probably limits data processing.

@mateuszkornecki
Copy link
Contributor Author

Possible workaround: Set the value of boostThreshold to be higher or equal than the number of points.
Live demo: https://jsfiddle.net/BlackLabel/fbd42ro9/

@highsoft-bot highsoft-bot added this to To do in Development-Flow Mar 5, 2020
@pawelfus
Copy link
Contributor

Internal note:
Before proceeding with the issue, check if boost has access (or already calculated) dataMin and dataMax values. And if not, find the reason why, if that's the performance related limitation, we need to rethink this.

@ppotaczek
Copy link
Contributor

Internal note:

That is probably for performance reason. If yAxis.min and yAxis.max are set, series.getExtremes method returns an empty object and yAxis.dataMin and yAxis.dataMax are always nulls.

* Do not compute extremes when min and max are set.
* If we use this in the core, we can add the hook
* to hasExtremes to the methods directly.
*/
wrap(Series.prototype, 'getExtremes', function (
this: Highcharts.Series,
proceed: Function
): Highcharts.DataExtremesObject {
if (!this.isSeriesBoosting || (!this.hasExtremes || !this.hasExtremes())) {
return proceed.apply(this, Array.prototype.slice.call(arguments, 1));
}
return {};
});

Series.prototype.hasExtremes = function (checkX?: boolean): boolean {
var options = this.options,
data: Array<Highcharts.PointOptionsType> = options.data as any,
xAxis = this.xAxis && this.xAxis.options,
yAxis = this.yAxis && this.yAxis.options,
colorAxis = this.colorAxis && this.colorAxis.options;
return data.length > (options.boostThreshold || Number.MAX_VALUE) &&
// Defined yAxis extremes
isNumber(yAxis.min) &&
isNumber(yAxis.max) &&
// Defined (and required) xAxis extremes
(!checkX ||
(isNumber(xAxis.min) && isNumber(xAxis.max))
) &&
// Defined (e.g. heatmap) colorAxis extremes
(!colorAxis ||
(isNumber(colorAxis.min) && isNumber(colorAxis.max))
);
};

As a simple solution we could calculate the extremes in case of y scrollbar.

@stale
Copy link

stale bot commented Apr 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Apr 18, 2022
@pawellysy
Copy link
Member

unstale

@stale stale bot removed the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Apr 20, 2022
@kamil-musialowski
Copy link
Contributor

kamil-musialowski commented Jun 13, 2022

Workaround: https://jsfiddle.net/BlackLabel/j5p03gv8/

(function(H) {
    H.wrap(H.Series.prototype, 'hasExtremes', function() {
        return false;
    });
})(Highcharts);

There's a similar problem with a heatmap with colorAxis, see demo: https://jsfiddle.net/BlackLabel/vou6qwax/

As a workaround, you can overwrite the hasExtremes method the same as above: https://jsfiddle.net/BlackLabel/864ma3he/

Internal note:
The problem doesn't occur when the colorAxis is added without any min/max options: https://jsfiddle.net/BlackLabel/Ld41ahrj/, but, of course, the points colors are calculated automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

6 participants