java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jfree.chart.ChartPanel
com.inductiveautomation.factorypmi.application.components.chart.PMIChartPanel
com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel
All Implemented Interfaces:
LoadingMonitor, LocaleListener, ComponentLifecycle, ExtensibleComponent, QualityMonitor, VisionComponent, ActionListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Printable, Serializable, EventListener, Accessible, org.jfree.chart.event.ChartChangeListener, org.jfree.chart.event.ChartProgressListener
Direct Known Subclasses:
PMIChart, PMIEasyChart.EasyChart

public abstract class PMILineChartPanel extends PMIChartPanel implements LoadingMonitor
See Also:
  • Field Details

    • MODE_ZOOM

      protected static final int MODE_ZOOM
      See Also:
    • MODE_PAN

      protected static final int MODE_PAN
      See Also:
    • MODE_MARK

      protected static final int MODE_MARK
      See Also:
    • MODE_XTRACE

      protected static final int MODE_XTRACE
      See Also:
    • plotBackground

      protected Color plotBackground
    • gridlineColor

      protected Color gridlineColor
    • gridlineStroke

      protected Stroke gridlineStroke
    • gridlineDashPattern

      protected String gridlineDashPattern
    • gridlineWidth

      protected float gridlineWidth
    • title

      protected String title
    • titleFont

      protected Font titleFont
    • legend

      protected boolean legend
    • tooltips

      protected boolean tooltips
    • propertiesLoading

      protected int propertiesLoading
    • selectedXValue

      protected String selectedXValue
    • antialias

      protected boolean antialias
    • selectedXValueListener

      protected PropertyChangeListener selectedXValueListener
    • mode

      protected int mode
      Controls the mouse-mode of the graph, such as panning and zooming
    • panStartPoint

      protected Point2D panStartPoint
    • panLine

      protected Line2D panLine
    • panLineStroke

      protected final Stroke panLineStroke
  • Constructor Details

    • PMILineChartPanel

      public PMILineChartPanel()
  • Method Details

    • createEmptyChart

      protected static org.jfree.chart.JFreeChart createEmptyChart(String title, Color bg, Color plot)
    • getPlots

      protected abstract AutoAnnotateXYPlot[] getPlots()
    • createChart

      public final void createChart()
    • createChartImpl

      protected abstract org.jfree.chart.JFreeChart createChartImpl()
    • print

      public int print(Graphics g, PageFormat pf, int pageIndex)
      Overridden to correctly adjust the anchor point for the printed size of the chart
      Specified by:
      print in interface Printable
      Overrides:
      print in class org.jfree.chart.ChartPanel
    • doSaveAs

      public void doSaveAs() throws IOException
      Description copied from class: PMIChartPanel
      Opens a file chooser and gives the user an opportunity to save the chart in PNG format.
      Overrides:
      doSaveAs in class PMIChartPanel
      Throws:
      IOException - if there is an I/O error.
    • saveAsImage

      public String saveAsImage() throws IOException
      Throws:
      IOException
    • saveAsImage

      public String saveAsImage(int width, int height) throws IOException
      Throws:
      IOException
    • getPNGBytes

      public byte[] getPNGBytes(int width, int height) throws IOException
      Throws:
      IOException
    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class org.jfree.chart.ChartPanel
    • createPopupMenu

      protected JPopupMenu createPopupMenu(boolean properties, boolean save, boolean print, boolean zoom)
      Description copied from class: PMIChartPanel
      Creates a popup menu for the panel. Overridden here to get the localized properties from BundleUtil.
      Overrides:
      createPopupMenu in class PMIChartPanel
      Parameters:
      properties - include a menu item for the chart property editor.
      save - include a menu item for saving the chart.
      print - include a menu item for printing the chart.
      zoom - include menu items for zooming.
      Returns:
      The popup menu.
    • resetAxes

      protected void resetAxes()
      Default implementation simply calls createChart()
    • getPlotBackground

      public Color getPlotBackground()
    • setPlotBackground

      public void setPlotBackground(Color color)
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String string)
    • isLegend

      public boolean isLegend()
    • isTooltips

      public boolean isTooltips()
    • setLegend

      public void setLegend(boolean b)
    • setTooltips

      public void setTooltips(boolean b)
    • isOpaque

      public boolean isOpaque()
      Overrides:
      isOpaque in class JComponent
    • getPropertiesLoading

      public int getPropertiesLoading()
      Specified by:
      getPropertiesLoading in interface LoadingMonitor
    • setPropertiesLoading

      public void setPropertiesLoading(int i)
      Specified by:
      setPropertiesLoading in interface LoadingMonitor
    • setBackground

      public void setBackground(Color bg)
      Overrides:
      setBackground in class JComponent
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • setTitleFont

      public void setTitleFont(Font font)
    • getTitleFont

      public Font getTitleFont()
    • setForeground

      public void setForeground(Color fg)
      Overrides:
      setForeground in class JComponent
    • createTitle

      protected org.jfree.chart.title.TextTitle createTitle()
    • setMode

      public void setMode(int newMode)
      Sets the current mode to ZOOM, PAN, MARK, or XTRACE
    • setAutoAnnotationMode

      protected void setAutoAnnotationMode(int mode)
    • mousePressed

      public void mousePressed(MouseEvent event)
      Handles a mouse pressed event (to start panning).

      Overridden to support PAN mode

      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class org.jfree.chart.ChartPanel
      Parameters:
      event - the event.
    • mouseMoved

      public void mouseMoved(MouseEvent event)
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class org.jfree.chart.ChartPanel
    • mouseReleased

      public void mouseReleased(MouseEvent event)
      Handles a mouse released event (stops panning).

      Overridden to support PAN mode

      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class org.jfree.chart.ChartPanel
      Parameters:
      event - the event.
    • mouseDragged

      public void mouseDragged(MouseEvent event)
      Handles a mouse dragged event to perform panning & interactive marking/xtracing
      Specified by:
      mouseDragged in interface MouseMotionListener
      Overrides:
      mouseDragged in class org.jfree.chart.ChartPanel
      Parameters:
      event - the event.
    • redrawAtEventPoint

      protected void redrawAtEventPoint(MouseEvent event)
    • respectDomainRangeOnPan

      protected boolean respectDomainRangeOnPan()
      Determines whether or not the X-axis panning respects the axis's range.
    • setBounds

      public void setBounds(Rectangle bounds)
      Overrides:
      setBounds in class Component
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      This function ONLY overrides the ZOOM_RESET_BOTH_COMMAND, to route it to the correct version of the overridden restoreAutoBounds() function
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class org.jfree.chart.ChartPanel
    • restoreAutoBounds

      public void restoreAutoBounds()
      This is overridden so that when it is called because of zooming a negative rectangle, the chart is totally reset, instead of restoring auto-bounds, because restoring auto-bounds assumes that the axes were set to auto-range in the first place, which isn't necessarilly true
      Overrides:
      restoreAutoBounds in class org.jfree.chart.ChartPanel
    • getPointInRectangle

      public static Point2D getPointInRectangle(double x, double y, Rectangle2D area)
    • getXTraceTrackMouse

      public boolean getXTraceTrackMouse()
    • setXTraceTrackMouse

      public void setXTraceTrackMouse(boolean value)
    • getGridlineColor

      public Color getGridlineColor()
    • setGridlineColor

      public void setGridlineColor(Color gridlineColor)
    • getGridlineDashPattern

      public String getGridlineDashPattern()
    • setGridlineDashPattern

      public void setGridlineDashPattern(String gridlineDashPattern)
    • getGridlineWidth

      public float getGridlineWidth()
    • setGridlineWidth

      public void setGridlineWidth(float gridlineWidth)
    • getGridlineStroke

      public Stroke getGridlineStroke()
    • getSelectedXValue

      public String getSelectedXValue()
    • _setSelectedXValue

      protected void _setSelectedXValue(String domainAnchor)
    • setSelectedXValue

      public void setSelectedXValue(String domainAnchor)