@teamflojo/floimg-quickchart 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -90
  3. package/package.json +12 -12
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Flojo, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  QuickChart.io generator for floimg - create charts using Chart.js configuration.
4
4
 
5
+ ## Standing on the Shoulders of Giants
6
+
7
+ This plugin is a thin wrapper around [Chart.js](https://www.chartjs.org/) via [QuickChart](https://quickchart.io/). We don't abstract or limit the underlying library—your configuration passes through directly.
8
+
9
+ - **Full Chart.js power**: Every Chart.js option works
10
+ - **Native format**: Use Chart.js config, not a FloImg abstraction
11
+ - **Their docs are your docs**: See [Chart.js documentation](https://www.chartjs.org/docs/)
12
+
13
+ FloImg orchestrates the workflow (generate → transform → save). Chart.js does what it does best.
14
+
5
15
  ## Installation
6
16
 
7
17
  ```bash
@@ -11,14 +21,14 @@ npm install @teamflojo/floimg @teamflojo/floimg-quickchart
11
21
  ## Usage
12
22
 
13
23
  ```typescript
14
- import createClient from '@teamflojo/floimg';
15
- import quickchart from '@teamflojo/floimg-quickchart';
24
+ import createClient from "@teamflojo/floimg";
25
+ import quickchart from "@teamflojo/floimg-quickchart";
16
26
 
17
27
  const floimg = createClient({
18
28
  store: {
19
- default: 's3',
20
- s3: { region: 'us-east-1', bucket: 'my-charts' }
21
- }
29
+ default: "s3",
30
+ s3: { region: "us-east-1", bucket: "my-charts" },
31
+ },
22
32
  });
23
33
 
24
34
  // Register the QuickChart generator
@@ -26,30 +36,32 @@ floimg.registerGenerator(quickchart());
26
36
 
27
37
  // Generate a bar chart
28
38
  const chart = await floimg.generate({
29
- generator: 'quickchart',
39
+ generator: "quickchart",
30
40
  params: {
31
- type: 'bar',
41
+ type: "bar",
32
42
  data: {
33
- labels: ['Q1', 'Q2', 'Q3', 'Q4'],
34
- datasets: [{
35
- label: 'Revenue ($M)',
36
- data: [12, 19, 3, 5],
37
- backgroundColor: 'rgba(75, 192, 192, 0.6)'
38
- }]
43
+ labels: ["Q1", "Q2", "Q3", "Q4"],
44
+ datasets: [
45
+ {
46
+ label: "Revenue ($M)",
47
+ data: [12, 19, 3, 5],
48
+ backgroundColor: "rgba(75, 192, 192, 0.6)",
49
+ },
50
+ ],
39
51
  },
40
52
  options: {
41
53
  scales: {
42
54
  y: {
43
- beginAtZero: true
44
- }
45
- }
46
- }
47
- }
55
+ beginAtZero: true,
56
+ },
57
+ },
58
+ },
59
+ },
48
60
  });
49
61
 
50
62
  // Convert to PNG and save
51
- const png = await floimg.transform({ blob: chart, op: 'convert', to: 'image/png' });
52
- const result = await floimg.save(png, './output/revenue.png');
63
+ const png = await floimg.transform({ blob: chart, op: "convert", to: "image/png" });
64
+ const result = await floimg.save(png, "./output/revenue.png");
53
65
 
54
66
  console.log(result.url); // Use in slides, emails, etc.
55
67
  ```
@@ -62,14 +74,14 @@ QuickChart supports all Chart.js chart types:
62
74
 
63
75
  ```typescript
64
76
  await floimg.generate({
65
- generator: 'quickchart',
77
+ generator: "quickchart",
66
78
  params: {
67
- type: 'bar',
79
+ type: "bar",
68
80
  data: {
69
- labels: ['Red', 'Blue', 'Yellow'],
70
- datasets: [{ data: [12, 19, 3] }]
71
- }
72
- }
81
+ labels: ["Red", "Blue", "Yellow"],
82
+ datasets: [{ data: [12, 19, 3] }],
83
+ },
84
+ },
73
85
  });
74
86
  ```
75
87
 
@@ -77,19 +89,21 @@ await floimg.generate({
77
89
 
78
90
  ```typescript
79
91
  await floimg.generate({
80
- generator: 'quickchart',
92
+ generator: "quickchart",
81
93
  params: {
82
- type: 'line',
94
+ type: "line",
83
95
  data: {
84
- labels: ['Jan', 'Feb', 'Mar', 'Apr'],
85
- datasets: [{
86
- label: 'Sales',
87
- data: [10, 15, 13, 17],
88
- borderColor: 'rgb(75, 192, 192)',
89
- tension: 0.1
90
- }]
91
- }
92
- }
96
+ labels: ["Jan", "Feb", "Mar", "Apr"],
97
+ datasets: [
98
+ {
99
+ label: "Sales",
100
+ data: [10, 15, 13, 17],
101
+ borderColor: "rgb(75, 192, 192)",
102
+ tension: 0.1,
103
+ },
104
+ ],
105
+ },
106
+ },
93
107
  });
94
108
  ```
95
109
 
@@ -97,17 +111,19 @@ await floimg.generate({
97
111
 
98
112
  ```typescript
99
113
  await floimg.generate({
100
- generator: 'quickchart',
114
+ generator: "quickchart",
101
115
  params: {
102
- type: 'pie',
116
+ type: "pie",
103
117
  data: {
104
- labels: ['Desktop', 'Mobile', 'Tablet'],
105
- datasets: [{
106
- data: [45, 40, 15],
107
- backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56']
108
- }]
109
- }
110
- }
118
+ labels: ["Desktop", "Mobile", "Tablet"],
119
+ datasets: [
120
+ {
121
+ data: [45, 40, 15],
122
+ backgroundColor: ["#FF6384", "#36A2EB", "#FFCE56"],
123
+ },
124
+ ],
125
+ },
126
+ },
111
127
  });
112
128
  ```
113
129
 
@@ -115,14 +131,14 @@ await floimg.generate({
115
131
 
116
132
  ```typescript
117
133
  await floimg.generate({
118
- generator: 'quickchart',
134
+ generator: "quickchart",
119
135
  params: {
120
- type: 'doughnut',
136
+ type: "doughnut",
121
137
  data: {
122
- labels: ['Win', 'Loss', 'Draw'],
123
- datasets: [{ data: [10, 5, 3] }]
124
- }
125
- }
138
+ labels: ["Win", "Loss", "Draw"],
139
+ datasets: [{ data: [10, 5, 3] }],
140
+ },
141
+ },
126
142
  });
127
143
  ```
128
144
 
@@ -131,27 +147,31 @@ await floimg.generate({
131
147
  ### Generator Options
132
148
 
133
149
  ```typescript
134
- floimg.registerGenerator(quickchart({
135
- width: 800, // Default width
136
- height: 600, // Default height
137
- backgroundColor: 'white', // Default background
138
- format: 'png', // 'png' | 'svg' | 'webp'
139
- devicePixelRatio: 2.0 // For high DPI displays
140
- }));
150
+ floimg.registerGenerator(
151
+ quickchart({
152
+ width: 800, // Default width
153
+ height: 600, // Default height
154
+ backgroundColor: "white", // Default background
155
+ format: "png", // 'png' | 'svg' | 'webp'
156
+ devicePixelRatio: 2.0, // For high DPI displays
157
+ })
158
+ );
141
159
  ```
142
160
 
143
161
  ### Per-Chart Overrides
144
162
 
145
163
  ```typescript
146
164
  await floimg.generate({
147
- generator: 'quickchart',
165
+ generator: "quickchart",
148
166
  params: {
149
- width: 1200, // Override width
150
- height: 800, // Override height
151
- backgroundColor: '#f0f0f0',
152
- type: 'bar',
153
- data: { /* ... */ }
154
- }
167
+ width: 1200, // Override width
168
+ height: 800, // Override height
169
+ backgroundColor: "#f0f0f0",
170
+ type: "bar",
171
+ data: {
172
+ /* ... */
173
+ },
174
+ },
155
175
  });
156
176
  ```
157
177
 
@@ -170,33 +190,33 @@ Since this generator uses Chart.js format directly, refer to the official Chart.
170
190
 
171
191
  ```typescript
172
192
  await floimg.generate({
173
- generator: 'quickchart',
193
+ generator: "quickchart",
174
194
  params: {
175
- type: 'line',
195
+ type: "line",
176
196
  data: {
177
- labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
197
+ labels: ["Jan", "Feb", "Mar", "Apr", "May"],
178
198
  datasets: [
179
199
  {
180
- label: '2023',
200
+ label: "2023",
181
201
  data: [10, 15, 13, 17, 20],
182
- borderColor: 'rgb(75, 192, 192)'
202
+ borderColor: "rgb(75, 192, 192)",
183
203
  },
184
204
  {
185
- label: '2024',
205
+ label: "2024",
186
206
  data: [12, 17, 15, 19, 23],
187
- borderColor: 'rgb(255, 99, 132)'
188
- }
189
- ]
207
+ borderColor: "rgb(255, 99, 132)",
208
+ },
209
+ ],
190
210
  },
191
211
  options: {
192
212
  plugins: {
193
213
  title: {
194
214
  display: true,
195
- text: 'Sales Comparison'
196
- }
197
- }
198
- }
199
- }
215
+ text: "Sales Comparison",
216
+ },
217
+ },
218
+ },
219
+ },
200
220
  });
201
221
  ```
202
222
 
@@ -204,23 +224,23 @@ await floimg.generate({
204
224
 
205
225
  ```typescript
206
226
  await floimg.generate({
207
- generator: 'quickchart',
227
+ generator: "quickchart",
208
228
  params: {
209
- type: 'bar',
229
+ type: "bar",
210
230
  data: {
211
- labels: ['Q1', 'Q2', 'Q3', 'Q4'],
231
+ labels: ["Q1", "Q2", "Q3", "Q4"],
212
232
  datasets: [
213
- { label: 'Product A', data: [10, 15, 12, 18], backgroundColor: '#FF6384' },
214
- { label: 'Product B', data: [8, 12, 10, 14], backgroundColor: '#36A2EB' }
215
- ]
233
+ { label: "Product A", data: [10, 15, 12, 18], backgroundColor: "#FF6384" },
234
+ { label: "Product B", data: [8, 12, 10, 14], backgroundColor: "#36A2EB" },
235
+ ],
216
236
  },
217
237
  options: {
218
238
  scales: {
219
239
  x: { stacked: true },
220
- y: { stacked: true }
221
- }
222
- }
223
- }
240
+ y: { stacked: true },
241
+ },
242
+ },
243
+ },
224
244
  });
225
245
  ```
226
246
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamflojo/floimg-quickchart",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "QuickChart.io generator for floimg - create charts using Chart.js",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,13 +16,6 @@
16
16
  "README.md",
17
17
  "LICENSE"
18
18
  ],
19
- "scripts": {
20
- "build": "tsc",
21
- "dev": "tsc --watch",
22
- "typecheck": "tsc --noEmit",
23
- "clean": "rm -rf dist",
24
- "prepublishOnly": "npm run build"
25
- },
26
19
  "keywords": [
27
20
  "floimg",
28
21
  "quickchart",
@@ -40,15 +33,22 @@
40
33
  "directory": "packages/floimg-quickchart"
41
34
  },
42
35
  "peerDependencies": {
43
- "@teamflojo/floimg": "^0.2.0"
36
+ "@teamflojo/floimg": "^0.8.0"
44
37
  },
45
38
  "devDependencies": {
46
39
  "@types/node": "^22.10.2",
47
- "@teamflojo/floimg": "workspace:*",
48
40
  "typescript": "^5.7.2",
49
- "vitest": "^2.1.9"
41
+ "vitest": "^2.1.9",
42
+ "@teamflojo/floimg": "0.9.0"
50
43
  },
51
44
  "engines": {
52
45
  "node": ">=18.0.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc",
49
+ "dev": "tsc --watch",
50
+ "test": "vitest --run",
51
+ "typecheck": "tsc --noEmit",
52
+ "clean": "rm -rf dist"
53
53
  }
54
- }
54
+ }