search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Timeline event count using hours scale (Scheduler)

Asked by CaWingz
1 year ago.

I can see by this example (https://code.daypilot.org/93064/javascript-scheduler-column-summary) that day pilot can count the events per day. What I need to know is will it count events per timeslot if I was to use the timeline view with either hours or minutes on the scale? Not per day.

Answer posted by Dan Letecky [DayPilot]
1 year ago.

Yes, this is possible.

The code from the Column Summary and Availability Chart tutorial uses the real cell size (args.cell.start and args.cell.end) to calculate the utilization (total number of events):

onBeforeCellRender: function(args) {
  if (args.cell.resource === "summary") {
    var events = dp.events.forRange(args.cell.start, args.cell.end).length;

    args.cell.backColor = "#ffffff";
    args.cell.areas = [
      {left:0, top: 0, right: 0, bottom: 0, style: "display: flex; justify-content: center; align-items: center;", text: events},
    ];
  }
}

This means it will work correctly if you change the timeline scale (even for a manually-defined timeline).

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.