An array of objects with key
and values
properties, as returned from d3.nest().entries()
Optional
fillTemplate: Record<string, any>An object to use as a template for any filled-in data objects.
The date
property will be populated automatically, and a sourceId
property will be populated by the layer's key
.
Optional
fillFn: ((datum, key, prevDatum?) => void)An optional function to populate filled-in data objects with.
This function is invoked after populating any fillTemplate
values.
Optional
prevDatum: Record<string, any>Generated using TypeDoc
Normalize the data arrays resulting from a
d3.nest
operation so that all group value arrays have the same number of elements, based on a Date property nameddate
.The data values are assumed to be sorted by
date
already, and are modified in-place. This makes the data suitable to passing tod3.stack
, which expects all stack data arrays to have the same number of values, for the same keys. When querying for data in SolarNetwork there might be gaps in the results, so this function can be used to "fill in" those gaps with "dummy" values so that there are no more gaps.Filled-in data objects are automatically populated with an appropriate
date
property and asourceId
property taken from thekey
of the layer the gap if found in. You can pass afillTemplate
object with static properties to also include on all filled-in data objects. You can also pass afillFn
function to populate the filled-in objects with dynamic data.For example, given:
The
layerData
would be modified in-place and look like this (notice the filled in second data value in the B group):