Merge branch 'master' of https://git.wmi.amu.edu.pl/s473558/profun
This commit is contained in:
commit
16981d9d3f
@ -16,3 +16,4 @@ This project makes use of the following dependencies (specified in `profun.cabal
|
||||
* bytestring (for ByteString type)
|
||||
* utf8-string (for conversion from String to ByteString)
|
||||
* time (for getting date)
|
||||
* process (for opening svg file)
|
||||
|
@ -16,6 +16,7 @@ main = do
|
||||
apiKey <- getWeatherKey
|
||||
|
||||
generatePlot 20 35 25 --example
|
||||
openPlot
|
||||
|
||||
putStrLn "Enter a city name: "
|
||||
city <- getLine
|
||||
|
10
app/Plot.hs
10
app/Plot.hs
@ -1,6 +1,7 @@
|
||||
module Plot where
|
||||
import Graphics.Rendering.Chart.Easy
|
||||
import Graphics.Rendering.Chart.Backend.Diagrams
|
||||
import System.Process (callCommand)
|
||||
|
||||
|
||||
formatData :: Double -> Double -> Double -> [(Int, Double)]
|
||||
@ -13,4 +14,11 @@ generatePlot yday tday tmrw = toFile def "plot/weather.svg" $ do
|
||||
layout_margin .= 30
|
||||
layout_y_axis . laxis_generate .= scaledAxis def (-10, 40)
|
||||
layout_x_axis . laxis_generate .= autoIndexAxis ["Yesterday", "Today", "Tomorrow"]
|
||||
plot $ line "Degrees Celsius" [formatData yday tday tmrw]
|
||||
plot $ line "Degrees Celsius" [formatData yday tday tmrw]
|
||||
|
||||
|
||||
openPlot :: IO ()
|
||||
openPlot = callCommand "start plot/weather.svg"
|
||||
-- start plot/weather.svg -- Windows
|
||||
-- xdg-open plot/weather.svg -- Linux
|
||||
-- open plot/weather.svg -- macOS
|
@ -74,7 +74,8 @@ executable profun
|
||||
aeson ^>=2.2.2.0,
|
||||
bytestring ^>=0.12.1.0,
|
||||
utf8-string ^>=1.0.2,
|
||||
time ^>=1.12.2
|
||||
time ^>=1.12.2,
|
||||
process ^>=1.6.18.0
|
||||
|
||||
-- Directories containing source files.
|
||||
hs-source-dirs: app
|
||||
|
Loading…
Reference in New Issue
Block a user