Skip to content

chare(chart): custom hex series colors, optional legend, safer color resolve - #364

Merged
neSpecc merged 4 commits into
mainfrom
chore/chart-color-handling
Aug 18, 2026
Merged

chare(chart): custom hex series colors, optional legend, safer color resolve#364
neSpecc merged 4 commits into
mainfrom
chore/chart-color-handling

Conversation

@Dobrunia

@Dobrunia Dobrunia commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

  • lines[].color still accepts ChartLineColor.Red / LightGrey. Anything else is treated as #RGB / #RRGGBB; invalid values fall back to red instead of throwing.
  • Optional legend prop (default false) draws a static color+label row under the plot.
  • Multi-series tooltip rows are sorted by value descending. Hover pointer stays above the legend (isolation + --z-popover).
  • Hours/minutes axis labels are compact (HH:mm); tooltip keeps the date. Minutes also show the day on the first visible tick (and when the day changes).
  • Playground: detalization now feeds matching data (30 days / 24 hours / 60 minutes), plus a many-series hex example.
изображение

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codex-ui Ready Ready Preview Aug 18, 2026 11:07am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the Chart Vue component in @codexteam/ui by making series color resolution safer/more flexible (palette tokens + hex with fallback), adding an optional legend, and refining tooltip/X-axis formatting for different detalization modes.

Changes:

  • Added hex-based per-series color support via a resolver that falls back to red instead of throwing.
  • Added optional legend prop to render a static series legend below the plot and adjusted layering so the hover pointer/tooltip stay above it.
  • Updated tooltip and X-axis behavior: sorted multi-series tooltip rows, compact time labels for hours/minutes, and improved minute tick labeling across day boundaries.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
@codexteam/ui/src/vue/components/chart/ChartLine.vue Switches SVG stop styling to object form and uses centralized color resolution + updated color prop type.
@codexteam/ui/src/vue/components/chart/Chart.vue Adds optional legend, tooltip row sorting, compact axis label formatting, tooltip sizing, and layering/style adjustments.
@codexteam/ui/src/vue/components/chart/Chart.types.ts Introduces ChartLineColorToken and loosens ChartLineColors.name to support resolved hex colors.
@codexteam/ui/src/vue/components/chart/Chart.colors.ts Implements hex parsing + safe resolver (resolveChartLineColor) with fallback behavior.
@codexteam/ui/package.json Bumps package version to 0.2.6.
@codexteam/ui/dev/pages/components/Chart.vue Updates playground to demo legend + multi-series + aligned sample data generation.
Suppressed comments (2)

@codexteam/ui/src/vue/components/chart/Chart.colors.ts:140

  • This exported helper only supports hex strings (#RGB/#RRGGBB), but the JSDoc describes the input as a generic "CSS color string". That over-promises supported formats and contradicts parseHexColor's behavior.
/**
 * Build a gradient set from a hex color. Returns null if the string is not a hex.
 * @param color - CSS color string
 */

@codexteam/ui/dev/pages/components/Chart.vue:32

  • The list item calls out "any CSS color", but only hex colors are supported by the resolver. Consider renaming this to "hex color" to avoid confusion.
      <ul class="chart-props__list">
        <li><code>red</code>, <code>light-grey</code> — built-in palette</li>
        <li>any CSS color: <code>'#3F88FF'</code>, <code>'#00C853'</code></li>
      </ul>

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 63 to +66
/**
* Name of the color for the chart line
* Name of the color for the chart line, or any CSS color string
*/
color?: ChartLineColor;
color?: ChartLineColorToken;
Comment thread @codexteam/ui/src/vue/components/chart/Chart.colors.ts
Comment on lines +24 to +28
<p class="chart-props__description">
<code>ChartLineColor.Red</code> / <code>ChartLineColor.LightGrey</code>,
or any CSS color string (<code>'#3F88FF'</code>, <code>'rgb(...)'</code>).
Omit it and the line stays red.
</p>
</div>
<div
v-for="(item, index) in tooltipLines"
:key="`tooltip-line-${item.prepared.line.label}-${index}`"
@neSpecc
neSpecc merged commit 438d0aa into main Aug 18, 2026
7 checks passed
@Dobrunia
Dobrunia deleted the chore/chart-color-handling branch August 18, 2026 16:20
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.

3 participants