#!/usr/bin/julia

using Pkg
pkg"activate ." # Activate enviroment

using DataFrames, CSV
using Statistics
using Makie, StatsMakie

# Directory of data and files
ECODIR="assets/ECOBICI";
FILE="2019-09.csv";

# Load data from csv to a DataFrame
dt = DataFrame(CSV.File("$ECODIR/$FILE"));
show(dt)

sleep(5)

# Create scene of Makie
scene = Scene()

display(scene)

println("")
println("Scene created!")

# Plot hitograms of "Estacion_Retiro" and "Estacion_Arribo"
plot!(scene, histogram(nbins=200 ), filter(x -> x < 100, sort(dt[!, 4] .+ 0.5 ) ), color = :gray )
plot!(scene, histogram(nbins=200 ), filter(x -> x < 100, sort(dt[!, 7] ) ), color = :black )

display(scene)

# ProgressMeter allows to see a nice graph in terminal
using ProgressMeter

@showprogress for i in 1:20
    sleep(1)
end
