Class PieChart

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible

public class PieChart extends JPanel implements PropertyChangeListener
Pie chart showing a circle with a highlighted arc representing preset share.
See Also:
  • Field Details

    • names

      private Vector names
      Names of portions that should be highlighted.
    • shares

      private Vector shares
      Shares of portions that should be highlighted.
  • Constructor Details

    • PieChart

      public PieChart()
      Creates a new pie chart.
  • Method Details

    • paint

      public void paint(Graphics graphics)
      Draws the pie chart given set share.
      Overrides:
      paint in class JComponent
      Parameters:
      graphics - Graphics area where the chart should be drawn.
    • propertyChange

      public void propertyChange(PropertyChangeEvent evt)
      Method called when some property of task was changed.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      evt - Event describing what was changed.
    • setShares

      public void setShares(Vector names, Vector shares)
      Sets names and shares that should be highlighted in the pie chart.
      Parameters:
      names - Descriptions of portions to be highlighted in the pie chart.
      shares - Percentages of portions to be highlighted in the pie chart.
    • changeColor

      private Color changeColor(Color color)
      Returns new color visibly different from the given one.
      Parameters:
      color - Color to be derivated.
      Returns:
      New color with R+50, G-50 and B+100;