efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Bug when change the data grouping

Hello,

I am using stock chart with GUI in React with Next.js.(versions: "highcharts": "^9.2.0", "highcharts-react-official": "^3.0.0"). I want users can change the data grouping from the UI in the chart. You can see in the example TradingView chart: https://www.tradingview.com/chart/. You can change the date type from there, and if you select month, you can see the prices in a monthly basis. It is a really crucial feature for our upcoming product.
tradingview.png
tradingview.png (241.94 KiB) Viewed 1679 times
I already tried to add this feature to my chart with adding data grouping to my series (I added a custom button which is written "set frequency" on it.) You can see and try from the demo: https://codesandbox.io/s/data-grouping- ... c/index.js. When you click to button, it expands to "daily, weekly, monthly". It seems it is working right now. But sometimes, it is causing different, strange bugs (I really couldn't figure out clearly why and when it happens.)

Let me show you one of the bugs with a video on this demo: https://www.loom.com/share/825b1f360537 ... 33e22c96f4 At 4th second, when I click to all, the chart changes. When I upload a new chart data (at 12th second), and after click monthly, after click "all" button frequently, the chart and the prices changes every time. I also have different kind of bugs related to that data grouping feature in my local project that I could not find any pattern why it happens.

I really appreciate if you help me on this. I also could not find any other approach to make this feature except the data grouping. It is a crucial feature for us.

Thanks!
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Bug when change the data grouping

Hello efenadir!

We appreciate you reaching out to us and sorry for late reply!

The issue from your video is probably related to the fact that the data hasn't been loaded properly and when you click the "All" button the data gets changed. But I'm really curious about all the other bugs related to data grouping. Could you describe one of them and if possible reproduce it in an online editor as before (I really appreciate it!)?

Best regards!
Dominik Chudy
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi Dominik,

Thank you for your answer. Are you sure that it is about the data? I am facing the same problem in my local and the data looks proper to me. If it so, what is the problem?

I tried to reproduce in a local editor but couldn't find the same bug. I will try again. I'm aware that it is difficult to find the problem without an online editor.

Thank you!
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi again,

I also tried with static data (not fetching from api), it does not fix the bug. You can see from demo: https://codesandbox.io/s/data-grouping- ... c/index.js

If you can select weekly from Set Frequency button and click All after that, the chart still changes fyi.

King regards!
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi again :),

You can also try to click to upload new data button and after that you can see that the daterange selector will fully shrink. But if you click to monthly, weekly, daily, you can also see the daterange selector will change?

In my local application, there is a searchbox and users can see whatever stock they want. Therefore, I change the chart config object a lot (update the data in config options etc.), and also I have 2 different features that you can see in the demo (the set frequency button and upload new data button -in my application it is see 5 years-10 years-20 years of data), so I changed the config options a lot due to this reasons. And this set frequency button causes some problems as you can see from the demo's.

Again, thank you!
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Bug when change the data grouping

Hi,
Thanks for the details information.

I try to find the solution for case that you describe and at first we need to a simplified the problem as we can.
And I have question, have you try creating custom buttons inside events?

I update the chart series and set dataGrouping, could you try to fit your funcionality to this approach?

Demo:
https://jsfiddle.net/BlackLabel/gdevhqj7/

API Refereneces:
https://api.highcharts.com/highstock/pl ... taGrouping
https://api.highcharts.com/highstock/chart.events.load

I'm waiting for news from you.
Best regards.
Sebastian Hajdus
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi Sebastian,

Thank you for contacting me.
I try to find the solution for case that you describe and at first we need to a simplified the problem as we can.
I agree with you. The datagrouping causes me some problems in my local. But I couldn't reproduce all my problems to a live editor except this one that I mentioned before. Let's start with this if you are okay too. I will try to explain other bugs after we will understand this, I don't want to confuse you.
And I have question, have you try creating custom buttons inside events?
No, I didn't create custom buttons that is programatically outside of Highcharts. I created with exporting module that is one of the feature in Highcharts. However, I still faced the same bug in your demo as well. Please look at the video: https://www.loom.com/share/4e9bd2325210 ... d56bfa6909

When I change the datagrouping and after my each click action to All button, the chart and last price changes. I hope it is clear to you.

PS:
- I came up your discussion with another person when I was looking for a solution for this problem. I am trying to add the same functionality that he mentioned in the discussion to my chart. (I also mentioned in my first post in this discussion) Your discussion: viewtopic.php?f=12&t=46156&p=165266&hil ... ng#p165266. Another discussion: viewtopic.php?f=12&t=47260 I believe this feature is a desired and important feature for your chart . I also wanted to give a feedback to you in a supporting manner.


Kind regards.
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Bug when change the data grouping

Hi,

Let me try to explain it in a slightly different way, you're using an approach that somehow works.
I mean here setting dataGrouping in exporting buttons at your example.
Something works but is not compatible with the API which can cause errors.

Take a look at examples using dataGrouping in the right way.

https://jsfiddle.net/gh/get/library/pur ... roximation
https://jsfiddle.net/BlackLabel/3dhrny5w/
https://api.highcharts.com/class-refere ... #dataGroup

The error that occurs in my demo, I tried to reproduce it in other configurations according to the API and it was not reproduced also I will not report it.

Best regards.
Sebastian Hajdus
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi,
Let me try to explain it in a slightly different way, you're using an approach that somehow works.
I want users can be able to change the data grouping on their own. Therefore, I need a button that triggers that action. (They should see the prices daily, weekly and monthly.) Is there any other approach that will work? I couldn't find any. If it is, I would happy to implement that approach.

In your examples, you give the datagrouping configuration initially, right? It can be not manipulate by users. I understand your demo approach is fitting more than mine, but still not meet my needs. In my first post in this discussion, I mentioned my needs.

So, as I understand, the bug occurs because my approach somehow works and it is not the best practice to use datagrouping? I would be very please if I can add this functionality in my chart, because it is important for our customers.

Thank you for your consideration.
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Bug when change the data grouping

Hi,
I will try to ask stock specialists what can be done in your case.

Keep in touch.
Best regards.
Sebastian Hajdus
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi,

Thank you for your support. I will be appreciate.

Kind regards.
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Bug when change the data grouping

Hi,
I have this suggestion to use dataGrouping.forced, in testing it seems to work.
Can you check how it looks like for you?

Demo:
https://jsfiddle.net/BlackLabel/jfwg50d3/

API References:
https://api.highcharts.com/highstock/pl ... ing.forced

Best regards.
Sebastian Hajdus
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi,

Thank you for reaching out again.

In your demo, if I do:

Code: Select all

rangeSelector: {
      selected: 5
    },
And click 'add data grouping', nothing changes. It only can happen with 'All', cannot happen with other range selectors. Demo: https://jsfiddle.net/q9jfrshg/2/. Also, at my previous demo's, forced was always be true. So, I believe it is not about that. In my opinion, the problem is about 'All' button.

Kind regards
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Bug when change the data grouping

Hi,
Yes, you have completely right it's a bug for rangeSelector button All, default array object with all range.

This problem doesn't occur with the previous version of Highcharts:
https://jsfiddle.net/BlackLabel/8wfzot5g/

Here is a link to the Github ticket that you can track:
https://github.com/highcharts/highcharts/issues/16319

Best regards!
Sebastian Hajdus
Highcharts Developer
efenadir
Posts: 31
Joined: Sat Jul 10, 2021 6:32 pm

Re: Bug when change the data grouping

Hi,

Thank you for your support! I am following.

Kind regards.

Return to “Highcharts Stock”