I am facing an issue with including multiple similar graphs on a single page within an Ionic2 application. I am utilizing the d3-ng2-service to wrap the d3 types for Angular2. The problem arises when attempting to place two graphs in separate div elements within their respective custom elements, as the drawing fails for both instances. Selecting the first div causes the second graph to override the first one without being drawn.
Is there a smart approach to include more than one graph on a page? The examples typically assign a unique id to the outer container, which is what I'm trying to achieve as well:
// Component code omitted for brevity
The HTML structure:
<div class='graphContainer'>
</div>
The usage of the custom component in an HTML file:
<ion-header>
<ion-navbar #dashboardNav>
<ion-title>Dashboard</ion-title>
<button ion-button menuToggle="favMenu" right>
<ion-icon name="menu"></ion-icon>
</button>
</ion-navbar>
</ion-header>
<ion-content>
<ion-item *ngFor="let entry of dashboard">
{{ entry.name }}
<d3-test-app [id]='entry.name' [timeSeries]='entry.timeSeries' [ref]='entry.name' size='medium'></d3-test-app>
</ion-item>
</ion-content>