Word cloud questions

Love the word cloud feature! A couple of quick questions re: the API:

  • Is there a way to get words to show up together? Eg: for the input “Management Consultant, Engineer, Actuary, Business Development Officer”, “Management Consultant” and “Business Development Officer” would show up next to each other in the same colour, rather than in different parts of the wordcloud
  • Is there a way to preserve the capitalisation of words - eg: Management rather than management?
  • I’m struggling to change the colour and font - any advice gratefully appreciated, here’s the code:

function generateWordCloudImageUrl(careerList) {
var wordArray = careerList.split(‘,’).map(function(s) { return s.trim(); });
const payload = {
“format”: “png”,
“width”: 600,
“height”: 400,
“fontFamily”: “Raleway, sans-serif”,
“color”: “#FB6302”,
“fontScale”: 15,
“scale”: “linear”,
“text”: wordArray.join(‘\n’)
};

const options = {
‘method’: ‘post’,
‘payload’: JSON.stringify(payload),
‘headers’: {
‘Content-Type’: ‘application/json’
}
};

const response = UrlFetchApp.fetch(‘https://quickchart.io/wordcloud’, options);
const blob = response.getBlob().setName(‘wordcloud.png’);

const path = ‘/Oxford Scholastica Academy/Marketing/The Great Careers Report/Wordclouds/wordcloud.png’;
uploadToDropbox(blob, DROPBOX_ACCESS_TOKEN, path);

// Delete existing shared link if exists
deleteExistingSharedLink(path, DROPBOX_ACCESS_TOKEN);

// Create a new shared link
const imageUrl = createDropboxSharedLink(path, DROPBOX_ACCESS_TOKEN);

return imageUrl;
}

Many thanks!

Jamie

Hi Jamie,

  1. To get words to show up together, set useWordList to true and pass a string of comma-separated phrases. This will allow you to use phrases like “Management Consultant” instead of splitting on every word.
  2. You can preserve capitalization by setting case to none
  3. To change the color, please see documentation on the colors parameter.
  4. For fonts, our options are fairly limited unless you are using the svg format, in which case you can use loadGoogleFonts to include any supported Google Font. For png format images, we can load custom fonts for users on the Professional plan.

In general, the documentation on API options has more detail on each of the parameters mentioned above!

Hope this helps,

Ian