chartengineer 0.1.0__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.
@@ -0,0 +1,174 @@
1
+ Metadata-Version: 2.1
2
+ Name: chartengineer
3
+ Version: 0.1.0
4
+ Summary: Library for quick and modern chart building.
5
+ Home-page:
6
+ Author: Brandyn Hamilton
7
+ Author-email: brandynham1120@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: pandas
14
+ Requires-Dist: numpy
15
+ Requires-Dist: dotenv
16
+ Requires-Dist: plotly
17
+ Requires-Dist: matplotlib
18
+ Requires-Dist: colorcet
19
+ Requires-Dist: nbformat>=4.2.0
20
+ Requires-Dist: kaleido==0.1.0.post1
21
+
22
+ # `chartengineer` Documentation
23
+
24
+ **chartengineer** is a lightweight Python package for building publication-ready, highly customizable Plotly charts from pandas DataFrames.
25
+
26
+ It supports a flexible API for pie charts, grouped bar charts, heatmaps, time series, and area/line plots, with robust formatting, annotations, and layout tools.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install chartengineer
34
+ ```
35
+
36
+ Or install from source:
37
+
38
+ ```bash
39
+ git clone https://github.com/your-org/chartengineer
40
+ cd chartengineer
41
+ pip install -e .
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Quickstart
47
+
48
+ ```python
49
+ from chartengineer import ChartMaker
50
+
51
+ cm = ChartMaker(shuffle_colors=True)
52
+ cm.build(
53
+ df=my_df,
54
+ groupby_col="CHAIN",
55
+ num_col="TOTAL_VOLUME",
56
+ title="Bridge Volume by Chain",
57
+ chart_type="pie",
58
+ options={
59
+ "tickprefix": {"y1": "$"},
60
+ "annotations": True,
61
+ "texttemplate": "%{label}<br>%{percent}"
62
+ }
63
+ )
64
+ cm.add_title(subtitle="As of 2025-04-01")
65
+ cm.show_fig()
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Supported Chart Types
71
+
72
+ - `"line"` (default)
73
+ - `"bar"`
74
+ - `"area"`
75
+ - `"pie"`
76
+ - `"heatmap"`
77
+
78
+ You can use a string or dictionary:
79
+
80
+ ```python
81
+ chart_type = "bar" # applies to both y1/y2
82
+ chart_type = {"y1": "line", "y2": "bar"} # axis-specific
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Main Methods
88
+
89
+ ### `ChartMaker.build(...)`
90
+
91
+ Build a chart.
92
+
93
+ **Arguments**
94
+
95
+ - `df`: pandas DataFrame
96
+ - `title`: Chart title
97
+ - `chart_type`: string or dict
98
+ - `groupby_col`, `num_col`: for grouped series or pie/bar
99
+ - `axes_data`: e.g. `{"x": "DATE", "y1": ["TVL"]}`
100
+ - `options`: plot style and behavior options
101
+
102
+ ---
103
+
104
+ ### `ChartMaker.show_fig()`
105
+
106
+ Render the current chart inline (Jupyter) or open in browser.
107
+
108
+ ### `ChartMaker.save_fig(path, filetype='png')`
109
+
110
+ Save the chart as `.png`, `.svg`, or `.html`.
111
+
112
+ ### ChartMaker.add_annotations(max_annotation=True, custom_annotations=None, annotation_placement=dict(x=0.5,y=0.5))
113
+
114
+ If called and the chart is plotting timeseries data, this automatically adds annotations for the first and last data points. If max_annotation is True, it dynamically calculates the max value in the dataset and annotates it. Note that this is meant for plotting single-series timeseries data.
115
+
116
+ If the chart is a Pie chart, the annotation_placement parameter enables moving the location of where the annotation is placed.
117
+
118
+ ### ChartMaker.add_dashed_line(date, annotation_text=None)
119
+
120
+ Adds a dashed line and annotation at the specified date; meant for timeseries data. If annotation_text is None, it uses the column name that contains the max value for the specified date.
121
+
122
+ ### ChartMaker.return_df()
123
+
124
+ Returns the dataframe used in a chart.
125
+
126
+ ### ChartMaker.return_fig()
127
+
128
+ Returns the Plotly figure that was created from calling the build method.
129
+
130
+ ---
131
+
132
+ ## Customization Options
133
+
134
+ All style options can be passed via the `options` parameter. These are the same options that can be passed to a base Plotly figure. Refer to the Plotly library documentation for a full list of accepted parameters.
135
+
136
+ ```python
137
+ options = {
138
+ "tickprefix": {"y1": "$"},
139
+ "ticksuffix": {"y1": "%"},
140
+ "dimensions": {"width": 800, "height": 400},
141
+ "font_family": "Cardo",
142
+ "font_size": {"axes": 16, "legend": 12, "textfont": 12},
143
+ "legend_placement": {"x": 1.05, "y": 1},
144
+ "show_text": True,
145
+ "annotations": True,
146
+ }
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Chart Features
152
+
153
+ - Grouped bar plots with custom sort and color mapping
154
+ - Automatic annotations for first/last/max points
155
+ - Time series support with datetime formatting
156
+ - Pie chart labels, percentages, donut hole support
157
+ - Heatmaps with flexible x/y/z column mapping
158
+
159
+ ---
160
+
161
+ ## Project Structure
162
+
163
+ ```
164
+ chartengineer/
165
+ ├── __init__.py
166
+ ├── core.py # ChartMaker class
167
+ ├── utils.py # Plotting utils, formatting
168
+ ```
169
+
170
+ ---
171
+
172
+ ## License
173
+
174
+ MIT License © Brandyn Hamilton
@@ -0,0 +1,153 @@
1
+ # `chartengineer` Documentation
2
+
3
+ **chartengineer** is a lightweight Python package for building publication-ready, highly customizable Plotly charts from pandas DataFrames.
4
+
5
+ It supports a flexible API for pie charts, grouped bar charts, heatmaps, time series, and area/line plots, with robust formatting, annotations, and layout tools.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pip install chartengineer
13
+ ```
14
+
15
+ Or install from source:
16
+
17
+ ```bash
18
+ git clone https://github.com/your-org/chartengineer
19
+ cd chartengineer
20
+ pip install -e .
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Quickstart
26
+
27
+ ```python
28
+ from chartengineer import ChartMaker
29
+
30
+ cm = ChartMaker(shuffle_colors=True)
31
+ cm.build(
32
+ df=my_df,
33
+ groupby_col="CHAIN",
34
+ num_col="TOTAL_VOLUME",
35
+ title="Bridge Volume by Chain",
36
+ chart_type="pie",
37
+ options={
38
+ "tickprefix": {"y1": "$"},
39
+ "annotations": True,
40
+ "texttemplate": "%{label}<br>%{percent}"
41
+ }
42
+ )
43
+ cm.add_title(subtitle="As of 2025-04-01")
44
+ cm.show_fig()
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Supported Chart Types
50
+
51
+ - `"line"` (default)
52
+ - `"bar"`
53
+ - `"area"`
54
+ - `"pie"`
55
+ - `"heatmap"`
56
+
57
+ You can use a string or dictionary:
58
+
59
+ ```python
60
+ chart_type = "bar" # applies to both y1/y2
61
+ chart_type = {"y1": "line", "y2": "bar"} # axis-specific
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Main Methods
67
+
68
+ ### `ChartMaker.build(...)`
69
+
70
+ Build a chart.
71
+
72
+ **Arguments**
73
+
74
+ - `df`: pandas DataFrame
75
+ - `title`: Chart title
76
+ - `chart_type`: string or dict
77
+ - `groupby_col`, `num_col`: for grouped series or pie/bar
78
+ - `axes_data`: e.g. `{"x": "DATE", "y1": ["TVL"]}`
79
+ - `options`: plot style and behavior options
80
+
81
+ ---
82
+
83
+ ### `ChartMaker.show_fig()`
84
+
85
+ Render the current chart inline (Jupyter) or open in browser.
86
+
87
+ ### `ChartMaker.save_fig(path, filetype='png')`
88
+
89
+ Save the chart as `.png`, `.svg`, or `.html`.
90
+
91
+ ### ChartMaker.add_annotations(max_annotation=True, custom_annotations=None, annotation_placement=dict(x=0.5,y=0.5))
92
+
93
+ If called and the chart is plotting timeseries data, this automatically adds annotations for the first and last data points. If max_annotation is True, it dynamically calculates the max value in the dataset and annotates it. Note that this is meant for plotting single-series timeseries data.
94
+
95
+ If the chart is a Pie chart, the annotation_placement parameter enables moving the location of where the annotation is placed.
96
+
97
+ ### ChartMaker.add_dashed_line(date, annotation_text=None)
98
+
99
+ Adds a dashed line and annotation at the specified date; meant for timeseries data. If annotation_text is None, it uses the column name that contains the max value for the specified date.
100
+
101
+ ### ChartMaker.return_df()
102
+
103
+ Returns the dataframe used in a chart.
104
+
105
+ ### ChartMaker.return_fig()
106
+
107
+ Returns the Plotly figure that was created from calling the build method.
108
+
109
+ ---
110
+
111
+ ## Customization Options
112
+
113
+ All style options can be passed via the `options` parameter. These are the same options that can be passed to a base Plotly figure. Refer to the Plotly library documentation for a full list of accepted parameters.
114
+
115
+ ```python
116
+ options = {
117
+ "tickprefix": {"y1": "$"},
118
+ "ticksuffix": {"y1": "%"},
119
+ "dimensions": {"width": 800, "height": 400},
120
+ "font_family": "Cardo",
121
+ "font_size": {"axes": 16, "legend": 12, "textfont": 12},
122
+ "legend_placement": {"x": 1.05, "y": 1},
123
+ "show_text": True,
124
+ "annotations": True,
125
+ }
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Chart Features
131
+
132
+ - Grouped bar plots with custom sort and color mapping
133
+ - Automatic annotations for first/last/max points
134
+ - Time series support with datetime formatting
135
+ - Pie chart labels, percentages, donut hole support
136
+ - Heatmaps with flexible x/y/z column mapping
137
+
138
+ ---
139
+
140
+ ## Project Structure
141
+
142
+ ```
143
+ chartengineer/
144
+ ├── __init__.py
145
+ ├── core.py # ChartMaker class
146
+ ├── utils.py # Plotting utils, formatting
147
+ ```
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ MIT License © Brandyn Hamilton
@@ -0,0 +1 @@
1
+ from .core import (ChartMaker)