Graph for a whole month when dates are missing

by r.a. » Fri Jan 08, 2016 9:36 am


We're currently using Dashboard Designer. One of the things we have made is a graph counting number of certain occurences for the last 30 days.

graf.png (16.41 KiB) Viewed 387 times

While the graph is correct, a wish however, is for it to show the start and end date even if there wouldn't happen to be any data for those days.

For example, in the attached image, that it would instead show the graph from 09. (included) to 08. (included), with values of 0 (since date of posting is the 8th).

I tried to look into the preRender function, but not been able to find anything that could manipulate the start and end (without also messing up the returned list data).

The current settings we use are:
In the Dashboard tab
* Chart
** Category: Time
** Value: Time
** Aggregate over category - Unit: days
** Rendering mode: auto

Any ideas/suggestions on how this could be solved?
Posts: 2
Joined: Fri Jan 08, 2016 9:08 am

by Dmitry Kozlov » Sat Jan 09, 2016 10:43 am

Specify min and max dates in the Dashboard -> Advanced tab following way:

Code: Select all
var handlers = {};
handlers.preRender = function(config, logger) {
  logger.debug('Configuration: ', config);
  config.categoryAxis.min = new Date(2015, 11, 1);
  config.categoryAxis.max = new Date(2015, 11, 31);
  return true;
User avatar
Dmitry Kozlov
Posts: 129
Joined: Wed Nov 12, 2014 3:24 pm

by r.a. » Mon Jan 11, 2016 8:11 am

Thank you. Works perfectly. =)

Code: Select all
  var idag = new Date();

  /* The CAML-Query uses -30 days */
  config.categoryAxis.min = new Date(idag.getFullYear(), idag.getMonth(), idag.getDate()-30);
  config.categoryAxis.max = idag;
Posts: 2
Joined: Fri Jan 08, 2016 9:08 am

Return to Dashboard Designer for SharePoint 2013