Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# FloatingTableView

View your datasets in a new window. Ideal for terminal-based data cleaning workflows.

FloatingTableView.jl leverages Julia Computing's [TableView.jl](https://github.com/JuliaComputing/TableView.jl) and [Blink.jl](https://github.com/JuliaGizmos/Blink.jl) to view any [Tables.jl](https://github.com/JuliaData/Tables.jl) compatible data source in an Electron-based window.

The function exports a single, one-argument function

```
julia> using DataFrames, FloatingTableView

julia> df = DataFrame(rand(100, 100));

julia> browse(df)
```

Because TableView.jl uses lazy-loading of data, FloatingTableView can handle very large datasets with no performance penalty. However, because it uses an Electron-based window via Blink.jl, there is a non-trivial "time to first browse" startup time. Repeated calls to `browse` will be fast.

Similar packages: [BrowseTables.jl](https://github.com/tpapp/BrowseTables.jl). Opens tables in a browser instead of an electron window, which may offer slightly improved performance for small datasets. However columns are not re-sizeable. Due the lazy-loading FloatingTableView will offer much better performance for large datasets.


42 changes: 38 additions & 4 deletions src/FloatingTableView.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ module FloatingTableView

using Blink, TableView

export browse
export browse, showtable

# Method for keeping current window active borrowed
# from Plots.jl
mutable struct CurrentWin
nullablewin::Union{Blink.Window, Nothing}
end
Expand All @@ -24,13 +26,45 @@ end

current(win::Blink.Window) = (CURRENT_WIN.nullablewin = win)

function browse(df)
"""
browse(t; kwargs)

Browse data source in a new Blink window using
Tables.jl's `showtable` function.

# Arguments

- `t`, a Tables.jl-compatible data source,
for example a `DataFrame` or a `NamedTuple`
of `Vector`s
- `kwargs`, keyword arguments passed to the
`showtable` command from TableView.jl to
control the details of the new data viewer.
See [`showtable`](@ref) for details.

# Examples

```julia
julia> t = (a = rand(10), b = rand(10))

julia> browse(t)
```

```julia
julia> t = rand(100, 100)

julia> browse(t, dark = true)
```

See also: [`showtable`](@ref)
"""
function browse(df; kwargs...)
if iswinnull() || !active(current())
w = Blink.Window()
current(w)
body!(current(), showtable(df))
body!(current(), showtable(df; kwargs...))
else
body!(current(), showtable(df))
body!(current(), showtable(df; kwargs...))
end

return nothing
Expand Down