Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Commit

Permalink
feat(): #51 remove special color setter. user should use ColorUtils d…
Browse files Browse the repository at this point in the history
…irectly
  • Loading branch information
Michael Oberwasserlechner committed Jun 14, 2017
1 parent 6c13c52 commit 8f99aa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 72 deletions.
42 changes: 6 additions & 36 deletions src/main/java/com/byteowls/vaadin/chartjs/data/LineDataset.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.byteowls.vaadin.chartjs.data;

import com.byteowls.vaadin.chartjs.options.elements.Line;
import com.byteowls.vaadin.chartjs.utils.ColorUtils;
import com.byteowls.vaadin.chartjs.utils.JUtils;
import elemental.json.Json;
import elemental.json.JsonObject;
Expand Down Expand Up @@ -104,13 +103,16 @@ public LineDataset fill(Line.FillMode fillMode) {
/**
* Sets the index of the target dataset till which it will be filled.
*/
public LineDataset fillTo(int datasetIndex) {
public LineDataset fill(int datasetIndex) {
this.fillToDatasetIndex = datasetIndex;
return this;
}

public LineDataset fillTo(boolean plus, int datasetIndex) {
this.fillToPlus = plus;
/**
* Fills the area between the current dataset and next or previous with the given index.
*/
public LineDataset fill(boolean next, int datasetIndex) {
this.fillToPlus = next;
this.fillToDatasetIndex = datasetIndex;
return this;
}
Expand Down Expand Up @@ -151,22 +153,6 @@ public LineDataset backgroundColor(String backgroundColor) {
return this;
}

/**
* The fill color as rgb array.
*/
public LineDataset backgroundColor(int[] rgb) {
this.backgroundColor(ColorUtils.toRgb(rgb));
return this;
}

/**
* The fill color as rgb array and a additional parameter for the alpha channel.
*/
public LineDataset backgroundColor(int[] rgb, double alpha) {
this.backgroundColor(ColorUtils.toRgba(rgb, alpha));
return this;
}

/**
* The width of the line in pixels
*/
Expand All @@ -183,22 +169,6 @@ public LineDataset borderColor(String borderColor) {
return this;
}

/**
* The color of the line as rgb array.
*/
public LineDataset borderColor(int[] rgb) {
this.borderColor(ColorUtils.toRgb(rgb));
return this;
}

/**
* The color of the line as rgb array and a additional parameter for the alpha channel.
*/
public LineDataset borderColor(int[] rgb, double alpha) {
this.borderColor(ColorUtils.toRgba(rgb, alpha));
return this;
}

/**
* Cap style of the line. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap
*/
Expand Down
42 changes: 6 additions & 36 deletions src/main/java/com/byteowls/vaadin/chartjs/data/RadarDataset.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.byteowls.vaadin.chartjs.data;

import com.byteowls.vaadin.chartjs.options.elements.Line;
import com.byteowls.vaadin.chartjs.utils.ColorUtils;
import com.byteowls.vaadin.chartjs.utils.JUtils;
import elemental.json.Json;
import elemental.json.JsonObject;
Expand Down Expand Up @@ -78,13 +77,16 @@ public RadarDataset fill(Line.FillMode fillMode) {
/**
* Sets the index of the target dataset till which it will be filled.
*/
public RadarDataset fillTo(int datasetIndex) {
public RadarDataset fill(int datasetIndex) {
this.fillToDatasetIndex = datasetIndex;
return this;
}

public RadarDataset fillTo(boolean plus, int datasetIndex) {
this.fillToPlus = plus;
/**
* Fills the area between the current dataset and next or previous with the given index.
*/
public RadarDataset fill(boolean next, int datasetIndex) {
this.fillToPlus = next;
this.fillToDatasetIndex = datasetIndex;
return this;
}
Expand Down Expand Up @@ -113,22 +115,6 @@ public RadarDataset backgroundColor(String backgroundColor) {
return this;
}

/**
* The fill color as rgb array.
*/
public RadarDataset backgroundColor(int[] rgb) {
this.backgroundColor(ColorUtils.toRgb(rgb));
return this;
}

/**
* The fill color as rgb array and a additional parameter for the alpha channel.
*/
public RadarDataset backgroundColor(int[] rgb, double alpha) {
this.backgroundColor(ColorUtils.toRgba(rgb, alpha));
return this;
}

/**
* The width of the line in pixels
*/
Expand All @@ -145,22 +131,6 @@ public RadarDataset borderColor(String borderColor) {
return this;
}

/**
* The color of the line as rgb array.
*/
public RadarDataset borderColor(int[] rgb) {
this.borderColor(ColorUtils.toRgb(rgb));
return this;
}

/**
* The color of the line as rgb array and a additional parameter for the alpha channel.
*/
public RadarDataset borderColor(int[] rgb, double alpha) {
this.borderColor(ColorUtils.toRgba(rgb, alpha));
return this;
}

/**
* Cap style of the line. See https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/lineCap
*/
Expand Down

0 comments on commit 8f99aa7

Please sign in to comment.