Skip to content

Carry an extrema target's x value as data instead of splitting its label on " at " #1249

Description

@jooyoungseo

Context

Extrema target labels are built by the model as one sentence, Max Bar at Q1, and two consumers recover the x value by searching for the English separator:

  • src/ui/components/GoToExtrema.tsx (buildTargetDisplayLabel) splits target.label on ' at ' to render "Max Bar Value: 8.00 at Q1".
  • src/state/viewModel/goToExtremaViewModel.ts (X_VALUE_SEPARATOR = ' at ') finds the x value after the last ' at ' to re-format it with the layer's formatter.

Since #1246 the labels are translated, and none of the other eight languages use " at " (Korean says "Q1에서 최대 막대", Spanish "Máximo de barra en Q1", …). In those languages the split finds nothing, so the dialog falls back to the label-plus-value form and the x value is shown as the model formatted it rather than through the layer formatter. Nothing breaks, but the two consumers are doing string parsing that only works in English.

Proposal

Add the x value to ExtremaTarget in src/type/extrema.ts (for example x?: XValue, beside the existing display block), have every trace that builds a target set it, and have both consumers read the field instead of parsing the label. The label then stays purely spoken text in any language, and the view model's reformatting no longer depends on a separator.

Activity

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

    releasedFor issues/features released

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions