So after some digging I saw something to suggest changing Scroller to navigator. When I do that further down the code I get "Cannot read property 'xAxis' of undefined"
var xAxisIndex = chart.xAxis.length,
yAxisIndex = chart.yAxis.length;
Unfortunately our file for building out this chart is over 10,000 lines of code so I makes it really hard to setup a fiddle. Can you help me debug what could be the issue please?
Hi,
Welcome to our forum and thanks for contacting us with your question.
Some options may be deprecated but in general most should fit.
The most sensible way in my opinion would be to check where the error crashes and compare it with the actual API documentation.
Are there any custom additions or wrappers in your code? This scroller looks like this, but I'm not sure.
Do you have many reported bugs in the console?
It can be difficult to suggest more without checking your configuration.
Scroller was change to Navigator. You are getting error for Scroller and need to change it to Navigator.
H.wrap(H.Navigator.prototype, 'drawHandle', function (proceed, x, index) {
is a good start, but you need to provide other arguments of the function as well (unless you are passing all arguemnts to the proceed function then it doesn't matter - hard to be sure with the little code as was shared).
Navigator.prototype.drawHandle = function (x, index, inverted, verb) {
For sure don't do
H.wrap(H.Navigator.prototype.drawHandle = function (...
beacuse you are just assigning new function for drawHandle and additional confusion is causing placing this in a function call. This is the same as just overwriting the drawHandle funciton and has nothing to do with the wrap function or wrapping the code. Proceed function as argument won't be there as it is added by wrap function.
Please create a minimal demo with the error visible for faster solution or let us know what is wrong with
H.wrap(H.Navigator.prototype, 'drawHandle', function (proceed, x, index) {
For me its giving error as
custom-navigator.js:39 Uncaught TypeError: Cannot read property 'push' of undefined
at e.HC.wrap.HC.Navigator.drawHandle (custom-navigator.js:39)
at e.HC.Navigator.render (custom-navigator.js:231)
at d.<anonymous> (VM4463 highstock.js:642)
at d.<anonymous> (VM4463 highstock.js:384)
at Array.forEach (<anonymous>)
at d.onload (VM4463 highstock.js:384)
at d.firstRender (VM4463 highstock.js:384)
at d.<anonymous> (VM4463 highstock.js:353)
at A (VM4463 highstock.js:18)
at d.init (VM4463 highstock.js:351)
// create the elements
if (!scroller.rendered) {
// the group
handles[index] = renderer.g('navigator-handle-' + ['left', 'right'][index])
.css({
cursor: 'ew-resize'
})
.attr({
zIndex: 10 - index
})
.add();
// circle
tempElem = renderer.circle(0, 12, 12)
.attr(attr)
.add(handles[index]);
elementsToDestroy.push(tempElem);
// Don't render the navigator until we have data (#486, #4202, #5172). Don't redraw while moving the handles (#4703).
if (!isNumber(min) || !isNumber(max) || (scroller.hasDragged && !defined(pxMin))) {
return;
}
We had put the update to highcharts on the back burner for a while but we are back at it. I still have a question as to why when I change from using Scroller to Navigator, 'this' is undefined. We are still on 2.1.8 but have changed the update to 9.3.2 to make sure we are current.
Above you said "Navigator.prototype.drawHandle = function (x, index, inverted, verb) {" should be written with 4 arguments but in the API i dont even see draw handle. Im sorry but I am working with someone elses code they wrote years ago and are no longer at the company so I am just trying to decipher it. https://api.highcharts.com/highstock/navigator
Is draw handle no longer extensible or something?
I can setup an account for you to go through thee code we have on a test site if that is something that could help.
Below I am adding a larger snippet of our code and will add screen shots of what it looks like working and not / where the issue is.
For any further help with this issue I will need you to provide me with a live demo of your chart. I know you have mentioned that it is very complex and consists of many lines of code, but most likely it could be simplified and you can also remove almost all records of your data, leaving a few samples. Just to be on the same page, upgrade from 2.1.8 to 9.0.1 is a huge step, many years of development and many things have changed since then, some methods are deprecated now. Of course we will do our best to deal with this case but if you could provide me with some more details and context it would be much easier. What exactly this custom code does? Perhaps this can be sovled in a different way since Highcharts Stock has grown significantly since then.
Ok understood. Thanks, that will help the process.
The custom code is a culmination of many developers working for years building, maintaining and adding features to a stock charting tool with many custom studies, hot keys and analysis tools. I am sure you have solved a few of the issues but I feel due to the depth of features it would be easiest to fix the deprecated functions and when I have more time go through the new features and update accordingly.
I went through the change log looking for any documentation of items that we use that are changing but couldn't find any that were relevant and there were a couple of documents I tried to view but got a 404 error. I know it was a long, long list and I probably missed things but do you happen to have a list of deprecated functions and I could search & replace them as needed?
I can give you access to our test site if that would suffice? And I will, of course try to provide a slimmed down version.
All information about deprecated functions can be found in the change log. If you can't find a specific function that seems to be deprecated, then most likely it wasn't public or explicitly posted in our API docs, and thus not listed in the changelog. If you came across any 404 errors in references, then please provide me with the link and we will fix it.
Regarding the issue, you could try to remove all those custom plugins and start with a simple working chart. Then you can add them one by one refactoring and making sure that they are working. Of course it is up to your, but I would start with something like that.
When it comes to the test site, it is hard to tell if it would be sufficien but of course I will give it a try. If it contains any confidential information feel free to send it in private message to me.