Linking to CSV files

Avatar

By Stuart Marshall

updated 7 months ago

Instead of adding data directly into Charter stack, a much more flexible and efficient approach is to link your data to a CSV (comma separated value) file. This could be:

  • A csv file that you have added to RW resources
  • A csv file that you have added to a folder on your server

Linking to a csv file is especially useful if your data is dynamic and changes (or needs updated) regularly. Using a csv file means that you can update the data outside of RapidWeaver so that you do not have to open RW, make your changes and then republish the page. It also means that someone else (other than yourself) can update the values that the chart uses.

See the example table below for the format that your csv file should use.

CSV data format

Download a csv example of this table

Points to note:

  • The labels / categories are all added to Row 1 (the first cell is ignored - you can add a note in here if you like or leave it blank). 
  • Each dataset that you wish to add should be 1 row (the above example has 3 datasets). 
  • The label for each dataset should be added in column 1

NB: In Charter stack you still need to specify how many datasets from the csv you wish to use. You also use Charter stack to set up the chart stylings for each dataset.

Tip: If others are going to be involved in updating the csv file then it might be desirable to add notes/comments into the csv file. If you add // to the start of a new row then that row will be ignored by Charter stack. 

RW resources folder

To add a csv file to your RW project simply drag the csv file into the Resources folder in your project. You can then link Charter to this by locating the csv file via the link dialog box.

'Warehoused' file

To warehouse a file simply add it to a folder on your server (or some other accessible location). Once done add the direct url to the file within Charter stack.

NB: CSV files that have been linked to in this way are often prevented from displaying in Preview mode due to 'cross origin restrictions'. In your browser's developers options you should be able to 'Disable Cross-Origin Restrictions' which will allow your chart to display. It is advisable to re-enable the restrictions once done.

Did this answer your question?