added option to show legend for performance tab graphs with single DCI
authorVictor Kirhenshtein <victor@netxms.org>
Tue, 10 Oct 2017 21:07:49 +0000 (00:07 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 10 Oct 2017 21:08:53 +0000 (00:08 +0300)
ChangeLog
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/PerfTabGraphSettings.java
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/objecttabs/internal/PerfTabGraph.java
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/propertypages/PerfTab.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/PerfTabGraphSettings.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/objecttabs/internal/PerfTabGraph.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/propertypages/PerfTab.java

index 56ba205..c4954cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
        - Option to set root object for "Geo Map" dashboard element
        - Filter in geo map view
        - "Duplicate" button in DCI threshold editor
+       - Option to show legend for performance tab graphs with single DCI
 - Implemented option to show "Top N items" in a Dashboad summary table using sorting and line limitation
 - Fixed issues: NX-1147, NX-1265, NX-1270, NX-1276, NX-1282, NX-1290, NX-1296, NX-1300, NX-1309, NX-1313, NX-1314, NX-1315, NX-1320, NX-1324, NX-1325, NX-1331, NX-1333, NX-1335
 
index a7f2ae4..1df4aa4 100644 (file)
@@ -47,6 +47,12 @@ public class PerfTabGraphSettings
    private boolean stacked = false;
    
    @Element(required = false)
+   private boolean showLegendAlways = false;
+   
+   @Element(required = false)
+   private boolean extendedLegend = true;
+   
+   @Element(required = false)
    private int minYScaleValue = 1;
    
    @Element(required = false)
@@ -438,4 +444,36 @@ public class PerfTabGraphSettings
    {
       this.logScaleEnabled = logScaleEnabled;
    }
+
+   /**
+    * @return the showLegendAlways
+    */
+   public boolean isShowLegendAlways()
+   {
+      return showLegendAlways;
+   }
+
+   /**
+    * @param showLegendAlways the showLegendAlways to set
+    */
+   public void setShowLegendAlways(boolean showLegendAlways)
+   {
+      this.showLegendAlways = showLegendAlways;
+   }
+
+   /**
+    * @return the extendedLegend
+    */
+   public boolean isExtendedLegend()
+   {
+      return extendedLegend;
+   }
+
+   /**
+    * @param extendedLegend the extendedLegend to set
+    */
+   public void setExtendedLegend(boolean extendedLegend)
+   {
+      this.extendedLegend = extendedLegend;
+   }
 }
index b0a8464..2bca0b7 100644 (file)
@@ -83,7 +83,8 @@ public class PerfTabGraph extends DashboardComposite
                chart.setZoomEnabled(false);
                chart.setTitleVisible(true);
                chart.setChartTitle(settings.getRuntimeTitle());
-               chart.setLegendVisible(false);
+               chart.setLegendVisible(settings.isShowLegendAlways());
+               chart.setExtendedLegend(settings.isExtendedLegend());
                chart.setLogScaleEnabled(settings.isLogScaleEnabled());
                chart.setStacked(settings.isStacked());
       
@@ -94,7 +95,7 @@ public class PerfTabGraph extends DashboardComposite
                
                GraphItemStyle style = new GraphItemStyle(settings.getType(), settings.getColorAsInt(), 2, 0);
                chart.setItemStyles(Arrays.asList(new GraphItemStyle[] { style }));
-               if(!settings.isAutoScale())
+               if (!settings.isAutoScale())
       {
                   chart.setYAxisRange(settings.getMinYScaleValue(), settings.getMaxYScaleValue());
       }
@@ -119,6 +120,8 @@ public class PerfTabGraph extends DashboardComposite
        public void addItem(PerfTabDci dci, PerfTabGraphSettings settings)
        {
                chart.setLegendVisible(true);
+               if (settings.isExtendedLegend())
+                  chart.setExtendedLegend(true);
                synchronized(items)
                {
                        items.add(dci);
index 40691a0..8da97fe 100644 (file)
@@ -49,6 +49,8 @@ public class PerfTab extends DCIPropertyPageDialog
        private Button checkShow;
        private Button checkLogScale;
    private Button checkStacked;
+   private Button checkShowLegendAlways;
+   private Button checkExtendedLegend;
        private LabeledText title;
        private LabeledText name;
        private ColorSelector color;
@@ -199,7 +201,21 @@ public class PerfTab extends DCIPropertyPageDialog
       gd = new GridData();
       gd.horizontalSpan = layout.numColumns;
       checkStacked.setLayoutData(gd);
-      
+
+      checkShowLegendAlways = new Button(optionsGroup, SWT.CHECK);
+      checkShowLegendAlways.setText("Always show &legend");
+      checkShowLegendAlways.setSelection(settings.isShowLegendAlways());
+      gd = new GridData();
+      gd.horizontalSpan = layout.numColumns;
+      checkShowLegendAlways.setLayoutData(gd);
+
+      checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
+      checkExtendedLegend.setText("&Extended legend");
+      checkExtendedLegend.setSelection(settings.isExtendedLegend());
+      gd = new GridData();
+      gd.horizontalSpan = layout.numColumns;
+      checkExtendedLegend.setLayoutData(gd);
+
       yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
       gd = new GridData();
       gd.horizontalSpan = layout.numColumns;
@@ -228,6 +244,8 @@ public class PerfTab extends DCIPropertyPageDialog
       settings.setGroupName(groupName.getText().trim());
                settings.setShowThresholds(checkShowThresholds.getSelection());
                settings.setStacked(checkStacked.getSelection());
+      settings.setShowLegendAlways(checkShowLegendAlways.getSelection());
+      settings.setExtendedLegend(checkExtendedLegend.getSelection());
                
                settings.setAutoScale(yAxisRange.isAuto());
                settings.setMinYScaleValue(yAxisRange.getMinY());
index a7f2ae4..1df4aa4 100644 (file)
@@ -47,6 +47,12 @@ public class PerfTabGraphSettings
    private boolean stacked = false;
    
    @Element(required = false)
+   private boolean showLegendAlways = false;
+   
+   @Element(required = false)
+   private boolean extendedLegend = true;
+   
+   @Element(required = false)
    private int minYScaleValue = 1;
    
    @Element(required = false)
@@ -438,4 +444,36 @@ public class PerfTabGraphSettings
    {
       this.logScaleEnabled = logScaleEnabled;
    }
+
+   /**
+    * @return the showLegendAlways
+    */
+   public boolean isShowLegendAlways()
+   {
+      return showLegendAlways;
+   }
+
+   /**
+    * @param showLegendAlways the showLegendAlways to set
+    */
+   public void setShowLegendAlways(boolean showLegendAlways)
+   {
+      this.showLegendAlways = showLegendAlways;
+   }
+
+   /**
+    * @return the extendedLegend
+    */
+   public boolean isExtendedLegend()
+   {
+      return extendedLegend;
+   }
+
+   /**
+    * @param extendedLegend the extendedLegend to set
+    */
+   public void setExtendedLegend(boolean extendedLegend)
+   {
+      this.extendedLegend = extendedLegend;
+   }
 }
index b0a8464..2bca0b7 100644 (file)
@@ -83,7 +83,8 @@ public class PerfTabGraph extends DashboardComposite
                chart.setZoomEnabled(false);
                chart.setTitleVisible(true);
                chart.setChartTitle(settings.getRuntimeTitle());
-               chart.setLegendVisible(false);
+               chart.setLegendVisible(settings.isShowLegendAlways());
+               chart.setExtendedLegend(settings.isExtendedLegend());
                chart.setLogScaleEnabled(settings.isLogScaleEnabled());
                chart.setStacked(settings.isStacked());
       
@@ -94,7 +95,7 @@ public class PerfTabGraph extends DashboardComposite
                
                GraphItemStyle style = new GraphItemStyle(settings.getType(), settings.getColorAsInt(), 2, 0);
                chart.setItemStyles(Arrays.asList(new GraphItemStyle[] { style }));
-               if(!settings.isAutoScale())
+               if (!settings.isAutoScale())
       {
                   chart.setYAxisRange(settings.getMinYScaleValue(), settings.getMaxYScaleValue());
       }
@@ -119,6 +120,8 @@ public class PerfTabGraph extends DashboardComposite
        public void addItem(PerfTabDci dci, PerfTabGraphSettings settings)
        {
                chart.setLegendVisible(true);
+               if (settings.isExtendedLegend())
+                  chart.setExtendedLegend(true);
                synchronized(items)
                {
                        items.add(dci);
index 40691a0..8da97fe 100644 (file)
@@ -49,6 +49,8 @@ public class PerfTab extends DCIPropertyPageDialog
        private Button checkShow;
        private Button checkLogScale;
    private Button checkStacked;
+   private Button checkShowLegendAlways;
+   private Button checkExtendedLegend;
        private LabeledText title;
        private LabeledText name;
        private ColorSelector color;
@@ -199,7 +201,21 @@ public class PerfTab extends DCIPropertyPageDialog
       gd = new GridData();
       gd.horizontalSpan = layout.numColumns;
       checkStacked.setLayoutData(gd);
-      
+
+      checkShowLegendAlways = new Button(optionsGroup, SWT.CHECK);
+      checkShowLegendAlways.setText("Always show &legend");
+      checkShowLegendAlways.setSelection(settings.isShowLegendAlways());
+      gd = new GridData();
+      gd.horizontalSpan = layout.numColumns;
+      checkShowLegendAlways.setLayoutData(gd);
+
+      checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
+      checkExtendedLegend.setText("&Extended legend");
+      checkExtendedLegend.setSelection(settings.isExtendedLegend());
+      gd = new GridData();
+      gd.horizontalSpan = layout.numColumns;
+      checkExtendedLegend.setLayoutData(gd);
+
       yAxisRange = new YAxisRangeEditor(dialogArea, SWT.NONE);
       gd = new GridData();
       gd.horizontalSpan = layout.numColumns;
@@ -228,6 +244,8 @@ public class PerfTab extends DCIPropertyPageDialog
       settings.setGroupName(groupName.getText().trim());
                settings.setShowThresholds(checkShowThresholds.getSelection());
                settings.setStacked(checkStacked.getSelection());
+      settings.setShowLegendAlways(checkShowLegendAlways.getSelection());
+      settings.setExtendedLegend(checkExtendedLegend.getSelection());
                
                settings.setAutoScale(yAxisRange.isAuto());
                settings.setMinYScaleValue(yAxisRange.getMinY());