示例#1
0
 public TimeAxisSetting(TimeAxisSetting s)
 {
     this.secPerPix      = s.secPerPix;
     this.minorUnit      = s.minorUnit;
     this.minorUnitCount = s.minorUnitCount;
     this.majorUnit      = s.majorUnit;
     this.majorUnitCount = s.majorUnitCount;
     this.labelUnit      = s.labelUnit;
     this.labelUnitCount = s.labelUnitCount;
     this.labelSpan      = s.labelSpan;
     this.format         = s.format;
 }
示例#2
0
 public TimeAxisSetting(TimeAxisSetting s)
 {
    this.secPerPix = s.secPerPix;
    this.minorUnit = s.minorUnit;
    this.minorUnitCount = s.minorUnitCount;
    this.majorUnit = s.majorUnit;
    this.majorUnitCount = s.majorUnitCount;
    this.labelUnit = s.labelUnit;
    this.labelUnitCount = s.labelUnitCount;
    this.labelSpan = s.labelSpan;
    this.format = s.format;
 }
示例#3
0
 private void chooseTickSettings()
 {
     if (rrdGraph.gdef.timeAxisSetting != null)
     {
         tickSetting = new TimeAxisSetting(rrdGraph.gdef.timeAxisSetting);
     }
     else
     {
         for (int i = 0; tickSettings[i].secPerPix >= 0 && secPerPix > tickSettings[i].secPerPix; i++)
         {
             tickSetting = tickSettings[i];
         }
     }
 }
示例#4
0
 /**
  * Configures x-axis grid and labels. The x-axis label is quite complex to configure.
  * So if you don't have very special needs, you can rely on the autoconfiguration to
  * get this right.
  * <p/>
  * Otherwise, you have to configure three elements making up the x-axis labels
  * and grid. The base grid, the major grid and the labels.
  * The configuration is based on the idea that you first specify a well
  * known amount of time and then say how many times
  * it has to pass between each minor/major grid line or label. For the label
  * you have to define two additional items: The precision of the label
  * in seconds and the format used to generate the text
  * of the label.
  * <p/>
  * For example, if you wanted a graph with a base grid every 10 minutes and a major
  * one every hour, with labels every hour you would use the following
  * x-axis definition.
  * <p/>
  * <pre>
  * setTimeAxis(RrdGraphConstants.MINUTE, 10,
  *             RrdGraphConstants.HOUR, 1,
  *             RrdGraphConstants.HOUR, 1,
  *             0, "%H:%M")
  * </pre>
  * <p/>
  * The precision in this example is 0 because the %X format is exact.
  * If the label was the name of the day, we would have had a precision
  * of 24 hours, because when you say something like 'Monday' you mean
  * the whole day and not Monday morning 00:00. Thus the label should
  * be positioned at noon. By defining a precision of 24 hours or
  * rather 86400 seconds, you make sure that this happens.
  *
  * @param minorUnit        Minor grid unit. Minor grid, major grid and label units
  *                         can be one of the following constants defined in
  *                         {@link RrdGraphConstants}: {@link RrdGraphConstants#SECOND SECOND},
  *                         {@link RrdGraphConstants#MINUTE MINUTE}, {@link RrdGraphConstants#HOUR HOUR},
  *                         {@link RrdGraphConstants#DAY DAY}, {@link RrdGraphConstants#WEEK WEEK},
  *                         {@link RrdGraphConstants#MONTH MONTH}, {@link RrdGraphConstants#YEAR YEAR}.
  * @param minorUnitCount   Number of minor grid units between minor grid lines.
  * @param majorUnit        Major grid unit.
  * @param majorUnitCount   Number of major grid units between major grid lines.
  * @param labelUnit        Label unit.
  * @param labelUnitCount   Number of label units between labels.
  * @param labelSpan        Label precision
  * @param simpleDateFormat Date format (SimpleDateFormat pattern of strftime-like pattern)
  */
 public void setTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount,
                         int labelUnit, int labelUnitCount, int labelSpan, String simpleDateFormat)
 {
     timeAxisSetting = new TimeAxisSetting(minorUnit, minorUnitCount, majorUnit, majorUnitCount,
                                           labelUnit, labelUnitCount, labelSpan, simpleDateFormat);
 }
示例#5
0
 private void chooseTickSettings()
 {
    if (rrdGraph.gdef.timeAxisSetting != null)
    {
       tickSetting = new TimeAxisSetting(rrdGraph.gdef.timeAxisSetting);
    }
    else
    {
       for (int i = 0; tickSettings[i].secPerPix >= 0 && secPerPix > tickSettings[i].secPerPix; i++)
       {
          tickSetting = tickSettings[i];
       }
    }
 }
示例#6
0
 /**
  * Configures x-axis grid and labels. The x-axis label is quite complex to configure.
  * So if you don't have very special needs, you can rely on the autoconfiguration to
  * get this right.
  * <p/>
  * Otherwise, you have to configure three elements making up the x-axis labels
  * and grid. The base grid, the major grid and the labels.
  * The configuration is based on the idea that you first specify a well
  * known amount of time and then say how many times
  * it has to pass between each minor/major grid line or label. For the label
  * you have to define two additional items: The precision of the label
  * in seconds and the format used to generate the text
  * of the label.
  * <p/>
  * For example, if you wanted a graph with a base grid every 10 minutes and a major
  * one every hour, with labels every hour you would use the following
  * x-axis definition.
  * <p/>
  * <pre>
  * setTimeAxis(RrdGraphConstants.MINUTE, 10,
  *             RrdGraphConstants.HOUR, 1,
  *             RrdGraphConstants.HOUR, 1,
  *             0, "%H:%M")
  * </pre>
  * <p/>
  * The precision in this example is 0 because the %X format is exact.
  * If the label was the name of the day, we would have had a precision
  * of 24 hours, because when you say something like 'Monday' you mean
  * the whole day and not Monday morning 00:00. Thus the label should
  * be positioned at noon. By defining a precision of 24 hours or
  * rather 86400 seconds, you make sure that this happens.
  *
  * @param minorUnit        Minor grid unit. Minor grid, major grid and label units
  *                         can be one of the following constants defined in
  *                         {@link RrdGraphConstants}: {@link RrdGraphConstants#SECOND SECOND},
  *                         {@link RrdGraphConstants#MINUTE MINUTE}, {@link RrdGraphConstants#HOUR HOUR},
  *                         {@link RrdGraphConstants#DAY DAY}, {@link RrdGraphConstants#WEEK WEEK},
  *                         {@link RrdGraphConstants#MONTH MONTH}, {@link RrdGraphConstants#YEAR YEAR}.
  * @param minorUnitCount   Number of minor grid units between minor grid lines.
  * @param majorUnit        Major grid unit.
  * @param majorUnitCount   Number of major grid units between major grid lines.
  * @param labelUnit        Label unit.
  * @param labelUnitCount   Number of label units between labels.
  * @param labelSpan        Label precision
  * @param simpleDateFormat Date format (SimpleDateFormat pattern of strftime-like pattern)
  */
 public void setTimeAxis(int minorUnit, int minorUnitCount, int majorUnit, int majorUnitCount,
                   int labelUnit, int labelUnitCount, int labelSpan, String simpleDateFormat)
 {
    timeAxisSetting = new TimeAxisSetting(minorUnit, minorUnitCount, majorUnit, majorUnitCount,
          labelUnit, labelUnitCount, labelSpan, simpleDateFormat);
 }