Skip to content

fix: Legend options configuration has no effect#136

Merged
hunterg325 merged 1 commit into
ChartGPU:mainfrom
ngripon:fix/legend-options-do-nothing
Feb 18, 2026
Merged

fix: Legend options configuration has no effect#136
hunterg325 merged 1 commit into
ChartGPU:mainfrom
ngripon:fix/legend-options-do-nothing

Conversation

@ngripon
Copy link
Copy Markdown
Contributor

@ngripon ngripon commented Feb 17, 2026

Description

Values provided in options.legend were not applied.

Minimal example

const container = document.getElementById("chart")!;
const chart = await ChartGPU.create(container, {
  legend: {
    show: true,
    position: "bottom",
  },
  series: [
    {
      type: "line",
      data: [
        [0, 1],
        [1, 3],
        [2, 2],
        [3, 5],
        [4, 4],
      ],
    },
  ],
});

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring
  • Other (please describe):

Related Issues

Testing

Given the simplicity of the change, the behavior was verified through manual testing.

  • Tested in Chrome/Edge 113+
  • Tested in Safari 18+
  • Added or updated examples in examples/ (when behavior changes)
  • Verified WebGPU validation is clean (no console warnings)
  • Tested on different GPUs/platforms (if applicable)

Documentation

I noticed that these options are not documented in docs/api/options.md.
I assumed they are intended to be public since they are already supported by the API, but please let me know if this behavior is not meant to be exposed yet.

  • Updated docs/ when public API or behavior changes
  • Updated CHANGELOG.md when public behavior changes
  • Updated README (if relevant)
  • Added code comments for complex logic

WebGPU Correctness

  • All queue.writeBuffer() calls use 4-byte aligned offsets and sizes
  • Uniform buffer sizes are properly aligned (typically 16 bytes)
  • Dynamic uniform buffer offsets respect minUniformBufferOffsetAlignment (if applicable)
  • Render pipeline target formats match render pass attachment formats
  • GPU resources are properly cleaned up (buffer.destroy(), device.destroy(), etc.)

Browser Testing Checklist

  • Chrome 113+
  • Edge 113+
  • Safari 18+
  • Other (specify):

Screenshots / Videos

With show: false:
image

With position: "bottom":
image

Performance Impact

Given the simplicity of the change, I doubt there will be an impact.

Additional Notes

Although it would be preferable for the top and bottom positions to reserve the correct amount of space to avoid overlapping the plot, this can be easily mitigated by adjusting the grid margins.


For Reviewers:

  • Does this PR follow the functional-first architecture patterns?
  • Are WebGPU resources properly managed?
  • Are examples updated and working?
  • Is documentation complete and accurate?

…not create legend if option.legend.show is false.
@hunterg325 hunterg325 closed this Feb 18, 2026
@hunterg325 hunterg325 reopened this Feb 18, 2026
@hunterg325
Copy link
Copy Markdown
Member

Wth. I have no idea why the PR closed. Reopened and pushed a commit for a super tiny formatting change, but it is good to go. Excellent job finding this!! :)

@hunterg325 hunterg325 merged commit a3b0e3f into ChartGPU:main Feb 18, 2026
2 checks passed
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.

2 participants