How to publish datafile and chart in WordPress

When you finally have a working chart it is time to publish it in WordPress. If you are using a different CMS there might be slight differences in how to get your chart published, but the steps described here will probably be similar in nature. For publishing in wordpress remember to save your data file with a .txt extension and not .json since wordpress rejects .json files. Renaming to to .txt will allow the file to be uploaded in the media library and your chart will still interpret it as a json file.

  • Upload the .txt file to the media library.
  • In the media library click on the file and then click on ‘View attachment page’.
  • Click on the link containing the name of your datafile.
  • You should now see your datafile in the browser.
  • Copy the url from the browser and replace the url in your html chart file.
  • Now you have to upload your html file to the media library as well, and then get the url to your chart in the exact same way. 

When you click ‘View attachemnt page’ with your html you should be able to see you chart / map in the browser.In order to publish this in wordpress you can embed it using an iframe. Here is an example of an iframe with a chart.

<iframe style="border: 0px;" src="https://gauteheggen.com/wp-content/uploads/OverHundreKurve.html" width="1000px" height="400px" scrolling="no"><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span><span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span><br />
</iframe>

In the iframe above you need to change the url in src. So where it says:

src="https://gauteheggen.com/wp-content/uploads/OverHundreKurve.html" 

you would have something that looks like:

src="http://s123456.azurewebsites.net/wp-content/uploads/OverHundreKurve.html"

Good luck!

Gaute