I'm currently working with primeng in an Angular project and I need to create a bar chart where the last two horizontal bars have different colors.
Right now, the last two bars are incorrectly being assigned to represent dogs and cats. My goal is to adjust the graph so that the orange bars correspond to tiger and lion instead of dog and cat.
Due to restrictions on StackOverflow, I am unable to upload a picture directly. However, you can view the example image on this external hosting site: https://ibb.co/jZyxddC
Below is the component code snippet:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-status-logs-graph',
templateUrl: './status-logs-graph.component.html',
styleUrls: ['./status-logs-graph.component.scss']
})
export class StatusLogsGraphComponent implements OnInit {
basicData: any;
basicOptions: any;
constructor() {
this.basicData = {
labels: ['dog', 'cat', 'hamster', 'lizard', 'tiger', 'lion'],
datasets: [
{
label: 'Domestic Animals',
backgroundColor: '#42A5F5',
data: [ 32, 54, 21, 11]
},
{
label: 'Wild Animals',
backgroundColor: '#FFA726',
data: [28, 48]
}
]
};
}
ngOnInit(): void {
}
}