Skip to content

Commit

Permalink
made palette pseudo class applicable to individual renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
ennerf committed Aug 15, 2023
1 parent 9b9d178 commit be06f88
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public abstract class AbstractRenderer<R extends Renderer> extends Parent implem
protected final StyleableBooleanProperty showInLegend = css().createBooleanProperty(this, "showInLegend", true);
protected final StyleableBooleanProperty useGlobalIndex = css().createBooleanProperty(this, "useGlobalIndex", true);
protected final StyleableIntegerProperty indexOffset = css().createIntegerProperty(this, "indexOffset", 0);
protected final IntegerProperty colorCount = css().createIntegerProperty(this, "colorCount", 8);
protected final IntegerProperty colorCount = css().createIntegerProperty(this, "colorCount", 8, true, null);
private final ObservableList<DataSet> datasets = FXCollections.observableArrayList();
private final ObservableList<DataSetNode> dataSetNodes = FXCollections.observableArrayList();
private final ObservableList<Axis> axesList = FXCollections.observableList(new NoDuplicatesList<>());
Expand Down
28 changes: 7 additions & 21 deletions chartfx-chart/src/main/resources/io/fair_acc/chartfx/_palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
-color-dataset-7: #B276B2; // (purple)
-color-dataset-8: #DECF3F; // (yellow)
-color-dataset-9: #4D4D4D; // (gray)
.renderer {
-fx-color-count: 9;
}
-fx-color-count: 9;
}

@mixin adobe() {
Expand All @@ -21,9 +19,7 @@
-color-dataset-5: #c1d82f; // green
-color-dataset-6: #8a7967; // brown
-color-dataset-7: #6a737b; // darkbrown/black
.renderer {
-fx-color-count: 7;
}
-fx-color-count: 7;
}

@mixin dell() {
Expand All @@ -35,9 +31,7 @@
-color-dataset-6: #71c6c1;
-color-dataset-7: #009bbb;
-color-dataset-8: #444444;
.renderer {
-fx-color-count: 8;
}
-fx-color-count: 8;
}

@mixin equidistant() {
Expand All @@ -49,9 +43,7 @@
-color-dataset-6: #f95d6a;
-color-dataset-7: #ff7c43;
-color-dataset-8: #ffa600;
.renderer {
-fx-color-count: 8;
}
-fx-color-count: 8;
}

@mixin tuneviewer() {
Expand All @@ -65,9 +57,7 @@
-color-dataset-7: darkgray;
-color-dataset-8: pink;
-color-dataset-9: black;
.renderer {
-fx-color-count: 9;
}
-fx-color-count: 9;
}

@mixin matlab() {
Expand All @@ -79,9 +69,7 @@
-color-dataset-5: rgb(119, 172, 48);
-color-dataset-6: rgb(77, 190, 238);
-color-dataset-7: rgb(162, 20, 47);
.renderer {
-fx-color-count: 7;
}
-fx-color-count: 7;
}

@mixin matlab-dark() {
Expand All @@ -93,9 +81,7 @@
-color-dataset-5: rgb(119, 172, 48);
-color-dataset-6: rgb(77, 190, 238);
-color-dataset-7: rgb(162, 137, 141);
.renderer {
-fx-color-count: 7;
}
-fx-color-count: 7;
}

// CSS classes that set the default similar to the JavaFX charts
Expand Down
31 changes: 8 additions & 23 deletions chartfx-chart/src/main/resources/io/fair_acc/chartfx/chart.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@
-color-dataset-7: darkgray;
-color-dataset-8: pink;
-color-dataset-9: black;
}
.chart .renderer {
-fx-color-count: 9;
}
.chart:misc {

.chart:misc, .renderer:misc {
-color-dataset-1: #5DA5DA;
-color-dataset-2: #F15854;
-color-dataset-3: #FAA43A;
Expand All @@ -102,23 +101,19 @@
-color-dataset-7: #B276B2;
-color-dataset-8: #DECF3F;
-color-dataset-9: #4D4D4D;
}
.chart:misc .renderer {
-fx-color-count: 9;
}
.chart:adobe {
.chart:adobe, .renderer:adobe {
-color-dataset-1: #00a4e4;
-color-dataset-2: #ff0000;
-color-dataset-3: #fbb034;
-color-dataset-4: #ffdd00;
-color-dataset-5: #c1d82f;
-color-dataset-6: #8a7967;
-color-dataset-7: #6a737b;
}
.chart:adobe .renderer {
-fx-color-count: 7;
}
.chart:dell {
.chart:dell, .renderer:dell {
-color-dataset-1: #0085c3;
-color-dataset-2: #7ab800;
-color-dataset-3: #f2af00;
Expand All @@ -127,11 +122,9 @@
-color-dataset-6: #71c6c1;
-color-dataset-7: #009bbb;
-color-dataset-8: #444444;
}
.chart:dell .renderer {
-fx-color-count: 8;
}
.chart:equidistant {
.chart:equidistant, .renderer:equidistant {
-color-dataset-1: #003f5c;
-color-dataset-2: #2f4b7c;
-color-dataset-3: #665191;
Expand All @@ -140,11 +133,9 @@
-color-dataset-6: #f95d6a;
-color-dataset-7: #ff7c43;
-color-dataset-8: #ffa600;
}
.chart:equidistant .renderer {
-fx-color-count: 8;
}
.chart:tuneviewer {
.chart:tuneviewer, .renderer:tuneviewer {
-color-dataset-1: #0000c8;
-color-dataset-2: #c80000;
-color-dataset-3: #00c800;
Expand All @@ -154,32 +145,26 @@
-color-dataset-7: darkgray;
-color-dataset-8: pink;
-color-dataset-9: black;
}
.chart:tuneviewer .renderer {
-fx-color-count: 9;
}
.chart:matlab {
.chart:matlab, .renderer:matlab {
-color-dataset-1: rgb(0, 114, 189);
-color-dataset-2: rgb(217, 83, 25);
-color-dataset-3: rgb(237, 177, 32);
-color-dataset-4: rgb(126, 47, 142);
-color-dataset-5: rgb(119, 172, 48);
-color-dataset-6: rgb(77, 190, 238);
-color-dataset-7: rgb(162, 20, 47);
}
.chart:matlab .renderer {
-fx-color-count: 7;
}
.chart:matlab-dark {
.chart:matlab-dark, .renderer:matlab-dark {
-color-dataset-1: rgb(89, 149, 189);
-color-dataset-2: rgb(217, 115, 71);
-color-dataset-3: rgb(237, 177, 32);
-color-dataset-4: rgb(218, 81, 245);
-color-dataset-5: rgb(119, 172, 48);
-color-dataset-6: rgb(77, 190, 238);
-color-dataset-7: rgb(162, 137, 141);
}
.chart:matlab-dark .renderer {
-fx-color-count: 7;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ $null: null; // null gets removed from Sass. Maybe create a placeholder and repl

.chart {
@include palette.tuneviewer();
}

.chart, .renderer {
&:misc {
@include palette.misc();
}
Expand Down

0 comments on commit be06f88

Please sign in to comment.