Package wx :: Package lib :: Module plot :: Class PlotCanvas

[frames | no frames]

## Type PlotCanvas

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                     Panel --+
                             |
                            PlotCanvas

Subclass of a wx.Panel which holds two scrollbars and the actual plotting canvas (self.canvas). It allows for simple general plotting of data with zoom, labels, and automatic axis scaling.

Method Summary
| ``__init__`(self, parent, id, pos, size, style, name)` Constructs a panel, which can be a child of a frame or any other non-control window
| ``Clear`(self)` Erase the window.
| ``Draw`(self, graphics, xAxis, yAxis, dc)` Wrapper around _Draw, which handles log axes
| ``GetClosestPoint`(self, pntXY, pointScaled)` Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for only the closest curve.
| ``GetClosestPoints`(self, pntXY, pointScaled)` Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for each curve.
| ``GetClosetPoint`(self, pntXY, pointScaled)` Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for only the closest curve.
| `GetEnableDrag(self)`
| ``GetEnableGrid`(self)` True if grid enabled.
| ``GetEnableLegend`(self)` True if Legend enabled.
| ``GetEnablePointLabel`(self)` True if pointLabel enabled.
| ``GetEnableZoom`(self)` True if zooming enabled.
| ``GetFontSizeAxis`(self)` Get current tick and axis label font size in points
| ``GetFontSizeLegend`(self)` Get current Legend font size in points
| ``GetFontSizeTitle`(self)` Get current Title font size in points
| `GetGridColour(self)`
| `getLogScale(self)`
| ``GetPointLabelFunc`(self)` Returns pointLabel Drawing Function
| ``GetShowScrollbars`(self)` Set True to show scrollbars
| `GetUseScientificNotation(self)`
| `GetXCurrentRange(self)`
| `GetXMaxRange(self)`
| ``GetXSpec`(self)` Returns current XSpec for axis
| ``GetXY`(self, event)` Wrapper around _getXY, which handles log scales
| `GetYCurrentRange(self)`
| `GetYMaxRange(self)`
| ``GetYSpec`(self)` Returns current YSpec for axis
| ``OnLeave`(self, event)` Used to erase pointLabel when mouse outside window
| `OnMotion(self, event)`
| `OnMouseDoubleClick(self, event)`
| `OnMouseLeftDown(self, event)`
| `OnMouseLeftUp(self, event)`
| `OnMouseRightDown(self, event)`
| `OnPaint(self, event)`
| `OnScroll(self, evt)`
| `OnSize(self, event)`
| ``PageSetup`(self)` Brings up the page setup dialog
| ``PositionScreenToUser`(self, pntXY)` Converts Screen position to User Coordinates
| ``PositionUserToScreen`(self, pntXY)` Converts User position to Screen Coordinates
| ``Printout`(self, paper)` Print current plot.
| ``PrintPreview`(self)` Print-preview current plot.
| ``Redraw`(self, dc)` Redraw the existing plot.
| ``Reset`(self)` Unzoom the plot.
| ``SaveFile`(self, fileName)` Saves the file to the type specified in the extension.
| ``ScrollRight`(self, units)` Move view right number of axis units.
| ``ScrollUp`(self, units)` Move view up number of axis units.
| `SetCursor(self, cursor)`
| ``SetEnableDrag`(self, value)` Set True to enable drag.
| ``SetEnableGrid`(self, value)` Set True to enable grid.
| ``SetEnableLegend`(self, value)` Set True to enable legend.
| ``SetEnablePointLabel`(self, value)` Set True to enable pointLabel.
| ``SetEnableZoom`(self, value)` Set True to enable zooming.
| ``SetFontSizeAxis`(self, point)` Set the tick and axis label font size (default is 10 point)
| ``SetFontSizeLegend`(self, point)` Set Legend font size (default is 7 point)
| ``SetFontSizeTitle`(self, point)` Set Title font size (default is 15 point)
| `SetGridColour(self, colour)`
| `setLogScale(self, logscale)`
| ``SetPointLabelFunc`(self, func)` Sets the function with custom code for pointLabel drawing **** more info needed ***********
| ``SetShowScrollbars`(self, value)` Set True to show scrollbars
| `SetUseScientificNotation(self, useScientificNotation)`
| ``SetXSpec`(self, type)` xSpec- defines x axis type.
| ``SetYSpec`(self, type)` ySpec- defines x axis type.
| ``UpdatePointLabel`(self, mDataDict)` Updates the pointLabel point on screen with data contained in mDataDict.
| ``Zoom`(self, Center, Ratio)` Zoom on the plot Centers on the X,Y coords given in Center Zooms by the Ratio = (Xratio, Yratio) given

Property Summary

Instance Method Details

### __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0, name='plotCanvas')
(Constructor)

Constructs a panel, which can be a child of a frame or any other non-control window

  Overrides:
    `wx.Panel.__init__`

### Clear(self)

Erase the window.

### Draw(self, graphics, xAxis=None, yAxis=None, dc=None)

Wrapper around _Draw, which handles log axes

### GetClosestPoint(self, pntXY, pointScaled=True)

Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for only the closest curve. Returns [] if no curves are being plotted.

x, y in user coords if pointScaled == True based on screen coords if pointScaled == False based on user coords

### GetClosestPoints(self, pntXY, pointScaled=True)

Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for each curve. Returns [] if no curves are being plotted.

x, y in user coords if pointScaled == True based on screen coords if pointScaled == False based on user coords

### GetClosetPoint(self, pntXY, pointScaled=True)

Returns list with [curveNumber, legend, index of closest point, pointXY, scaledXY, distance] list for only the closest curve. Returns [] if no curves are being plotted.

x, y in user coords if pointScaled == True based on screen coords if pointScaled == False based on user coords

### GetEnableGrid(self)

True if grid enabled.

### GetEnableLegend(self)

True if Legend enabled.

### GetEnablePointLabel(self)

True if pointLabel enabled.

### GetEnableZoom(self)

True if zooming enabled.

### GetFontSizeAxis(self)

Get current tick and axis label font size in points

### GetFontSizeLegend(self)

Get current Legend font size in points

### GetFontSizeTitle(self)

Get current Title font size in points

### GetPointLabelFunc(self)

Returns pointLabel Drawing Function

### GetShowScrollbars(self)

Set True to show scrollbars

### GetXSpec(self)

Returns current XSpec for axis

### GetXY(self, event)

Wrapper around _getXY, which handles log scales

### GetYSpec(self)

Returns current YSpec for axis

### OnLeave(self, event)

Used to erase pointLabel when mouse outside window

### PageSetup(self)

Brings up the page setup dialog

### PositionScreenToUser(self, pntXY)

Converts Screen position to User Coordinates

### PositionUserToScreen(self, pntXY)

Converts User position to Screen Coordinates

### Printout(self, paper=None)

Print current plot.

### PrintPreview(self)

Print-preview current plot.

### Redraw(self, dc=None)

Redraw the existing plot.

### Reset(self)

Unzoom the plot.

### SaveFile(self, fileName='')

Saves the file to the type specified in the extension. If no file name is specified a dialog box is provided. Returns True if sucessful, otherwise False.

.bmp Save a Windows bitmap file. .xbm Save an X bitmap file. .xpm Save an XPM bitmap file. .png Save a Portable Network Graphics file. .jpg Save a Joint Photographic Experts Group file.

### ScrollRight(self, units)

Move view right number of axis units.

### ScrollUp(self, units)

Move view up number of axis units.

### SetEnableDrag(self, value)

Set True to enable drag.

### SetEnableGrid(self, value)

Set True to enable grid.

### SetEnableLegend(self, value)

Set True to enable legend.

### SetEnablePointLabel(self, value)

Set True to enable pointLabel.

### SetEnableZoom(self, value)

Set True to enable zooming.

### SetFontSizeAxis(self, point=10)

Set the tick and axis label font size (default is 10 point)

### SetFontSizeLegend(self, point=7)

Set Legend font size (default is 7 point)

### SetFontSizeTitle(self, point=15)

Set Title font size (default is 15 point)

### SetPointLabelFunc(self, func)

Sets the function with custom code for pointLabel drawing **** more info needed ***********

### SetShowScrollbars(self, value)

Set True to show scrollbars

### SetXSpec(self, type='auto')

    xSpec- defines x axis type. Can be 'none', 'min' or 'auto'
    where:
        'none' - shows no axis or tick mark values
        'min' - shows min bounding box values
        'auto' - rounds axis range to sensible values

### SetYSpec(self, type='auto')

    ySpec- defines x axis type. Can be 'none', 'min' or 'auto'
    where:
        'none' - shows no axis or tick mark values
        'min' - shows min bounding box values
        'auto' - rounds axis range to sensible values

### UpdatePointLabel(self, mDataDict)

Updates the pointLabel point on screen with data contained in mDataDict.

mDataDict will be passed to your function set by SetPointLabelFunc. It can contain anything you want to display on the screen at the scaledXY point you specify.

This function can be called from parent window with onClick, onMotion events etc.

### Zoom(self, Center, Ratio)

Zoom on the plot Centers on the X,Y coords given in Center Zooms by the Ratio = (Xratio, Yratio) given

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:12:43 2007 | http://epydoc.sf.net