configurable line width on ad-hoc line charts (issue #1214)
authorVictor Kirhenshtein <victor@netxms.org>
Tue, 17 May 2016 07:49:24 +0000 (10:49 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 17 May 2016 07:49:24 +0000 (10:49 +0300)
ChangeLog
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/ChartConfig.java
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/propertypages/General.java
src/java/netxms-eclipse/PerfView/src/org/netxms/ui/eclipse/perfview/views/HistoricalGraphView.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/ChartConfig.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/propertypages/General.java
webui/webapp/PerfView/src/org/netxms/ui/eclipse/perfview/views/HistoricalGraphView.java

index e91f21e..bc0a82b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        - Configurable display format for dashboard elements data sources
        - Improved inverted line chart support
        - DCI filter in DCI selection dialog
+       - Configurable line width on ad-hoc line charts
 - Android console
        - Reorganized alarm notification section (issue #1194)
-- Fixed issues: #859, #1086, #1194, #1195, #1196, #1197, #1200
+- Fixed issues: #859, #1086, #1194, #1195, #1196, #1197, #1200, #1214
 
 
 *
index 09f2b21..8f35c9e 100644 (file)
@@ -75,11 +75,14 @@ public class ChartConfig
    @Element(required = false)
    private boolean translucent = true;
    
+   @Element(required = false)
+   private int lineWidth = 2;
+   
    @Element(required = false)
    private boolean autoScale = true;
    
    @Element(required = false)
-   private int minYScaleValue = 1;
+   private int minYScaleValue = 0;
 
    @Element(required = false)
    private int maxYScaleValue = 100;
@@ -698,41 +701,81 @@ public class ChartConfig
       this.extendedLegend = extendedLegend;
    }
 
+   /**
+    * @return the lineWidth
+    */
+   public int getLineWidth()
+   {
+      return lineWidth;
+   }
+
+   /**
+    * @param lineWidth the lineWidth to set
+    */
+   public void setLineWidth(int lineWidth)
+   {
+      this.lineWidth = lineWidth;
+   }
+
+   /**
+    * @return
+    */
    public boolean isAutoScale()
    {
       return autoScale;
    }
 
+   /**
+    * @param autoScale
+    */
    public void setAutoScale(boolean autoScale)
    {
       this.autoScale = autoScale;
    }
 
+   /**
+    * @return
+    */
    public int getMinYScaleValue()
    {
       return minYScaleValue;
    }
 
+   /**
+    * @param minYScaleValue
+    */
    public void setMinYScaleValue(int minYScaleValue)
    {
       this.minYScaleValue = minYScaleValue;
    }
 
+   /**
+    * @return
+    */
    public int getMaxYScaleValue()
    {
       return maxYScaleValue;
    }
 
+   /**
+    * @param maxYScaleValue
+    */
    public void setMaxYScaleValue(int maxYScaleValue)
    {
       this.maxYScaleValue = maxYScaleValue;
    }
 
+   /**
+    * @return
+    */
    public TimePeriod timePeriod()
    {
       return new TimePeriod(timeFrameType, timeRange, timeUnits, timeFrom, timeTo);
    }
    
+   /**
+    * @param tp
+    */
    public void setTimePeriod(TimePeriod tp)
    {
       timeFrameType = tp.getTimeFrameType();
index 89ba2ae..41f5503 100644 (file)
@@ -42,6 +42,7 @@ import org.netxms.ui.eclipse.perfview.PredefinedChartConfig;
 import org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 import org.netxms.ui.eclipse.tools.WidgetHelper;
+import org.netxms.ui.eclipse.widgets.LabeledSpinner;
 import org.netxms.ui.eclipse.widgets.LabeledText;
 import org.netxms.ui.eclipse.widgets.TimePeriodSelector;
 
@@ -60,7 +61,8 @@ public class General extends PropertyPage
        private Button checkStacked;
        private Button checkExtendedLegend;
    private Button checkTranslucent;
-       private Combo legendPleace;
+   private LabeledSpinner lineWidth;
+       private Combo legendLocation;
        private Scale refreshIntervalScale;
        private Spinner refreshIntervalSpinner;
        private TimePeriodSelector timeSelector;
@@ -97,7 +99,7 @@ public class General extends PropertyPage
       layout.marginHeight = WidgetHelper.OUTER_SPACING;
       layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
       layout.makeColumnsEqualWidth = true;
-      layout.numColumns = 2;
+      layout.numColumns = 3;
       optionsGroup.setLayout(layout);
       gd = new GridData();
       gd.horizontalAlignment = SWT.FILL;
@@ -111,7 +113,16 @@ public class General extends PropertyPage
       checkLogScale = new Button(optionsGroup, SWT.CHECK);
       checkLogScale.setText(Messages.get().General_LogScale);
       checkLogScale.setSelection(config.isLogScale());
-      
+
+      lineWidth = new LabeledSpinner(optionsGroup, SWT.NONE);
+      lineWidth.setLabel("Line width");
+      lineWidth.setRange(1, 99);
+      lineWidth.setSelection(config.getLineWidth());
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      gd.verticalSpan = 2;
+      lineWidth.setLayoutData(gd);
+            
       checkStacked = new Button(optionsGroup, SWT.CHECK);
       checkStacked.setText("Stacked");
       checkStacked.setSelection(config.isStacked());
@@ -120,22 +131,7 @@ public class General extends PropertyPage
       checkTranslucent.setText("Translucent");
       checkTranslucent.setSelection(config.isTranslucent());
       
-      Composite legendGroup = new Composite(optionsGroup, SWT.NONE);
-      layout = new GridLayout();
-      layout.numColumns = 2;
-      layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
-      layout.makeColumnsEqualWidth = true;
-      layout.marginHeight = 0;
-      layout.marginWidth = 0;
-      layout.marginTop = WidgetHelper.OUTER_SPACING;
-      legendGroup.setLayout(layout);
-      gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
-      gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      legendGroup.setLayoutData(gd);
-      
-      checkShowLegend = new Button(legendGroup, SWT.CHECK);
+      checkShowLegend = new Button(optionsGroup, SWT.CHECK);
       checkShowLegend.setText(Messages.get().General_ShowLegend);
       checkShowLegend.setSelection(config.isShowLegend());
       checkShowLegend.addSelectionListener(new SelectionListener() {
@@ -143,7 +139,7 @@ public class General extends PropertyPage
          public void widgetSelected(SelectionEvent e)
          {
             checkExtendedLegend.setEnabled(checkShowLegend.getSelection());
-            legendPleace.setEnabled(checkShowLegend.getSelection());
+            legendLocation.setEnabled(checkShowLegend.getSelection());
             checkShowHostNames.setEnabled(checkShowLegend.getSelection());
          }
 
@@ -153,52 +149,29 @@ public class General extends PropertyPage
             widgetSelected(e);
          }
       });
-      gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
-      gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      checkShowLegend.setLayoutData(gd);
       
-
-      checkShowHostNames = new Button(legendGroup, SWT.CHECK);
+      checkShowHostNames = new Button(optionsGroup, SWT.CHECK);
       checkShowHostNames.setText(Messages.get().General_ShowHostNames);
       checkShowHostNames.setSelection(config.isShowHostNames());
       checkShowHostNames.setEnabled(config.isShowLegend());
       
-      checkExtendedLegend = new Button(legendGroup, SWT.CHECK);
-      checkExtendedLegend.setText("Show extended legend");
-      checkExtendedLegend.setSelection(config.isExtendedLegend());         
-      checkExtendedLegend.setEnabled(config.isShowLegend());   
-      
-      Composite placeGroup = new Composite(optionsGroup, SWT.NONE);
-      layout = new GridLayout();
-      layout.numColumns = 2;
-      layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
-      layout.marginHeight = 0;
-      layout.marginWidth = 0;
-      layout.marginTop = WidgetHelper.OUTER_SPACING;
-      placeGroup.setLayout(layout);
       gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
+      gd.horizontalAlignment = GridData.FILL;
       gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      placeGroup.setLayoutData(gd);
-      
-      Label comboLabel = new Label(placeGroup, SWT.NONE);
-      comboLabel.setText("Place on ");
-
-      legendPleace = new Combo(placeGroup, SWT.READ_ONLY);
-      GridData gridData = new GridData();
-      gridData.horizontalAlignment = GridData.FILL;
-      gridData.grabExcessHorizontalSpace = true;
-      legendPleace.setLayoutData(gridData);
+      gd.verticalSpan = 2;
+      gd.verticalAlignment = SWT.TOP;
+      legendLocation = WidgetHelper.createLabeledCombo(optionsGroup, SWT.READ_ONLY, "Legend location", gd);
+      legendLocation.add("left");
+      legendLocation.add("right");
+      legendLocation.add("top");
+      legendLocation.add("bottom");
+      legendLocation.select(31 - Integer.numberOfLeadingZeros(config.getLegendPosition()));      
+      legendLocation.setEnabled(config.isShowLegend()); 
       
-      legendPleace.add("left");
-      legendPleace.add("right");
-      legendPleace.add("top");
-      legendPleace.add("bottom");
-      legendPleace.select(31 - Integer.numberOfLeadingZeros(config.getLegendPosition()));      
-      legendPleace.setEnabled(config.isShowLegend()); 
+      checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
+      checkExtendedLegend.setText("Show extended legend");
+      checkExtendedLegend.setSelection(config.isExtendedLegend());         
+      checkExtendedLegend.setEnabled(config.isShowLegend());   
       
       Composite refreshGroup = new Composite(optionsGroup, SWT.NONE);
       layout = new GridLayout();
@@ -210,7 +183,7 @@ public class General extends PropertyPage
       gd = new GridData();
       gd.horizontalAlignment = SWT.FILL;
       gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
+      gd.horizontalSpan = 3;
       refreshGroup.setLayoutData(gd);
 
       checkAutoRefresh = new Button(refreshGroup, SWT.CHECK);
@@ -326,7 +299,8 @@ public class General extends PropertyPage
                checkLogScale.setSelection(false);
                checkStacked.setSelection(false);
                checkExtendedLegend.setSelection(false);                
-               legendPleace.select(3);
+               legendLocation.select(3);
+               lineWidth.setSelection(2);
                
                yAxisRange.setSelection(true, 0, 100);
                
@@ -353,8 +327,9 @@ public class General extends PropertyPage
                config.setRefreshRate(refreshIntervalSpinner.getSelection());
       config.setStacked(checkStacked.getSelection());
       config.setExtendedLegend(checkExtendedLegend.getSelection());
-      config.setLegendPosition((int)Math.pow(2,legendPleace.getSelectionIndex()));
+      config.setLegendPosition((int)Math.pow(2,legendLocation.getSelectionIndex()));
       config.setTranslucent(checkTranslucent.getSelection());
+      config.setLineWidth(lineWidth.getSelection());
                config.setTimeFrameType(timeSelector.getTimeFrameType());
                config.setTimeUnits(timeSelector.getTimeUnitValue());
                config.setTimeRange(timeSelector.getTimeRangeValue());
index f8e157e..a17c5de 100644 (file)
@@ -316,6 +316,7 @@ public class HistoricalGraphView extends ViewPart implements GraphSettingsChange
       chart.setLegendPosition(config.getLegendPosition());
       chart.setStacked(config.isStacked());
       chart.setTranslucent(config.isTranslucent());
+      chart.setLineWidth(config.getLineWidth());
       if(!config.isAutoScale())
       {
          chart.setYAxisRange(config.getMinYScaleValue(), config.getMaxYScaleValue());
index 09f2b21..8f35c9e 100644 (file)
@@ -75,11 +75,14 @@ public class ChartConfig
    @Element(required = false)
    private boolean translucent = true;
    
+   @Element(required = false)
+   private int lineWidth = 2;
+   
    @Element(required = false)
    private boolean autoScale = true;
    
    @Element(required = false)
-   private int minYScaleValue = 1;
+   private int minYScaleValue = 0;
 
    @Element(required = false)
    private int maxYScaleValue = 100;
@@ -698,41 +701,81 @@ public class ChartConfig
       this.extendedLegend = extendedLegend;
    }
 
+   /**
+    * @return the lineWidth
+    */
+   public int getLineWidth()
+   {
+      return lineWidth;
+   }
+
+   /**
+    * @param lineWidth the lineWidth to set
+    */
+   public void setLineWidth(int lineWidth)
+   {
+      this.lineWidth = lineWidth;
+   }
+
+   /**
+    * @return
+    */
    public boolean isAutoScale()
    {
       return autoScale;
    }
 
+   /**
+    * @param autoScale
+    */
    public void setAutoScale(boolean autoScale)
    {
       this.autoScale = autoScale;
    }
 
+   /**
+    * @return
+    */
    public int getMinYScaleValue()
    {
       return minYScaleValue;
    }
 
+   /**
+    * @param minYScaleValue
+    */
    public void setMinYScaleValue(int minYScaleValue)
    {
       this.minYScaleValue = minYScaleValue;
    }
 
+   /**
+    * @return
+    */
    public int getMaxYScaleValue()
    {
       return maxYScaleValue;
    }
 
+   /**
+    * @param maxYScaleValue
+    */
    public void setMaxYScaleValue(int maxYScaleValue)
    {
       this.maxYScaleValue = maxYScaleValue;
    }
 
+   /**
+    * @return
+    */
    public TimePeriod timePeriod()
    {
       return new TimePeriod(timeFrameType, timeRange, timeUnits, timeFrom, timeTo);
    }
    
+   /**
+    * @param tp
+    */
    public void setTimePeriod(TimePeriod tp)
    {
       timeFrameType = tp.getTimeFrameType();
index 89ba2ae..41f5503 100644 (file)
@@ -42,6 +42,7 @@ import org.netxms.ui.eclipse.perfview.PredefinedChartConfig;
 import org.netxms.ui.eclipse.perfview.widgets.YAxisRangeEditor;
 import org.netxms.ui.eclipse.shared.ConsoleSharedData;
 import org.netxms.ui.eclipse.tools.WidgetHelper;
+import org.netxms.ui.eclipse.widgets.LabeledSpinner;
 import org.netxms.ui.eclipse.widgets.LabeledText;
 import org.netxms.ui.eclipse.widgets.TimePeriodSelector;
 
@@ -60,7 +61,8 @@ public class General extends PropertyPage
        private Button checkStacked;
        private Button checkExtendedLegend;
    private Button checkTranslucent;
-       private Combo legendPleace;
+   private LabeledSpinner lineWidth;
+       private Combo legendLocation;
        private Scale refreshIntervalScale;
        private Spinner refreshIntervalSpinner;
        private TimePeriodSelector timeSelector;
@@ -97,7 +99,7 @@ public class General extends PropertyPage
       layout.marginHeight = WidgetHelper.OUTER_SPACING;
       layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
       layout.makeColumnsEqualWidth = true;
-      layout.numColumns = 2;
+      layout.numColumns = 3;
       optionsGroup.setLayout(layout);
       gd = new GridData();
       gd.horizontalAlignment = SWT.FILL;
@@ -111,7 +113,16 @@ public class General extends PropertyPage
       checkLogScale = new Button(optionsGroup, SWT.CHECK);
       checkLogScale.setText(Messages.get().General_LogScale);
       checkLogScale.setSelection(config.isLogScale());
-      
+
+      lineWidth = new LabeledSpinner(optionsGroup, SWT.NONE);
+      lineWidth.setLabel("Line width");
+      lineWidth.setRange(1, 99);
+      lineWidth.setSelection(config.getLineWidth());
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      gd.verticalSpan = 2;
+      lineWidth.setLayoutData(gd);
+            
       checkStacked = new Button(optionsGroup, SWT.CHECK);
       checkStacked.setText("Stacked");
       checkStacked.setSelection(config.isStacked());
@@ -120,22 +131,7 @@ public class General extends PropertyPage
       checkTranslucent.setText("Translucent");
       checkTranslucent.setSelection(config.isTranslucent());
       
-      Composite legendGroup = new Composite(optionsGroup, SWT.NONE);
-      layout = new GridLayout();
-      layout.numColumns = 2;
-      layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
-      layout.makeColumnsEqualWidth = true;
-      layout.marginHeight = 0;
-      layout.marginWidth = 0;
-      layout.marginTop = WidgetHelper.OUTER_SPACING;
-      legendGroup.setLayout(layout);
-      gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
-      gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      legendGroup.setLayoutData(gd);
-      
-      checkShowLegend = new Button(legendGroup, SWT.CHECK);
+      checkShowLegend = new Button(optionsGroup, SWT.CHECK);
       checkShowLegend.setText(Messages.get().General_ShowLegend);
       checkShowLegend.setSelection(config.isShowLegend());
       checkShowLegend.addSelectionListener(new SelectionListener() {
@@ -143,7 +139,7 @@ public class General extends PropertyPage
          public void widgetSelected(SelectionEvent e)
          {
             checkExtendedLegend.setEnabled(checkShowLegend.getSelection());
-            legendPleace.setEnabled(checkShowLegend.getSelection());
+            legendLocation.setEnabled(checkShowLegend.getSelection());
             checkShowHostNames.setEnabled(checkShowLegend.getSelection());
          }
 
@@ -153,52 +149,29 @@ public class General extends PropertyPage
             widgetSelected(e);
          }
       });
-      gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
-      gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      checkShowLegend.setLayoutData(gd);
       
-
-      checkShowHostNames = new Button(legendGroup, SWT.CHECK);
+      checkShowHostNames = new Button(optionsGroup, SWT.CHECK);
       checkShowHostNames.setText(Messages.get().General_ShowHostNames);
       checkShowHostNames.setSelection(config.isShowHostNames());
       checkShowHostNames.setEnabled(config.isShowLegend());
       
-      checkExtendedLegend = new Button(legendGroup, SWT.CHECK);
-      checkExtendedLegend.setText("Show extended legend");
-      checkExtendedLegend.setSelection(config.isExtendedLegend());         
-      checkExtendedLegend.setEnabled(config.isShowLegend());   
-      
-      Composite placeGroup = new Composite(optionsGroup, SWT.NONE);
-      layout = new GridLayout();
-      layout.numColumns = 2;
-      layout.horizontalSpacing = WidgetHelper.OUTER_SPACING;
-      layout.marginHeight = 0;
-      layout.marginWidth = 0;
-      layout.marginTop = WidgetHelper.OUTER_SPACING;
-      placeGroup.setLayout(layout);
       gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
+      gd.horizontalAlignment = GridData.FILL;
       gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
-      placeGroup.setLayoutData(gd);
-      
-      Label comboLabel = new Label(placeGroup, SWT.NONE);
-      comboLabel.setText("Place on ");
-
-      legendPleace = new Combo(placeGroup, SWT.READ_ONLY);
-      GridData gridData = new GridData();
-      gridData.horizontalAlignment = GridData.FILL;
-      gridData.grabExcessHorizontalSpace = true;
-      legendPleace.setLayoutData(gridData);
+      gd.verticalSpan = 2;
+      gd.verticalAlignment = SWT.TOP;
+      legendLocation = WidgetHelper.createLabeledCombo(optionsGroup, SWT.READ_ONLY, "Legend location", gd);
+      legendLocation.add("left");
+      legendLocation.add("right");
+      legendLocation.add("top");
+      legendLocation.add("bottom");
+      legendLocation.select(31 - Integer.numberOfLeadingZeros(config.getLegendPosition()));      
+      legendLocation.setEnabled(config.isShowLegend()); 
       
-      legendPleace.add("left");
-      legendPleace.add("right");
-      legendPleace.add("top");
-      legendPleace.add("bottom");
-      legendPleace.select(31 - Integer.numberOfLeadingZeros(config.getLegendPosition()));      
-      legendPleace.setEnabled(config.isShowLegend()); 
+      checkExtendedLegend = new Button(optionsGroup, SWT.CHECK);
+      checkExtendedLegend.setText("Show extended legend");
+      checkExtendedLegend.setSelection(config.isExtendedLegend());         
+      checkExtendedLegend.setEnabled(config.isShowLegend());   
       
       Composite refreshGroup = new Composite(optionsGroup, SWT.NONE);
       layout = new GridLayout();
@@ -210,7 +183,7 @@ public class General extends PropertyPage
       gd = new GridData();
       gd.horizontalAlignment = SWT.FILL;
       gd.grabExcessHorizontalSpace = true;
-      gd.horizontalSpan = 2;
+      gd.horizontalSpan = 3;
       refreshGroup.setLayoutData(gd);
 
       checkAutoRefresh = new Button(refreshGroup, SWT.CHECK);
@@ -326,7 +299,8 @@ public class General extends PropertyPage
                checkLogScale.setSelection(false);
                checkStacked.setSelection(false);
                checkExtendedLegend.setSelection(false);                
-               legendPleace.select(3);
+               legendLocation.select(3);
+               lineWidth.setSelection(2);
                
                yAxisRange.setSelection(true, 0, 100);
                
@@ -353,8 +327,9 @@ public class General extends PropertyPage
                config.setRefreshRate(refreshIntervalSpinner.getSelection());
       config.setStacked(checkStacked.getSelection());
       config.setExtendedLegend(checkExtendedLegend.getSelection());
-      config.setLegendPosition((int)Math.pow(2,legendPleace.getSelectionIndex()));
+      config.setLegendPosition((int)Math.pow(2,legendLocation.getSelectionIndex()));
       config.setTranslucent(checkTranslucent.getSelection());
+      config.setLineWidth(lineWidth.getSelection());
                config.setTimeFrameType(timeSelector.getTimeFrameType());
                config.setTimeUnits(timeSelector.getTimeUnitValue());
                config.setTimeRange(timeSelector.getTimeRangeValue());
index 14fc3f0..2cf508b 100644 (file)
@@ -311,6 +311,7 @@ public class HistoricalGraphView extends ViewPart implements GraphSettingsChange
       chart.setLegendPosition(config.getLegendPosition());
       chart.setStacked(config.isStacked());
       chart.setTranslucent(config.isTranslucent());
+      chart.setLineWidth(config.getLineWidth());
       if(!config.isAutoScale())
       {
          chart.setYAxisRange(config.getMinYScaleValue(), config.getMaxYScaleValue());