javascript - Morris Bar chart dynamic labels -


is possible setup label names hash sent morris?

  morris.bar({     element: 'mevsother',     data: $('#mevother').data('result'),     xkey: 'created_at',     ykeys: ['me', 'rank'],     labels: ['me', 'them']   }); 

hash exemple:

`[{"created_at":"2014-02-24","name":"john","me":0,"rank":0}...` 

so want 1 of label take value of name how can this? instead of 'them' value of name: john.

you can parse data variable , value it. according hash can be:

var result = $('#mevother').data('result'); var labels = ['me', result[0].name];  morris.bar({     element: 'mevsother',     data: result,     xkey: 'created_at',     ykeys: ['me', 'rank'],     labels: labels   }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -