Skip to content

Add legends to XY charts#7724

Open
xdumaine wants to merge 3 commits into
mermaid-js:developfrom
xdumaine:xychart-legends
Open

Add legends to XY charts#7724
xdumaine wants to merge 3 commits into
mermaid-js:developfrom
xdumaine:xychart-legends

Conversation

@xdumaine
Copy link
Copy Markdown

@xdumaine xdumaine commented May 7, 2026

📑 Summary

Adds legends for named XY chart line and bar series. Authors can already write labels like line "avg" [...]; this change preserves those labels and renders them in a right-side legend when showLegend is enabled.

Fixes #5292.

Motivation

XY charts support multiple line and bar plots, but readers currently have no built-in way to map each plotted color to a series name. That makes examples like average, p50, and p95 latency lines hard to interpret without surrounding text or manually faked legends.

This PR makes the existing named-series syntax useful in rendered output while keeping unnamed plots unchanged.

📏 Design Decisions

  • Reuses existing plot labels from line "name" [...] and bar "name" [...]; no new diagram syntax is required.
  • Omits unnamed plots from the legend so existing charts do not gain placeholder entries.
  • Adds a ChartLegend layout component that reserves right-side space before the plot expands into remaining width.
  • Adds xyChart.showLegend, legendFontSize, legendPadding, and themeVariables.xyChart.legendTextColor for configuration/theming.
  • Documents the feature with the required (v<MERMAID_RELEASE_VERSION>+) marker and includes a minor changeset.

Screenshots

Full chart with legend:

XY chart with avg, p50, and p95 legend

Legend detail:

XY chart legend detail

Disclaimer / Methods

I used Cursor's AI coding agent with GPT 5.5. to help inspect Mermaid's XY chart and pie legend implementations, draft the implementation, update docs/config/types, and run verification. I reviewed the generated changes, corrected the implementation where needed, checked the contribution guidelines and PR template, and validated behavior locally with parser, TypeScript, lint, and focused Cypress rendering tests.

Test plan

  • pnpm --filter mermaid types:build-config

  • pnpm exec prettier --write "packages/mermaid/src/diagrams/xychart/**/*.{ts,js}" "packages/mermaid/src/themes/*.js" "packages/mermaid/src/docs/syntax/xyChart.md" "docs/syntax/xyChart.md" "cypress/integration/rendering/xychart/xyChart.spec.js" "packages/mermaid/src/schemas/config.schema.yaml" "packages/mermaid/src/config.type.ts"

  • pnpm exec vitest run packages/mermaid/src/diagrams/xychart/parser/xychart.jison.spec.ts

  • pnpm exec vitest run packages/mermaid/src/diagrams/xychart/chartBuilder/components/legend.spec.ts packages/mermaid/src/diagrams/xychart/chartBuilder/index.spec.ts packages/mermaid/src/diagrams/xychart/xychartDb.spec.ts packages/mermaid/src/diagrams/xychart/parser/xychart.jison.spec.ts packages/mermaid/src/themes/theme-xychart.spec.js (79/79 passing)

  • pnpm exec vitest run --coverage packages/mermaid/src/diagrams/xychart/chartBuilder/components/legend.spec.ts packages/mermaid/src/diagrams/xychart/chartBuilder/index.spec.ts packages/mermaid/src/diagrams/xychart/xychartDb.spec.ts packages/mermaid/src/themes/theme-xychart.spec.js

  • pnpm test:check:tsc

  • pnpm exec eslint --quiet packages/mermaid/src/diagrams/xychart/chartBuilder/components/legend.ts packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts packages/mermaid/src/diagrams/xychart/chartBuilder/interfaces.ts packages/mermaid/src/diagrams/xychart/xychartDb.ts cypress/integration/rendering/xychart/xyChart.spec.js

  • MERMAID_PORT=9000 pnpm run load:env -- start-server-and-test dev http://localhost:9000/ "cypress run --spec cypress/integration/rendering/xychart/xyChart.spec.js" (38/38 passing)

📋 Tasks

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Made with Cursor

xdumaine and others added 2 commits May 7, 2026 10:49
Preserve named line and bar series as legend entries so multi-series XY charts can identify their plotted data.

Co-authored-by: Cursor <cursoragent@cursor.com>
Follow Mermaid contribution guidance by marking the new docs section with the release token and adding a changeset.

Co-authored-by: Cursor <cursoragent@cursor.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 3934d7c
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/69fcb0353d160e0009f3853d
😎 Deploy Preview https://deploy-preview-7724--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

🦋 Changeset detected

Latest commit: 3934d7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/@mermaid-js/examples@7724

mermaid

npm i https://pkg.pr.new/mermaid@7724

@mermaid-js/layout-elk

npm i https://pkg.pr.new/@mermaid-js/layout-elk@7724

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/@mermaid-js/layout-tidy-tree@7724

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/@mermaid-js/mermaid-zenuml@7724

@mermaid-js/parser

npm i https://pkg.pr.new/@mermaid-js/parser@7724

@mermaid-js/tiny

npm i https://pkg.pr.new/@mermaid-js/tiny@7724

commit: 3934d7c

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 1.32450% with 149 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.29%. Comparing base (8b52e53) to head (3934d7c).
⚠️ Report is 153 commits behind head on develop.

Files with missing lines Patch % Lines
...diagrams/xychart/chartBuilder/components/legend.ts 0.86% 115 Missing ⚠️
.../src/diagrams/xychart/chartBuilder/orchestrator.ts 0.00% 22 Missing ⚠️
packages/mermaid/src/diagrams/xychart/xychartDb.ts 0.00% 2 Missing ⚠️
packages/mermaid/src/themes/theme-base.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-dark.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-forest.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-neo-dark.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-neo.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-neutral.js 0.00% 1 Missing ⚠️
packages/mermaid/src/themes/theme-redux-color.js 0.00% 1 Missing ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #7724      +/-   ##
==========================================
- Coverage     3.30%   3.29%   -0.01%     
==========================================
  Files          561     561              
  Lines        58355   58495     +140     
  Branches       873     875       +2     
==========================================
+ Hits          1928    1930       +2     
- Misses       56427   56565     +138     
Flag Coverage Δ
unit 3.29% <1.32%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/config.type.ts 100.00% <ø> (ø)
...id/src/diagrams/xychart/chartBuilder/interfaces.ts 10.00% <ø> (ø)
packages/mermaid/src/themes/theme-default.js 95.87% <100.00%> (+<0.01%) ⬆️
packages/mermaid/src/themes/theme-base.js 2.11% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-dark.js 1.90% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-forest.js 2.10% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-neo-dark.js 2.41% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-neo.js 2.50% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-neutral.js 2.65% <0.00%> (-0.01%) ⬇️
packages/mermaid/src/themes/theme-redux-color.js 2.29% <0.00%> (-0.01%) ⬇️
... and 6 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 7, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 11 changed May 7, 2026, 3:42 PM

Add focused unit coverage for legend rendering, builder layout integration, plot title persistence, and theme defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pbrolin47
Copy link
Copy Markdown
Collaborator

Hi @xdumaine. Thanks for this PR.

[sisyphus-bot]


What's working well

🎉 Comprehensive test coverage for a first-time contributor. Four new test files covering legend unit tests, chart builder integration, DB title persistence, and all 11 themes. 79/79 unit tests +
38/38 Cypress passing is the complete picture the project expects.

🎉 Clean architectural fit. ChartLegend implements the existing ChartComponent interface without any deviation. Reserving space before expanding the plot to fill remaining width is exactly the right
layout approach — same pattern as the title component.

🎉 Elegant backwards-compatible syntax. Reusing line "name" [...] (already parseable; title was previously ignored) means zero new grammar and existing unnamed charts are completely unaffected.

🎉 Correct sanitization. title: textSanitizer(title.text) in both setLineData and setBarData matches the established pattern for every other user-supplied text field in this diagram. No XSS path —
text reaches SVG exclusively via D3's .text() (sets textContent, not innerHTML).

🎉 Config schema first. Schema additions drive config.type.ts regeneration; PR body includes pnpm types:build-config in the test plan. The regenerated file matches the schema additions exactly.


Things to address

🟡 [important] showLegend: true by default changes rendering for existing documents

config.schema.yaml:
showLegend:
description: Should show a legend for named plots
type: boolean
default: true

Any existing diagram that already uses line "name" [...] or bar "name" [...] syntax — including documents on GitHub, GitLab, Obsidian — will now automatically render a legend box, changing their
layout dimensions and visual appearance.

CLAUDE.md is explicit: "Mermaid is rendered server-side by GitHub/GitLab — rendering changes affect millions of existing documents. Treat visual output changes as potentially breaking."

The counter-argument (acknowledged in the PR description) is that users who wrote line "avg" [...] expected the name to mean something — they were already opting in to the feature by using the
named-series syntax. That logic is sound, and it means unnamed charts are truly unaffected.

I would like some additional input from other maintainers if we should go for showLegend: true as default or flip to false. @aloisklink , @knsv ?

The existing Cypress imgSnapshotTest cases don't use named series, so no baseline failures are expected regardless.

🟢 [nit] Cypress legend test uses screenshot: false only

cypress/integration/rendering/xychart/xyChart.spec.js:
it('should render legends for named plots', () => {
renderGraph(..., { screenshot: false });
cy.get('g.legend text').should('have.length', 3);
// ...

The test correctly verifies DOM structure (element counts and text content). But without an imgSnapshotTest call, visual regressions — wrong marker size, misaligned text, wrong color — won't be
caught in Argos / the snapshot pipeline. An additional imgSnapshotTest case with the same three-series diagram would add meaningful regression coverage. Low priority since the unit tests cover
positioning math, but worth noting.


Security

No XSS or injection issues. Full trace:

  1. line "name" → JISON calls setLineData({ text: 'name', type: 'text' }, [...]) with '' for unnamed plots
  2. textSanitizer(title.text) → sanitizeText(text.trim(), config) → DOMPurify-backed sanitization, matching all other text in this diagram
  3. plot.title flows to DrawableElem type: 'text'
  4. xyChartRenderer.ts:242 — d3.text((data) => data.text) sets .textContent, never .innerHTML
  5. Legend marker geometry (path strings, x/y/width/height) is derived entirely from layout arithmetic on numeric config values — no user input

getPlotColorFromPalette() supplies fill/strokeFill values set as D3 .attr('fill', ...) / .attr('stroke', ...) — the existing risk surface, no new exposure.


Other checks

  • Diagram isolation ✓ — legend.ts imports only from interfaces.js, textDimensionCalculator.js, and diagram-api/types.js. No cross-diagram imports.
  • Changeset ✓ — minor bump with feat: prefix. Correct for a new user-facing feature.
  • No console.log ✓
  • TypeScript ✓ — title: string added as required field on LinePlotData/BarPlotData, and the only creation site (xychartDb.ts) populates it in both setLineData and setBarData. No existing code
    creates these types directly.
  • MERMAID_RELEASE_VERSION ✓ — Added in commit 2/3 to the new Legend section heading.
  • Unnamed-plot filter ✓ — filter((plot) => plot.title) correctly excludes title: '' (falsy), matching the described behavior.
  • Legend visibility fallback ✓ — When legend dimensions exceed available space, visiblePlots is reset to [] and calculateSpace returns {0, 0}. Silent but correct behavior; space is returned to the
    plot.
  • Both orientations covered ✓ — Vertical and horizontal layout paths both call legend.calculateSpace() and legend.setBoundingBoxXY().

@xdumaine
Copy link
Copy Markdown
Author

xdumaine commented May 8, 2026

Great call out re: defaulting the legend to true. However, based on the end of that block (quoted below) I'm going to wait for feedback before flipping that. I'm happy to go either way and glad to make that change once there's consensus. Thank you for the review!

I would like some additional input from other maintainers if we should go for showLegend: true as default or flip to false. @aloisklink , @knsv ?

@xdumaine
Copy link
Copy Markdown
Author

@aloisklink @knsv any preference? I'm glad to update it per your guidance. Would love to get this landed.

Copy link
Copy Markdown
Member

@aloisklink aloisklink left a comment

Choose a reason for hiding this comment

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

Great work on this, @xdumaine! I'm really like this!

I think keeping showLegend: true by default is fine. Most people would probably be happy to see this, and it's not going to significantly negatively affect this XY charts for other users.

But on the off chance someone doesn't like it, could you maybe add a short instruction on how to disable this in the changeset?

I've done a quick review of your code as well, and I think the main blocking issue I spotted was the lack of visual regression E2E tests (the current @argos-ci changes are all flakiness that should be gone the next time you push), but please see my comments for more information!


I'm going to ping @subhash-halder, the original author of XY charts, in case they want to review this (and also so they can see how awesome this feature is!).

'mermaid': minor
---

feat: add legends for named XY chart line and bar series
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nitpick: This makes it just a little bit easier to parse the CHANGELOG.md file and release notes for changes, if you only care about some diagram type.

Suggested change
feat: add legends for named XY chart line and bar series
feat(xyChart): add legends for named line and bar series

line "p50" [38.2, 36.8, 39.7, 54.5, 49.0, 38.4]
line "p95" [112.2, 75.3, 103.0, 177.0, 180.2, 109.4]
`,
{ screenshot: false }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue(blocking): Currently, we don't have any visual regression tests of your new feature.

Can we remove this line? If we take a screenshot of it, then @argos-ci should warn us if we accidentally change how legends look, in the future.

'mermaid': minor
---

feat: add legends for named XY chart line and bar series
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: I think making showLegend default to true is okay for this feature. Most people would probably be happy to see this, and it's not going to significantly negatively affect this XY charts for other users.

But, just in case, can you add a short line here that explains how to disable it for users that do want to disable it?

Comment on lines +83 to +86
const fontSize = this.chartConfig.legendFontSize;
const markerSize = fontSize * LEGEND_MARKER_TO_FONT_RATIO;
const markerSpacing = fontSize * LEGEND_MARKER_SPACING_TO_FONT_RATIO;
const itemSpacing = fontSize * LEGEND_ITEM_SPACING_TO_FONT_RATIO;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue(non-blocking): Not a blocking issue, but this is duplicated above in https://github.com/xdumaine/mermaid/blob/3934d7c49034146f6b1969ee6628e236b135ac1e/packages/mermaid/src/diagrams/xychart/chartBuilder/components/legend.ts#L47-L50

If there's any way you can reduce these, without making the code more complicated, please do!

},
];
}),
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion:

Would it be better to instead combine the code, e.g. doing something like:

...this.visiblePlots.map((plot, index) => {
  if (isBarPlot(plot)) {
    return {
      groupTexts: ['legend', 'markers'],
      type: 'rect',
      // ....
    }
  } else {
    return {
      groupTexts: ['legend', 'markers'],
      type: 'path',
      // ...
    };
  }
}),

It means we can avoid the .flatMap and I think it's makes this easier to understand!

},
],
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue: This is quite a lot of hard-coded data, which means that future changes will probably need to modify this file.

suggestion: Is there any way we can just load some default data from getConfig()/getChartThemeConfig()?

Comment on lines +6 to +99
const chartConfig: XYChartConfig = {
width: 700,
height: 500,
titleFontSize: 20,
titlePadding: 10,
showTitle: true,
showLegend: true,
legendFontSize: 14,
legendPadding: 10,
showDataLabel: false,
showDataLabelOutsideBar: false,
chartOrientation: 'vertical',
plotReservedSpacePercent: 50,
xAxis: {
showLabel: true,
labelFontSize: 14,
labelPadding: 5,
showTitle: true,
titleFontSize: 16,
titlePadding: 5,
showTick: true,
tickLength: 5,
tickWidth: 2,
showAxisLine: true,
axisLineWidth: 2,
},
yAxis: {
showLabel: true,
labelFontSize: 14,
labelPadding: 5,
showTitle: true,
titleFontSize: 16,
titlePadding: 5,
showTick: true,
tickLength: 5,
tickWidth: 2,
showAxisLine: true,
axisLineWidth: 2,
},
};

const chartThemeConfig: XYChartThemeConfig = {
backgroundColor: '#fff',
titleColor: '#111',
dataLabelColor: '#222',
legendTextColor: '#333',
xAxisLabelColor: '#444',
xAxisTitleColor: '#555',
xAxisTickColor: '#666',
xAxisLineColor: '#777',
yAxisLabelColor: '#888',
yAxisTitleColor: '#999',
yAxisTickColor: '#aaa',
yAxisLineColor: '#bbb',
plotColorPalette: '#f00,#0f0',
};

const chartData: XYChartData = {
title: 'An Example Chart',
xAxis: {
type: 'band',
title: '',
categories: ['90d', '60d', '30d'],
},
yAxis: {
type: 'linear',
title: 'Seconds',
min: 0,
max: 200,
},
plots: [
{
type: 'line',
title: 'avg',
strokeFill: '#f00',
strokeWidth: 2,
data: [
['90d', 48.1],
['60d', 41.5],
['30d', 45.7],
],
},
{
type: 'bar',
title: 'p95',
fill: '#0f0',
data: [
['90d', 112.2],
['60d', 75.3],
['30d', 103.0],
],
},
],
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue: Again, lots of hard-coded data here.

suggestion: Do we really need this test file, especially since we have the unit tests for legend.ts and the E2E tests?

It might just be easier to delete this file, if it's not offering any value.

Comment on lines +34 to +42
title: string;
strokeFill: string;
strokeWidth: number;
data: SimplePlotDataType;
}

export interface BarPlotData {
type: 'bar';
title: string;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: Is there any way we can document that empty titles are treated differently?

Maybe something like:

export interface BarPlotData {
  type: 'bar';
  /**
   * The title of this plot, or `""` if there is no title.
   */
  title: string;

Converting this to be title: string | undefined; might be better, but it would require code changes, so I don't think you need to go through the effort of that unless you really want to.

Comment on lines +1 to +25
import { getThemeVariables as getBaseThemeVariables } from './theme-base.js';
import { getThemeVariables as getDarkThemeVariables } from './theme-dark.js';
import { getThemeVariables as getDefaultThemeVariables } from './theme-default.js';
import { getThemeVariables as getForestThemeVariables } from './theme-forest.js';
import { getThemeVariables as getNeoDarkThemeVariables } from './theme-neo-dark.js';
import { getThemeVariables as getNeoThemeVariables } from './theme-neo.js';
import { getThemeVariables as getNeutralThemeVariables } from './theme-neutral.js';
import { getThemeVariables as getReduxColorThemeVariables } from './theme-redux-color.js';
import { getThemeVariables as getReduxDarkColorThemeVariables } from './theme-redux-dark-color.js';
import { getThemeVariables as getReduxDarkThemeVariables } from './theme-redux-dark.js';
import { getThemeVariables as getReduxThemeVariables } from './theme-redux.js';

const themes = [
['base', getBaseThemeVariables],
['dark', getDarkThemeVariables],
['default', getDefaultThemeVariables],
['forest', getForestThemeVariables],
['neo-dark', getNeoDarkThemeVariables],
['neo', getNeoThemeVariables],
['neutral', getNeutralThemeVariables],
['redux-color', getReduxColorThemeVariables],
['redux-dark-color', getReduxDarkColorThemeVariables],
['redux-dark', getReduxDarkThemeVariables],
['redux', getReduxThemeVariables],
];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue(blocking): Please use

import { getThemeVariables as baseThemeVariables } from './theme-base.js';
import { getThemeVariables as darkThemeVariables } from './theme-dark.js';
import { getThemeVariables as defaultThemeVariables } from './theme-default.js';
import { getThemeVariables as forestThemeVariables } from './theme-forest.js';
import { getThemeVariables as neutralThemeVariables } from './theme-neutral.js';
import { getThemeVariables as neoThemeVariables } from './theme-neo.js';
import { getThemeVariables as neoDarkThemeVariables } from './theme-neo-dark.js';
import { getThemeVariables as reduxThemeVariables } from './theme-redux.js';
import { getThemeVariables as reduxDarkThemeVariables } from './theme-redux-dark.js';
import { getThemeVariables as reduxColorThemeVariables } from './theme-redux-color.js';
import { getThemeVariables as reduxDarkColorThemeVariables } from './theme-redux-dark-color.js';
export default {
base: {
getThemeVariables: baseThemeVariables,
},
dark: {
getThemeVariables: darkThemeVariables,
},
default: {
getThemeVariables: defaultThemeVariables,
},
forest: {
getThemeVariables: forestThemeVariables,
},
neutral: {
getThemeVariables: neutralThemeVariables,
},
neo: {
getThemeVariables: neoThemeVariables,
},
'neo-dark': {
getThemeVariables: neoDarkThemeVariables,
},
redux: {
getThemeVariables: reduxThemeVariables,
},
'redux-dark': {
getThemeVariables: reduxDarkThemeVariables,
},
'redux-color': {
getThemeVariables: reduxColorThemeVariables,
},
'redux-dark-color': {
getThemeVariables: reduxDarkColorThemeVariables,
},
};
instead.

Comment on lines +37 to +44
it.each(themes)('%s allows overriding legend text color', (_name, getThemeVariables) => {
const theme = getThemeVariables({
xyChart: {
legendTextColor: '#123456',
},
});

expect(theme.xyChart.legendTextColor).toBe('#123456');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

issue: This test seems to be testing the getThemeVariables instead of anything XYChart.

suggestion: Please remove! Maybe in the future we can add a separate test for this, but it doesn't need to be in this PR.

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

Labels

Graph: XY XY Chart Type: Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XYChart not allowing legends

3 participants