Skip to content

Commit 3545e53

Browse files
committed
fix: added useColorsForLine for LineChartDataSet
1 parent 23bc864 commit 3545e53

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/charting/data/LineDataSet.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ export class LineDataSet extends LineRadarDataSet<Entry> implements ILineDataSet
6464

6565
private mDrawCircleHole = true;
6666

67-
private mUserColorsFoFill = false;
67+
private mUserColorsForFill = false;
68+
69+
public useColorsForLine = false;
6870

6971
/**
7072
* the max number allowed point before filtering. <= O means disabled
@@ -368,10 +370,10 @@ export class LineDataSet extends LineRadarDataSet<Entry> implements ILineDataSet
368370
}
369371

370372
getUseColorsForFill() {
371-
return this.mUserColorsFoFill;
373+
return this.mUserColorsForFill;
372374
}
373375

374376
setUseColorsForFill(value: boolean) {
375-
this.mUserColorsFoFill = value;
377+
this.mUserColorsForFill = value;
376378
}
377379
}

src/charting/renderer/LineChartRenderer.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ export class LineChartRenderer extends LineRadarRenderer {
560560
const colors = dataSet.getColors() as any as { color: string | Color; [k: string]: any }[];
561561
const nbColors = colors.length;
562562
const xKey = dataSet.xProperty;
563-
const useColorsForFill = dataSet.getUseColorsForFill();
564563
const renderPaint = this.renderPaint;
565564
let paintColorsShader;
566565
if (nbColors > 1) {
@@ -570,6 +569,7 @@ export class LineChartRenderer extends LineRadarRenderer {
570569

571570
let oldShader;
572571
if (drawFilled) {
572+
const useColorsForFill = dataSet.getUseColorsForFill();
573573
if (paintColorsShader && useColorsForFill) {
574574
oldShader = renderPaint.getShader();
575575
renderPaint.setShader(paintColorsShader);
@@ -587,13 +587,14 @@ export class LineChartRenderer extends LineRadarRenderer {
587587
}
588588

589589
if (drawLine) {
590-
if (paintColorsShader) {
590+
const useColorsForLine = dataSet.useColorsForLine;
591+
if (paintColorsShader && useColorsForLine) {
591592
oldShader = renderPaint.getShader();
592593
renderPaint.setShader(paintColorsShader);
593594
}
594595
trans.pathValueToPixel(linePath);
595596
this.drawPath(c, linePath, renderPaint);
596-
if (paintColorsShader) {
597+
if (paintColorsShader && useColorsForLine) {
597598
renderPaint.setShader(oldShader);
598599
oldShader = null;
599600
}

0 commit comments

Comments
 (0)