More text positions and per-text styling to the bar texts of BitResourceTimeline

Aperta
#15,441 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@msynk ci sta già lavorando.

Dal 22/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

area / BlazorUI

Summary

A BitResourceTimelineAllocation can label its bar only on four sides (TextAbove, TextBelow, TextStart, TextEnd), always centered above/below the bar, and always in the timeline's bar-label color and font. Scheduling UIs often need more than that: a flight number at the start of the bar and its status at the end, a gate under one corner, a warning in red, a code in bold.

Proposal

Replace the four string properties of BitResourceTimelineAllocation with one Texts property of a new BitResourceTimelineBarTexts type, which has a property per position:

  • TopStart, TopCenter, TopEnd: above the bar, aligned with its start edge, centered on it, or aligned with its end edge
  • BottomStart, BottomCenter, BottomEnd: the same below the bar
  • Start, End: beside the bar, on its center line (where TextStart / TextEnd are drawn today)

Each position is a new BitResourceTimelineBarText that carries what customizes the text:

  • Text: the value
  • Color: a CSS color (falls back to the bar-label color)
  • Font: a CSS font shorthand (falls back to Options.BarLabelFont or the theme's font)
  • OffsetX / OffsetY: pixels to move the text from where its position puts it

A string converts to a BitResourceTimelineBarText implicitly, so the common case stays short:

new BitResourceTimelineAllocation
{
    Id = "BA117",
    ResourceId = "A1",
    StartTime = start,
    EndTime = end,
    Texts = new()
    {
        TopStart = "BA117",
        TopEnd = new() { Text = "On time", Color = "#2f9e44", Font = "600 11px sans-serif" },
        BottomStart = new() { Text = "London", Color = "#868e96" },
        BottomEnd = new() { Text = "T5", OffsetX = -4 },
    },
}

All three renderers (Canvas, Svg, Html) draw each text in its own color and font. Its own font is also used to measure it, so the room kept for it (and the stacking of the bars) follows its size. With StickyBarLabels, texts aligned with an edge stay in view the same way the centered ones do, and still leave the view with their bar. CollapseMatchingEdgeLabels keeps working on End / Start.

Name conflict

The component already has a Texts parameter (BitResourceTimelineTexts) for its own words: its accessible name, loading text and announcements. To keep the two apart, rename it to Strings (BitResourceTimelineStrings), on the component and on BitResourceTimelineParams.

Breaking changes

The component has only shipped in 11.0.0 prereleases, so this breaks prerelease users only:

Before After
TextAbove = "x" Texts = new() { TopCenter = "x" }
TextBelow = "x" Texts = new() { BottomCenter = "x" }
TextStart = "x" Texts = new() { Start = "x" }
TextEnd = "x" Texts = new() { End = "x" }
<BitResourceTimeline Texts="..." /> <BitResourceTimeline Strings="..." />
BitResourceTimelineTexts BitResourceTimelineStrings

These go into BreakingChanges.md and the breaking-change analyzer (BITBC001 / BITBC002). The Boilerplate's Workbench (ExtrasSection) uses the old names and needs updating separately.

Lingua principale
C#
Stelle
1.4k
Fork
264
Merge medio
8h 5m
PR unite (30g)
595

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bitfoundation/bitplatform

Tutte le issue di bitfoundation/bitplatform

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.