I am trying to use PrimeNG charts in my jhipster(spring/angular) project and all kind of charts (or other PrimeNG components) are not displayed at all. I am using angular 7.3.7 and primeng 7.1.3. I did see some reported issues with this and have tried different solutions but with no results.
Html page:
<p-chart type="bar" width="400" height="400" [data]="data" [options]="options"></p-chart>
Component code:
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'jhi-statistics',
templateUrl: './statistics.component.html',
styles: []
})
export class StatisticsComponent implements OnInit {
data: any;
constructor() {
this.data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
backgroundColor: '#42A5F5',
borderColor: '#1E88E5',
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: 'My Second dataset',
backgroundColor: '#9CCC65',
borderColor: '#7CB342',
data: [28, 48, 40, 19, 86, 27, 90]
}
]
}
}
}
app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ChartModule } from 'primeng/primeng';
...
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
...
ChartModule
],
...
vendor.css:
@import '~bootstrap/dist/css/bootstrap.min.css';
@import '~primeng/resources/primeng.min.css';
and I have no error though. Am I missing something? Any help will be appreciated.