python - Highcharts stacked percentage area -


i have different series of data actual , expected value. each country it's expected there's done @ least xx assignments depending on team size. expected value can increase or decrease. new data retrieved every day , saved in sqlite database. idea present data using flask in python.

the sqlite database has following layout: data layout

i dreaming of plotting these data in such way it's shown in percentage wise. let's if see plot greece only, @ maximum expected value, in case 12, , plot 58% of area since maximum covered value 7. if see plot poland, expected value 22, means in order reach 100% both countries have complete assignments.

i have tried, kind of lost. here code:

highcharts.chart('container', { chart: {     type: 'area' }, title: {     text: 'covered assignents country' }, xaxis: {     type: 'datetime',     tickmarkplacement: 'on',     title: {         enabled: false     } }, yaxis: {     title: {         text: 'percent'     } }, tooltip: {     pointformat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y:,.0f} assignments)<br/>',     split: true }, plotoptions: {     area: {         stacking: 'percent',         linecolor: '#ffffff',         linewidth: 1,         marker: {             linewidth: 1,             linecolor: '#ffffff'         }     } }, series: [{     name: 'greece',     data: [{x: date.utc(2017,09,08), y:4}, {x: date.utc(2017,09,09), y:6}, {x: date.utc(2017,09,10), y:7}] }, {     name: 'poland',     data: [{x: date.utc(2017,09,08), y:1}, {x: date.utc(2017,09,09), y:3}, {x: date.utc(2017,09,10), y:5}] }, {     name: 'italy',     data: [{x: date.utc(2017,09,08), y:1}, {x: date.utc(2017,09,09), y:2}, {x: date.utc(2017,09,10), y:7}] }] }); 

jsfiddle: http://jsfiddle.net/ehnhq0pz/3/



i hope makes sense :)

change stacking "percent" "normal" ("percent" fills chart top). need calculate y values percentages before make data series:

data: [{x: date.utc(2017,09,08), origtasks:4, y:14}, ... 

above, 14 percentage somehow calculate yourself. note can include other data in series well, , later access in tooltips example (here: origtasks).

http://jsfiddle.net/ehnhq0pz/5/


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -