Plot-ho-matic 0.4.0.2 → 0.4.0.3
raw patch · 6 files changed
+38/−16 lines, 6 filesdep +Chart-cairodep +textdep −Chart-gtkdep ~gtkPVP ok
version bump matches the API change (PVP)
Dependencies added: Chart-cairo, text
Dependencies removed: Chart-gtk
Dependency ranges changed: gtk
API changes (from Hackage documentation)
Files
- .travis.yml +1/−1
- Plot-ho-matic.cabal +5/−3
- README.md +5/−1
- src/GraphWidget.hs +7/−5
- src/PlotChart.hs +16/−3
- src/PlotHo.hs +4/−3
.travis.yml view
@@ -2,7 +2,7 @@ env: - GHCVER=7.6.3- - GHCVER=7.8.2 # see note about Alex/Happy+ - GHCVER=7.8.3 # see note about Alex/Happy before_install: - travis_retry sudo add-apt-repository -y ppa:hvr/ghc
Plot-ho-matic.cabal view
@@ -1,5 +1,5 @@ name: Plot-ho-matic-version: 0.4.0.2+version: 0.4.0.3 synopsis: Real-time line plotter for protobuf-like data license: BSD3 license-file: LICENSE@@ -33,11 +33,12 @@ , data-default-class , stm , glib- , gtk+ , gtk >= 0.13 , time , Chart >= 1.1- , Chart-gtk >= 1.1+ , Chart-cairo >= 1.1 , linear+ , text ghc-options: -O2 -Wall ghc-prof-options: -O2 -Wall -prof -fprof-auto -fprof-cafs -rtsopts@@ -60,3 +61,4 @@ , containers ghc-options: -threaded -O2+ ghc-prof-options: -threaded -O2 -Wall -prof -fprof-auto -fprof-cafs -rtsopts
README.md view
@@ -3,4 +3,8 @@ [](https://travis-ci.org/ghorn/Plot-ho-matic) -todo: a readme, for one+See the example in the examples folder for usage.++"user error: out of memory"+If you get this ^ error on OSX your cairo/pango/gtk may be linked to an XQuartz library.+ Add --extra-lib-dirs=/usr/local/lib (or wherever the correct libraries are) to your .cabal/config
src/GraphWidget.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_GHC -Wall #-} {-# Language ScopedTypeVariables #-}+{-# Language PackageImports #-} -- | This module manages the widget which lets the user click signals and stuff @@ -12,10 +13,11 @@ import Control.Monad ( when, unless ) import qualified Data.Sequence as S import qualified Data.Tree as Tree-import Graphics.UI.Gtk ( AttrOp( (:=) ) )-import qualified Graphics.UI.Gtk as Gtk+import "gtk" Graphics.UI.Gtk ( AttrOp( (:=) ) )+import qualified "gtk" Graphics.UI.Gtk as Gtk import Data.Time ( NominalDiffTime ) import System.Glib.Signals ( on )+import qualified Data.Text as T import PlotChart ( GraphInfo(..), AxisScaling(..), XAxisType(..), newChartCanvas ) import PlotTypes ( SignalTree, ListViewInfo(..), Getter )@@ -236,9 +238,9 @@ -- linear or log scaling on the x and y axis? xScalingSelector <- Gtk.comboBoxNewText yScalingSelector <- Gtk.comboBoxNewText- mapM_ (Gtk.comboBoxAppendText xScalingSelector)+ mapM_ (Gtk.comboBoxAppendText xScalingSelector . T.pack) ["linear (auto)","linear (manual)","logarithmic (auto)"]- mapM_ (Gtk.comboBoxAppendText yScalingSelector)+ mapM_ (Gtk.comboBoxAppendText yScalingSelector . T.pack) ["linear (auto)","linear (manual)","logarithmic (auto)"] Gtk.comboBoxSetActive xScalingSelector 0 Gtk.comboBoxSetActive yScalingSelector 0@@ -293,7 +295,7 @@ -- x axis type xAxisTypeSelector <- Gtk.comboBoxNewText- mapM_ (Gtk.comboBoxAppendText xAxisTypeSelector)+ mapM_ (Gtk.comboBoxAppendText xAxisTypeSelector . T.pack) ["shifted counter","counter","shifted time","time"] Gtk.comboBoxSetActive xAxisTypeSelector 0 xAxisTypeSelectorBox <- labeledWidget "x axis:" xAxisTypeSelector
src/PlotChart.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -Wall #-}+{-# Language PackageImports #-} -- | One signals are selected and whatnot, this module just dumbly plots whatever -- is in the GraphInfo data@@ -18,9 +19,9 @@ import Data.Default.Class ( def ) --import qualified Data.Foldable as F --import qualified Data.Sequence as S-import qualified Graphics.UI.Gtk as Gtk+import qualified "gtk" Graphics.UI.Gtk as Gtk import qualified Graphics.Rendering.Chart as Chart-import qualified Graphics.Rendering.Chart.Gtk as ChartGtk+import Graphics.Rendering.Chart.Backend.Cairo ( runBackend, defaultEnv ) import PlotTypes ( Getter ) @@ -85,7 +86,19 @@ let myGraph = displayChart xAxisType (giXScaling gi, giYScaling gi) (giXRange gi, giYRange gi) nameWithPoints- ChartGtk.updateCanvas myGraph canvas+ chartGtkUpdateCanvas myGraph canvas++chartGtkUpdateCanvas :: Chart.Renderable a -> Gtk.DrawingArea -> IO Bool+chartGtkUpdateCanvas chart canvas = do+ win <- Gtk.widgetGetDrawWindow canvas+ (width, height) <- Gtk.widgetGetSize canvas+ regio <- Gtk.regionRectangle $ Gtk.Rectangle 0 0 width height+ let sz = (fromIntegral width,fromIntegral height)+ Gtk.drawWindowBeginPaintRegion win regio+ _ <- Gtk.renderWithDrawable win $ runBackend (defaultEnv Chart.bitmapAlignmentFns) (Chart.render chart sz) + Gtk.drawWindowEndPaint win+ return True+ displayChart :: (Chart.PlotValue a, Show a, RealFloat a) => XAxisType ->
src/PlotHo.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -Wall #-} {-# Language ScopedTypeVariables #-} {-# Language DeriveFunctor #-}+{-# Language PackageImports #-} module PlotHo ( Lookup(..)@@ -17,8 +18,8 @@ import qualified Control.Concurrent as CC import qualified Control.Concurrent.STM as STM import Data.Time ( getCurrentTime, diffUTCTime )-import Graphics.UI.Gtk ( AttrOp( (:=) ) )-import qualified Graphics.UI.Gtk as Gtk+import "gtk" Graphics.UI.Gtk ( AttrOp( (:=) ) )+import qualified "gtk" Graphics.UI.Gtk as Gtk import System.Glib.Signals ( on ) --import System.IO ( withFile, IOMode ( WriteMode ) ) --import qualified Data.ByteString.Lazy as BSL@@ -178,7 +179,7 @@ chanWidgets <- mapM (\x -> x graphWindowsToBeKilled) windows -- ghc stats- statsLabel <- Gtk.labelNew Nothing+ statsLabel <- Gtk.labelNew (Nothing :: Maybe String) let statsWorker = do CC.threadDelay 500000 msg <- if statsEnabled