rephorm 1.1.4__tar.gz → 1.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rephorm-1.1.6/MANIFEST.in +2 -0
- {rephorm-1.1.4/src/rephorm.egg-info → rephorm-1.1.6}/PKG-INFO +1 -1
- rephorm-1.1.6/docs/reporting/font.md +10 -0
- rephorm-1.1.6/docs/reporting/glossary.md +5 -0
- rephorm-1.1.6/docs/reporting/grid-layout.md +45 -0
- rephorm-1.1.6/docs/reporting/information-tips.md +17 -0
- rephorm-1.1.6/docs/reporting/introduction.md +41 -0
- rephorm-1.1.6/docs/reporting/marker-symbols.md +5 -0
- rephorm-1.1.6/docs/reporting/multiline-title.md +16 -0
- rephorm-1.1.6/docs/reporting/object-parameters.md +440 -0
- rephorm-1.1.6/docs/reporting/objects.md +104 -0
- rephorm-1.1.6/docs/reporting/styles-dictionary.md +206 -0
- rephorm-1.1.6/docs/tutorials/Readme.md +21 -0
- rephorm-1.1.6/docs/tutorials/advanced_report.pdf +0 -0
- rephorm-1.1.6/docs/tutorials/advanced_report.py +809 -0
- rephorm-1.1.6/docs/tutorials/basic_report.pdf +0 -0
- rephorm-1.1.6/docs/tutorials/basic_report.py +215 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/pyproject.toml +2 -2
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/__init__.py +1 -1
- {rephorm-1.1.4 → rephorm-1.1.6/src/rephorm.egg-info}/PKG-INFO +1 -1
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm.egg-info/SOURCES.txt +16 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/LICENSE +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/README.md +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/setup.cfg +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/decorators/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/decorators/settings_validation.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/colors.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/legend_positions.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/styles.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/update_layout.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/dict/update_traces.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/_globals.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/_utilities/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/_utilities/chart_mapper_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/_utilities/grid_mapper_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/_utilities/table_mapper_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/chapter_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/chart_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/chart_series_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/grid_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/page_break_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/report_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/table_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/table_section_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/table_series_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_mappers/text_mapper.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_params/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/object_params/settings.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/_utilities/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/_utilities/settings_container.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/chapter.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/chart.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/chart_series.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/footnote.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/grid.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/page_break.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/report.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/table.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/table_section.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/table_series.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/objects/text.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/PDF.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/add_style_prefix.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/OpenSans-Bold.ttf +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/OpenSans-BoldItalic.ttf +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/OpenSans-Italic.ttf +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/OpenSans.ttf +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/fonts/font_loading.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/is_set.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/merge/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/merge/chart_properties_manager.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/merge/merge_settings.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/merge/merge_styles.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/merge/pdf_merger.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/__init__.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/add_footnotes.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/cleanup_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/footnotes_counter.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/image_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/layout_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/range_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/report_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/resolve_color.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/table_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/report/title_utility.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm/utility/unit_converter.py +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm.egg-info/dependency_links.txt +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm.egg-info/requires.txt +0 -0
- {rephorm-1.1.4 → rephorm-1.1.6}/src/rephorm.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rephorm
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.6
|
|
4
4
|
Summary: Python package for generating PDF reports through code
|
|
5
5
|
Author-email: OGResearch <it@ogresearch.com>
|
|
6
6
|
Maintainer-email: Sergey Plotnikov <sergey.plotnikov@ogresearch.com>, Martynas Vycas <martynas.vycas@ogresearch.com>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Grid Layout
|
|
2
|
+
|
|
3
|
+
It is possible to create a custom grid layout using the `layout` parameter in the Grid object.
|
|
4
|
+
The `layout` option accepts a 2D matrix — a list of lists — where:
|
|
5
|
+
|
|
6
|
+
* Each inner list represents a column in the grid.
|
|
7
|
+
* Each item within the inner list represents a row in that column.
|
|
8
|
+
|
|
9
|
+
To specify which cells are active, use `{}`, and for the cells that should remain empty use `None`.
|
|
10
|
+
|
|
11
|
+
To configure cells, you have the following options:
|
|
12
|
+
|
|
13
|
+
* `{}` – An active cell (that can hold content).
|
|
14
|
+
* `None` – Inactive/empty cell (will be skipped).
|
|
15
|
+
* `{"colspan": N}` – An active cell that spans N columns.
|
|
16
|
+
* `{"rowspan": N}` – An active cell that spans N rows.
|
|
17
|
+
|
|
18
|
+
The following layout creates a grid with **2 columns and 3 rows**, where the middle row contains an active cell that spans 2 columns, and the last row has two active cells:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
1. grid = rephorm.Grid(
|
|
22
|
+
2. ncol=2, nrow=3, layout=[[None, None], [{"colspan": 2}, None], [{}, {}]])
|
|
23
|
+
3.
|
|
24
|
+
4. grid.add(chart)
|
|
25
|
+
5.
|
|
26
|
+
6. grid.add(chart)
|
|
27
|
+
7.
|
|
28
|
+
8. grid.add(chart)
|
|
29
|
+
```
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
The first chart added to the grid is automatically placed in the first active cell of the middle row. When using colspan, it is important to set the remaining spanned cells in that row to None.
|
|
33
|
+
|
|
34
|
+
The example below demonstrates a similar layout configuration, but using “rowspan” instead. Note that in the last row (the last list), None is used for the first cell to account for the vertical span:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
1. grid = rephorm.Grid(
|
|
38
|
+
2. ncol=2, nrow=3, layout=[[None, None], [{"rowspan": 2}, None], [None, {}]])
|
|
39
|
+
3.
|
|
40
|
+
4. grid.add(chart)
|
|
41
|
+
5.
|
|
42
|
+
6. grid.add(chart)
|
|
43
|
+
7.
|
|
44
|
+
```
|
|
45
|
+

|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Appendix B – Helpful Information and Tips
|
|
2
|
+
|
|
3
|
+
How to use hints
|
|
4
|
+
|
|
5
|
+
When using the reporting package, you can hover over the object you are instantiating to view all possible parameters you can configure.
|
|
6
|
+
|
|
7
|
+
For example, hovering over a report object will display not only the report's parameters and keyword arguments (kwargs) but also the style keys for all associated objects.
|
|
8
|
+
|
|
9
|
+
Keyword arguments (kwargs) are set in the same way as regular arguments, so you can treat them as such.
|
|
10
|
+
|
|
11
|
+
**Important:** In some IDEs, this feature might not be available. However, you can view the documentation by using Ctrl + Click on the specific object. (Currently, PyCharm offers the best support for this feature.)
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
Regular objects will include hints as well, but they will not have style-specific hints.
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# About
|
|
2
|
+
The purpose of this documentation is to provide guidance on how to use and interact with the Rephorm package. Using Python, Rephorm can create PDF reports that include various charts and tables. By enabling users to write high-level Python code, Rephorm facilitates the creation of PDF reports. All the complex details are handled in the background by the package, so users are only required to import Rephorm, provide the required data, and use it to generate their reports.
|
|
3
|
+
|
|
4
|
+
# Installing rephorm package
|
|
5
|
+
1. Initiate a new python project
|
|
6
|
+
2. Access your virtual environment terminal: this can be done directly in your IDE or by activating the virtual environment in your system’s command line. (Python dependency 3.12)
|
|
7
|
+
3. Execute the following command in your (virtual environment) terminal:
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
1. pip install rephorm
|
|
12
|
+
```
|
|
13
|
+
This command will download and install the most recent version of the Rephorm package. Once installed, ensure that your IDE is configured to use this virtual environment.
|
|
14
|
+
|
|
15
|
+
# Rephorm Objects
|
|
16
|
+
|
|
17
|
+
Objects serve as the building blocks of your report. As the creator, you are responsible for initializing, creating, and interacting with them:
|
|
18
|
+
|
|
19
|
+
* **Report** – this is the main object that is responsible for assembling all other objects. Picture it as your blank report sheet. First, you need to initialize it, specifying its structure (such as margins, paper size like A4, A3), and then amend other objects within. Everything you add to this object will be included in the final output PDF file.
|
|
20
|
+
* **Chapter** – used to establish a new chapter by inserting a title for a new page and organizing shared parameters and styles for objects within that chapter.
|
|
21
|
+
* **Page break** – allows adding page breaks throughout the report.
|
|
22
|
+
* **Grid** – allows creating grid layouts.
|
|
23
|
+
* **Text** – to insert text.
|
|
24
|
+
* **Chart** – to create charts.
|
|
25
|
+
* **Table** – to create tables.
|
|
26
|
+
* **Table section** – facilitates the creation of a "new section" within a table, marked by a bold title. This adds an empty row where the title is placed in the first column.
|
|
27
|
+
* **Chart series** – to create chart series (that can be added to Chart object).
|
|
28
|
+
* **Table series** – to create table series (that can be added to Table object).
|
|
29
|
+
|
|
30
|
+
The function of some of these objects is simple and straightforward. However, we will explore certain ones in more detail later to ensure you have a thorough understanding of their operation and what you can achieve with them.
|
|
31
|
+
|
|
32
|
+
# Object hierarchy
|
|
33
|
+
|
|
34
|
+
Before we dive deeper, it is crucial to understand the hierarchy of the object structure. Having an understanding of this order is essential when amending multiple objects together, as trying to amend incompatible objects together would be like trying to fit a square peg into a round hole.
|
|
35
|
+
|
|
36
|
+
For instance, this hierarchy demonstrates that you can use the .add() method on the report object to include sections, tables, grids, charts, texts, or page breaks.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Multiline title
|
|
2
|
+
|
|
3
|
+
You can create a multiline title by using the newline character (“\n”) within the title text:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
1. chart1 = legort.Chart(
|
|
7
|
+
2. span=plot_span,
|
|
8
|
+
3. figure_title="Real Inflow of \n Remittances (100× log)",
|
|
9
|
+
4. show_legend=True,
|
|
10
|
+
5. show_grid=True)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This will display the title across two lines.
|
|
14
|
+
|
|
15
|
+
**Note:** Using more than one \n in a title is not recommended, as it may cause layout issues.
|
|
16
|
+
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
# Object parameters
|
|
2
|
+
|
|
3
|
+
When instantiating objects, you can define various parameters that influence the appearance of the final product.
|
|
4
|
+
|
|
5
|
+
## Required parameters
|
|
6
|
+
|
|
7
|
+
Required parameters are mandatory and you always have to assign them, otherwise the code will fail.
|
|
8
|
+
|
|
9
|
+
**The required parameters are:**
|
|
10
|
+
|
|
11
|
+
* **data:** necessary for both ChartSeries and TableSeries objects.
|
|
12
|
+
* **span:** required for Table object to define the scope.
|
|
13
|
+
|
|
14
|
+
## Optional parameters
|
|
15
|
+
Optional parameters allow for customization. They have default settings, which are used if no user-defined values are provided. While omitting these will not break the code, it may result in outputs that are irrelevant. After parameter name, in parenthesis, it shows what data type it expects.
|
|
16
|
+
|
|
17
|
+
All the parameters below are optional, except for the data and span:
|
|
18
|
+
|
|
19
|
+
### Report
|
|
20
|
+
* `title (str):` Title of the report. Placed in the front page.
|
|
21
|
+
* `subtitle (str):` Subtitle of the report. Placed in the front page after the title.
|
|
22
|
+
* `load_fonts (list[Dict[str, str]]):` fonts to be loaded for the report. Each dictionary in the list must include the following attributes:
|
|
23
|
+
* `font_family:` The family name of the font.
|
|
24
|
+
* `font_style:` The style of the font (e.g., normal, italic).
|
|
25
|
+
* `font_path:` Path to the font file.
|
|
26
|
+
* `orientation (str):` Orientation of the report, e.g., 'P' for Portrait or 'L' for Landscape.
|
|
27
|
+
* `unit (str):` Measurement unit used in the report, e.g., 'pt' (points), 'mm' (millimeters), 'cm' (centimeters).
|
|
28
|
+
* `format (str):` Paper format of the report, e.g., 'A4', 'Letter'.
|
|
29
|
+
* `logo (str):` Path to the logo file used in the report.
|
|
30
|
+
* `styles (Dict):` A dictionary defining the styling for the report and its child objects.
|
|
31
|
+
|
|
32
|
+
**Note** :Load_fonts - If Load fonts is specified, every font family needs to contain fonts for three styles: bold, italic and regular. “B”, “I”, “” (regular as empty string)
|
|
33
|
+
|
|
34
|
+
### Chart
|
|
35
|
+
* `title (str):` title of the chart
|
|
36
|
+
* `figure (plotly.graph_objs.Figure):` Plotly figure object. If provided, it will plot the given figure object.
|
|
37
|
+
* `apply_report_layout (bool):` If set to true, it applies the standard report layout to the provided figure (can only be used for a custom Plotly figure).
|
|
38
|
+
* `span (ir.Span):` Specifies the span of the chart.
|
|
39
|
+
* `highlight (ir.Span):` Indicates the span of the highlight.
|
|
40
|
+
* `show_legend (bool):` Determines whether to show or hide the legend.
|
|
41
|
+
* `show_grid (bool):` Controls the visibility of the grid.
|
|
42
|
+
* `axis_border (bool):` Allows enabling or disabling axis borders. (chart border)
|
|
43
|
+
* `xaxis_title (str):` Specifies the title for the X-axis.
|
|
44
|
+
* `yaxis_title (str):` Specifies the title for the Y-axis.
|
|
45
|
+
* `yaxis2_title (str):` The title for the secondary Y-axis.
|
|
46
|
+
* `legend_orientation (str):` Specifies the orientation of the legend, with options "v" for vertical or "h" for horizontal.
|
|
47
|
+
* `legend_position (str):` Indicates the position of the legend, e.g., "SO" for South Outside, "S" for South Inside.
|
|
48
|
+
* `series_type (str):` Type of series to display - "line" for line charts, "bar" for bar charts, "bar_contribution" for contribution bar charts; use "line" with markers_mode="markers" for marker-based charts.
|
|
49
|
+
* `markers_mode (str):` Display style for data points - "lines+markers" (lines with symbols/dots), "lines" (lines only), or "markers" (symbols/dots only).
|
|
50
|
+
* `legend (tuple):` Specifies legend labels for the series. At the chart level, this is primarily useful for multivariate series. Provide multiple labels like ("Label 1", "Label 2", ...).
|
|
51
|
+
* `marker_symbol (str):` Specifies the symbol name for markers, default is "asterisk".
|
|
52
|
+
* `zeroline (bool):` If true, it displays a horizontal line at Y=0 to help indicate the zero baseline.
|
|
53
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
54
|
+
|
|
55
|
+
### Chart series
|
|
56
|
+
* **data (IrisSeries):** Data for the chart series. (required parameter)
|
|
57
|
+
* `span (ir.Span):` Span of the chart series.
|
|
58
|
+
* `yaxis (str):` Y-axis position for the chart series. Defaults to "left". Possible values: “left” or “right”.
|
|
59
|
+
* `legend (tuple):` Specifies the legend labels for the series. For a single series, use ("Label",). For multivariate series, provide multiple labels like ("Label 1", "Label 2", ...).
|
|
60
|
+
* `highlight (ir.Span):` Span of the highlight.
|
|
61
|
+
* `series_type (str):` Type of series to display - "line" for line charts, "bar" for bar charts, "bar_contribution" for contribution bar charts; use "line" with markers_mode="markers" for marker-based charts.
|
|
62
|
+
* `markers_mode (str):` Display style for data points - "lines+markers" (lines with symbols/dots), "lines" (lines only), or "markers" (symbols/dots only).
|
|
63
|
+
* `marker_symbol (str):` Symbol used for markers in the series, e.g., "asterisk".
|
|
64
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
65
|
+
|
|
66
|
+
### Grid
|
|
67
|
+
* `title (str):` Title of the grid.
|
|
68
|
+
* `footnotes (tuple[str, ...]):` Table footnotes referencing the table title. The value for this parameter should be provided as strings enclosed in parentheses and separated by commas, e.g., ("footnote 1", "footnote 2",).
|
|
69
|
+
* `ncol (int):` Number of columns in the grid.
|
|
70
|
+
* `nrow (int):` Number of rows in the grid.
|
|
71
|
+
* `layout (Dict):` layout configuration for the chart (see section “Grid layout”).
|
|
72
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
73
|
+
|
|
74
|
+
### Chapter
|
|
75
|
+
* `title (str):` Title of the section.
|
|
76
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
77
|
+
|
|
78
|
+
### Table
|
|
79
|
+
* `title (str):` Title of the table.
|
|
80
|
+
* **span (ir.Span):** Span of the table. **(required parameter)**
|
|
81
|
+
* `footnotes (tuple[str, ...]):` Table footnotes referencing the table title. The value for this parameter should be provided as strings enclosed in parentheses and separated by commas, e.g., ("footnote 1", "footnote 2",).
|
|
82
|
+
* `Width (int):` The maximum width allowed for rendering the table. By default, the table will use the available page width.
|
|
83
|
+
* `highlight (ir.Span):` Span of the highlight.
|
|
84
|
+
* `show_units (bool):` Option to display or hide units in the table.
|
|
85
|
+
* `frequency (str):` Frequency of the data in the table.
|
|
86
|
+
* `decimal_precision (int):` Sets number of decimal places after the decimal point.
|
|
87
|
+
* `compare_style (str):` Comparison style for the table series, options include "diff", "pct".
|
|
88
|
+
* `layout (Dict):` Layout configuration for the table (Plotly specific).
|
|
89
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
90
|
+
|
|
91
|
+
### Table Section
|
|
92
|
+
|
|
93
|
+
* `title (str):` Title of the table section.
|
|
94
|
+
* `highlight (ir.Span):` Span of the highlight in the table section.
|
|
95
|
+
* `show_units (bool):` To show/hide units for the table section.
|
|
96
|
+
* `styles (Dict):` Styles dictionary for the table section.
|
|
97
|
+
|
|
98
|
+
### Table series
|
|
99
|
+
* **data (IrisSeries):** Data for the table series. **(required parameter)**
|
|
100
|
+
* `title (str):` Name of the table series / row.
|
|
101
|
+
* `unit (str):` The text value for the "units" column in this specific row of the table series. This defines what will be displayed as the unit for the corresponding row.
|
|
102
|
+
* `span (ir.Span):` Span of the table series.
|
|
103
|
+
* `highlight (ir.Span):` Span of the highlight in the table series.
|
|
104
|
+
* `compare_style (str):` Comparison style for the table series, options include "diff", "pct".
|
|
105
|
+
* `decimal_precision (int):` Sets number of decimal places after the decimal point.
|
|
106
|
+
* `comparison_series (bool):` Indicates whether the series should be displayed as a comparison series.
|
|
107
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
108
|
+
|
|
109
|
+
### Text
|
|
110
|
+
* `title (str):` The title of the text object.
|
|
111
|
+
* `text (str):` The body of the text object.
|
|
112
|
+
* `align (Literal["x", "c", "l", "j", "r"]):` Alignment of the text body. Default “j” - justify.
|
|
113
|
+
* `Markdown (bool):` Enables Markdown syntax within the text body. Default is False.
|
|
114
|
+
* `styles (Dict):` Styles dictionary for additional customization.
|
|
115
|
+
|
|
116
|
+
### Page Break
|
|
117
|
+
The PageBreak class does not take any parameters. It is used to insert a page break in the report.
|
|
118
|
+
|
|
119
|
+
### Footnote
|
|
120
|
+
* `text (str):` The textual data you want to hold in the Footnote object.
|
|
121
|
+
|
|
122
|
+
## Special parameters
|
|
123
|
+
|
|
124
|
+
### load_fonts
|
|
125
|
+
Parameters that accept a specific data structure as their value.
|
|
126
|
+
Rephorm requires to define and load fonts manually. Currently it has a pre-installed “OpenSans” with styles: “Regular”, “Italic” and “Bold”. If you want to use some other font, you would need to load it manually, via this parameter.
|
|
127
|
+
|
|
128
|
+
load_fonts is an optional parameter for the Report object. It expects a list of dictionaries, each specifying the details of a font you want to load.
|
|
129
|
+
When loading a specific font into the Rephorm package, make sure that the same font is also installed on your **local machine** — that is, the computer where your code is running.
|
|
130
|
+
|
|
131
|
+
Below is an example of the fonts data structure, where the "YujiMai" font family is defined and loaded into the report instance.
|
|
132
|
+
```python
|
|
133
|
+
1. fonts = [
|
|
134
|
+
2. {
|
|
135
|
+
3. "font_family": "YujiMai",
|
|
136
|
+
4. "font_style": "",
|
|
137
|
+
5. "font_path": "./testing/fonts/YujiMai.ttf",
|
|
138
|
+
6. },
|
|
139
|
+
7. {
|
|
140
|
+
8. "font_family": "YujiMai",
|
|
141
|
+
9. "font_style": "B",
|
|
142
|
+
10. "font_path": "./testing/fonts/YujiMai - Copy.ttf",
|
|
143
|
+
11. },
|
|
144
|
+
12. {
|
|
145
|
+
13. "font_family": "YujiMai",
|
|
146
|
+
14. "font_style": "I",
|
|
147
|
+
15. "font_path": "./testing/fonts/YujiMai - Copy (2).ttf",
|
|
148
|
+
16. },
|
|
149
|
+
17. ]
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
It accepts `.ttf` or `.otf` font file format.
|
|
153
|
+
|
|
154
|
+
When adding a font family, you need to provide the file paths for three styles within that family:
|
|
155
|
+
|
|
156
|
+
* Regular – “font_style” as “” (empty) string
|
|
157
|
+
* Bold – “font_style” as “B” string
|
|
158
|
+
* Bold Italic – “font_style” as “I” string
|
|
159
|
+
|
|
160
|
+
After, you can pass this “fonts” list in the report as:
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
1. report = Rephorm.Report(load_fonts = fonts)
|
|
164
|
+
```
|
|
165
|
+
This will load custom fonts, enabling you to use them in the report through the styles dictionary.
|
|
166
|
+
|
|
167
|
+
### styles
|
|
168
|
+
|
|
169
|
+
The styles parameter works like a design setting that controls how your report looks. It passes design instructions to the related objects in your report.
|
|
170
|
+
|
|
171
|
+
The styles parameter is inheritable within objects, which means styling properties flow downward from parent objects to their children. Therefore, if we want to set a consistent highlight color for all charts throughout a report, we can specify this at the report level using the following code:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
1. report = Rephorm.Report(
|
|
175
|
+
2. styles={
|
|
176
|
+
3. "chart": {
|
|
177
|
+
4. "highlight_color": "green"
|
|
178
|
+
5. }
|
|
179
|
+
6. }
|
|
180
|
+
7. )
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
In this example, we define the styles parameter and provide a structured, nested dictionary containing the key "chart". This configuration means that any styling properties we specify for charts will automatically be applied to all chart objects subsequently added to this report instance. Specifically, we set the highlight_color property to "green", ensuring all charts in the report will utilize this consistent highlight color without requiring individual styling for each chart.
|
|
184
|
+
|
|
185
|
+
The styles parameter can be expressed using either nested dictionaries or a flattened structure with dot notation. The first example demonstrates how styling can be applied using a nested dictionary structure. However, the same configuration can also be achieved using a simplified, flat dictionary format as shown below:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
1. report = Rephorm.Report(
|
|
189
|
+
2. styles={
|
|
190
|
+
3. "chart.highlight_color": "green"
|
|
191
|
+
4. }
|
|
192
|
+
5. )
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
For individual chart styling, you can apply specific design parameters directly to a particular chart object instance. This approach allows you to customize styling on a specific object basis, overriding any previously established styles. For instance:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
1. chart = Rephorm.Chart(
|
|
199
|
+
2. span=chart_span,
|
|
200
|
+
3. highlight=ir.qq(2026, 1) >> ir.qq(2028, 1),
|
|
201
|
+
4. styles={
|
|
202
|
+
5. "highlight_color": "blue"
|
|
203
|
+
6. }
|
|
204
|
+
7. )
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
In this case, the specific chart will use a highlight_color of blue, even if the highlight color for charts at the report or grid level was set to yellow.
|
|
208
|
+
|
|
209
|
+
## Simplification of styles dictionary keys
|
|
210
|
+
|
|
211
|
+
When defining styles directly within an object, to simplify style definitions, you can omit the object name.
|
|
212
|
+
|
|
213
|
+
For example:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
1. chart = Rephorm.Chart(
|
|
217
|
+
2. span=chart_span,
|
|
218
|
+
3. highlight=ir.qq(2026, 1) >> ir.qq(2028, 1),
|
|
219
|
+
4. styles={
|
|
220
|
+
5. "highlight_color": "blue",
|
|
221
|
+
6. },
|
|
222
|
+
7. )
|
|
223
|
+
```
|
|
224
|
+
## Adding styles to Report object.
|
|
225
|
+
|
|
226
|
+
As you are aware, the report object serves as the parent for all other objects. Therefore, to modify the default styles of the report, it is recommended to include a specific style dictionary when creating the report object.
|
|
227
|
+
|
|
228
|
+
## Styles dictionary keys:
|
|
229
|
+
|
|
230
|
+
Here is the full definition of the styles dictionary that details the various style options available for customization.
|
|
231
|
+
|
|
232
|
+
Information about the styles dictionary structure below:
|
|
233
|
+
|
|
234
|
+
* **First Level**: Represents parent objects (like "Table").
|
|
235
|
+
* **Second Level**: Represents top-level style properties for each parent.
|
|
236
|
+
* If a second-level property has no further numbering: It is a direct attribute of the parent that accepts a value.
|
|
237
|
+
* If a second-level property has third-level: It represents a child element with its own set of styling properties.
|
|
238
|
+
|
|
239
|
+
Style key-value pairs below come in such definition:
|
|
240
|
+
|
|
241
|
+
When applied at the Table level, it affects all rows; when applied to a specific TableSeries, it affects only that row.
|
|
242
|
+
|
|
243
|
+
To view the default values for each key, refer to **Appendix A – Styles Dictionary.**
|
|
244
|
+
|
|
245
|
+
**1. Table**
|
|
246
|
+
|
|
247
|
+
* **highlight_color (str):** Highlight color for the entire table, including all child objects (sections and series). Accepted values: Hex (`#000000`), RGB (`rgb(255, 255, 255)`), or color names (`green`).
|
|
248
|
+
|
|
249
|
+
* **title**
|
|
250
|
+
- **font_style (str):** Font style for the table title. Accepted values: `"B"` (Bold), `"I"` (Italic), `""` (Regular).
|
|
251
|
+
- **font_family (str):** Font family for the table title.
|
|
252
|
+
- **font_color (str):** Font color for the table title. Accepted values: Hex (`#000000`), RGB (`rgb(255, 255, 255)`), or color names (`green`).
|
|
253
|
+
- **font_size (int):** Font size for the table title.
|
|
254
|
+
|
|
255
|
+
* **Heading**
|
|
256
|
+
- **highlight_color (str):** Highlight color for the table header. Accepted values: Hex (`#000000`), RGB (`rgb(255, 255, 255)`), or color names (`green`).
|
|
257
|
+
- **font_style (str):** Font style for the table header. Accepted values: `"B"` (Bold), `"I"` (Italic), `""` (Regular).
|
|
258
|
+
- **font_family (str):** Font family for the table header.
|
|
259
|
+
- **font_color (str):** Font color for the table header. Accepted values: Hex (`#000000`), RGB (`rgb(255, 255, 255)`), or color names (`green`).
|
|
260
|
+
- **font_size (int):** Font size for the table header.
|
|
261
|
+
|
|
262
|
+
* **series**
|
|
263
|
+
- **font_style (str):** Font style for table rows (TableSeries object). Accepted values: "B" (Bold), "I" (Italic), "" (Regular).
|
|
264
|
+
- **font_family (str):** Font family for table rows.
|
|
265
|
+
- **font_color (str):** Font color for table rows (TableSeries object). Accepted values: Hex (#000000), RGB (rgb(255, 255, 255)), or color names (green).
|
|
266
|
+
- **font_size (int):** Font size for table rows (TableSeries object).
|
|
267
|
+
- **highlight_color (str):** Highlight color for table rows (TableSeries object). Accepted values: Hex (#000000), RGB (rgb(255, 255, 255)), or color names (green).
|
|
268
|
+
|
|
269
|
+
* **section**
|
|
270
|
+
- **font_style (str):** Font style of the table section. Accepted values: "B" (Bold), "I" (Italic), "" (Regular).
|
|
271
|
+
- **font_family (str):** Font family of the table section. Table section child objects will inherit this style.
|
|
272
|
+
- **font_color (str):** Font color of the table section. Table section child objects will inherit this style. Accepted values: Hex (#000000), RGB (rgb(255, 255, 255)), or color names (green).
|
|
273
|
+
- **font_size (int):** Font size of the table section.
|
|
274
|
+
- **highlight_color (str):** Highlight color for the table section. Accepted values: Hex (#000000), RGB (rgb(255, 255, 255)), or color names (green).
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**2. Chart**
|
|
279
|
+
|
|
280
|
+
* **highlight_color (str):** Highlight color for the chart elements.
|
|
281
|
+
* **grid_color (str):** Color for the grid lines of the chart.
|
|
282
|
+
* **bg_color (str):** Background color of the chart.
|
|
283
|
+
* **chart_border_color (str):** Border color of the chart.
|
|
284
|
+
* **line_styles_order (str[]):** Array that defines the default sequence of line styles.
|
|
285
|
+
* **line_color_order (str[]):** Array that defines the default sequence of colors for ChartSeries. Accepted value is list of (rgb) strings.
|
|
286
|
+
* **bar_color_order (str[]):** Array that defines the default sequence of colors for bars in a bar chart.
|
|
287
|
+
* **line_width_order (list[float | int]):** Array that defines the default sequence of line widths.
|
|
288
|
+
|
|
289
|
+
* **legend**
|
|
290
|
+
- **border_width (int):** Border width for the legend box.
|
|
291
|
+
- **bg_color (str):** Background color for the legend.
|
|
292
|
+
- **font_style (str):** Font style for the chart legend text.
|
|
293
|
+
- **font_family (str):** Font family for the chart legend text.
|
|
294
|
+
- **font_color (str):** Font color for the chart legend text.
|
|
295
|
+
- **font_size (int):** Font size for the chart legend text.
|
|
296
|
+
|
|
297
|
+
* **title**
|
|
298
|
+
- **font_style (str):** Font style for the chart title.
|
|
299
|
+
- **font_family (str):** Font family for the chart title.
|
|
300
|
+
- **font_color (str):** Font color for the chart title.
|
|
301
|
+
- **font_size (int):** Font size for the chart title.
|
|
302
|
+
|
|
303
|
+
* **x_axis**
|
|
304
|
+
- **ticks**
|
|
305
|
+
- **font_size (int):** Font size for the x-axis tick marks.
|
|
306
|
+
- **font_color (str):** Font color for the x-axis tick marks.
|
|
307
|
+
- **font_family (str):** Font family for the x-axis tick marks.
|
|
308
|
+
- **label**
|
|
309
|
+
- **font_size (int):** Font size for the x-axis label.
|
|
310
|
+
- **font_color (str):** Font color for the x-axis label.
|
|
311
|
+
- **font_family (str):** Font family for the x-axis label.
|
|
312
|
+
|
|
313
|
+
* **y_axis**
|
|
314
|
+
- **ticks**
|
|
315
|
+
- **font_size (int):** Font size for the y-axis tick marks.
|
|
316
|
+
- **font_color (str):** Font color for the y-axis tick marks.
|
|
317
|
+
- **font_family (str):** Font family for the y-axis tick marks.
|
|
318
|
+
- **label**
|
|
319
|
+
- **font_size (int):** Font size for the y-axis label.
|
|
320
|
+
- **font_color (str):** Font color for the y-axis label.
|
|
321
|
+
- **font_family (str):** Font family for the y-axis label.
|
|
322
|
+
|
|
323
|
+
* **y_axis2**
|
|
324
|
+
- **ticks**
|
|
325
|
+
- **font_size (int):** Font size for the y-axis tick marks.
|
|
326
|
+
- **font_color (str):** Font color for the y-axis tick marks.
|
|
327
|
+
- **font_family (str):** Font family for the y-axis tick marks.
|
|
328
|
+
- **label**
|
|
329
|
+
- **font_size (int):** Font size for the y-axis label.
|
|
330
|
+
- **font_color (str):** Font color for the y-axis label.
|
|
331
|
+
- **font_family (str):** Font family for the y-axis label.
|
|
332
|
+
|
|
333
|
+
* **series**
|
|
334
|
+
- **bar_edge_color (str):** Border color for bars in bar charts.
|
|
335
|
+
- **bar_edge_width (int):** Border width for bars in bar charts.
|
|
336
|
+
- **bar_face_color (str):** Fill color for bars in bar charts.
|
|
337
|
+
- **line_width (int):** Line width for line series.
|
|
338
|
+
- **line_style (str):** Line style for line series.
|
|
339
|
+
- **line_color (str):** Line color for line series.
|
|
340
|
+
- **marker_color (str):** Color of the marker symbol.
|
|
341
|
+
- **marker_size (int):** Size of the marker symbol.
|
|
342
|
+
- **marker_width (int):** Width of the marker symbol.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
**3. Report**
|
|
347
|
+
|
|
348
|
+
* **title**
|
|
349
|
+
- **font_style (str):** Font style for the report title.
|
|
350
|
+
- **font_size (int):** Font size for the report title.
|
|
351
|
+
- **font_color (str):** Font color for the report title.
|
|
352
|
+
- **font_family (str):** Font family for the report title.
|
|
353
|
+
|
|
354
|
+
* **subtitle**
|
|
355
|
+
- **font_style (str):** Font style for the report subtitle.
|
|
356
|
+
- **font_size (int):** Font size for the report subtitle.
|
|
357
|
+
- **font_color (str):** Font color for the report subtitle.
|
|
358
|
+
- **font_family (str):** Font family for the report subtitle.
|
|
359
|
+
|
|
360
|
+
* **abstract**
|
|
361
|
+
- **height (int):** Height of the abstract block.
|
|
362
|
+
- **font_size (int):** Font size for the abstract text.
|
|
363
|
+
- **font_color (str):** Font color for the abstract text.
|
|
364
|
+
|
|
365
|
+
* **footer**
|
|
366
|
+
- **height (int):** Height of the footer block.
|
|
367
|
+
- **top_margin (int):** Space above the footer.
|
|
368
|
+
- **top_padding (int):** Space inside the footer.
|
|
369
|
+
|
|
370
|
+
* **header**
|
|
371
|
+
- **height (int):** Height of the header block.
|
|
372
|
+
- **bottom_margin (int):** Space below the header.
|
|
373
|
+
|
|
374
|
+
* **font_style (str):** Font style for the report (inherited by child objects).
|
|
375
|
+
* **font_family (str):** Font family for the report text.
|
|
376
|
+
* **font_color (str):** Font color for the report text.
|
|
377
|
+
* **page_margin_top (int):** Top page margin.
|
|
378
|
+
* **page_margin_right (int):** Right page margin.
|
|
379
|
+
* **page_margin_bottom (int):** Bottom page margin.
|
|
380
|
+
* **page_margin_left (int):** Left page margin.
|
|
381
|
+
* **title_bottom_padding (int):** Space between the title and its object.
|
|
382
|
+
* **logo_height (int):** Height of the logo.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
**4. Text**
|
|
387
|
+
|
|
388
|
+
* **font_style (str):** Font style for the main body of the Text object.
|
|
389
|
+
* **font_family (str):** Font family for the main body of the Text object.
|
|
390
|
+
* **font_size (int):** Font size for the main body of the Text object.
|
|
391
|
+
|
|
392
|
+
* **title**
|
|
393
|
+
- **font_style (str):** Font style of the Text object title.
|
|
394
|
+
- **font_family (str):** Font family of the Text object title.
|
|
395
|
+
- **font_size (int):** Font size of the Text object title.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
**5. Footnotes**
|
|
400
|
+
|
|
401
|
+
* **font_style (str):** Font style for footnotes.
|
|
402
|
+
* **font_family (str):** Font family for footnotes.
|
|
403
|
+
* **font_color (str):** Font color for footnotes.
|
|
404
|
+
* **font_size (int):** Font size for footnotes.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
**6. Grid**
|
|
409
|
+
|
|
410
|
+
* **title**
|
|
411
|
+
- **font_style (str):** Font style for Grid title.
|
|
412
|
+
- **font_family (str):** Font family for Grid title.
|
|
413
|
+
- **font_color (str):** Font color for Grid title.
|
|
414
|
+
- **font_size (int):** Font size for Grid title.
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
**7. Chapter**
|
|
419
|
+
|
|
420
|
+
* **Title**
|
|
421
|
+
- **font_style (str):** Font style for Chapter title.
|
|
422
|
+
- **font_family (str):** Font family for Chapter title.
|
|
423
|
+
- **font_color (str):** Font color for Chapter title.
|
|
424
|
+
- **font_size (int):** Font size for Chapter title.
|
|
425
|
+
|
|
426
|
+
* **font_style (str):** Font style for Chapter (inherited by child objects).
|
|
427
|
+
* **font_family (str):** Font family for Chapter.
|
|
428
|
+
* **font_size (int):** Font size for Chapter.
|
|
429
|
+
|
|
430
|
+
## Customizing Chart Highlight Colors
|
|
431
|
+
|
|
432
|
+
You can customize the chart highlight color using various formats, including hex, RGB, or natural language (e.g., “g” or “green”). However, using RGB will create a solid color fill for the highlighted range. For custom colors, use RGBA (e.g., “rgba(0, 128, 0, 0.25)”) or HSLA (e.g., “hsla(120, 100%, 25%, 0.25)”).
|
|
433
|
+
|
|
434
|
+
For simple highlights, you can use natural language such as “green.” When you specify “green,” the highlight will use MATLAB’s default green color with added transparency of 25%, that is applied in the backend.
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|