Angular Timeline Resource Group Aggregate Summaries
Get started with this exampleUsage
theme: 'ios' You can turn auto theming on and let it decide based on the platform.
Usage
themeVariant: 'light' You can turn auto dark mode on based on system settings.
Usage
clickToCreate: true,
// click to create is on dragToCreate: true,
// drag to create is on dragToMove: true,
// reordering is on dragToResize: true,
// resizing is on eventDelete: true
// deleting is on Fine-tune drag & drop with these options, which are false by default.
Usage
locale: localeEn Selecting the locale loads the localized settings and the translated UI text.
Resource Group Aggregate Summaries
When scheduling across multiple groups of resources it sometimes is helpful to provide summaries and aggregate calculations on a group level. These dynamically calculated values can be presented as custom templated events in resource parent rows. Whenever new bookings are made, updated or deleted, use the onEventCreated, onEventUpdated and onEventDeleted lifecycle events to update the aggregates for their parent resource. As we are working with variable event heights, make sure to set eventHeight: 'variable' which can be configured under the view. This is necessary if the actual booked events have a different height than the summary events (for parent resources).
Demo

Code
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import {
formatDate,
MbscCalendarEvent,
MbscEventcalendar,
MbscEventcalendarOptions,
MbscEventCreatedEvent,
MbscEventDeletedEvent,
MbscEventUpdatedEvent,
MbscModule,
MbscNewEventData,
MbscPageLoadingEvent,
MbscResource,
setOptions ,
} from '@mobiscroll/angular';
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
});
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
standalone: true,
imports: [CommonModule, MbscModule],
})
export class AppComponent {
calendarOptions: MbscEventcalendarOptions = {
min: '2026-10-30T00:00',
max: '2026-11-12T00:00',
clickToCreate: true,
dragToCreate: false,
dragToMove: true,
dragToResize: false,
eventOverlap: false,
view: {
timeline: {
type: 'week',
eventDisplay: 'fill',
eventHeight: 'variable',
},
},
extendDefaultEvent: (args: MbscNewEventData) => {
const d = args.start;
const start = new Date(d.getFullYear(), d.getMonth(), d.getDate(), 9);
const end = new Date(start.getFullYear(), start.getMonth(), start.getDate(), 18);
return {
allDay: true,
start: start,
end: end,
title: 'New event',
name: 'John Doe',
distance: 42,
consumption: 6,
};
},
};
myEvents: MbscCalendarEvent[] = [
{
id: 1,
allDay: true,
start: '2026-10-30T06:00',
end: '2026-10-30T19:00',
resource: 'orlando_1',
title: 'Sales meeting with JLL',
name: 'John C. Johnson',
distance: 120,
consumption: 35,
},
{
id: 2,
allDay: true,
start: '2026-10-31T03:00',
end: '2026-10-31T20:00',
resource: 'orlando_1',
title: 'Client consultation',
name: 'Mary K. Adams',
distance: 95,
consumption: 30,
},
{
id: 3,
allDay: true,
start: '2026-11-02T10:00',
end: '2026-11-02T17:00',
resource: 'orlando_1',
title: 'Project review at XYZ',
name: 'Robert B. Brown',
distance: 150,
consumption: 40,
},
{
id: 4,
allDay: true,
start: '2026-11-04T09:00',
end: '2026-11-04T16:00',
resource: 'orlando_1',
title: 'Team building workshop',
name: 'Susan E. Smith',
distance: 60,
consumption: 20,
},
// Showing partial data. Download full source.
];
eventsWithSummaries: MbscCalendarEvent[] = this.myEvents;
myResources: MbscResource[] = [
{
id: 'orlando',
name: 'CNL Tower II',
address: '420 S Orange Ave, Orlando, FL 32801',
eventCreation: false,
eventDragBetweenResources: false,
eventDragInTime: false,
eventResize: false,
color: 'transparent',
children: [
{
id: 'orlando_1',
car: 'Lincoln Continental',
plate: '51-5375',
type: 'Sedan',
},
{
id: 'orlando_2',
car: 'Porsche Panamera',
plate: '72-2590',
type: 'Sports sedan',
},
{
id: 'orlando_3',
car: 'Range Rover Velar',
plate: '41-7701',
type: 'Compact SUV',
},
],
},
// Showing partial data. Download full source.
];
firstViewDay: Date = new Date();
lastViewDay: Date = new Date();
getAggregateEvents(dayEvents: MbscCalendarEvent[]): MbscCalendarEvent[] {
const aggregateEvents: Record<string, MbscCalendarEvent> = {};
this.myResources.forEach((resource) => {
for (let date = new Date(this.firstViewDay); date <= this.lastViewDay; date.setDate(date.getDate() + 1)) {
aggregateEvents[(resource.id as string) + +date] = {
id: (resource.id as string) + +date,
isSummary: true,
allDay: true,
start: new Date(date),
end: new Date(date),
consumption: 0,
distance: 0,
resource: resource.id,
};
}
});
dayEvents.forEach((event) => {
if (!event['isSummary']) {
const parentResource = (event.resource as string).split('_')[0];
const dayStart = new Date(event.start as Date).setHours(0, 0, 0, 0); // Check type
if (aggregateEvents[parentResource + dayStart]) {
aggregateEvents[parentResource + dayStart]['consumption'] += event['consumption'];
aggregateEvents[parentResource + dayStart]['distance'] += event['distance'];
}
}
});
return Object.values(aggregateEvents);
}
updateCalendarEvents(inst: MbscEventcalendar): void {
const dailyEvents = inst.getEvents();
const updatedSummaries = this.getAggregateEvents(dailyEvents);
this.eventsWithSummaries = [...this.myEvents, ...updatedSummaries];
}
handlePageLoading(args: MbscPageLoadingEvent): void {
this.firstViewDay = new Date(args.firstDay);
this.lastViewDay = new Date(args.lastDay);
this.updateCalendarEvents(args.inst! as MbscEventcalendar);
}
handleEventUpdated(args: MbscEventUpdatedEvent): void {
this.updateCalendarEvents(args.inst! as MbscEventcalendar);
}
handleEventCreated(args: MbscEventCreatedEvent): void {
const newEvent = args.event;
this.myEvents.push(newEvent);
this.updateCalendarEvents(args.inst! as MbscEventcalendar);
}
handleEventDeleted(args: MbscEventDeletedEvent): void {
const deletedEvent = args.event;
const index = this.myEvents.indexOf(deletedEvent);
this.myEvents.splice(index, 1);
this.updateCalendarEvents(args.inst! as MbscEventcalendar);
}
roundCost(cost: number): number {
return Math.round(cost);
}
formatMyDate(date: Date): string {
return formatDate('hh:mm A', new Date(date));
}
}
<mbsc-eventcalendar
class="mds-aggregates"
[options]="calendarOptions"
[data]="eventsWithSummaries"
[resources]="myResources"
[timelineEventContentTemplate]="customEventTemp"
[resourceTemplate]="customResourceTemp"
(onPageLoading)="handlePageLoading($event)"
(onEventCreated)="handleEventCreated($event)"
(onEventDeleted)="handleEventDeleted($event)"
(onEventUpdated)="handleEventUpdated($event)"
>
<ng-template #customEventTemp let-event>
<ng-container *ngIf="event.currentResource.isParent; else notSummary">
<div class="mds-aggregates-summary-event mbsc-flex">
<div class="mds-aggregates-summary-details mbsc-flex mbsc-flex-1-1">
<div class="mds-aggregates-label">
Total dist.
<div class="mds-aggregates-summary-value">{{event.original.distance}} mi</div>
</div>
<div class="mds-aggregates-label">
Total cons.
<div class="mds-aggregates-summary-value">{{event.original.consumption}} gal</div>
</div>
<div class="mds-aggregates-label">
Est. cost
<div class="mds-aggregates-summary-value">$ {{roundCost(event.original.consumption * 3.706 || 0)}}</div>
</div>
</div>
</div>
</ng-container>
<ng-template #notSummary>
<div class="mds-aggregates-event">
<div class="mds-aggregates-title">{{event.title}}</div>
<div class="mds-aggregates-name">{{event.original.name}}</div>
<div class="mds-aggregates-details">
<div class="mds-aggregates-label">
Est. distance:
<span class="mds-aggregates-value"> {{event.original.distance}} mi</span>
</div>
<div class="mds-aggregates-label">
Est. consumption:
<span class="mds-aggregates-value"> {{event.original.consumption}} gal </span>
</div>
</div>
<div class="mds-aggregates-label mbsc-flex">
<div class="mbsc-flex-1-1">
Pick up:
<span class="mds-aggregates-value"> {{formatMyDate(event.original.start)}} </span>
</div>
<div>Drop off: <span class="mds-aggregates-value"> {{formatMyDate(event.original.end)}} </span></div>
</div>
</div>
</ng-template>
</ng-template>
<ng-template #customResourceTemp let-res>
<ng-container *ngIf="res.isParent;else notParent">
<div>{{res.name}}</div>
<div class="mds-aggregates-address">{{res.address}}</div>
</ng-container>
<ng-template #notParent>
<div>{{res.car}}</div>
<div class="mds-aggregates-plate">{{res.plate}}</div>
<div class="mds-aggregates-cartype">{{res.type}}</div>
</ng-template>
</ng-template>
</mbsc-eventcalendar>
.mds-aggregates .mbsc-timeline-column,
.mds-aggregates .mbsc-timeline-header-column {
width: 14.5em;
}
.mds-aggregates .mbsc-timeline-row-gutter {
height: 6px;
}
.mds-aggregates .mbsc-timeline-resource-title {
font-size: 14px;
font-weight: 600;
}
.mds-aggregates .mbsc-ios .mbsc-schedule-event:after {
display: none;
}
.mds-aggregates .mbsc-schedule-event-inner {
height: auto;
width: 100%;
}
.mbsc-windows-dark .mds-aggregates-summary-event,
.mbsc-ios-dark .mds-aggregates-summary-event,
.mbsc-material-dark .mds-aggregates-summary-event {
color: #fff;
}
.mds-aggregates-address {
padding: 8px 0;
font-size: 11px;
line-height: 16px;
font-weight: 600;
}
.mds-aggregates-plate {
padding: 8px 0;
font-weight: 600;
}
.mds-aggregates-cartype {
font-size: 11px;
font-weight: 600;
}
.mds-aggregates-summary-event {
color: #000;
}
.mds-aggregates-summary-details {
white-space: normal;
justify-content: space-between;
padding: 8px;
}
.mds-aggregates-summary-label {
font-size: 11px;
font-weight: 400;
}
.mds-aggregates-summary-value {
font-weight: 600;
font-size: 15px;
line-height: 24px;
}
.mds-aggregates-event {
padding: 4px;
}
.mds-aggregates-title {
white-space: normal;
line-height: 20px;
font-size: 14px;
font-weight: 600;
}
.mds-aggregates-name {
padding: 4px 0;
font-size: 12px;
line-height: 16px;
font-weight: 600;
}
.mds-aggregates-value {
font-weight: 600;
}
.mds-aggregates-label {
font-size: 11px;
font-weight: 400;
}
.mds-aggregates-details {
white-space: normal;
justify-content: space-between;
padding: 8px 0;
}