Class PieChart


  • public class PieChart
    extends Chart
    The PieChart class implements drawing a pie chart from data samples. From each data row only the first sample is taken to draw the pie. The slices are drawn counter clock wise, last row to first starting at the start angle as defined with setStart(double).

    As a side effect the the ticksample data in the Y axis of the graph is set to the percentage of the sum of sample values. See draw(Graph, boolean) for more information.

    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      PieChart()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Layer draw​(Graph graph, boolean doDraw)
      Draws the pie chart into a new layer of the defined height and width.
      static java.lang.String getName()  
      void setHeight​(int height)
      Sets the height of the pie chart, if it has not been set yet.
      void setStart​(double start)
      Sets the starting angle of the first pie piece, if it has not been set yet.
      void setWidth​(int width)
      Sets the width of the pie chart, if it has not been set yet.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PieChart

        public PieChart()
    • Method Detail

      • getName

        public static java.lang.String getName()
      • draw

        public Layer draw​(Graph graph,
                          boolean doDraw)
        Draws the pie chart into a new layer of the defined height and width. As noted in the above class comment, this method sets the ticksample value of the graph's Y axis as the chart is drawn. This method can thus be used to simply calculate this data.
        Specified by:
        draw in class Chart
        Parameters:
        graph - The graph the chart belongs to
        doDraw - Indicates whether to draw or only calculate
        Returns:
        The layer into which the pie chart has been drawn or null if no drawing has been requested.
      • setWidth

        public void setWidth​(int width)
        Sets the width of the pie chart, if it has not been set yet.
        Parameters:
        width - The width of the pie chart.
      • setHeight

        public void setHeight​(int height)
        Sets the height of the pie chart, if it has not been set yet.
        Parameters:
        height - The height of the pie chart.
      • setStart

        public void setStart​(double start)
        Sets the starting angle of the first pie piece, if it has not been set yet. This angle is considered to be in degrees, to rotate counter clockwise for positive values. Zero degrees is at 3 o'clock.
        Parameters:
        start -