An array of objects with key and values properties, as returned from d3.nest().entries()
OptionalfillTemplate: 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.
OptionalfillFn: (An optional function to populate filled-in data objects with.
This function is invoked after populating any fillTemplate values.
Normalize the data arrays resulting from a
d3.nestoperation 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
datealready, 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
dateproperty and asourceIdproperty taken from thekeyof the layer the gap if found in. You can pass afillTemplateobject with static properties to also include on all filled-in data objects. You can also pass afillFnfunction to populate the filled-in objects with dynamic data.For example, given:
The
layerDatawould be modified in-place and look like this (notice the filled in second data value in the B group):