Skip to content

Updating cursor though plotOptions does not update each series #17878

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

Closed
karolkolodziej opened this issue Oct 24, 2022 · 8 comments · Fixed by #17972
Closed

Updating cursor though plotOptions does not update each series #17878

karolkolodziej opened this issue Oct 24, 2022 · 8 comments · Fixed by #17972
Assignees

Comments

@karolkolodziej
Copy link
Contributor

Expected behaviour

When updating the series cursor through the plotOptions each series should have that property as it is with color.

Actual behaviour

When updating the series cursor through the plotOptions only the first series has updated cursor.
This is not the case when you have column and line but is when having column and scatter.

Live demo with steps to reproduce

https://jsfiddle.net/BlackLabel/qofx0uhg/

Product version

Highcharts JS v10.2.1 (2022-08-29)

Affected browser(s)

All

@Noppey
Copy link

Noppey commented Nov 9, 2022

Is there any indication when this bug is going to be resolved? It's quite an annoying bug in our application as it's unclear to customers when they can click through to zoom in.

@MarkusBarstad
Copy link
Contributor

MarkusBarstad commented Nov 10, 2022

Hey @Noppey apologies for not having solved this yet!

I will get someone with more experience to look into it, for the time being there is a (somewhat laborious) workaround you can use, at least going by the fiddle you posted. It involves simply recreating the series which does not accurately receives the updated cursor with the same desired settings as the old, but after updating plotOptions: https://jsfiddle.net/mkb93/3tgk7Lcs/

Internal note:
Logging each series shows that they have series.cursor.options set accurately, but the style-attribute of the series' HTML-objects shows that only one of them receives the cursor-style. The initial setting of the cursor works for both series, it is when it is already set that the bug occurs (which can be seen by removing the initial settings of plotOptions in the OP fiddle)

@Noppey
Copy link

Noppey commented Nov 14, 2022

I understand the workaround, but I don't like the additional complexity in our usecase (not the jsfiddle).
Is it possible to get the bug assigned to someone who has the ability to solve it?

@TorsteinHonsi
Copy link
Collaborator

TorsteinHonsi commented Nov 15, 2022

Thank you for your patience @Noppey !

Until the next maintenance is released, there's a more modular drop-in workaround you can use, instead of rewriting your logic. Then after release this can be removed (or not):

// Drop-in workaround for #17878
Highcharts.addEvent(Highcharts.seriesTypes.column, 'afterUpdate', function(options) {
    if (this.options.cursor) {
        this.trackerGroups.forEach(key => {
            if (this[key]) {
                this[key].attr({
                    'style': `cursor: ${this.options.cursor}`
                });
            }
        });
    }
});

View it live on jsFiddle.

@MarkusBarstad MarkusBarstad removed their assignment Nov 15, 2022
@Noppey
Copy link

Noppey commented Nov 21, 2022

What would be the appropriate workaround for highstock? It doesn't recognize the property seriesTypes here.

@karolkolodziej
Copy link
Contributor Author

From what I can see (demo), it works exactly the same in stock.

@Noppey
Copy link

Noppey commented Nov 23, 2022

My typescript compiler complained that seriesTypes was not a property. But the javascript works as you've mentioned:

Highcharts.addEvent((Highcharts as any).seriesTypes.column, 'afterUpdate', function (options) {
    if (this.options.cursor) {
        this.trackerGroups.forEach(key => {
            if (this[key]) {
                this[key].attr({
                    'style': `cursor: ${this.options.cursor}`
                });
            }
        });
    }
});

@karolkolodziej
Copy link
Contributor Author

The seriesTypes is an internal property thus TS complains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants