changeset 168:b3f6e49a5c7a

Bug 3195: Add property for tick marker on X axis Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/41
author Yasumasa Suenaga <yasuenag@gmail.com>
date Wed, 12 Oct 2016 21:25:38 +0900
parents fb425a4e5af7
children dbe9ae2813ac
files ChangeLog analyzer/fx/heapstats.properties analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/LogResourcesController.java analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/utils/HeapStatsUtils.java analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/resources.fxml analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/histogram.fxml analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/summary.fxml
diffstat 9 files changed, 47 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 11 22:51:44 2016 +0900
+++ b/ChangeLog	Wed Oct 12 21:25:38 2016 +0900
@@ -1,4 +1,8 @@
-2016-10-06  Yasumasa Suenaga <yasuenag@gmail.com>
+2016-10-12  Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3195: Add property for tick marker on X axis
+
+2016-10-11  Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3002: HeapStats CLI should show ID in each subcommand
 	* Bug 3001: HeapStats CLI should report error without exception
--- a/analyzer/fx/heapstats.properties	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/heapstats.properties	Wed Oct 12 21:25:38 2016 +0900
@@ -13,3 +13,4 @@
 datetime_format=yyyy/MM/dd HH:mm:ss
 #plugins=
 reftree_fontsize=11
+tickmarker=false
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/LogResourcesController.java	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/LogResourcesController.java	Wed Oct 12 21:25:38 2016 +0900
@@ -24,6 +24,7 @@
 import java.util.ResourceBundle;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javafx.application.Platform;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
@@ -147,13 +148,9 @@
         valueColumn.setCellValueFactory(new PropertyValueFactory<>("value"));
 
         String bgcolor = "-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";";
-        javaCPUChart.lookup(".chart").setStyle(bgcolor);
-        systemCPUChart.lookup(".chart").setStyle(bgcolor);
-        javaMemoryChart.lookup(".chart").setStyle(bgcolor);
-        safepointChart.lookup(".chart").setStyle(bgcolor);
-        safepointTimeChart.lookup(".chart").setStyle(bgcolor);
-        threadChart.lookup(".chart").setStyle(bgcolor);
-        monitorChart.lookup(".chart").setStyle(bgcolor);
+        Stream.of(javaCPUChart, systemCPUChart, javaMemoryChart, safepointChart, safepointTimeChart, threadChart, monitorChart)
+              .peek(c -> c.lookup(".chart").setStyle(bgcolor))
+              .forEach(c -> c.getXAxis().setTickMarkVisible(HeapStatsUtils.getTickMarkerSwitch()));
 
         initializeChartSeries();
 
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/HistogramController.java	Wed Oct 12 21:25:38 2016 +0900
@@ -204,6 +204,7 @@
         searchList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
 
         topNChart.lookup(".chart").setStyle("-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";");
+        topNChart.getXAxis().setTickMarkVisible(HeapStatsUtils.getTickMarkerSwitch());
 
         searchFilterEnable = false;
         excludeFilterEnable = false;
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/SummaryController.java	Wed Oct 12 21:25:38 2016 +0900
@@ -103,10 +103,10 @@
         keyColumn.setCellValueFactory(new PropertyValueFactory<>("category"));
         valueColumn.setCellValueFactory(new PropertyValueFactory<>("value"));
 
-        heapChart.lookup(".chart").setStyle("-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";");
-        instanceChart.lookup(".chart").setStyle("-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";");
-        gcTimeChart.lookup(".chart").setStyle("-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";");
-        metaspaceChart.lookup(".chart").setStyle("-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";");
+        String bgcolor = "-fx-background-color: " + HeapStatsUtils.getChartBgColor() + ";";
+        Stream.of(heapChart, instanceChart, gcTimeChart, metaspaceChart)
+              .peek(c -> c.lookup(".chart").setStyle(bgcolor))
+              .forEach(c -> c.getXAxis().setTickMarkVisible(HeapStatsUtils.getTickMarkerSwitch()));
 
         initializeChartSeries();
     }
--- a/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/utils/HeapStatsUtils.java	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/java/jp/co/ntt/oss/heapstats/utils/HeapStatsUtils.java	Wed Oct 12 21:25:38 2016 +0900
@@ -182,6 +182,11 @@
         if (fontsize == null) {
             prop.setProperty("reftree_fontsize", "11");
         }
+        
+        /* Tick marker on X axis */
+        if (prop.getProperty("tickmarker") == null) {
+            prop.setProperty("tickmarker", "false");
+        }
 
         /* Add shutdown hook for saving current settings. */
         Runnable savePropImpl = () -> {
@@ -334,6 +339,15 @@
     }
 
     /**
+     * Get the switch to show tick marker on X axis.
+     *
+     * @return true if Analyzer should show tick marker.
+     */
+    public static boolean getTickMarkerSwitch() {
+        return Boolean.parseBoolean(prop.getProperty("tickmarker"));
+    }
+    
+    /**
      * Convert stack trace to String.
      *
      * @param e Throwable object to convert.
--- a/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/resources.fxml	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/log/tabs/resources.fxml	Wed Oct 12 21:25:38 2016 +0900
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (C) 2015 Nippon Telegraph and Telephone Corporation
+ Copyright (C) 2015-2016 Nippon Telegraph and Telephone Corporation
 
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
@@ -44,7 +44,7 @@
                                 <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis side="LEFT" />
+                                <NumberAxis side="LEFT" minorTickVisible="false" />
                             </yAxis>
                         </LineChart>
                         <AnchorPane fx:id="threadsAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -66,7 +66,7 @@
                                 <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis autoRanging="false" label="\%" lowerBound="0.0" side="LEFT" tickUnit="10.0" upperBound="100.0d" />
+                                <NumberAxis autoRanging="false" label="\%" lowerBound="0.0" side="LEFT" upperBound="100.0d" tickUnit="10.0" minorTickVisible="false" />
                             </yAxis>
                         </StackedAreaChart>
                         <AnchorPane fx:id="javaCPUAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -79,7 +79,7 @@
                                 <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis autoRanging="false" label="\%" lowerBound="0.0" side="LEFT" tickUnit="10.0" upperBound="100.0d" />
+                                <NumberAxis autoRanging="false" label="\%" lowerBound="0.0" side="LEFT" upperBound="100.0d" tickUnit="10.0" minorTickVisible="false" />
                             </yAxis>
                         </StackedAreaChart>
                         <AnchorPane fx:id="systemCPUAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -92,7 +92,7 @@
                                 <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis label="MB" side="LEFT" />
+                                <NumberAxis label="MB" side="LEFT" minorTickVisible="false" />
                             </yAxis>
                         </LineChart>
                         <AnchorPane fx:id="javaMemoryAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -102,10 +102,10 @@
                     <children>
                         <LineChart id="safepointChart" fx:id="safepointChart" animated="false" createSymbols="false" legendVisible="false" minHeight="0.0" minWidth="0.0" onMouseExited="#onChartMouseExited" onMouseMoved="#onChartMouseMoved" title="%chart.safepoint.count">
                             <xAxis>
-                                <CategoryAxis side="BOTTOM" tickLabelsVisible="false" tickMarkVisible="false" visible="false" />
+                                <CategoryAxis side="BOTTOM" tickLabelsVisible="false" visible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis side="LEFT" />
+                                <NumberAxis side="LEFT" minorTickVisible="false" />
                             </yAxis>
                         </LineChart>
                         <AnchorPane fx:id="safepointAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -115,10 +115,10 @@
                     <children>
                         <LineChart id="safepointTimeChart" fx:id="safepointTimeChart" animated="false" createSymbols="false" legendVisible="false" minHeight="0.0" minWidth="0.0" onMouseExited="#onChartMouseExited" onMouseMoved="#onChartMouseMoved" title="%chart.safepoint.time">
                             <xAxis>
-                                <CategoryAxis side="BOTTOM" tickLabelsVisible="false" tickMarkVisible="false" visible="false" />
+                                <CategoryAxis side="BOTTOM" tickLabelsVisible="false" visible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis label="ms" side="LEFT" />
+                                <NumberAxis label="ms" side="LEFT" minorTickVisible="false" />
                             </yAxis>
                         </LineChart>
                         <AnchorPane fx:id="safepointTimeAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
@@ -131,7 +131,7 @@
                                 <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                             </xAxis>
                             <yAxis>
-                                <NumberAxis side="LEFT" />
+                                <NumberAxis side="LEFT" minorTickVisible="false" />
                             </yAxis>
                         </LineChart>
                         <AnchorPane fx:id="monitorAnchor" minHeight="0.0" minWidth="0.0" mouseTransparent="true" />
--- a/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/histogram.fxml	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/histogram.fxml	Wed Oct 12 21:25:38 2016 +0900
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (C) 2015 Nippon Telegraph and Telephone Corporation
+ Copyright (C) 2015-2016 Nippon Telegraph and Telephone Corporation
 
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
@@ -69,7 +69,7 @@
                                         <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                                     </xAxis>
                                     <yAxis>
-                                        <NumberAxis fx:id="topNYAxis" autoRanging="false" label="MB" side="LEFT" />
+                                        <NumberAxis fx:id="topNYAxis" autoRanging="false" label="MB" side="LEFT" minorTickVisible="false" />
                                     </yAxis>
                                 </StackedAreaChart>
                                 <AnchorPane fx:id="topNChartAnchor" mouseTransparent="true" />
--- a/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/summary.fxml	Tue Oct 11 22:51:44 2016 +0900
+++ b/analyzer/fx/src/main/resources/jp/co/ntt/oss/heapstats/plugin/builtin/snapshot/tabs/summary.fxml	Wed Oct 12 21:25:38 2016 +0900
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (C) 2015 Nippon Telegraph and Telephone Corporation
+ Copyright (C) 2015-2016 Nippon Telegraph and Telephone Corporation
 
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
@@ -49,7 +49,7 @@
                                         <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                                     </xAxis>
                                     <yAxis>
-                                        <NumberAxis label="MB" side="LEFT" />
+                                        <NumberAxis label="MB" side="LEFT" minorTickVisible="false" />
                                     </yAxis>
                                 </StackedAreaChart>
                                 <AnchorPane mouseTransparent="true" prefHeight="200.0" prefWidth="200.0" />
@@ -62,7 +62,7 @@
                                         <CategoryAxis side="BOTTOM" tickLabelsVisible="false" visible="false" />
                                     </xAxis>
                                     <yAxis>
-                                        <NumberAxis label="instances" side="LEFT" />
+                                        <NumberAxis label="instances" side="LEFT" minorTickVisible="false" />
                                     </yAxis>
                                 </LineChart>
                                 <AnchorPane mouseTransparent="true" prefHeight="200.0" prefWidth="200.0" />
@@ -75,7 +75,7 @@
                                         <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                                     </xAxis>
                                     <yAxis>
-                                        <NumberAxis label="ms" side="LEFT" />
+                                        <NumberAxis label="ms" side="LEFT" minorTickVisible="false" />
                                     </yAxis>
                                 </LineChart>
                                 <AnchorPane mouseTransparent="true" prefHeight="200.0" prefWidth="200.0" />
@@ -85,10 +85,10 @@
                             <children>
                                 <AreaChart id="metaspaceChart" fx:id="metaspaceChart" animated="false" createSymbols="false" layoutX="-174.0" layoutY="-166.0" minHeight="0.0" title="%chart.metaspace" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
                                     <xAxis>
-                                        <CategoryAxis side="BOTTOM" tickLabelsVisible="false" tickMarkVisible="false" />
+                                        <CategoryAxis side="BOTTOM" tickLabelsVisible="false" />
                                     </xAxis>
                                     <yAxis>
-                                        <NumberAxis label="MB" side="LEFT" />
+                                        <NumberAxis label="MB" side="LEFT" minorTickVisible="false" />
                                     </yAxis>
                                 </AreaChart>
                                 <AnchorPane mouseTransparent="true" prefHeight="200.0" prefWidth="200.0" />