CSV is considered to be an industry standard for data analysis. The most common ways of producing CSV data are:
- export from Excel
- export from databases
CSV stands for comma-separated values so a simple CSV file looks the following way:
Product,Price Apple,2.50 Cherry,5.25
For getting the data from the file, specify the URL to this file:
<html> <head></head> <body> <div id="wdr-component"></div> <link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet"/> <script src="https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js"></script> <script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script> <script> var pivot = new WebDataRocks({ container: "#wdr-component", toolbar: true, report: { dataSource: { filename: "URL-to-your-CSV-file" } } }); </script> </body> </html>
In most cases, a comma (,
) is used as a separator between different fields, such as Product
and Price
. WebDataRocks also supports other separators.
If fields in your data are separated by a semicolon (;
) such data source can be used without any additional configurations. If fields in your data are separated by some other symbol, e.g. a colon (:
), you need to specify fieldSeparator
as in the example:
<html> <head></head> <body> <div id="wdr-component"></div> <link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet"/> <script src="https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js"></script> <script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script> <script> var pivot = new WebDataRocks({ container: "#wdr-component", toolbar: true, report: { dataSource: { filename: "URL-to-your-CSV-file", fieldSeparator: ":" } } }); </script> </body> </html>
Learn more