<div class="panel panel-default analysis-items-distribution">
  <div class="panel-heading">
    <h3 class="panel-title">{{$ctrl.analysistitle | translate}}</h3>
  </div>
  <div class="panel-body">
    <div ng-if="$ctrl.chapterscount > 0 && $ctrl.items.length > 0">
      <div class="analysiscanvasbarcontainer">
        <canvas class="chart chart-bar" chart-data="$ctrl.data" 
        chart-labels="$ctrl.labels" chart-options="$ctrl.options"></canvas>
      </div>
      <hr>
      <div class="analysistablecontainer">
        <table class="table table-responsive table-condensed table-striped table-bordered analysis-items-table"
          style="width: {{$ctrl.tablewidth}}px;">
          <tbody>
            <tr>
              <th></th>
              <th ng-repeat="chapter in $ctrl.chapters track by $index">{{chapter}}</th>
            </tr>
            <tr ng-repeat="item in $ctrl.items track by $index" ng-init="itemindex = $index">
              <td>{{item.label}}</td>
              <td ng-repeat="presence in item.presence track by $index"
                  ng-class="{ 'list-item-color-{{(itemindex % 12)}}' : presence === 1 }">
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <p ng-if="$ctrl.chapterscount > 0 && $ctrl.items.length == 0">
      <i>{{$ctrl.noitemsmessage | translate}}</i>
    </p>
    <p ng-if="$ctrl.chapterscount == 0">
      <i>{{'jsp.analysisItemsChapters.em.noChapters' | translate}}</i>
    </p>
  </div>
</div>
