diff --git a/src/timeLine.ts b/src/timeLine.ts index 77bd590..34f0ced 100644 --- a/src/timeLine.ts +++ b/src/timeLine.ts @@ -151,16 +151,22 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual }]; } - const weekStandardFormat: WeekStandard = WeekStandard[timelineSettings.weeksDeterminationStandards.weekStandard.value.value]; + const weekStandardFormat: WeekStandard = timelineSettings.weeksDeterminationStandards.weekStandard.value + ? WeekStandard[timelineSettings.weeksDeterminationStandards.weekStandard.value.value] + : WeekStandard.NotSet; const calendarFormat: CalendarFormat = { - month: Month[timelineSettings.fiscalYearCalendar.month.value.value], + month: timelineSettings.fiscalYearCalendar.month.value + ? Month[timelineSettings.fiscalYearCalendar.month.value.value] + : Month.January, day: timelineSettings.fiscalYearCalendar.day.value, } const weekDayFormat: WeekDayFormat = { daySelection: timelineSettings.weekDay.daySelection.value, - day: timelineSettings.weekDay.day.value ? Day[timelineSettings.weekDay.day.value.value] : Day.Sunday, + day: timelineSettings.weekDay.day.value + ? Day[timelineSettings.weekDay.day.value.value] + : Day.Sunday, } const isCalendarChanged: boolean = previousCalendar @@ -507,7 +513,9 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual colorPalette: powerbiVisualsApi.extensibility.ISandboxExtendedColorPalette, ): void { const calendarFormat: CalendarFormat = { - month: Month[settings.fiscalYearCalendar.month.value.value], + month: settings.fiscalYearCalendar.month.value + ? Month[settings.fiscalYearCalendar.month.value.value] + : Month.January, day: settings.fiscalYearCalendar.day.value, } @@ -708,6 +716,7 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual public update(options: powerbiVisualsApi.extensibility.visual.VisualUpdateOptions): void { try { + debugger; this.host.eventService.renderingStarted(options); if (!Timeline.ARE_VISUAL_UPDATE_OPTIONS_VALID(options)) { @@ -797,7 +806,9 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual } if (adjustedPeriod.period.startDate && adjustedPeriod.period.endDate) { - const granularityType = GranularityType[this.formattingSettings.granularity.granularity.value.value]; + const granularityType = this.formattingSettings.granularity.granularity.value + ? GranularityType[this.formattingSettings.granularity.granularity.value.value] + : GranularityType.month; this.changeGranularity(granularityType, adjustedPeriod.period.startDate, adjustedPeriod.period.endDate); this.updateCalendar(this.formattingSettings, oldEnableManualSizing, newEnableManualSizing); } @@ -1290,16 +1301,22 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual localizationManager: powerbiVisualsApi.extensibility.ILocalizationManager, ) { - const weekStandardFormat: WeekStandard = WeekStandard[formattingSettings.weeksDeterminationStandards.weekStandard.value.value]; + const weekStandardFormat: WeekStandard = formattingSettings.weeksDeterminationStandards.weekStandard.value + ? WeekStandard[formattingSettings.weeksDeterminationStandards.weekStandard.value.value] + : WeekStandard.NotSet; const calendarFormat: CalendarFormat = { - month: Month[formattingSettings.fiscalYearCalendar.month.value.value], + month: formattingSettings.fiscalYearCalendar.month.value + ? Month[formattingSettings.fiscalYearCalendar.month.value.value] + : Month.January, day: formattingSettings.fiscalYearCalendar.day.value, } const weekDayFormat: WeekDayFormat = { daySelection: formattingSettings.weekDay.daySelection.value, - day: formattingSettings.weekDay.day.value ? Day[formattingSettings.weekDay.day.value.value] : Day.Sunday, + day: formattingSettings.weekDay.day.value + ? Day[formattingSettings.weekDay.day.value.value] + : Day.Sunday, } const calendar: Calendar = this.calendarFactory.create(weekStandardFormat, calendarFormat, weekDayFormat); @@ -1324,7 +1341,9 @@ export class Timeline implements powerbiVisualsApi.extensibility.visual.IVisual actualEndDate.getTime() !== prevEndDate.getTime(); if (!changedSelection) { - const granularityType = GranularityType[formattingSettings.granularity.granularity.value.value]; + const granularityType = formattingSettings.granularity.granularity.value + ? GranularityType[formattingSettings.granularity.granularity.value.value] + : GranularityType.month; this.changeGranularity( granularityType, startDate,