This example explains how to create a line chart that consits of several domains (analogues to the domains defined in cal-heatmap).
For every domain, a separate svg element is added to the DOM. When pressing Previous
or Next
, new data is fetched and a new svg element with a line chart is created. This new svg element is placed before (in the case of Previous
) or after (in the case of Next
) the existing domain svgs. Next, all domain svgs are shifted either to the left or to the right, and finally the svg element on the opposide side is removed from the DOM.
The code also contains a nrOfPrefetchedDomains
parameter. When set to 1, two additional domains are constructed and placed on either side of the chart area, but they remain invisible (using the class invisible
and the display: none
attribute in the style sheet). This is useful when you would replace the DataObjStub by something that performs API calls to a backend. By pr