Class PMILineChartPanel

    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean antialias  
      protected java.awt.Color gridlineColor  
      protected java.lang.String gridlineDashPattern  
      protected java.awt.Stroke gridlineStroke  
      protected float gridlineWidth  
      protected boolean legend  
      protected int mode
      Controls the mouse-mode of the graph, such as panning and zooming
      protected static int MODE_MARK  
      protected static int MODE_PAN  
      protected static int MODE_XTRACE  
      protected static int MODE_ZOOM  
      protected java.awt.geom.Line2D panLine  
      protected java.awt.Stroke panLineStroke  
      protected java.awt.geom.Point2D panStartPoint  
      protected java.awt.Color plotBackground  
      protected int propertiesLoading  
      protected java.lang.String selectedXValue  
      protected java.beans.PropertyChangeListener selectedXValueListener  
      protected java.lang.String title  
      protected java.awt.Font titleFont  
      protected boolean tooltips  
      • Fields inherited from class org.jfree.chart.ChartPanel

        DEFAULT_BUFFER_USED, DEFAULT_HEIGHT, DEFAULT_MAXIMUM_DRAW_HEIGHT, DEFAULT_MAXIMUM_DRAW_WIDTH, DEFAULT_MINIMUM_DRAW_HEIGHT, DEFAULT_MINIMUM_DRAW_WIDTH, DEFAULT_WIDTH, DEFAULT_ZOOM_TRIGGER_DISTANCE, localizationResources, PRINT_COMMAND, PROPERTIES_COMMAND, SAVE_COMMAND, ZOOM_IN_BOTH_COMMAND, ZOOM_IN_DOMAIN_COMMAND, ZOOM_IN_RANGE_COMMAND, ZOOM_OUT_BOTH_COMMAND, ZOOM_OUT_DOMAIN_COMMAND, ZOOM_OUT_RANGE_COMMAND, ZOOM_RESET_BOTH_COMMAND, ZOOM_RESET_DOMAIN_COMMAND, ZOOM_RESET_RANGE_COMMAND
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface java.awt.print.Printable

        NO_SUCH_PAGE, PAGE_EXISTS
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void _setSelectedXValue​(java.lang.String domainAnchor)  
      void actionPerformed​(java.awt.event.ActionEvent event)
      This function ONLY overrides the ZOOM_RESET_BOTH_COMMAND, to route it to the correct version of the overridden restoreAutoBounds() function
      void createChart()  
      protected abstract org.jfree.chart.JFreeChart createChartImpl()  
      protected static org.jfree.chart.JFreeChart createEmptyChart​(java.lang.String title, java.awt.Color bg, java.awt.Color plot)  
      protected javax.swing.JPopupMenu createPopupMenu​(boolean properties, boolean save, boolean print, boolean zoom)
      Creates a popup menu for the panel.
      protected org.jfree.chart.title.TextTitle createTitle()  
      void doSaveAs()
      Opens a file chooser and gives the user an opportunity to save the chart in PNG format.
      java.awt.Color getGridlineColor()  
      java.lang.String getGridlineDashPattern()  
      java.awt.Stroke getGridlineStroke()  
      float getGridlineWidth()  
      java.awt.Color getPlotBackground()  
      protected abstract AutoAnnotateXYPlot[] getPlots()  
      byte[] getPNGBytes​(int width, int height)  
      static java.awt.geom.Point2D getPointInRectangle​(double x, double y, java.awt.geom.Rectangle2D area)  
      int getPropertiesLoading()  
      java.lang.String getSelectedXValue()  
      java.lang.String getTitle()  
      java.awt.Font getTitleFont()  
      boolean getXTraceTrackMouse()  
      boolean isLegend()  
      boolean isOpaque()  
      boolean isTooltips()  
      void mouseDragged​(java.awt.event.MouseEvent event)
      Handles a mouse dragged event to perform panning & interactive marking/xtracing
      void mouseMoved​(java.awt.event.MouseEvent event)  
      void mousePressed​(java.awt.event.MouseEvent event)
      Handles a mouse pressed event (to start panning).
      void mouseReleased​(java.awt.event.MouseEvent event)
      Handles a mouse released event (stops panning).
      void paintComponent​(java.awt.Graphics g)  
      int print​(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
      Overridden to correctly adjust the anchor point for the printed size of the chart
      protected void redrawAtEventPoint​(java.awt.event.MouseEvent event)  
      protected void resetAxes()
      Default implementation simply calls createChart()
      protected boolean respectDomainRangeOnPan()
      Determines whether or not the X-axis panning respects the axis's range.
      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
      java.lang.String saveAsImage()  
      java.lang.String saveAsImage​(int width, int height)  
      protected void setAutoAnnotationMode​(int mode)  
      void setBackground​(java.awt.Color bg)  
      void setBounds​(java.awt.Rectangle bounds)  
      void setFont​(java.awt.Font font)  
      void setForeground​(java.awt.Color fg)  
      void setGridlineColor​(java.awt.Color gridlineColor)  
      void setGridlineDashPattern​(java.lang.String gridlineDashPattern)  
      void setGridlineWidth​(float gridlineWidth)  
      void setLegend​(boolean b)  
      void setMode​(int newMode)
      Sets the current mode to ZOOM, PAN, MARK, or XTRACE
      void setPlotBackground​(java.awt.Color color)  
      void setPropertiesLoading​(int i)  
      void setSelectedXValue​(java.lang.String domainAnchor)  
      void setTitle​(java.lang.String string)  
      void setTitleFont​(java.awt.Font font)  
      void setTooltips​(boolean b)  
      void setXTraceTrackMouse​(boolean value)  
      • Methods inherited from class org.jfree.chart.ChartPanel

        addChartMouseListener, chartChanged, chartProgress, doEditChartProperties, getAnchor, getChart, getChartRenderingInfo, getDefaultDirectoryForSaveAs, getDismissDelay, getEntityForPoint, getFillZoomRectangle, getHorizontalAxisTrace, getHorizontalTraceLine, getInitialDelay, getListeners, getMaximumDrawHeight, getMaximumDrawWidth, getMinimumDrawHeight, getMinimumDrawWidth, getPopupMenu, getRefreshBuffer, getReshowDelay, getScaleX, getScaleY, getScreenDataArea, getScreenDataArea, getVerticalAxisTrace, getVerticalTraceLine, getZoomAroundAnchor, getZoomInFactor, getZoomOutFactor, getZoomTriggerDistance, isDomainZoomable, isEnforceFileExtensions, isRangeZoomable, mouseClicked, mouseEntered, mouseExited, removeChartMouseListener, restoreAutoDomainBounds, restoreAutoRangeBounds, scale, setAnchor, setChart, setDefaultDirectoryForSaveAs, setDismissDelay, setDisplayToolTips, setDomainZoomable, setEnforceFileExtensions, setFillZoomRectangle, setHorizontalAxisTrace, setHorizontalTraceLine, setInitialDelay, setMaximumDrawHeight, setMaximumDrawWidth, setMinimumDrawHeight, setMinimumDrawWidth, setMouseZoomable, setMouseZoomable, setPopupMenu, setRangeZoomable, setRefreshBuffer, setReshowDelay, setVerticalAxisTrace, setVerticalTraceLine, setZoomAroundAnchor, setZoomInFactor, setZoomOutFactor, setZoomTriggerDistance, translateJava2DToScreen, translateScreenToJava2D, updateUI, zoom, zoomInBoth, zoomInDomain, zoomInRange, zoomOutBoth, zoomOutDomain, zoomOutRange
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • plotBackground

        protected java.awt.Color plotBackground
      • gridlineColor

        protected java.awt.Color gridlineColor
      • gridlineStroke

        protected java.awt.Stroke gridlineStroke
      • gridlineDashPattern

        protected java.lang.String gridlineDashPattern
      • gridlineWidth

        protected float gridlineWidth
      • title

        protected java.lang.String title
      • titleFont

        protected java.awt.Font titleFont
      • legend

        protected boolean legend
      • tooltips

        protected boolean tooltips
      • propertiesLoading

        protected int propertiesLoading
      • selectedXValue

        protected java.lang.String selectedXValue
      • antialias

        protected boolean antialias
      • selectedXValueListener

        protected java.beans.PropertyChangeListener selectedXValueListener
      • mode

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

        protected java.awt.geom.Point2D panStartPoint
      • panLine

        protected java.awt.geom.Line2D panLine
      • panLineStroke

        protected final java.awt.Stroke panLineStroke
    • Constructor Detail

      • PMILineChartPanel

        public PMILineChartPanel()
    • Method Detail

      • createEmptyChart

        protected static org.jfree.chart.JFreeChart createEmptyChart​(java.lang.String title,
                                                                     java.awt.Color bg,
                                                                     java.awt.Color plot)
      • createChart

        public final void createChart()
      • createChartImpl

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

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

        public void doSaveAs()
                      throws java.io.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:
        java.io.IOException - if there is an I/O error.
      • saveAsImage

        public java.lang.String saveAsImage()
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • saveAsImage

        public java.lang.String saveAsImage​(int width,
                                            int height)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getPNGBytes

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

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

        protected javax.swing.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 java.awt.Color getPlotBackground()
      • setPlotBackground

        public void setPlotBackground​(java.awt.Color color)
      • getTitle

        public java.lang.String getTitle()
      • setTitle

        public void setTitle​(java.lang.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 javax.swing.JComponent
      • setBackground

        public void setBackground​(java.awt.Color bg)
        Overrides:
        setBackground in class javax.swing.JComponent
      • setFont

        public void setFont​(java.awt.Font font)
        Overrides:
        setFont in class javax.swing.JComponent
      • setTitleFont

        public void setTitleFont​(java.awt.Font font)
      • getTitleFont

        public java.awt.Font getTitleFont()
      • setForeground

        public void setForeground​(java.awt.Color fg)
        Overrides:
        setForeground in class javax.swing.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​(java.awt.event.MouseEvent event)
        Handles a mouse pressed event (to start panning).

        Overridden to support PAN mode

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

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

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

        Overridden to support PAN mode

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

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

        protected void redrawAtEventPoint​(java.awt.event.MouseEvent event)
      • respectDomainRangeOnPan

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

        public void setBounds​(java.awt.Rectangle bounds)
        Overrides:
        setBounds in class java.awt.Component
      • actionPerformed

        public void actionPerformed​(java.awt.event.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 java.awt.event.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 java.awt.geom.Point2D getPointInRectangle​(double x,
                                                                double y,
                                                                java.awt.geom.Rectangle2D area)
      • getXTraceTrackMouse

        public boolean getXTraceTrackMouse()
      • setXTraceTrackMouse

        public void setXTraceTrackMouse​(boolean value)
      • getGridlineColor

        public java.awt.Color getGridlineColor()
      • setGridlineColor

        public void setGridlineColor​(java.awt.Color gridlineColor)
      • getGridlineDashPattern

        public java.lang.String getGridlineDashPattern()
      • setGridlineDashPattern

        public void setGridlineDashPattern​(java.lang.String gridlineDashPattern)
      • getGridlineWidth

        public float getGridlineWidth()
      • setGridlineWidth

        public void setGridlineWidth​(float gridlineWidth)
      • getGridlineStroke

        public java.awt.Stroke getGridlineStroke()
      • getSelectedXValue

        public java.lang.String getSelectedXValue()
      • _setSelectedXValue

        protected void _setSelectedXValue​(java.lang.String domainAnchor)
      • setSelectedXValue

        public void setSelectedXValue​(java.lang.String domainAnchor)