swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.28k stars 1.15k forks source link

ngx-charts-pie-chart is not displaying data in 12.1.0 version Angular 8 #1497

Closed kirankumardm141 closed 2 years ago

kirankumardm141 commented 3 years ago

I'm doing the same thing as they are doing here

https://stackblitz.com/edit/swimlane-pie-chart?embed=1&file=app/app.component.ts but it doesn't display data in 12.1.0 ngx-charts version and i'm using angular 8 version.

HTML Code: <ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="single" [gradient]="gradient" [legend]="showLegend" [legendPosition]="legendPosition" [labels]="showLabels" [doughnut]="isDoughnut" (select)="onSelect($event)" (activate)="onActivate($event)" (deactivate)="onDeactivate($event)" >

ts file


import { BrowserModule } from '@angular/platform-browser';
import { NgxChartsModule } from '@swimlane/ngx-charts';
import { single } from './data';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  single: any[];
  view: any[] = [700, 400];

  // options
  gradient: boolean = true;
  showLegend: boolean = true;
  showLabels: boolean = true;
  isDoughnut: boolean = false;
  legendPosition: string = 'below';

  colorScheme = {
    domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
  };

  constructor() {
    Object.assign(this, { single });
  }

  onSelect(data): void {
    console.log('Item clicked', JSON.parse(JSON.stringify(data)));
  }

  onActivate(data): void {
    console.log('Activate', JSON.parse(JSON.stringify(data)));
  }

  onDeactivate(data): void {
    console.log('Deactivate', JSON.parse(JSON.stringify(data)));
  }
}``

** I don't know it might be a bug in 12.1.0 ngx-charts version**

** Please help **

** Thanks in advance :)**
EnigmaTechx commented 3 years ago

I'm having the same issue. Any tips?

Berchant commented 2 years ago

same issue

kirankumardm141 commented 2 years ago

Try higher version like 13.x.x which is compatible with angular 8.

Hope that resolves the issue as mine did.

Berchant commented 2 years ago

ooh sorry i use angular 12 and still data aren't showing i've update and even downgrade just to see if it can work