11namespace Plotly.NET
22
3+ open Plotly.NET .ConfigObjects
34open DynamicObj
45open System.Runtime .InteropServices
56
6- // missing config props :
7+ //missing:
78
9+ //var configAttributes = {
10+ // plotlyServerURL: {
11+ // valType: 'string',
12+ // dflt: '',
13+ // description: [
14+ // 'When set it determines base URL for',
15+ // 'the \'Edit in Chart Studio\' `showEditInChartStudio`/`showSendToCloud` mode bar button',
16+ // 'and the showLink/sendData on-graph link.',
17+ // 'To enable sending your data to Chart Studio Cloud, you need to',
18+ // 'set both `plotlyServerURL` to \'https://chart-studio.plotly.com\' and',
19+ // 'also set `showSendToCloud` to true.'
20+ // ].join(' ')
21+ // },
822// fillFrame: {
923// valType: 'boolean',
1024// dflt: false,
@@ -94,7 +108,7 @@ open System.Runtime.InteropServices
94108// valType: 'boolean',
95109// dflt: false,
96110// description: [
97- // 'Determines whether a link to plot.ly is displayed',
111+ // 'Determines whether a link to Chart Studio Cloud is displayed',
98112// 'at the bottom right corner of resulting graphs.',
99113// 'Use with `sendData` and `linkText`.'
100114// ].join(' ')
@@ -112,7 +126,7 @@ open System.Runtime.InteropServices
112126// dflt: true,
113127// description: [
114128// 'If *showLink* is true, does it contain data',
115- // 'just link to a plot.ly file?'
129+ // 'just link to a Chart Studio Cloud file?'
116130// ].join(' ')
117131// },
118132// showSources: {
@@ -141,10 +155,10 @@ open System.Runtime.InteropServices
141155// dflt: false,
142156// description: [
143157// 'Should we include a ModeBar button, labeled "Edit in Chart Studio",',
144- // 'that sends this chart to plot.ly or another plotly server as specified ',
145- // 'by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0',
158+ // 'that sends this chart to chart-studio.plotly.com (formerly plot.ly) or another plotly server',
159+ // 'as specified by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0',
146160// 'this button was included by default, now it is opt-in using this flag.',
147- // 'Note that this button can (depending on `plotlyServerURL`) send your data',
161+ // 'Note that this button can (depending on `plotlyServerURL` being set ) send your data',
148162// 'to an external server. However that server does not persist your data',
149163// 'until you arrive at the Chart Studio and explicitly click "Save".'
150164// ].join(' ')
@@ -166,14 +180,6 @@ open System.Runtime.InteropServices
166180// 'See ./components/modebar/buttons.js for the list of names.'
167181// ].join(' ')
168182// },
169- // modeBarButtonsToAdd: {
170- // valType: 'any',
171- // dflt: [],
172- // description: [
173- // 'Add mode bar button using config objects',
174- // 'See ./components/modebar/buttons.js for list of arguments.'
175- // ].join(' ')
176- // },
177183// modeBarButtons: {
178184// valType: 'any',
179185// dflt: false,
@@ -184,15 +190,6 @@ open System.Runtime.InteropServices
184190// 'See ./components/modebar/buttons.js for more info.'
185191// ].join(' ')
186192// },
187- // toImageButtonOptions: {
188- // valType: 'any',
189- // dflt: {},
190- // description: [
191- // 'Statically override options for toImage modebar button',
192- // 'allowed keys are format, filename, width, height, scale',
193- // 'see ../components/modebar/buttons.js'
194- // ].join(' ')
195- // },
196193// displaylogo: {
197194// valType: 'boolean',
198195// dflt: true,
@@ -256,7 +253,9 @@ open System.Runtime.InteropServices
256253// },
257254
258255// logging: {
259- // valType: 'boolean',
256+ // valType: 'integer',
257+ // min: 0,
258+ // max: 2,
260259// dflt: 1,
261260// description: [
262261// 'Turn all console logging on or off (errors will be thrown)',
@@ -268,6 +267,21 @@ open System.Runtime.InteropServices
268267// ].join(' ')
269268// },
270269
270+ // notifyOnLogging: {
271+ // valType: 'integer',
272+ // min: 0,
273+ // max: 2,
274+ // dflt: 0,
275+ // description: [
276+ // 'Set on-graph logging (notifier) level',
277+ // 'This should ONLY be set via Plotly.setPlotConfig',
278+ // 'Available levels:',
279+ // '0: no on-graph logs',
280+ // '1: warnings and errors, but not informational messages',
281+ // '2: verbose logs'
282+ // ].join(' ')
283+ // },
284+
271285// queueLength: {
272286// valType: 'integer',
273287// min: 0,
@@ -319,42 +333,6 @@ open System.Runtime.InteropServices
319333// ].join(' ')
320334// }
321335//};
322-
323- type ToImageButtonOptions () =
324- inherit DynamicObj()
325- static member init
326- (
327- [<Optional; DefaultParameterValue( null ) >] ? Format : StyleParam.ImageFormat ,
328- [<Optional; DefaultParameterValue( null ) >] ? Filename : string ,
329- [<Optional; DefaultParameterValue( null ) >] ? Width : float ,
330- [<Optional; DefaultParameterValue( null ) >] ? Height : float ,
331- [<Optional; DefaultParameterValue( null ) >] ? Scale : float
332- ) =
333- ToImageButtonOptions()
334- |> ToImageButtonOptions.style
335- (
336- ?Format = Format ,
337- ?Filename = Filename,
338- ?Width = Width ,
339- ?Height = Height ,
340- ?Scale = Scale
341- )
342-
343- static member style
344- (
345- [<Optional; DefaultParameterValue( null ) >] ? Format ,
346- [<Optional; DefaultParameterValue( null ) >] ? Filename ,
347- [<Optional; DefaultParameterValue( null ) >] ? Width ,
348- [<Optional; DefaultParameterValue( null ) >] ? Height ,
349- [<Optional; DefaultParameterValue( null ) >] ? Scale
350- ) =
351- fun ( btnConf : ToImageButtonOptions ) ->
352- Format |> Option.map StyleParam.ImageFormat.toString |> DynObj.setValueOpt btnConf " format"
353- Filename |> DynObj.setValueOpt btnConf " filename"
354- Width |> DynObj.setValueOpt btnConf " width"
355- Height |> DynObj.setValueOpt btnConf " height"
356- Scale |> DynObj.setValueOpt btnConf " scale"
357- btnConf
358336/// Config
359337type Config () =
360338 inherit DynamicObj ()
@@ -368,7 +346,8 @@ type Config() =
368346 [<Optional; DefaultParameterValue( null ) >] ? ShowEditInChartStudio : bool ,
369347 [<Optional; DefaultParameterValue( null ) >] ? ToImageButtonOptions : ToImageButtonOptions ,
370348 [<Optional; DefaultParameterValue( null ) >] ? Editable : bool ,
371- [<Optional; DefaultParameterValue( null ) >] ? EditableAnnotations : seq < StyleParam.AnnotationEditOptions >
349+ [<Optional; DefaultParameterValue( null ) >] ? EditableAnnotations : seq < StyleParam.AnnotationEditOptions >,
350+ [<Optional; DefaultParameterValue( null ) >] ? ModeBarButtonsToAdd : seq < StyleParam.ModeBarButton >
372351 ) =
373352 Config()
374353 |> Config.style
@@ -379,7 +358,8 @@ type Config() =
379358 ?ToImageButtonOptions = ToImageButtonOptions,
380359 ?ShowEditInChartStudio = ShowEditInChartStudio,
381360 ?Editable = Editable,
382- ?EditableAnnotations = EditableAnnotations
361+ ?EditableAnnotations = EditableAnnotations,
362+ ?ModeBarButtonsToAdd = ModeBarButtonsToAdd
383363 )
384364
385365
@@ -394,7 +374,8 @@ type Config() =
394374 [<Optional; DefaultParameterValue( null ) >] ? ToImageButtonOptions : ToImageButtonOptions ,
395375 [<Optional; DefaultParameterValue( null ) >] ? ShowEditInChartStudio : bool ,
396376 [<Optional; DefaultParameterValue( null ) >] ? Editable : bool ,
397- [<Optional; DefaultParameterValue( null ) >] ? EditableAnnotations : seq < StyleParam.AnnotationEditOptions >
377+ [<Optional; DefaultParameterValue( null ) >] ? EditableAnnotations : seq < StyleParam.AnnotationEditOptions >,
378+ [<Optional; DefaultParameterValue( null ) >] ? ModeBarButtonsToAdd : seq < StyleParam.ModeBarButton >
398379
399380 ) =
400381 fun ( config : Config ) ->
@@ -404,6 +385,7 @@ type Config() =
404385 ToImageButtonOptions |> DynObj.setValueOpt config " toImageButtonOptions"
405386 ShowEditInChartStudio |> DynObj.setValueOpt config " showEditInChartStudio"
406387 Editable |> DynObj.setValueOpt config " editable"
388+ ModeBarButtonsToAdd |> DynObj.setValueOptBy config " modeBarButtonsToAdd" ( fun x -> x |> Seq.map StyleParam.ModeBarButton.convert)
407389 EditableAnnotations
408390 |> Option.map
409391 ( fun edits ->
0 commit comments