javascript - Angular : SetData to HighChart widget from an array object -


i'm using under angular component highchart widget :

demo of chart : https://www.highcharts.com/demo/pie-legend

from documentation , using :

highcharts.chart('divchart', {           chart: {             plotbackgroundcolor: null,             plotborderwidth: null,             plotshadow: false,             type: 'pie'           },           title: {             text: this.nb           },           tooltip: {             pointformat: '{series.name}: <b>{point.percentage:.1f}%</b>'           },           plotoptions: {             pie: {               allowpointselect: true,               cursor: 'pointer',               datalabels: {                 enabled: false               },               showinlegend: true             }           },           series: [{             name: 'brands',             colorbypoint: true,             data: [{               name: 'microsoft internet explorer',               y: 56.33             }, {               name: 'chrome',               y: 24.03,               sliced: true,               selected: true             }, {               name: 'firefox',               y: 10.38             }, {               name: 'safari',               y: 4.77             }, {               name: 'opera',               y: 0.91             }, {               name: 'proprietary or undetectable',               y: 0.2             }]           }]         }); 

but since loading dynamically datat ( chrome , firefox ...) , have set fo key/ value data indicationg each browser value :

  browsers: {[key: string ]: number } = {}; 

for example browsers list contains :

chrome (name) -> 60 (value)

firefox -> 30

edge -> 10

....

i wanna inject browsers list values dynamically data of chart , , not mannually , since list may contain numerous values.

i think there methode called setdata , don't know if it's usefull.

ideas ?

yes there setdata function http://api.highcharts.com/highcharts/series.setdata

but after need update chart http://api.highcharts.com/highcharts/series.update


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -