java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
cz.fidentis.analyst.gui.elements.histogram.components.chart.ChartBody
All Implemented Interfaces:
EventGenerator, ImageObserver, MenuContainer, Serializable, Accessible

public class ChartBody extends JPanel implements EventGenerator

Panel for drawing a histogram chart.

Dispatches ActionEvent with the following action commands:

See Also:
  • Field Details

  • Constructor Details

    • ChartBody

      public ChartBody()

      Creates a new instance.

      By default, LinearScale is used for y-axis. See setVerticalScale(FunctionScale).

      Inner x scale uses LinearScale and preferred size of this component is used as domain. If the actual size is different from the preferred size, then zooming and panning might not work as expected.

  • Method Details

    • getHorizontalScale

      public FunctionScale getHorizontalScale()
    • getVerticalScale

      public FunctionScale getVerticalScale()
    • setValues

      public void setValues(List<Integer> yValues)
      Set Y values. Index of a Y value is used as the corresponding x value. Method creates an inner copy of yValues. and resets zoom on x-axis.
      Parameters:
      yValues - Y values
      See Also:
    • setVerticalScale

      public void setVerticalScale(FunctionScale scale)
      Set scale for Y axis.
      Parameters:
      scale - scale
      See Also:
    • setPaints

      public void setPaints(Paint stroke, Paint fill)
      Set Paints for chart stroke and fill.
      Parameters:
      stroke - stroke paint
      fill - fill paint
      See Also:
    • updateBody

      public void updateBody()
      Update chart body.
    • paintComponent

      protected void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • addActionListener

      public boolean addActionListener(ActionListener listener)
      Specified by:
      addActionListener in interface EventGenerator
      Parameters:
      listener - listener
      Returns:
      true if listener was successfully added to the collection
    • removeActionListener

      public boolean removeActionListener(ActionListener listener)
      Specified by:
      removeActionListener in interface EventGenerator
      Parameters:
      listener - listener
      Returns:
      true if listener was successfully removed from the collection