Skip to content

Option to make x-axis calendar-scaled - #7740

Merged
ankurjuneja merged 24 commits into
developfrom
fb_calendar_based_grouping_1209
Aug 15, 2026
Merged

Option to make x-axis calendar-scaled#7740
ankurjuneja merged 24 commits into
developfrom
fb_calendar_based_grouping_1209

Conversation

@ankurjuneja

@ankurjuneja ankurjuneja commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Rationale

The platform vis library (TrendingLinePlot) only supported an ordinal/discrete X-axis, so equal time gaps and long gaps between dates looked identical. These changes add an opt-in timeBasedXTick mode that renders a continuous, day-offset–based time scale (with same-day jitter on the continuous axis and a shared LABKEY.vis.dateToDayNumber helper), enabling the targetedms calendar grouping without affecting existing discrete-axis callers.

https://github.com/LabKey/internal-issues/issues/1209

Related Pull Requests

Changes

  • Added opt-in timeBasedXTick continuous time X-axis.
  • Added shared LABKEY.vis.dateToDayNumber helper.

Tasks 📍

  • Claude Code Review
  • Manual Testing
  • Test Automation
  • Verify Fix

@labkey-jeckels

Copy link
Copy Markdown
Contributor

A too-verbose but still relevant finding from my own Claude review:

Issue: The jitter/sequential branch was broadened from discrete-only to also include scaleType.continuous. This is a shared library used well beyond this feature. The CDS Connector chart (server/modules/clientModules/cds/webapp/Connector/src/view/Chart.js, getPointLayer) sets position: 'jitter' whenever plotNullPoints is true, and its x-scale is continuous for continuous/numeric/timestamp x measures. Before this change, that combination fell into the else branch and received no horizontal jitter; after it, points are jittered by xBinWidth = |scale(1) - scale(0)| / 2. That width assumes "1 x-unit = one slot ≈ one day," which is only meaningful for the calendar day-offset axis — for an arbitrary continuous measure (e.g. a concentration or an integer time index), scale(1)-scale(0) is an essentially arbitrary jitter magnitude.
Why it matters: A visual regression in CDS/Connector scatter plots (and any other continuous-x + jitter caller) that is unrelated to this story, with a jitter amount that has no defined meaning for non-day axes. It will not crash, which is why it's easy to miss, but it changes existing plot output.
Suggestion: Gate the new continuous behavior on explicit intent rather than on scaleType === continuous broadly — e.g. have the calendar feature set a geom flag (geom.timeBasedXTick/geom.continuousJitterUnit) and only take the continuous-jitter path when that flag is present. At minimum, confirm with manual testing that CDS plots with null points on a continuous axis are visually unchanged, and note the result on the PR.

Comment thread core/webapp/vis/src/plot.js Outdated
}

// Larger spans: tick on the 1st of the month, stepping whole months so the count fits.
const minDate = new Date(minDayNumber * 86400000);

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.

Consider a constant with a helpful name for this hard-coded value.

@ankurjuneja
ankurjuneja merged commit 3dae9ab into develop Aug 15, 2026
7 checks passed
@ankurjuneja
ankurjuneja deleted the fb_calendar_based_grouping_1209 branch August 15, 2026 14:32
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