Thanks for giving some pointers.. i started debugging more and see that drawing lines does not snap with candle.. so sometimes it falls on saturday.. and then user changes the timeline and saturday might not be there.. and that would mess up the timeline and create the issue..so using cardinal:false is better.. but we can not use that.. i
is there a way to snap lines to candles ? or points on charts.. to void this issue ?
i think there is one more issue.. we need to save user's annotation and i am following the code of 'save chart' from stock-tools.src..
as follows..
Code: Select all
chart.annotations.forEach(function (annotation, index) {
let userOptions = annotation.userOptions;
let copyUserOpts = $.extend({}, userOptions);
delete copyUserOpts.events; // i do have custom events override for add,delete and drag
annAry[index] = copyUserOpts;
});
then while loading annotation i am using
Code: Select all
for(let ann of annAry){
//console.log('here is the annotation..',ann);
//ann.events = self.getAnnotationBuiltInEvents(self);
//add annotation events back..
chart.addAnnotation(ann,false);
}
//redraw he chart finally
this is mostly working.. but sometimes it fails with following exception
Code: Select all
annotations-advanced.src.js:381 Uncaught (in promise) TypeError: this.options.positioner.call is not a function
at ControlPoint.redraw (annotations-advanced.src.js:381)
at annotations-advanced.src.js:1112
at Array.forEach (<anonymous>)
at CrookedLine.redraw (annotations-advanced.src.js:1111)
at CrookedLine.Annotation.redraw (annotations-advanced.src.js:2688)
at annotations-advanced.src.js:3609
at Array.forEach (<anonymous>)
at a.drawAnnotations (annotations-advanced.src.js:3608)
at highstock.js:19
at Array.forEach (<anonymous>)
ControlPoint.redraw @ annotations-advanced.src.js:381
(anonymous) @ annotations-advanced.src.js:1112
redraw @ annotations-advanced.src.js:1111
Annotation.redraw @ annotations-advanced.src.js:2688
(anonymous) @ annotations-advanced.src.js:3609
drawAnnotations @ annotations-advanced.src.js:3608
(anonymous) @ highstock.js:19
q @ highstock.js:19
a.redraw @ highstock.js:355
(anonymous) @ chartprofileview.js:3986
Promise.then (async)
loadAnnotations @ chartprofileview.js:3973
(anonymous) @ chartprofileview.js:4049
Promise.then (async)
saveAnnotations @ chartprofileview.js:4045
deselectButton @ chartprofileview.js:1156
(anonymous) @ highstock.js:19
q @ highstock.js:19
NavigationBindings.bindingsChartClick @ annotations-advanced.src.js:6409
(anonymous) @ annotations-advanced.src.js:6287
and i cant figure out how to avoid that ..
any idea ?? or help.. i am really stuck here..
Thanks