WebDataRocks supports two types of data sources:

CSV data source

CSV is considered as 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 simple CSV file looks the following way:

Product,Price
Apple,2.50
Cherry,5.25

In this example, 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:

<div id="wdr-component"></div>
<link href="https://cdn.webdatarocks.com/your-personal-code/webdatarocks.min.css" rel="stylesheet"/>
<script src="https://cdn.webdatarocks.com/your-personal-code/webdatarocks.toolbar.min.js"></script>
<script src="https://cdn.webdatarocks.com/your-personal-code/webdatarocks.js"></script>
<script>
var pivot = new WebDataRocks({
	container: "#wdr-component",
	toolbar: true,
	report: {
		dataSource: {
			filename: "URL-to-your-file",
			fieldSeparator: ":"
		}
	}
});
</script>

JSON data source

JSON is very popular because is it easily understandable for users. WebDataRocks supports a certain kind of JSON data – array of objects, where each object is an unordered collection of KEY/VALUE pairs. Here is a sample of valid JSON data for WebDataRocks:

[
	{
		"Product": "Apple",
		"Price": 2.50
	},
	{
		"Product": "Cherry",
		"Price": 5.25
	}
]

If you have JSON data that is already on the page (for example, in yourJSONData variable), you can just specify it in the report.

var pivot = new WebDataRocks({
	container: "#component",
	report: {
		dataSource: {
			data: yourJSONData
		}
	}
});