Speak: Multiseries Chart Data


I had trouble finding information on how to construct the SPEAK multiseries chart data in Sitecore, so I thought to document it here.

For multiseries chart, the expected data is formed as follows:

 {
 	"data": {
 		"dataset": [{
 			"data": [{
 				"Series": "SeriesValue1",
 				"Category": "CategoryValue1",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue2",
 				"Category": "CategoryValue1",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue3",
 				"Category": "CategoryValue1",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue1",
 				"Category": "CategoryValue2",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue2",
 				"Category": "CategoryValue2",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue3",
 				"Category": "CategoryValue2",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue1",
 				"Category": "CategoryValue3",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue2",
 				"Category": "CategoryValue3",
 				"Value": "Value"
 			}, {
 				"Series": "SeriesValue3",
 				"Category": "CategoryValue3",
 				"Value": "Value"
 			}]
 		}]
 	}
 }
Note: if you have 0 value, you cannot omit the series/category, but rather must explicitly set the value to 0 e.g.
{
"Series": "Visits",
"Date": "8/23/2016",
"Value": 0
}
Categories: SPEAK, Sitecore
Tags: Sitecore;

SEARCH ARTICLES