Skip to content

Charts: timestamp x-axis, normalize mode, and explicit label control #8

Closed

Description

@albertwoo

Context

For a 6-month, 12-company market-cap chart I had to precompute everything outside the widget:

  • No time axis. No DateTime/epoch input, so I formatted date strings, appended a synthetic "Now" point, forward-filled gaps across six exchanges' calendars, and passed one label per point.
  • No label control. Labels needs one string per point; a shorter array labels only the leading points (verified with 5 labels over 100 points). LabelEvery / MaxLabels belongs in ChartOpts.
  • Scale. With caps from $0.06T to $5.1T, the y-range flattens everything under the top three into indistinguishable lines. I built a second, percent-change series set to compare shapes.
  • Gaps. Whether NaN breaks a line is undocumented; I forward-filled to be safe.

Proposal

new ChartOpts {
    XValues = epochs,                 // float[]
    TimeFormat = "MMM d",
    Normalize = Normalize.Index100,   // Index100 | Percent | None
    LabelEvery = 2,                   // or MaxLabels = 12
}
  • Debug assert when Labels.Length is neither 0 nor the point count.
  • Document NaN as the gap marker (or add explicit gap support).

Acceptance

The same chart can be written without app-side date formatting, date-union forward filling, or a second normalized series set.

Activity

  1. albertwoo commented on Nov 11, 2026

    @albertwoo
    ContributorAuthor

    Fixed and merged in PR #14.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions