Step 2: Embed the Script in a Wiki

2024-03-28

You can embed an exported JavaScript chart into a Wiki or any other HTML page without needing to make any modifications to what is exported. To complete this step you must have either "Platform Developer" or "Trusted Analyst" permissions.

This topic is a continuation of the JavaScript Visualizations tutorial and begins with you holding the exported script on your clipboard or in a text file as described in the previous step.

  • Click the Overview tab to go to the home page of your study, or navigate to any tab where you would like to place this exported chart.
  • Add a Wiki web part on the left.
  • Create a new wiki:
    • If the folder already contains a wiki page named "default", the new web part will display it. Choose New from the web part (triangle) menu.
    • Otherwise, click Create a new wiki page in the new wiki web part.
  • Give the page the name of your choice. Wiki page names must be unique, so be careful not to overwrite something else unintentionally.
  • Enter a Title such as "Draft of Chart".
  • Click the Source tab. Note: if there is no Source tab, click Convert To..., select HTML and click Convert.
  • Paste the JavaScript code you copied earlier onto the source tab. Retrieve it from your text file, "ChartJS.txt" if it is no longer on your browser clipboard.
  • Scroll up and click Save.
  • You could also add additional HTML to the page before or after the pasted JavaScript of the chart, or make edits as we will explore in the next tutorial step.
    • Caution: Do not switch to the Visual tab. The visual editor does not support this JavaScript element, so switching to that tab would cause the chart to be deleted. You will be warned if you click the Visual tab. If you do accidentally lose the chart, you can to recover the JavaScript using the History of the wiki page, your ChartJS.txt file, or by exporting it again from the saved timechart.
  • Scroll up and click Save & Close.
  • Return to the tab where you placed the new wiki web part. If it does not already show your chart, select Customize from the (triangle) menu for the web part and change the Page to display to the name of the wiki you just created. Click Submit.
  • Notice that the web part now contains the series of single timecharts as created in the wizard.

Related Topics

Previous Step | Next Step (3 of 4)