@teamflojo/floimg-quickchart 0.1.0 → 0.2.0
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.
- package/README.md +19 -19
- package/dist/index.d.ts +1 -1
- package/package.json +11 -10
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# floimg-quickchart
|
|
2
2
|
|
|
3
|
-
QuickChart.io generator for
|
|
3
|
+
QuickChart.io generator for floimg - create charts using Chart.js configuration.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install @teamflojo/floimg @teamflojo/floimg-quickchart
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import createClient from '
|
|
15
|
-
import quickchart from '
|
|
14
|
+
import createClient from '@teamflojo/floimg';
|
|
15
|
+
import quickchart from '@teamflojo/floimg-quickchart';
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const floimg = createClient({
|
|
18
18
|
store: {
|
|
19
19
|
default: 's3',
|
|
20
20
|
s3: { region: 'us-east-1', bucket: 'my-charts' }
|
|
@@ -22,10 +22,10 @@ const imgflo = createClient({
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// Register the QuickChart generator
|
|
25
|
-
|
|
25
|
+
floimg.registerGenerator(quickchart());
|
|
26
26
|
|
|
27
27
|
// Generate a bar chart
|
|
28
|
-
const chart = await
|
|
28
|
+
const chart = await floimg.generate({
|
|
29
29
|
generator: 'quickchart',
|
|
30
30
|
params: {
|
|
31
31
|
type: 'bar',
|
|
@@ -48,8 +48,8 @@ const chart = await imgflo.generate({
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// Convert to PNG and save
|
|
51
|
-
const png = await
|
|
52
|
-
const result = await
|
|
51
|
+
const png = await floimg.transform({ blob: chart, op: 'convert', to: 'image/png' });
|
|
52
|
+
const result = await floimg.save(png, './output/revenue.png');
|
|
53
53
|
|
|
54
54
|
console.log(result.url); // Use in slides, emails, etc.
|
|
55
55
|
```
|
|
@@ -61,7 +61,7 @@ QuickChart supports all Chart.js chart types:
|
|
|
61
61
|
### Bar Chart
|
|
62
62
|
|
|
63
63
|
```typescript
|
|
64
|
-
await
|
|
64
|
+
await floimg.generate({
|
|
65
65
|
generator: 'quickchart',
|
|
66
66
|
params: {
|
|
67
67
|
type: 'bar',
|
|
@@ -76,7 +76,7 @@ await imgflo.generate({
|
|
|
76
76
|
### Line Chart
|
|
77
77
|
|
|
78
78
|
```typescript
|
|
79
|
-
await
|
|
79
|
+
await floimg.generate({
|
|
80
80
|
generator: 'quickchart',
|
|
81
81
|
params: {
|
|
82
82
|
type: 'line',
|
|
@@ -96,7 +96,7 @@ await imgflo.generate({
|
|
|
96
96
|
### Pie Chart
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
|
-
await
|
|
99
|
+
await floimg.generate({
|
|
100
100
|
generator: 'quickchart',
|
|
101
101
|
params: {
|
|
102
102
|
type: 'pie',
|
|
@@ -114,7 +114,7 @@ await imgflo.generate({
|
|
|
114
114
|
### Doughnut Chart
|
|
115
115
|
|
|
116
116
|
```typescript
|
|
117
|
-
await
|
|
117
|
+
await floimg.generate({
|
|
118
118
|
generator: 'quickchart',
|
|
119
119
|
params: {
|
|
120
120
|
type: 'doughnut',
|
|
@@ -131,7 +131,7 @@ await imgflo.generate({
|
|
|
131
131
|
### Generator Options
|
|
132
132
|
|
|
133
133
|
```typescript
|
|
134
|
-
|
|
134
|
+
floimg.registerGenerator(quickchart({
|
|
135
135
|
width: 800, // Default width
|
|
136
136
|
height: 600, // Default height
|
|
137
137
|
backgroundColor: 'white', // Default background
|
|
@@ -143,7 +143,7 @@ imgflo.registerGenerator(quickchart({
|
|
|
143
143
|
### Per-Chart Overrides
|
|
144
144
|
|
|
145
145
|
```typescript
|
|
146
|
-
await
|
|
146
|
+
await floimg.generate({
|
|
147
147
|
generator: 'quickchart',
|
|
148
148
|
params: {
|
|
149
149
|
width: 1200, // Override width
|
|
@@ -169,7 +169,7 @@ Since this generator uses Chart.js format directly, refer to the official Chart.
|
|
|
169
169
|
### Multi-Dataset Chart
|
|
170
170
|
|
|
171
171
|
```typescript
|
|
172
|
-
await
|
|
172
|
+
await floimg.generate({
|
|
173
173
|
generator: 'quickchart',
|
|
174
174
|
params: {
|
|
175
175
|
type: 'line',
|
|
@@ -203,7 +203,7 @@ await imgflo.generate({
|
|
|
203
203
|
### Stacked Bar Chart
|
|
204
204
|
|
|
205
205
|
```typescript
|
|
206
|
-
await
|
|
206
|
+
await floimg.generate({
|
|
207
207
|
generator: 'quickchart',
|
|
208
208
|
params: {
|
|
209
209
|
type: 'bar',
|
|
@@ -234,6 +234,6 @@ MIT
|
|
|
234
234
|
|
|
235
235
|
## See Also
|
|
236
236
|
|
|
237
|
-
- [
|
|
237
|
+
- [floimg](https://github.com/bcooke/floimg) - Core library
|
|
238
238
|
- [QuickChart.io](https://quickchart.io) - Chart rendering service
|
|
239
239
|
- [Chart.js](https://www.chartjs.org) - Charting library
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const quickchartSchema: GeneratorSchema;
|
|
|
7
7
|
* QuickChart generator - creates charts using Chart.js via QuickChart.io API
|
|
8
8
|
*
|
|
9
9
|
* This generator accepts Chart.js configuration directly (pass-through pattern).
|
|
10
|
-
* No
|
|
10
|
+
* No floimg abstraction - you get full Chart.js capabilities.
|
|
11
11
|
*
|
|
12
12
|
* @see https://www.chartjs.org/docs/ - Chart.js documentation
|
|
13
13
|
* @see https://quickchart.io/documentation/ - QuickChart API docs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamflojo/floimg-quickchart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "QuickChart.io generator for floimg - create charts using Chart.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,6 +16,13 @@
|
|
|
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
|
+
},
|
|
19
26
|
"keywords": [
|
|
20
27
|
"floimg",
|
|
21
28
|
"quickchart",
|
|
@@ -37,17 +44,11 @@
|
|
|
37
44
|
},
|
|
38
45
|
"devDependencies": {
|
|
39
46
|
"@types/node": "^22.10.2",
|
|
47
|
+
"@teamflojo/floimg": "workspace:*",
|
|
40
48
|
"typescript": "^5.7.2",
|
|
41
|
-
"vitest": "^2.1.9"
|
|
42
|
-
"@teamflojo/floimg": "0.1.0"
|
|
49
|
+
"vitest": "^2.1.9"
|
|
43
50
|
},
|
|
44
51
|
"engines": {
|
|
45
52
|
"node": ">=18.0.0"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"build": "tsc",
|
|
49
|
-
"dev": "tsc --watch",
|
|
50
|
-
"typecheck": "tsc --noEmit",
|
|
51
|
-
"clean": "rm -rf dist"
|
|
52
53
|
}
|
|
53
|
-
}
|
|
54
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Brett Cooke
|
|
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.
|