json - Need guidance with structuring and storing Morris chart data with AngularFire in my Angular application -


i'm having trouble how should structure data angular metrics dashboard application.

i've been utilizing morris js' wonderful charting library , using ngmorrischart directives allow 2 way binding angular.

despite research , reading i'm having trouble how should go seeding, saving, editing , deleting table data these charts. i'm lost despite reading on how should structure , format store data.

the way have structured display view has graphs , on tab switches table view i'm aiming have users able input data monthly example. have multiple dashboards reuse these controllers. firebase json

"widgetone":    "fa-icon" : "fa-area-chart",   "labels" : "['2013 a', '2014 a', '2014 b']",   "last_updated" : "2013-08-31t09:05:08.740z",   "position" : "one",   "priority" : 1,   "title" : "title here",   "type" : "area",   "xkey" : "period",   "ykeys" : "['aold', 'a', 'b']" 

updated code app.controller('chartscontroller', function ($scope, $firebase) {

        //initiate firebase reference         var chartsref = new firebase('https://dashboard-retro.firebaseio.com/lync/widgets/widgetone');         var charts = $firebase(chartsref).$asobject();         console.log('here charts object ' + charts.xkey); //returning undefined         console.log('here charts object ' + charts); //returning [object object]          // set line, area, bar options         var chartoptions = function(hidegrid) {              // need pull in using firebase + $http             var chartxkey = 'period';              var chartykeys = ['aold', 'a', 'b'];              var chartlabels = ['2013 a', '2014 a', '2014 b'];              var chartcolors = ['#c3c3c3', '#f36648', '#64bed8'];              var chart = {                 behavelikeline: true,                 xkey: chartxkey,                 ykeys: chartykeys,                 labels: chartlabels,                 linecolors: chartcolors,                 fillopacity: 0.7,                 linewidth: 1,                 pointsize: 4,                 gridlinecolor: '#cfcfcf',                 hidehover: 'auto',                 resize: true,                 smooth: true             };             if(hidegrid) {                 chart.axes = false;                 chart.grid = false;                         }             return chart;         };          var  data = function() {             return [                 {period: '2014-01', aold: 4465279, a: 4932003, b: 187067},                 {period: '2014-02', aold: 5005381, a: 4948005, b: 181611},                 {period: '2014-03', aold: 5511556, a: 5423848, b: 223014},                 {period: '2014-04', aold: 5387309, a: 5074078, b: 207068},                 {period: '2014-05', aold: 6002556, a: 4733337, b: 330464},                 {period: '2014-06', aold: 5309628, a: 4443538, b: 962987},                 {period: '2014-07', aold: 5025872, a: 3831382, b: 1834638}             ];         };          $scope.arealynconeoptions = new chartoptions();         $scope.arealynconedata = new data();      } ); 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -