javascript - Highcharts SVG element not updating. Custom Freeform Drawing inside Highchats? -


i using highchart rendering graphs , using renderer in order draw custom line inside chart. want path recalculated , repainted whenever there data change. using highcharts-ng , angular same. code mentioned below:-

{             options: {                 chart: {                     type: 'line',                     margintop: 80,                     style: {                         fontfamily: 'serif',                         fontsize:14                     },                     events:{                         redraw:function(e){                             console.log(e)                             var elem=e.target.renderer.element()                             console.log(elem)                             console.log('i reloaded')                         }                     }                     //backgroundcolor:'rgba(255, 255, 255, 0.1)'                 },                 exporting: {                     enabled: false                 },                 plotoptions: {                     series: {                         animation: false,                         marker: {                             symbol: 'circle'                         },                         linewidth: 1,                         events: {                             afteranimate: function () {                                 console.log('lol')                             }                         }                     }                 },                 colors: ['#2c91de', '#165a8e'],             },             tooltip: {                 style: {                     padding: 10,                     fontweight: 'bold'                 }             },             title: {                 text: ""             },             loading: false,             series: [],             func: (chart) => {                 this.$timeout(() => {                     console.log(chart)                     var ren = chart.renderer;                     var group = ren.g().add();                     var attrforvline = {                         'stroke-width': 3,                         stroke: '#2c91de',                         dashstyle: 'solid'                     };                      (var = 0; < chart.series[0].data.length; i++) {                         var plot1 = chart.series[0].data[i];                         var plot2 = chart.series[1].data[i];                          /**                          * creating line segments across graphs.                          * keeping zindex low these lines.                          */                         ren.path([                             'm',                             plot1.plotx + chart.plotleft,                             plot1.ploty + chart.plottop,                             'v',                             plot2.ploty + chart.plottop                         ]).attr(attrforvline).add();                     }                 }, 1000);             },             yaxis: {                 tickinterval: 40,                 title: {                     text: ''                 }             },             xaxis: {                 startontick: true,                 endontick: true,                 linecolor: '#000000',                 type: 'datetime',                 labels: {                     rotation: -60,                     format: '{value:%m-%d-%y}',                     align: 'right'                 }             }         }; 

whenever chart rendered renders path. if data changes path not change rather remains same. please help. want update svg rendered dynamically. thanks

chart mentioned below has vertical lines drawn renderer enter image description here

when change data lines drawn renderer needs removed still stays , graph repainted different data points.as shown below enter image description here

i want rid of these lines , redraw them.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -