Skip to content

Words go outside the canvas when many data points exist (Scaling of wordcloud) #110

@Zoe-Bot

Description

@Zoe-Bot

When rendering a word cloud with a large number of data points, words often overflow outside the canvas boundary. This issue occurs even when using the aspect ratio or responsive options provided by Chart.js. There is no way to ensure that the entire word cloud fits within the canvas bounds.

To Reproduce

  1. Use a large dataset to generate a word cloud.
  2. Observe that words are placed outside the canvas area.

Expected behavior

All words in the word cloud should remain within the render canvas.

Screenshots
I have attached a screenshot from your official website example to illustrate the issue.

image

Context

  • Version: chart.js: ^4.4.4, chartjs-chart-wordcloud: ^4.4.2
  • Browser: 131.0.6778.140 (64-Bit)

Suggested Solution

  • Provide an option to set a zoom level or a fit-to-canvas property.
  • Alternatively, add a configuration to auto-scale the word cloud to ensure all words fit within the canvas dimensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions