Package 'fdishinyr'

Title: FDI Shiny utils
Description: FDI Shiny utils
Authors: Emmanuel Blondel [aut, cre] (ORCID: <https://orcid.org/0000-0002-5870-5762>), Alexandre Bennici [aut] (ORCID: <https://orcid.org/0000-0003-2160-3487>)
Maintainer: Emmanuel Blondel <[email protected]>
License:
Version: 0.1.20260529
Built: 2026-07-09 18:36:22 UTC
Source: https://github.com/fdiwg/fdishinyr

Help Index


util ERROR logger

Description

ERROR logger

Usage

ERROR(txt, ...)

Arguments

txt

a character vector of format strings, each of up to 8192 bytes.

...

any values to be passed into txt. See sprintf


FDI shiny utils

Description

FDI shiny utils

Author(s)

Emmanuel Blondel [email protected]

See Also

Useful links:


Generic Chart Shiny Module (Server)

Description

Server-side logic for a fully generic and configurable charting module. The module supports multiple plot types (time series, bars, stacked areas, distributions, rankings, composition charts), time granularities, aggregation statistics (sum or mean), optional error computation, internationalization (i18n), and data export.

The server:

  • Normalizes and aggregates heterogeneous tabular data

  • Handles time-based aggregation (monthly / yearly)

  • Computes optional statistical errors (SD, SE, CI95)

  • Dynamically dislay data with the appropriate Plotly chart type

  • Provides tabular summaries and download capabilities

Usage

generic_chart_server(
  id,
  lang = NULL,
  df,
  col_date,
  col_group,
  col_value,
  time_label = "Date",
  value_label = "Value",
  group_label = "Group",
  plot_types = NULL,
  plot_type_default = NULL,
  time_choices = c("month", "year"),
  stat = "sum",
  error = "none",
  rank_number = 10,
  rank_target_id = NULL,
  rank_target_color = "orange"
)

Arguments

id

Character string. Module namespace identifier.

lang

Optional language parameter. Can be either:

  • a character string (static language), or

  • a reactive returning a character string (dynamic language)

If NULL, the current global language is used. Default is NULL

df

A reactive or static data.frame containing the input data.

col_date

Character string, name of the date column in df.

col_group

Character string, name of the grouping column (categorical variable).

col_value

Character string, name of the numeric value column.

time_label

Character string used as x-axis label for time-based charts. Default is "Date".

value_label

Character string used as y-axis label for numeric values. Default is "Value".

group_label

Character string used as label for grouping variables. Default is "Group".

plot_types

Optional character vector restricting the set of plot types available to the user.

Supported values are:

  • "line" – Multi-series line chart showing the evolution of each group over time.

  • "line_sum" – Line chart displaying the total aggregated value (sum over all groups) through time.

  • "line_mean" – Line chart displaying the mean value over time, with optional error bands.

  • "area_stack" – Stacked area chart showing absolute contributions of each group over time.

  • "area_stack_pct" – Stacked area chart normalized to percentages, highlighting relative group contributions over time.

  • "bar_mean" – Bar chart showing mean values per time period, with optional error bars.

  • "bar_stack" – Stacked bar chart displaying absolute group contributions per period.

  • "bar_stack_pct" – Stacked bar chart normalized to percentages for relative comparison between groups.

  • "rank_sum" – Ranking bar chart displaying the top 10 contributing groups based on total aggregated values.

  • "heatmap" – Heatmap showing the intensity of values across time periods and groups.

  • "bubble" – Bubble chart where bubble size represents value magnitude across time and groups.

  • "pie" – Pie chart showing the overall distribution of values among groups.

  • "donut" – Donut chart variant of the pie chart, emphasizing proportional composition.

  • "treemap" – Treemap visualization showing hierarchical proportions of groups based on aggregated values.

  • "boxplot" – Boxplot showing the distribution and variability of raw values per group.

If NULL, the user can select among all plot types allowed by the aggregation statistic.

plot_type_default

Optional character string defining the default plot type selected in the plot type selector. Supported values are the same as plot_types. If NULL, the first available plot type is selected.

time_choices

Character vector defining allowed time granularities. Default is c("month", "year").

stat

Character string defining the aggregation statistic. Supported values are:

  • "sum"

  • "mean"

Default is "sum".

error

Character string defining the default error type for mean-based plots. Supported values are:

  • "none"

  • "sd"

  • "se"

  • "ci95"

Default is "none".

rank_number

Integer. Specific to rank_sum mode. Defines the number of ranked items to display. Default is 10.

rank_target_id

Optional character string. Specific to rank_sum mode. Must match one of the values of the grouping column defined in col_group. If NULL, the chart displays the top rank_number ranked items. If provided, the chart centers the view around the targeted item and displays up to rank_number items around it. Default is NULL.

rank_target_color

Optional character string. Specific to rank_sum mode. Must be a valid R color name or hexadecimal color code. Defines the fill color used to highlight the targeted item specified in rank_target_id. Default is "orange".


Generic Chart Shiny Module (UI)

Description

User interface for the generic chart Shiny module.

The UI provides:

  • A configurable sidebar for plot options

  • A main panel displaying interactive charts and summary tables

  • Download controls for exporting charts (PNG / HTML)

This UI is designed to work with generic_chart_server and relies on bs4Dash plotly::layout components.

Usage

generic_chart_ui(id, title = "", sliderWidth = 25)

Arguments

id

Character string. Module namespace identifier.

title

Character string, title displayed at the top of the chart box.

sliderWidth

A numeric value between 25 and 100. Sidebar opening width in percentage. 25%, means the card sidebar will take 25% of the card width, when opened. Default is 25.


util INFO logger

Description

INFO logger

Usage

INFO(txt, ...)

Arguments

txt

a character vector of format strings, each of up to 8192 bytes.

...

any values to be passed into txt. See sprintf


util generic logger

Description

Generic logger

Usage

logger(type = c("INFO", "WARN", "ERROR"), txt, ...)

Arguments

type

type either INFO, WARN or DEBUG

txt

a character vector of format strings, each of up to 8192 bytes.

...

any values to be passed into txt. See sprintf


Set translation language

Description

set_translation_language

Usage

set_translation_language(lang)

Arguments

lang

lang


Get translator

Description

Get translator

Usage

translator()

Value

the translator, object of class Translator


util WARN logger

Description

WARN logger

Usage

WARN(txt, ...)

Arguments

txt

a character vector of format strings, each of up to 8192 bytes.

...

any values to be passed into txt. See sprintf


POC shiny module server

Description

POC shiny module server

Usage

welcome_server(id, lang = NULL)

Arguments

id

id

lang

lang a reactive version of the language. Default is NULL (optional)


POC shiny module UI

Description

POC shiny module UI

Usage

welcome_ui(id)

Arguments

id

id