primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Chart in dialog it's drawn with smaller height and width

Open lukgit17 opened this issue 8 years ago • 1 comments

[x ] bug report => Search github for a similar issue or PR before submitting [ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap [ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35


 **Angular version:** 5.2.0
<!-- Check whether this is still an issue in the most recent Angular version -->

* **PrimeNG version:** 5.2.0

Chart, in dialog, with height 650 px it's drawn with height 150 px and maintainAspectRatio : true. In option maintainAspectRatio is set as false. Chart drawing normally after I added in component chart.js at canvas tag [attr.width]=\"width\" [attr.height]=\"height\".

template: "\n        <div style=\"position:relative\" [style.width]=\"width\" [style.height]=\"height\">\n            <canvas [attr.width]=\"width\" [attr.height]=\"height\" (click)=\"onCanvasClick($event)\"></canvas>\n        </div>\n    "

But after build with command ng build --prod --aot , charts are drawn smaller again with height 150 px.

Example : 
<p-dialog #chartDlg header="Grafic" [(visible)]="showChartDlg" [responsive]="true" [width]="1050" [modal]="true">
    <div *ngIf="activeTab==2||activeTab==0">
        <p-chart #chartCons type="line" [data]="dataChart[0]" [height]="650" [width]="1000" [options]="options[0]"></p-chart>
    </div>

    <div *ngIf="resizedChart==0&&activeTab==3" class="ui-g ui-lg-12 ui-fluid">
        <div class="ui-lg-6">
            <p-chart #chartPrKg type="line" [data]="dataChart[1]" height="350" width="500" [options]="options[1]" (click)="resizeChart(1)"></p-chart>
        </div>
        <div class="ui-lg-6">
            <p-chart #chartPrCap type="line" [data]="dataChart[2]" height="350" width="500" [options]="options[2]" (click)="resizeChart(2)"></p-chart>
        </div>
    </div>
    <p-footer>
        <div class="ui-dialog-buttonpane ui-helper-clearfix">
            <button tabindex="1" type="button" pButton icon="fa-close" (click)="closeChart()" label="Inchide"></button>
            <button *ngIf="!working" tabindex="1" type="button" pButton icon="ui-icon-picture-as-pdf" (click)="pdfChart()" label="Genereaza Pdf" class="green-button flat" style="float:left"></button>
            <iframe *ngIf="working" width="24px" height="24px" class="gear-black" style="float:left"></iframe>
        </div>
    </p-footer>
</p-dialog>

in ts file : 
options[0],options[1] and options[2] are same with different title : 
      this.options[i] = {
        responsive: false,
        maintainAspectRatio: false, 
        title: {},
        elements: {
          line: {
              tension: 0, // disables bezier curves
          }
        },
        animation: {
          duration: 100, // general animation time
        },
        hover: {
          animationDuration: 50, // duration of animations when hovering an item
        },
        responsiveAnimationDuration: 50, // animation duration after a resize                   
      };        
    }

print screen : 
![image](https://user-images.githubusercontent.com/25950706/36411586-0be22a28-161f-11e8-8722-e7962971b59c.png)

lukgit17 avatar Feb 19 '18 13:02 lukgit17

Try with 5.2.4 please.

cagataycivici avatar Apr 18 '18 07:04 cagataycivici