Data Grouping - Monthly (end-of-month)

前端 未结 2 465
醉梦人生
醉梦人生 2021-01-12 13:50

I\'m having a very difficult time trying to get my data to be grouped via month. I\'ve even gone so far as to programmatically filter through my data to return only the last

2条回答
  •  爱一瞬间的悲伤
    2021-01-12 14:25

    We tried a Hack around this, where we used Highstock's (Splinechart) RangeSelector, Event and DataGrouping. On click of weekly rangeselectorButton we catch this event through setExtremes. Post catching the event approximate it to "sum". If you are using two series than iterate the object. Currently doing it weekly just extend it for Monthly using corresponding UNIT

      events: {
             setExtremes: function (e) {
                 if (e.rangeSelectorButton != undefined) {
                     var triger = e.rangeSelectorButton;
                     if (triger.type == 'week') {
                         $.each(this.series, function (index, obj) {
                             obj.options.dataGrouping.units[0] = ['week', [1]];
                         });
                     } else if (triger.type == 'day') {
                         $.each(this.series, function (index, obj) {
                             obj.options.dataGrouping.units[0] = ['day', [1]];
                         });
                     }
                 }
             }
         },
    

提交回复
热议问题