Generate charts dynamically in typescript
Posted: 05 Jul 2016, 12:00
I wish to insert a bar chart in dynamically generated div element. But the dataset is not assigned or given to [value] property of p-barChart tag and the resultant canvas tag is not generated
--app.component.ts File--
--app.component.ts File--
Code: Select all
let topDiv = document.getElementById("graphs");
let categoryDiv = document.createElement('div');
categoryDiv.setAttribute("id","category");
categoryDiv.innerHTML =
('<div class="col-md-6"><div class="panel panel-default"><div class="panel-heading"><h3 class="panel- title">'+category+'</h3></div><div class="panel-body"><p-barChart [value]= "'+data+'" [legend]="lgnd"(onBarsSelect)="onSelect($event)" [barValueSpacing]="10"></p-barChart></div></div></div>');
topDiv.appendChild(categoryDiv);