wx.lib.plot: patch #1663937 to allow user to turn off scientific

notation on plot.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@44586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-03-01 01:26:13 +00:00
parent 5d1ccdb489
commit 8cb3186049
2 changed files with 12 additions and 1 deletions

View File

@@ -32,6 +32,9 @@ you can now write::
Will Sadkin provided a patch for the wx.lib.masked package that fixes Will Sadkin provided a patch for the wx.lib.masked package that fixes
its support for using the navigation keys on the numeric keypad. its support for using the navigation keys on the numeric keypad.
wx.lib.plot: patch #1663937 to allow user to turn off scientific
notation on plot.

View File

@@ -567,6 +567,8 @@ class PlotCanvas(wx.Panel):
self._pointLabelFunc= None self._pointLabelFunc= None
self.canvas.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) self.canvas.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
self._useScientificNotation = False
self.canvas.Bind(wx.EVT_PAINT, self.OnPaint) self.canvas.Bind(wx.EVT_PAINT, self.OnPaint)
self.canvas.Bind(wx.EVT_SIZE, self.OnSize) self.canvas.Bind(wx.EVT_SIZE, self.OnSize)
# OnSize called to make sure the buffer is initialized. # OnSize called to make sure the buffer is initialized.
@@ -746,6 +748,12 @@ class PlotCanvas(wx.Panel):
"""Set True to show scrollbars""" """Set True to show scrollbars"""
return self.sb_vert.IsShown() return self.sb_vert.IsShown()
def SetUseScientificNotation(self, useScientificNotation):
self._useScientificNotation = useScientificNotation
def GetUseScientificNotation(self):
return self._useScientificNotation
def SetEnableDrag(self, value): def SetEnableDrag(self, value):
"""Set True to enable drag.""" """Set True to enable drag."""
if value not in [True,False]: if value not in [True,False]:
@@ -1565,7 +1573,7 @@ class PlotCanvas(wx.Panel):
error = e error = e
factor = f factor = f
grid = factor * 10.**power grid = factor * 10.**power
if power > 4 or power < -4: if self._useScientificNotation and (power > 4 or power < -4):
format = '%+7.1e' format = '%+7.1e'
elif power >= 0: elif power >= 0:
digits = max(1, int(power)) digits = max(1, int(power))