Skip to content

AgTables is an easy-to-use wrapper for the AG Grid library, designed for quick visualization and easy sharing of tabular data

License

Notifications You must be signed in to change notification settings

bhftbootcamp/AgTables.jl

Repository files navigation

AgTables.jl

Stable Dev Build Status Coverage Registry

AgTables is an easy-to-use wrapper for the AG Grid library, designed for quick visualization and easy sharing of tabular data.

Installation

If you haven't installed our local registry yet, do that first:

] registry add https://github.com/bhftbootcamp/Green.git

To install AgTables, simply use the Julia package manager:

] add AgTables

Usage

In the most basic scenario, the user just needs to parse the data and put it in a table:

using AgTables

julia> order_data = ag_order_sample_data()
100-element Vector{AgTables.Order}:
 AgTables.Order("LTCUSDT", DateTime("2024-05-29T13:40:00"), "ORD00001", ...)
 AgTables.Order("ETHUSDT", DateTime("2024-05-29T12:30:00"), "ORD00002", ...)
 AgTables.Order("XRPUSDT", DateTime("2024-05-29T13:00:00"), "ORD00003", ...)

julia> order_table = ag_table(order_data)
AgTables.AGTable(Sheet1)

julia> ag_show(order_table)
true

order_table

To go further, the user can composite panels from tables and configure different parameters for each column of the table:

using AgTables

ag_show(
    ag_panel(
        ag_table(
            ag_stock_sample_data(),
            AgNumberColumnDef(;
                field_name = "price",
                str_format = "%s <span style='font-size:10px;color:rgb(120,123,134);font-weight:400'>USD</span>",
                visible = true,
            ),
            AgNumberColumnDef(;
                field_name = "h24",
                header_name = "24h%",
                formatter = AGFormatter(;
                    style = AG_PERCENT,
                    maximum_fraction_digits = 2,
                ),
                threshold = AGThreshold(
                    0;
                    color_up = "#22ab94",
                    color_down = "#f23645",
                ),
                filter = true,
            ),
            AgNumberColumnDef(;
                field_name = "volume",
                formatter = AGFormatter(;
                    short = true,
                ),
            ),
            AgNumberColumnDef(;
                field_name = "mkt",
                header_name = "market сap",
                formatter = AGFormatter(;
                    style = AG_CURRENCY,
                    currency = AgTables.USD,
                    separator = true,
                ),
            ),
            AgStringColumnDef(;
                field_name = "sector",
                filter = true,
            );
            column_filter = true,
            name = "Stocks",
        ),
        ag_table(
            ag_order_sample_data(),
            AgStringColumnDef(;
                field_name = "symbol",
                filter = true,
            ),
            AgStringColumnDef(;
                field_name = "orderSide",
                color_map = Dict(
                    "BUY" => "green",
                    "SELL" => "red",
                ),
                filter = true,
            ),
            name = "Orders",
        ),
    ),
)

stock_order_panel

Using AG Grid Enterprise

Set AG_GRID_LICENSE_KEY at runtime to enable AG Grid's enterprise features:

ENV["AG_GRID_LICENSE_KEY"] = "YOUR_LICENSE_KEY_HERE"

Contributing

Contributions to AgTables are welcome! If you encounter a bug, have a feature request, or would like to contribute code, please open an issue or a pull request on GitHub.

About

AgTables is an easy-to-use wrapper for the AG Grid library, designed for quick visualization and easy sharing of tabular data

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •