maje
maje

Reputation: 424

Wordcloud Highcharts .NET

I am having an issue with the creation of a Wordcloud with Highcharts 7.1.2 with C# and .NET.

I can create the wordcloud just fine, but I can't set the weight of the words.

The piece of code below is what I currently have, as you can see I am trying to use the Labelrank as a mean to set the weight. I cannot find an example of the wordcloud in c#, but I found some in JS and they always set the weight of each word.

            List<Series> seriesList = new List<Series>();

            List<WordcloudSeriesData> newWordcloudSeriesDataList = new List<WordcloudSeriesData>();
            foreach (var data in datas)
            {
                newWordcloudSeriesDataList.Add(new WordcloudSeriesData
                {
                    Name = data.Name,
                    Labelrank = data.Rank
                });
            }

            seriesList.Add(new WordcloudSeries
            {
                Data = newWordcloudSeriesDataList,
                Rotation = new WordcloudSeriesRotation
                {
                    From = 0,
                    To = 0,
                    Orientations = 1
                }
            });
            

PS: I found a workaround.

When you create the json before sending it to the front, use

chartinfo = chartinfo.Replace("labelrank", "weight");

where chartinfo is the json.

Upvotes: 1

Views: 143

Answers (0)

Related Questions