$scope.chartDataArray = [];
for (var j = 0; j < 5; j++)// I replace "5" with a variable that represents the number of charts needed, consuming Rest Api
{
$scope.chartDataArray[j] = {
labels: ['June', 'July', 'August', 'September', 'October', 'November', 'December'],// Replaced with custom data
datasets: [{
label: 'Dataset One',
fillColor: 'rgba(220,220,220,0.2)',
strokeColor: 'rgba(220,220,220,1)',
pointColor: 'rgba(220,220,220,1)',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data: [30, 45, 60, 75, 50, 20, 35] // Custom data
}, {
label: 'Dataset Two',
fillColor: 'rgba(151,187,205,0.2)',
strokeColor: 'rgba(151,187,205,1)',
pointColor: 'rgba(151,187,205,1)',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: 'rgba(151,187,205,1)',
data: [15, 25, 35, 45, 55, 65, 75] // Custom Data
}]
};
//scope.options ....
} //closing the loop
and within my html document
<div ng-repeat="data in chartDataArray">
<canvas tc-chartjs-line chart-options="options" chart-data="data" auto-legend ng-click="chartClick($event)" chart="chart"></canvas>
</div>