@@ -12,12 +12,13 @@ open System.Runtime.CompilerServices
12
12
[<AutoOpen>]
13
13
module ChartExtensions =
14
14
15
- type internal RenderOptions (? EngineType : ExportEngine , ? Width : int , ? Height : int ) =
15
+ type internal RenderOptions (? EngineType : ExportEngine , ? Width : int , ? Height : int , ? Scale : float ) =
16
16
member _.Engine =
17
17
( defaultArg EngineType ExportEngine.PuppeteerSharp) |> ExportEngine.getEngine
18
18
19
19
member _.Width = defaultArg Width 600
20
20
member _.Height = defaultArg Height 600
21
+ member _.Scale = defaultArg Scale 1.0
21
22
22
23
type Chart with
23
24
@@ -27,35 +28,39 @@ module ChartExtensions =
27
28
/// <param name="EngineType">The Render engine to use</param>
28
29
/// <param name="Width">width of the resulting image</param>
29
30
/// <param name="Height">height of the resulting image</param>
31
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
30
32
[<CompiledName( " ToBase64JPGStringAsync" ) >]
31
33
static member toBase64JPGStringAsync
32
34
(
33
35
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
34
36
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
35
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
37
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
38
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
36
39
) =
37
40
38
41
let opts =
39
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
42
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
40
43
41
- fun ( gChart : GenericChart ) -> opts.Engine.RenderJPGAsync( opts.Width, opts.Height, gChart)
44
+ fun ( gChart : GenericChart ) -> opts.Engine.RenderJPGAsync( opts.Width, opts.Height, opts.Scale , gChart)
42
45
43
46
/// <summary>
44
47
/// Returns a function that converts a GenericChart to a base64 encoded JPG string
45
48
/// </summary>
46
49
/// <param name="EngineType">The Render engine to use</param>
47
50
/// <param name="Width">width of the resulting image</param>
48
51
/// <param name="Height">height of the resulting image</param>
52
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
49
53
[<CompiledName( " ToBase64JPGString" ) >]
50
54
static member toBase64JPGString
51
55
(
52
56
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
53
57
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
54
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
58
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
59
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
55
60
) =
56
61
fun ( gChart : GenericChart ) ->
57
62
gChart
58
- |> Chart.toBase64JPGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
63
+ |> Chart.toBase64JPGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
59
64
|> AsyncHelper.taskSync
60
65
61
66
/// <summary>
@@ -65,19 +70,21 @@ module ChartExtensions =
65
70
/// <param name="EngineType">The Render engine to use</param>
66
71
/// <param name="Width">width of the resulting image</param>
67
72
/// <param name="Height">height of the resulting image</param>
73
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
68
74
[<CompiledName( " SaveJPGAsync" ) >]
69
75
static member saveJPGAsync
70
76
(
71
77
path : string ,
72
78
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
73
79
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
74
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
80
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
81
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
75
82
) =
76
83
77
84
let opts =
78
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
85
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
79
86
80
- fun ( gChart : GenericChart ) -> opts.Engine.SaveJPGAsync( path, opts.Width, opts.Height, gChart)
87
+ fun ( gChart : GenericChart ) -> opts.Engine.SaveJPGAsync( path, opts.Width, opts.Height, opts.Scale , gChart)
81
88
82
89
/// <summary>
83
90
/// Returns a function that saves a GenericChart as JPG image
@@ -86,17 +93,19 @@ module ChartExtensions =
86
93
/// <param name="EngineType">The Render engine to use</param>
87
94
/// <param name="Width">width of the resulting image</param>
88
95
/// <param name="Height">height of the resulting image</param>
96
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
89
97
[<CompiledName( " SaveJPG" ) >]
90
98
static member saveJPG
91
99
(
92
100
path : string ,
93
101
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
94
102
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
95
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
103
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
104
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
96
105
) =
97
106
fun ( gChart : GenericChart ) ->
98
107
gChart
99
- |> Chart.saveJPGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height)
108
+ |> Chart.saveJPGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
100
109
|> AsyncHelper.taskSync
101
110
102
111
/// <summary>
@@ -105,35 +114,39 @@ module ChartExtensions =
105
114
/// <param name="EngineType">The Render engine to use</param>
106
115
/// <param name="Width">width of the resulting image</param>
107
116
/// <param name="Height">height of the resulting image</param>
117
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
108
118
[<CompiledName( " ToBase64PNGStringAsync" ) >]
109
119
static member toBase64PNGStringAsync
110
120
(
111
121
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
112
122
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
113
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
123
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
124
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
114
125
) =
115
126
116
127
let opts =
117
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
128
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
118
129
119
- fun ( gChart : GenericChart ) -> opts.Engine.RenderPNGAsync( opts.Width, opts.Height, gChart)
130
+ fun ( gChart : GenericChart ) -> opts.Engine.RenderPNGAsync( opts.Width, opts.Height, opts.Scale , gChart)
120
131
121
132
/// <summary>
122
133
/// Returns a function that converts a GenericChart to a base64 encoded PNG string
123
134
/// </summary>
124
135
/// <param name="EngineType">The Render engine to use</param>
125
136
/// <param name="Width">width of the resulting image</param>
126
137
/// <param name="Height">height of the resulting image</param>
138
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
127
139
[<CompiledName( " ToBase64PNGString" ) >]
128
140
static member toBase64PNGString
129
141
(
130
142
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
131
143
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
132
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
144
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
145
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
133
146
) =
134
147
fun ( gChart : GenericChart ) ->
135
148
gChart
136
- |> Chart.toBase64PNGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
149
+ |> Chart.toBase64PNGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
137
150
|> AsyncHelper.taskSync
138
151
139
152
/// <summary>
@@ -143,18 +156,20 @@ module ChartExtensions =
143
156
/// <param name="EngineType">The Render engine to use</param>
144
157
/// <param name="Width">width of the resulting image</param>
145
158
/// <param name="Height">height of the resulting image</param>
159
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
146
160
[<CompiledName( " SavePNGAsync" ) >]
147
161
static member savePNGAsync
148
162
(
149
163
path : string ,
150
164
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
151
165
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
152
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
166
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
167
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
153
168
) =
154
169
let opts =
155
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
170
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
156
171
157
- fun ( gChart : GenericChart ) -> opts.Engine.SavePNGAsync( path, opts.Width, opts.Height, gChart)
172
+ fun ( gChart : GenericChart ) -> opts.Engine.SavePNGAsync( path, opts.Width, opts.Height, opts.Scale , gChart)
158
173
159
174
160
175
/// <summary>
@@ -164,17 +179,19 @@ module ChartExtensions =
164
179
/// <param name="EngineType">The Render engine to use</param>
165
180
/// <param name="Width">width of the resulting image</param>
166
181
/// <param name="Height">height of the resulting image</param>
182
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
167
183
[<CompiledName( " SavePNG" ) >]
168
184
static member savePNG
169
185
(
170
186
path : string ,
171
187
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
172
188
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
173
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
189
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
190
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
174
191
) =
175
192
fun ( gChart : GenericChart ) ->
176
193
gChart
177
- |> Chart.savePNGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height)
194
+ |> Chart.savePNGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
178
195
|> AsyncHelper.taskSync
179
196
180
197
/// <summary>
@@ -183,34 +200,38 @@ module ChartExtensions =
183
200
/// <param name="EngineType">The Render engine to use</param>
184
201
/// <param name="Width">width of the resulting image</param>
185
202
/// <param name="Height">height of the resulting image</param>
203
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
186
204
[<CompiledName( " ToSVGStringAsync" ) >]
187
205
static member toSVGStringAsync
188
206
(
189
207
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
190
208
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
191
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
209
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
210
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
192
211
) =
193
212
let opts =
194
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
213
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
195
214
196
- fun ( gChart : GenericChart ) -> opts.Engine.RenderSVGAsync( opts.Width, opts.Height, gChart)
215
+ fun ( gChart : GenericChart ) -> opts.Engine.RenderSVGAsync( opts.Width, opts.Height, opts.Scale , gChart)
197
216
198
217
/// <summary>
199
218
/// Returns a function that converts a GenericChart to a SVG string
200
219
/// </summary>
201
220
/// <param name="EngineType">The Render engine to use</param>
202
221
/// <param name="Width">width of the resulting image</param>
203
222
/// <param name="Height">height of the resulting image</param>
223
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
204
224
[<CompiledName( " ToSVGString" ) >]
205
225
static member toSVGString
206
226
(
207
227
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
208
228
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
209
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
229
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
230
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
210
231
) =
211
232
fun ( gChart : GenericChart ) ->
212
233
gChart
213
- |> Chart.toSVGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
234
+ |> Chart.toSVGStringAsync ( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
214
235
|> AsyncHelper.taskSync
215
236
216
237
/// <summary>
@@ -220,18 +241,20 @@ module ChartExtensions =
220
241
/// <param name="EngineType">The Render engine to use</param>
221
242
/// <param name="Width">width of the resulting image</param>
222
243
/// <param name="Height">height of the resulting image</param>
244
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
223
245
[<CompiledName( " SaveSVGAsync" ) >]
224
246
static member saveSVGAsync
225
247
(
226
248
path : string ,
227
249
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
228
250
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
229
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
251
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
252
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
230
253
) =
231
254
let opts =
232
- RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height)
255
+ RenderOptions( ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
233
256
234
- fun ( gChart : GenericChart ) -> opts.Engine.SaveSVGAsync( path, opts.Width, opts.Height, gChart)
257
+ fun ( gChart : GenericChart ) -> opts.Engine.SaveSVGAsync( path, opts.Width, opts.Height, opts.Scale , gChart)
235
258
236
259
/// <summary>
237
260
/// Returns a function that saves a GenericChart as SVG image
@@ -240,15 +263,17 @@ module ChartExtensions =
240
263
/// <param name="EngineType">The Render engine to use</param>
241
264
/// <param name="Width">width of the resulting image</param>
242
265
/// <param name="Height">height of the resulting image</param>
266
+ /// <param name="Scale">scale the resulting image by this factor. The DPI will stay the same, but the resolution will be scaled.</param>
243
267
[<CompiledName( " SaveSVG" ) >]
244
268
static member saveSVG
245
269
(
246
270
path : string ,
247
271
[<Optional; DefaultParameterValue( null ) >] ? EngineType : ExportEngine ,
248
272
[<Optional; DefaultParameterValue( null ) >] ? Width : int ,
249
- [<Optional; DefaultParameterValue( null ) >] ? Height : int
273
+ [<Optional; DefaultParameterValue( null ) >] ? Height : int ,
274
+ [<Optional; DefaultParameterValue( null ) >] ? Scale : float
250
275
) =
251
276
fun ( gChart : GenericChart ) ->
252
277
gChart
253
- |> Chart.saveSVGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height)
278
+ |> Chart.saveSVGAsync ( path, ?EngineType = EngineType, ?Width = Width, ?Height = Height, ?Scale = Scale )
254
279
|> AsyncHelper.taskSync
0 commit comments