Create a Clustered Stacked Bar Chart using Ng2-charts

84 views Asked by At

I am working on ng2-charts Clustered Stacked Bar where I want to achieve clustered stacks. Something similar to attached image, is it possible using Ng2-Charts in angular enter image description here?

i tried to create a chart like this, but can't find this is a correct way!

import { Component, OnInit } from '@angular/core'; import { ChartOptions, ChartType, ChartDataSets } from 'chart.js'; import { Label } from 'ng2-charts';  @Component({   selector: 'my-app',   templateUrl: './app.component.html',   styleUrls: \[ './app.component.css' \] }) export class AppComponent  {   public barChartOptions: ChartOptions = {     responsive: true,   };   public barChartLabels: Label\[\] = \['2006', '2007', '2008', '2009', '2010', '2011', '2012'\];   public barChartType: ChartType = 'bar';   public barChartLegend = true;   public barChartPlugins = \[\];      public barChartData: ChartDataSets\[\] = \[       { data: \[, \], label: 'Series A', stack: 'a' },       { data: \[28,\], label: 'Series B', stack: 'b' },       { data: \[85, \], label: 'Series A', stack: 'a' },       { data: \[38, ,\], label: 'Series B', stack: 'b' },     \];    constructor() { }    ngOnInit() {   } } 
0

There are 0 answers