asciichart 1.0.1 → 1.0.2
raw patch · 5 files changed
+16/−17 lines, 5 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +0/−5
- README.md +8/−4
- Setup.hs +0/−2
- asciichart.cabal +2/−2
- src/Data/Text/Chart.hs +6/−4
− ChangeLog.md
@@ -1,5 +0,0 @@-# Revision history for asciichart--## 1.0.0 -- YYYY-mm-dd--* First version. Released on an unsuspecting world.
README.md view
@@ -1,12 +1,16 @@ # asciichart -[](https://opensource.org/licenses/MIT)-[](https://travis-ci.org/madnight/asciichart)+<p><a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg" alt="License: MIT" /></a>+<a href="https://travis-ci.org/madnight/asciichart"><img src="https://travis-ci.org/madnight/asciichart.svg?branch=master" alt="Build Status" /></a>+<img src="https://badgen.net/badge//haskell/purple?icon=haskell" alt="" />+<a href="http://hackage.haskell.org/package/asciichart"><img src="https://images.weserv.nl/?url=img.shields.io/hackage/v/asciichart.svg&h=200&t=fitup&dpr=8" width="100" alt="Hackage" /></a>+<a href="http://hackage.haskell.org/package/asciichart"><img src="https://images.weserv.nl/?url=img.shields.io/hackage-deps/v/asciichart.svg&w=3000&t=fitup" height="20" alt="Hackage-Deps" /></a></p> -ASCII line charts in terminal ╭┈╯. Console line charts in pure Haskell.++ASCII line charts in terminal ╭┈╯. Console line charts in pure Haskell. This is a Haskell port of the Javascript library [kroitor/asciichart](https://github.com/kroitor/asciichart). Free for any usage (MIT License). -+ ## Usage ```bash
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
asciichart.cabal view
@@ -1,5 +1,5 @@ name: asciichart-version: 1.0.1+version: 1.0.2 synopsis: Line charts in terminal license: MIT license-file: LICENSE@@ -10,7 +10,7 @@ copyright: (c) 2018-Present Fabian Beuke category: Text build-type: Simple-extra-source-files: ChangeLog.md, README.md+extra-source-files: README.md cabal-version: >=1.10 tested-with: GHC == 7.8 , GHC == 7.10
src/Data/Text/Chart.hs view
@@ -69,7 +69,8 @@ max' = maximum series range = abs $ max' - min' offset = 3- ratio = fromIntegral (height opts) / fromIntegral range :: Float+ ratio = if range == 0 then 1+ else fromIntegral (height opts) / fromIntegral range :: Float min2 = fromIntegral min' * ratio max2 = fromIntegral max' * ratio rows = round $ abs $ max2 - min2@@ -83,8 +84,9 @@ -- axis and labels forM_ [min2..max2] $ \y -> do- let label = fromInteger max' - (y - min2)- * fromInteger range / fromIntegral rows+ let label = if rows == 0 then y+ else fromInteger max' - (y - min2) *+ fromInteger range / fromIntegral rows result [round $ y - min2] [max 0 $ offset - 5] $ printf ("%" ++ show (pad series) ++ ".2f") label result [round $ y - min2] [offset - 1] . bool "┤" "┼" $ y == 0@@ -112,7 +114,7 @@ -- | Takes a List of Integers and prints out a -- corresponding chart with a default terminal height of 14 blocks. plot :: [Integer] -> IO ()-plot = plotWith options+plot x = if length x < 1 then return () else plotWith options x -- | Same as plot but it's possible to define custom options. -- Example: @'plotWith' options { 'height' = 20 }@