Sparkline in Templates

I'm building out some templates that tie into UDTs in perspective. Some of these templates will use sparklines to show historical data. I have found a few notes that indicate that this can be done by creating a custom property array on the sparkline with the items: aggregate, alias, and path. You then do a tag history-expression binding on the sparkline "points" prop. I have tried this without any luck. If you create an array you can't name the items, they just show up as 0, 1, 2. I tried adding the correct values to them(Average, Chart, expression binding of tag path), and got the following error:

Error_Expressioneval("Only objects allowed in tag history binding expression value array.")

So i switched it from an array to an object, and then got the following error:

Error_expressioneval("Tag history binding "tags" expression must reference array value.")

What am I missing here?



sparklinekeys

You need to make an array containing objects.
So custom.paths would be something like:

[
	{
		"aggregate": "Average",
		"alias": "pen1",
		"path": "path1"
	},
	{
		"aggregate": "Average",
		"alias": "pen2",
		"path": "path2"
	}
]

For posterity, I'll also note that the 'aggregate' key in the nested objects is optional; omit it if you want to use the aggregation mode defined on the parent binding.

Thank you so much, that did the trick. Are there any other parameters that you can pass to the sparkline this way, for example update rate, start/end date, etc? Thanks again

Sure, you can add bindings to most of the attributes of your tag history binding itself. Note the little fx icon on e.g. Point Count in your first screenshot. You author an expression in there (which itself can refer to any other custom property), and then if you change that custom property, the inner expression will re-evaluate which will cause the actual tag history binding to re-evaluate.