Пример #1
0
        /**
         * Does the same as {@link #line(String, java.awt.Color, String)},
         * but the graph gets stacked on top of the
         * previous LINE, AREA or STACK graph. Depending on the type of the
         * previous graph, the STACK will be either a LINE or an AREA.  This
         * obviously implies that the first STACK must be preceded by an AREA
         * or LINE.
         * <p/>
         * Note, that when you STACK onto *UNKNOWN* data, Rrd4n will not
         * draw any graphics ... *UNKNOWN* is not zero.
         *
         * @param srcName Virtual source name
         * @param color   Stacked graph color
         * @param legend  Legend text
         * @throws ArgumentException Thrown if this STACK has no previously defined AREA, STACK or LINE
         *                      graph bellow it.
         */
        public void stack(String srcName, Color color, String legend)
        {
            // find parent AREA or LINE
            SourcedPlotElement parent = null;

            for (int i = plotElements.Count - 1; i >= 0; i--)
            {
                PlotElement plotElement = plotElements[i];
                if (plotElement.GetType() == typeof(SourcedPlotElement) ||
                    plotElement.GetType() == typeof(Area) ||
                    plotElement.GetType() == typeof(Line))
                {
                    parent = (SourcedPlotElement)plotElement;
                    break;
                }
            }
            if (parent == null)
            {
                throw new ArgumentException("You have to stack graph onto something (line or area)");
            }
            else
            {
                LegendText legendText = new LegendText(color, legend);
                comments.Add(legendText);
                plotElements.Add(new Stack(parent, srcName, color));
            }
        }
Пример #2
0
        /**
         * Plots requested data as a line, using the color and the line width specified.
         *
         * @param srcName Virtual source name
         * @param color   Line color
         * @param legend  Legend text
         * @param width   Line width (default: 1.0F)
         */
        public void line(String srcName, Color color, String legend, float width)
        {
            LegendText legendText = new LegendText(color, legend);

            comments.Add(legendText);
            plotElements.Add(new Line(srcName, color, width));
        }
Пример #3
0
        /**
         * Plots requested data in the form of the filled area starting from zero, using
         * the color specified.
         *
         * @param srcName Virtual source name.
         * @param color   Color of the filled area.
         * @param legend  Legend text.
         */
        public void area(String srcName, Color color, String legend)
        {
            LegendText legendText = new LegendText(color, legend);

            comments.Add(legendText);
            plotElements.Add(new Area(srcName, color));
        }
Пример #4
0
        /**
         * Draws a horizontal rule into the graph and optionally adds a legend
         *
         * @param value  Position of the rule
         * @param color  Rule color
         * @param legend Legend text. If null, legend text will be omitted.
         * @param width Rule width
         */
        public void hrule(double value, Color color, String legend, float width)
        {
            LegendText legendText = new LegendText(color, legend);

            comments.Add(legendText);
            plotElements.Add(new HRule(value, color, legendText, width));
        }
Пример #5
0
        /**
         * Draws a vertical rule into the graph and optionally adds a legend
         *
         * @param timestamp Position of the rule (seconds since epoch)
         * @param color     Rule color
         * @param legend    Legend text. Use null to omit the text.
         * @param width     Rule width
         */
        public void vrule(long timestamp, Color color, String legend, float width)
        {
            LegendText legendText = new LegendText(color, legend);

            comments.Add(legendText);
            plotElements.Add(new VRule(timestamp, color, legendText, width));
        }
Пример #6
0
 public HRule(double value, Color color, LegendText legend, float width)
     : base(color, legend, width)
 {
     this.value = value;
 }
Пример #7
0
 public HRule(double value, Color color, LegendText legend, float width)
      : base(color, legend, width)
  {
      this.value = value;
  }
Пример #8
0
 public Rule(Color color, LegendText legend, float width)
     : base(color)
 {
     this.legend = legend;
     this.width = width;
 }
Пример #9
0
 /**
  * Plots requested data in the form of the filled area starting from zero, using
  * the color specified.
  *
  * @param srcName Virtual source name.
  * @param color   Color of the filled area.
  * @param legend  Legend text.
  */
 public void area(String srcName, Color color, String legend)
 {
    LegendText legendText = new LegendText(color, legend);
    comments.Add(legendText);
    plotElements.Add(new Area(srcName, color));
 }
Пример #10
0
 /**
  * Does the same as {@link #line(String, java.awt.Color, String)},
  * but the graph gets stacked on top of the
  * previous LINE, AREA or STACK graph. Depending on the type of the
  * previous graph, the STACK will be either a LINE or an AREA.  This
  * obviously implies that the first STACK must be preceded by an AREA
  * or LINE.
  * <p/>
  * Note, that when you STACK onto *UNKNOWN* data, Rrd4n will not
  * draw any graphics ... *UNKNOWN* is not zero.
  *
  * @param srcName Virtual source name
  * @param color   Stacked graph color
  * @param legend  Legend text
  * @throws ArgumentException Thrown if this STACK has no previously defined AREA, STACK or LINE
  *                      graph bellow it.
  */
 public void stack(String srcName, Color color, String legend)
 {
    // find parent AREA or LINE
    SourcedPlotElement parent = null;
    for (int i = plotElements.Count - 1; i >= 0; i--)
    {
       PlotElement plotElement = plotElements[i];
       if (plotElement.GetType() == typeof(SourcedPlotElement)
          || plotElement.GetType() == typeof(Area)
          || plotElement.GetType() == typeof(Line))
       {
          parent = (SourcedPlotElement)plotElement;
          break;
       }
    }
    if (parent == null)
    {
       throw new ArgumentException("You have to stack graph onto something (line or area)");
    }
    else
    {
       LegendText legendText = new LegendText(color, legend);
       comments.Add(legendText);
       plotElements.Add(new Stack(parent, srcName, color));
    }
 }
Пример #11
0
 /**
  * Plots requested data as a line, using the color and the line width specified.
  *
  * @param srcName Virtual source name
  * @param color   Line color
  * @param legend  Legend text
  * @param width   Line width (default: 1.0F)
  */
 public void line(String srcName, Color color, String legend, float width)
 {
    LegendText legendText = new LegendText(color, legend);
    comments.Add(legendText);
    plotElements.Add(new Line(srcName, color, width));
 }
Пример #12
0
 /**
  * Draws a vertical rule into the graph and optionally adds a legend
  *
  * @param timestamp Position of the rule (seconds since epoch)
  * @param color     Rule color
  * @param legend    Legend text. Use null to omit the text.
  * @param width     Rule width
  */
 public void vrule(long timestamp, Color color, String legend, float width)
 {
    LegendText legendText = new LegendText(color, legend);
    comments.Add(legendText);
    plotElements.Add(new VRule(timestamp, color, legendText, width));
 }
Пример #13
0
 /**
  * Draws a horizontal rule into the graph and optionally adds a legend
  *
  * @param value  Position of the rule
  * @param color  Rule color
  * @param legend Legend text. If null, legend text will be omitted.
  * @param width Rule width
  */
 public void hrule(double value, Color color, String legend, float width)
 {
    LegendText legendText = new LegendText(color, legend);
    comments.Add(legendText);
    plotElements.Add(new HRule(value, color, legendText, width));
 }
Пример #14
0
 public Rule(Color color, LegendText legend, float width)
     : base(color)
 {
     this.legend = legend;
     this.width  = width;
 }
Пример #15
0
 internal VRule(long timestamp, Color color, LegendText legend, float width)
     : base(color, legend, width)
 {
     this.timestamp = timestamp;
 }