Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Word padding in wordcloud #8264

Open
ghost opened this issue May 2, 2018 · 8 comments
Open

Word padding in wordcloud #8264

ghost opened this issue May 2, 2018 · 8 comments

Comments

@ghost
Copy link

ghost commented May 2, 2018

A word cloud with extreme long words results in some space issues between words, so that it looks like one word. Therefor I suggest a new option wordPadding, that adds some padding before and after words similar to a white space. Examples:

@ghost ghost added the Type: Enhancement label May 2, 2018
@ghost ghost assigned jon-a-nygaard May 2, 2018
@bre1470 bre1470 self-assigned this Jun 12, 2018
@OmarMustafa
Copy link

Hi @bre1470, any updates on this?
I have a similar issue and I couldn't seem to find a solution for it. When I add leading and trailing spaces to words, they get trimmed.

image

@bre1470
Copy link
Contributor

bre1470 commented Sep 13, 2019

@OmarMustafa You can try the following event implementation for a custom wordSpaces option:

Highcharts.chart('container', {
    chart: {
        events: {
            load: function() {
                var allSeries = this.series,
                    noBreakSpace = String.fromCharCode(0xA0),
                    WordCloudSeries = Highcharts.seriesTypes.wordcloud,
                    data, options, point, series, spacing, wordSpaces;
                for (var i = 0, ie = allSeries.length; i < ie; ++i) {
                    series = allSeries[i];
                    if (!(series instanceof WordCloudSeries)) continue;
                    options = series.options;
                    wordSpaces = (options.wordSpaces || 0);
                    if (!wordSpaces) continue;
                    data = options.data;
                    spacing = '';
                    while (wordSpaces--) spacing += noBreakSpace;
                    for (var j = 0, je = data.length; j < je; ++j) {
                        point = data[j];
                        point.name = spacing + point.name + spacing;
                    }
                    series.setData(data);
                }
            }
        }
    },
    series: [{
        type: 'wordcloud',
        data: data,
        name: 'Occurrences',
        rotation: {
            from: 0,
            to: 0
        },
        spiral: 'rectangular',
        placementStrategy: 'center',
        wordSpaces: 1
    }],
    title: {
        text: 'Wordcloud of Lorem Ipsum'
    }
});

Demo: https://jsfiddle.net/0jw1L39m/

@stale
Copy link

stale bot commented Jul 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

@stale stale bot added the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Jul 9, 2021
@raf18seb raf18seb removed the Status: Stale This issue hasn't had any activity for a while, and will be auto-closed if no further updates occur. label Jul 13, 2021
@KacperMadej KacperMadej added this to To do in Development-Flow via automation Jul 15, 2021
@mkhavari01
Copy link

i do wanna know how to make this kind of word cloud https://isid.research.ac.ir/Reza_Malekzadeh which exist in here but mine has lots of spaces between words

@raf18seb
Copy link
Contributor

Hi @mkhavari01, could you ask your question more precisely? I don't see any word cloud chart on the website you provided.

@jesusgrace777
Copy link

jesusgrace777 commented Apr 12, 2023

Hi Team, could you please help me on sharing the solution for fixing the Word Cloud Text merging without space. Attached the screenshot
image

@karolkolodziej
Copy link
Contributor

@jesusgrace777 Could you please share an example where this issue is visible? I'm not able to recreate that on my own.

@fshenton
Copy link

Hi all, has anyone worked out how to control the x and y spacing between words?

I'm a bit stuck, I want to reduce the horizontal and vertical spacing quite a lot, to the point where words are nearly touching. But i can't find something to override/implement based on the API docs

Current:
image

Target (approx):
image

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

No branches or pull requests

8 participants