We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
DataSet.getColor
1 parent 6d449be commit 34b3419Copy full SHA for 34b3419
src/ui-chart/data/BaseDataSet.ts
@@ -169,11 +169,11 @@ export abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
169
* ###### ###### COLOR GETTING RELATED METHODS ##### ######
170
*/
171
172
- public getColor(index?) {
173
- if (index === undefined || this.colors.length === 0) {
174
- return this.color;
+ public getColor(index = 0) {
+ if (this.colors?.length > 0) {
+ return this.colors[Math.floor(index) % this.colors.length];
175
}
176
- return this.colors[Math.floor(index) % this.colors.length];
+ return this.color;
177
178
179
/**
0 commit comments