Skip to content

Fix change-start-date resolution - #192

Open
v-aidaba wants to merge 1 commit into
microsoft:mainfrom
v-aidaba:feature/multikpi-start-date
Open

Fix change-start-date resolution#192
v-aidaba wants to merge 1 commit into
microsoft:mainfrom
v-aidaba:feature/multikpi-start-date

Conversation

@v-aidaba

Copy link
Copy Markdown
Contributor

Fix change-start-date, add landing page and empty states

Start date ("Change start date"):

  • Match the selected start date by calendar day (fixes time/timezone off-by-one)
  • Missing day (gap) falls back to the next available date
  • Out-of-range date falls back to the closest available date instead of a 0% change
  • Invalid text input is ignored and flagged, not silently applied
  • Warning hint icon explains any adjustment (gap / out-of-range / invalid)
  • New "Show start date on chart" KPI toggle to display "(since )" by the days count

Landing page & empty states:

  • Add landing page with the visual icon (supportsLandingPage / supportsEmptyDataView)
  • Empty-state messages for missing Date/Values, invalid/blank dates, and no valid data

Comment thread src/multiKpi.ts
this.host.eventService.renderingStarted(options);

const dataView: powerbi.DataView = options?.dataViews?.[0];
if (this.handleLandingPage(options)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression risk vs. previous behavior: before this change update() always assigned this.settings (even with an undefined dataView, populateFormattingSettingsModel returns a default Settings). The new landing-page branch returns early without setting it, so this.settings stays undefined. The host still calls getFormattingModel() when the visual is selected with no data (the Format pane is available regardless of bound fields; supportsLandingPage doesn't suppress it), and buildFormattingModel dereferences .cards with no null-guard -> TypeError. Suggest still populating settings in the landing branch, e.g. this.settings = this.formattingSettingsService.populateFormattingSettingsModel(Settings, options?.dataViews?.[0]);, or guarding getFormattingModel().

{
color: kpiSettings.dateColor.value.value,
data: `${series.dateDifference} days`,
data: kpiSettings.showStartDate.value && kpiSettings.percentCalcDate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kpiSettings.percentCalcDate reflects only the manually typed start date, so a start date coming from a data-bound changeStartDate field (dataRepresentation.percentCalcDate) won't trigger the "(since ...)" suffix. If this is intentional, please add a short code comment here documenting that the suffix deliberately applies only to the manual start-date input, so it's clear to future readers.

const template: string = this.constructorOptions.localizationManager?.getDisplayName("Visual_StartDateHint_Invalid") ?? "Visual_StartDateHint_Invalid";
message = `\u26A0\uFE0F ${template.replace("${1}", adjustment.requestedText ?? "")}`;
} else {
const requested: string = getFormattedDate(adjustment.requestedDate);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint date uses DefaultDateFormat while the chart formats with settings.date.format.value, so the hint may show a different format than the label. Minor consistency nit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants