amcharts / amstock3

JavaScript Stock Chart V3
Other
53 stars 31 forks source link

Amcharts: Cursor can't access the last day of the period #8

Open daniilc-magnumwm opened 6 years ago

daniilc-magnumwm commented 6 years ago

When I zoom my chart sometimes the data in the last day is not accessible for cursor. I'm not sure whether it is a bug or an expected behaviour.

enter image description here

It is mostly the case when the endDate hasn't reached the middle of the day. For example in the graph below when I listen to the zoomed event I observe the following result of event.endDate - Tue Jul 24 2018 03:54:25

But if I drag the slide a bit - the data for this date become accessible. I understand that the data is rendered in the graph, but I'm not able to reach it. For my task it is crucial to have the same data in the date input field and the last accessible in the chart.

  1. Is it possible to adjust the cursor to the nearest date? I'll be confident if I can move only though days with specified hours, like Tue Jul 24 2018 22:00:00 ( 22:00:00 for every day, passing all other dates)
  2. Is it possible to add some margin from the right in order the cursor can access the data? Now the graph is very close the edge of the block and so the cursor can't catch the line.

I'll appreciate any advice

The reproduction code is here

daniilc-magnumwm commented 6 years ago

Well, I guess it is not the expected behaviour of 'groupToPeriods'. I specified the maxSeries to 0, but still when the slider reaches the beginning of the new day the data for the last day can't be reached with the cursor.

@martynasma @amcharts Any thoughts?

martynasma commented 6 years ago

Hey,

Try setting extendToFullPeriod to true.

daniilc-magnumwm commented 6 years ago

@martynasma but the default value is true I have tried it before, but it didn't help me either.

martynasma commented 6 years ago

OK, the next thing we can try is to use:

"glueToTheEnd": true

http://docs.amcharts.com/3/javascriptstockchart/AmStockChart#glueToTheEnd

daniilc-magnumwm commented 6 years ago

The same. Please note that the problem exist only for the dates of the beginning of the day, like Tue Jul 24 2018 03:54:25 For Tue Jul 24 2018 18:54:25 it is fine.

amcharts commented 6 years ago

New comment from Zendesk by Martynas Majeris on ticket 38519. (replying here will automatically notify amCharts support agent)

Hm, your data seems to be uniform without any hours attached to it.

OK, one more thing to try (in connection to glueToTheEnd):

AmCharts.useUTC = true;

This should go before you open instantiate the chart.

Yours sincerely,

Martynas Majeris amCharts

P.S. have you seen upcoming amCharts 4 yet? https://www.amcharts.com/v4

daniilc-magnumwm commented 6 years ago

@amcharts still the same

daniilc-magnumwm commented 6 years ago

Same problem exist for the start of the period.

2018-08-09_19-57-44

daniilc-magnumwm commented 6 years ago

That actually weird. I found out that the start period depends on the the hours. For example in the screenshot below the slider startDate is Tue Jun 13 2017 12:16:00 GMT+0800 The periods starts from the next day (Wednesday), although Tuesday is accessible for navigation, but its percentage value are non-zero.

2018-08-10_14-51-10

daniilc-magnumwm commented 6 years ago

@amcharts @martynasma Any thoughts? Have you consider adding step parameter to the slider? This parameter will be related to the the zooming scale. I'm currently working on my own one. It will just emit zooming event when reach a new value.

martynasma commented 6 years ago

I'm sorry, no. We need more time to figure this. Issues like that are extremely tricky.

Thank you for your patience.

daniilc-magnumwm commented 6 years ago

No problem take your time. I'll try to find the solution on my own as well.