changeset 179:b74225fe6334

Bug 3259: [REFACTORING] color selection for chart classes Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/56
author Yasumasa Suenaga <yasuenag@gmail.com>
date Wed, 07 Dec 2016 21:14:17 +0900
parents 20d76a0c828a
children ad9e1645ff33
files ChangeLog analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/log.css analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/snapshot.css analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/heapsummary-bottom-old.css analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/heapsummary-bottom-young.css
diffstat 6 files changed, 183 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 05 12:29:44 2016 +0900
+++ b/ChangeLog	Wed Dec 07 21:14:17 2016 +0900
@@ -1,3 +1,7 @@
+2016-12-07  Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3259: [REFACTORING] color selection for chart classes
+
 2016-12-05  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3249: Accumulated GC time should be show in SnapShot summary tab
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java	Mon Dec 05 12:29:44 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java	Wed Dec 07 21:14:17 2016 +0900
@@ -141,24 +141,16 @@
         oldUsage.setName("Old");
         free = new XYChart.Series<>();
         free.setName("Free");
-        String[] colors = {"blue", "limegreen", "red"};
+
+        String cssName = "/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/";
         if (HeapStatsUtils.getHeapOrder()) {
             heapChart.getData().addAll(youngUsage, oldUsage, free);
+            cssName += "heapsummary-bottom-young.css";
         } else {
             heapChart.getData().addAll(oldUsage, youngUsage, free);
-            /* swap color order */
-            colors[0] = "limegreen";
-            colors[1] = "blue";
+            cssName += "heapsummary-bottom-old.css";
         }
-        /* Set heapChart colors */
-        Platform.runLater(() -> {
-            for (int i = 0; i < colors.length; i++) {
-                heapChart.lookup(".default-color" + i + ".chart-series-area-fill").setStyle(String.format("-fx-fill: %s;", colors[i]));
-                heapChart.lookup(".default-color" + i + ".chart-series-area-line").setStyle(String.format("-fx-stroke: %s;", colors[i]));
-                heapChart.lookup(".default-color" + i + ".area-legend-symbol").setStyle(String.format("-fx-background-color: %s, white;", colors[i]));
-                heapChart.lookup(".default-color" + i + ".chart-area-symbol").setStyle(String.format("-fx-background-color: %s, white;", colors[i]));
-            }
-        });
+        heapChart.getStylesheets().add(cssName);
 
         instances = new XYChart.Series<>();
         instances.setName("Instances");
--- a/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/log.css	Mon Dec 05 12:29:44 2016 +0900
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/log.css	Wed Dec 07 21:14:17 2016 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014-2015 Yasumasa Suenaga
+ * Copyright (C) 2014-2016 Yasumasa Suenaga
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -23,76 +23,98 @@
 
 
 /* Java CPU */
-#javaCPUChart .default-color0.chart-series-area-fill { -fx-fill: red; }
-#javaCPUChart .default-color0.chart-series-area-line { -fx-stroke: red; }
-#javaCPUChart .default-color0.area-legend-symbol { -fx-background-color: red, white; }
-
-#javaCPUChart .default-color1.chart-series-area-fill { -fx-fill: blue; }
-#javaCPUChart .default-color1.chart-series-area-line { -fx-stroke: blue; }
-#javaCPUChart .default-color1.area-legend-symbol { -fx-background-color: blue, white; }
-
+#javaCPUChart .series0 {
+    -fx-fill: red;
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
+#javaCPUChart .series1 {
+    -fx-fill: blue;
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
 
 /* System CPU */
-#systemCPUChart .default-color0.chart-series-area-fill { -fx-fill: red; }
-#systemCPUChart .default-color0.chart-series-area-line { -fx-stroke: red; }
-#systemCPUChart .default-color0.area-legend-symbol { -fx-background-color: red, white; }
-
-#systemCPUChart .default-color1.chart-series-area-fill { -fx-fill: limegreen; }
-#systemCPUChart .default-color1.chart-series-area-line { -fx-stroke: limegreen; }
-#systemCPUChart .default-color1.area-legend-symbol { -fx-background-color: limegreen, white; }
-
-#systemCPUChart .default-color2.chart-series-area-fill { -fx-fill: blue; }
-#systemCPUChart .default-color2.chart-series-area-line { -fx-stroke: blue; }
-#systemCPUChart .default-color2.area-legend-symbol { -fx-background-color: blue, white; }
-
-#systemCPUChart .default-color3.chart-series-area-fill { -fx-fill: orange; }
-#systemCPUChart .default-color3.chart-series-area-line { -fx-stroke: orange; }
-#systemCPUChart .default-color3.area-legend-symbol { -fx-background-color: orange, white; }
-
-#systemCPUChart .default-color4.chart-series-area-fill { -fx-fill: violet; }
-#systemCPUChart .default-color4.chart-series-area-line { -fx-stroke: violet; }
-#systemCPUChart .default-color4.area-legend-symbol { -fx-background-color: violet, white; }
-
-#systemCPUChart .default-color5.chart-series-area-fill { -fx-fill: skyblue; }
-#systemCPUChart .default-color5.chart-series-area-line { -fx-stroke: skyblue; }
-#systemCPUChart .default-color5.area-legend-symbol { -fx-background-color: skyblue, white; }
-
-#systemCPUChart .default-color6.chart-series-area-fill { -fx-fill: bisque; }
-#systemCPUChart .default-color6.chart-series-area-line { -fx-stroke: bisque; }
-#systemCPUChart .default-color6.area-legend-symbol { -fx-background-color: bisque, white; }
-
-#systemCPUChart .default-color7.chart-series-area-fill { -fx-fill: darkgray; }
-#systemCPUChart .default-color7.chart-series-area-line { -fx-stroke: darkgray; }
-#systemCPUChart .default-color7.area-legend-symbol { -fx-background-color: darkgray, white; }
-
-#systemCPUChart .default-color8.chart-series-area-fill { -fx-fill: maroon; }
-#systemCPUChart .default-color8.chart-series-area-line { -fx-stroke: maroon; }
-#systemCPUChart .default-color8.area-legend-symbol { -fx-background-color: maroon, white; }
+#systemCPUChart .series0 {
+    -fx-fill: red;
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
+#systemCPUChart .series1 {
+    -fx-fill: limegreen;
+    -fx-stroke: limegreen;
+    -fx-background-color: limegreen, white;
+}
+#systemCPUChart .series2 {
+    -fx-fill: blue;
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
+#systemCPUChart .series3 {
+    -fx-fill: orange;
+    -fx-stroke: orange;
+    -fx-background-color: orange, white;
+}
+#systemCPUChart .series4 {
+    -fx-fill: violet;
+    -fx-stroke: violet;
+    -fx-background-color: violet, white;
+}
+#systemCPUChart .series5 {
+    -fx-fill: skyblue;
+    -fx-stroke: skyblue;
+    -fx-background-color: skyblue, white;
+}
+#systemCPUChart .series6 {
+    -fx-fill: bisque;
+    -fx-stroke: bisque;
+    -fx-background-color: bisque, white;
+}
+#systemCPUChart .series7 {
+    -fx-fill: darkgray;
+    -fx-stroke: darkgray;
+    -fx-background-color: darkgray, white;
+}
+#systemCPUChart .series8 {
+    -fx-fill: maroon;
+    -fx-stroke: maroon;
+    -fx-background-color: maroon, white;
+}
 
 
 /* Java Native Memory */
-
-/* VSZ */
-#javaMemoryChart .default-color0.chart-series-line { -fx-stroke: blue; }
-#javaMemoryChart .default-color0.chart-line-symbol { -fx-background-color: blue, white; }
-
-/* RSS */
-#javaMemoryChart .default-color1.chart-series-line { -fx-stroke: red; }
-#javaMemoryChart .default-color1.chart-line-symbol { -fx-background-color: red, white; }
-
+#javaMemoryChart .series0 {
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
+#javaMemoryChart .series1 {
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
 
 /* Safepoint chart */
-#safepointChart .chart-series-line { -fx-stroke: limegreen; }
+#safepointChart .series0 {
+    -fx-stroke: limegreen;
+    -fx-background-color: limegreen, white;
+}
 
 /* Safepoint time chart */
-#safepointTimeChart .chart-series-line { -fx-stroke: orange; }
-
+#safepointTimeChart .series0 {
+    -fx-stroke: orange;
+    -fx-background-color: orange, white;
+}
 
 /* Thread chart */
-#threadChart .chart-series-line { -fx-stroke: red; }
+#threadChart .series0 {
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
 
 /* Monitor chart */
-#monitorChart .chart-series-line { -fx-stroke: blue; }
+#monitorChart .series0 {
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
 
 /* Archive file area */
 #logArea { -fx-font-family: monospace ; }
--- a/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/snapshot.css	Mon Dec 05 12:29:44 2016 +0900
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/snapshot.css	Wed Dec 07 21:14:17 2016 +0900
@@ -22,21 +22,25 @@
 */
 
 /* instance */
-#instanceChart .default-color0.chart-series-line { -fx-stroke: blue; }
-#instanceChart .default-color0.chart-line-symbol { -fx-background-color: blue, white; }
+#instanceChart .series0 {
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
 
 /* GC time */
-#gcTimeChart .default-color0.chart-series-line { -fx-stroke: orange; }
-#gcTimeChart .default-color0.chart-line-symbol { -fx-background-color: orange, white; }
-
+#gcTimeChart .series0 {
+    -fx-stroke: orange;
+    -fx-background-color: orange, white;
+}
 
 /* Metaspace */
-#metaspaceChart .default-color0.chart-series-area-fill { -fx-fill: red; }
-#metaspaceChart .default-color0.chart-series-area-line { -fx-stroke: red; }
-#metaspaceChart .default-color0.chart-area-symbol  { -fx-background-color: red, white; }
-#metaspaceChart .default-color0.area-legend-symbol { -fx-background-color: red, white; }
-
-#metaspaceChart .default-color1.chart-series-area-fill { -fx-fill: blue; }
-#metaspaceChart .default-color1.chart-series-area-line { -fx-stroke: blue; }
-#metaspaceChart .default-color1.chart-area-symbol  { -fx-background-color: blue, white; }
-#metaspaceChart .default-color1.area-legend-symbol { -fx-background-color: blue, white; }
+#metaspaceChart .series0 {
+    -fx-fill: red;
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
+#metaspaceChart .series1 {
+    -fx-fill: blue;
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/heapsummary-bottom-old.css	Wed Dec 07 21:14:17 2016 +0900
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+/* 
+    Created on : 2016/12/06, 22:47:29
+    Author     : Yasumasa
+*/
+
+#heapChart .series0 {
+    -fx-fill: limegreen;
+    -fx-stroke: limegreen;
+    -fx-background-color: limegreen, white;
+}
+#heapChart .series1 {
+    -fx-fill: blue;
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
+#heapChart .series2 {
+    -fx-fill: red;
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/heapsummary-bottom-young.css	Wed Dec 07 21:14:17 2016 +0900
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 Yasumasa Suenaga
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+/* 
+    Created on : 2016/12/06, 22:47:06
+    Author     : Yasumasa
+*/
+
+#heapChart .series0 {
+    -fx-fill: blue;
+    -fx-stroke: blue;
+    -fx-background-color: blue, white;
+}
+#heapChart .series1 {
+    -fx-fill: limegreen;
+    -fx-stroke: limegreen;
+    -fx-background-color: limegreen, white;
+}
+#heapChart .series2 {
+    -fx-fill: red;
+    -fx-stroke: red;
+    -fx-background-color: red, white;
+}