{"id":20279745,"url":"https://github.com/genieframework/stipplepivottable.jl","last_synced_at":"2025-10-26T05:49:17.063Z","repository":{"id":252805982,"uuid":"840672536","full_name":"GenieFramework/StipplePivotTable.jl","owner":"GenieFramework","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-03T08:00:44.000Z","size":396,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-01T07:23:00.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GenieFramework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-10T10:31:15.000Z","updated_at":"2025-02-03T07:45:20.000Z","dependencies_parsed_at":"2025-01-28T15:23:12.403Z","dependency_job_id":"e839eb40-3c60-473d-8167-85357dbf3fde","html_url":"https://github.com/GenieFramework/StipplePivotTable.jl","commit_stats":null,"previous_names":["genieframework/stipplepivottable.jl"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenieFramework%2FStipplePivotTable.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenieFramework%2FStipplePivotTable.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenieFramework%2FStipplePivotTable.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenieFramework%2FStipplePivotTable.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GenieFramework","download_url":"https://codeload.github.com/GenieFramework/StipplePivotTable.jl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241773256,"owners_count":20018064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T13:32:56.396Z","updated_at":"2025-10-26T05:49:12.019Z","avatar_url":"https://github.com/GenieFramework.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StipplePivotTable\n\nThis component renders a configurable Pivot Table featuring aggregations, filters, and row/column sorting.\n\n## How to use\n\nThe component accepts the following properties:\n\n### data\n\nThe data source for the pivot table. Expected format is any object that complies to the Tables.jl interface (most commonly a DataFrame).\n\nExample:\n\n```julia\n# load json file and parse it, then convert it to a DataFrame\njson_string = read(json_file, String)\nraw_data = JSON3.read(json_string)\ndataframe = DataFrame(raw_data)     # Use this variable for the component's \"data\" property\n```\n\n### rows\n\nA list of `Cell` objects defining the rows aggregation hierarchy. Each `Cell` object should include the following properties:\n\n- `field`: Name of the data source field.\n- `sort_by`: Criteria to perform sorting. Defaults to `\"label\"`. Other accepted values must reference items in the `\"Values\"` section, concatenating field name and aggregation function, joined by underscore `\"_\"` (i.e. `\"Annual Salary_sum\"`)\n- `order`: Order of sorting. Accepted values: `\"asc\"` (default), `\"desc\"`.\n- `label`: The label of the cell. Defaults to the value of `field`.\n\nExample:\n\n```julia\nrows = [\n    Cell(field = \"Business Unit\", sort_by = \"label\", order = \"asc\", label = \"Business U.\"),\n    Cell(field = \"Department\", sort_by = \"label\", order = \"desc\")\n]\n```\n\n### columns\n\nA list of `Cell` objects defining the columns aggregation hierarchy. Each `Cell` object should include the following properties:\n\n- `field`: Name of the data source field.\n- `sort_by`: Criteria to perform sorting. Defaults to `\"label\"`. Other accepted values must reference items in the `\"Values\"` section, concatenating field name and aggregation function, joined by underscore `\"_\"` (i.e. `\"Annual Salary_sum\"`)\n- `order`: Order of sorting. Accepted values: `\"asc\"` (default), `\"desc\"`.\n- `label`: The label of the cell. Defaults to the value of `field`.\n\nExample:\n\n```julia\ncolumns = [\n    Cell(field = \"Annual Salary\", sort_by = \"label\", order = \"asc\", label = \"Salary\"),\n    Cell(field = \"Gender\", sort_by = \"label\", order = \"desc\")\n]\n```\n\n### values\n\nA list of `Value` objects defining the values to be aggregated in the pivot table. Each `Value` object should include the following properties:\n\n- `field`: Name of the data source field.\n- `aggregation`: The aggregation method to be applied to the field.\n- `formula`: An optional formula for calculating the value. Defaults to `nothing`.\n- `label`: A label for the value. Defaults to the value of `field`.\n\nExample:\n\n```julia\nvalues = [\n    Value(field = \"Annual Salary\", aggregation = \"sum\", format = CurrencyFormatter( decimals=2, symbol=\"€\", position=\"after\" )),\n    Value(field = \"Annual Salary\", aggregation = \"custom\", formula = \"{Annual Salary} * 0.21\", label = \"Tax\", format = PercentageFormatter( decimals=2, multiply_by_100=true)\n]\n```\n\n#### Built-in aggregation methods\n- `sum`: Sum of values\n- `count`: Count of records\n- `counta`: Count of non-null values\n- `countunique`: Count of unique values\n- `average`: Average (mean) of values\n- `max`: Maximum value\n- `min`: Minimum value\n- `median`: Median value\n- `stdev`: Sample standard deviation\n- `stdevp`: Population standard deviation\n- `var`: Sample variance\n- `varp`: Population variance\n- `custom`: Custom formula\n\n#### Custom formula syntax\n\n- Use curly braces to reference fields: `{fieldName}`\n- Example: `{Annual Salary} * 0.21`\n\n#### Formatting Configuration\n\n- NumberFormatter\n    - `decimals`: Number of decimals, default is `2`\n- CurrencyFormatter\n    - `decimals`: Number of decimals, default is `2`\n    - `symbol`: Currency symbol to display (`$`, `€`...), default is `$`\n    - `position`: Position of the symbol in the cell (`before` or `after`), default is `before`\n- PercentageFormatter\n    - `decimals`: Number of decimals, default is `2`\n    - `multiply_by_100`: Automatically multiply by 100, default is `true`\n\n\n### filters\n\nA list of `Filter` objects defining the filters to be applied to the pivot table. Each `Filter` object should include the following properties:\n\n- `field`: The field to which the filter is applied.\n- `condition`: The condition to be applied on the field.\n- `type`: The type of the filter, default is `nothing`.\n- `value`: The value for the filter, default is `nothing`.\n- `selected_values`: The selected values for the filter, default is `nothing`.\n\nExample:\n\n```julia\nfilters = [\n    Filter(field = \"Annual Salary\", condition = \"greaterThan\", value = 220000),\n    Filter(field = \"Country\", condition = \"contains\", selected_values = [\"China\", \"Brazil\"])\n]\n```\n\n### Creating a Pivot Table\n\nTo create a pivot table, use the `PivotTable` and `PivotTableOptions` structs along with the `pivottable` function.\n\nExample:\n\n```julia\nusing StipplePivotTable; const spt = StipplePivotTable\nusing DataFrames, JSON3\n\n# Load and parse source data\njson_file = \"data/Employee_Sample_Data.json\"\njson_string = read(json_file, String)\ndata = JSON3.read(json_string)\ndf = DataFrame(data)\n\n# Create a pivot table\npt = PivotTable(\n    df,\n    PivotTableOptions(\n        rows = spt.rows([\"Country\", \"Department\"]),\n        columns = spt.columns([\"Annual Salary\", \"Gender\", \"Ethnicity\"]),\n        values = [\n            Value(\"Annual Salary\", aggregation = \"sum\"),\n            Value(\"Annual Salary\", aggregation = \"custom\", formula = \"{Annual Salary} * 0.21\", label = \"Tax\")\n        ],\n        filters = [\n            Filter(\"Annual Salary\", condition = \"greaterThan\", value = 220000),\n            Filter(\"Country\", condition = \"contains\", selected_values = [\"China\", \"Brazil\"])\n        ]\n    )\n)\n\n# Expose the pivot table var\n\n@app begin\n    @out pt = pt\nend\n```\n\n### Rendering the pivot table\n\nIn low-code Julia, the pivot table can be rendered using the `pivottable` function:\n\n```julia\n# Render the pivot table\npivottable(:pt)\n```\n\nWhile in HTML views, rendering is done using the corresponding HTML component:\n\n```html\n\u003cst-pivottable :data=\"pt.data\" :columns=\"pt.opts.columns\" :values=\"pt.opts.values\" :rows=\"pt.otps.rows\" :filters=\"pt.opts.filters\"\u003e\u003c/st-pivottable\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenieframework%2Fstipplepivottable.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenieframework%2Fstipplepivottable.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenieframework%2Fstipplepivottable.jl/lists"}