Skip to content

Commit 34b3419

Browse files
committed
fix: DataSet.getColor fix
1 parent 6d449be commit 34b3419

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ui-chart/data/BaseDataSet.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ export abstract class BaseDataSet<T extends Entry> implements IDataSet<T> {
169169
* ###### ###### COLOR GETTING RELATED METHODS ##### ######
170170
*/
171171

172-
public getColor(index?) {
173-
if (index === undefined || this.colors.length === 0) {
174-
return this.color;
172+
public getColor(index = 0) {
173+
if (this.colors?.length > 0) {
174+
return this.colors[Math.floor(index) % this.colors.length];
175175
}
176-
return this.colors[Math.floor(index) % this.colors.length];
176+
return this.color;
177177
}
178178

179179
/**

0 commit comments

Comments
 (0)