1
1
namespace FSharp.Plotly
2
2
3
- //full attributes from the plotly docs :
4
- //var configAttributes = {
5
- // staticPlot: {
6
- // valType: 'boolean',
7
- // dflt: false,
8
- // description: [
9
- // 'Determines whether the graphs are interactive or not.',
10
- // 'If *false*, no interactivity, for export or image generation.'
11
- // ].join(' ')
12
- // },
3
+ //Missing imploementations (from full attributes from the plotly docs) :
4
+ //To string: -> edits: {AnnotationEditOptions}
5
+ type AnnotationEditOptions =
6
+ ///Determines if the main anchor of the annotation is editable.The main anchor corresponds to the',
7
+ ///text (if no arrow) or the arrow (which drags the whole thing leaving the arrow length & direction unchanged).
8
+ | AnnotationPosition
9
+ ///Has only an effect for annotations with arrows. Enables changing the length and direction of the arrow.
10
+ | AnnotationTail
11
+ ///Enables editing annotation text.
12
+ | AnnotationText
13
+ ///Enables editing axis title text.
14
+ | AxisTitleText
15
+ ///Enables moving colorbars.
16
+ | ColorbarPosition
17
+ ///Enables editing colorbar title text.
18
+ | ColorbarTitleText
19
+ ///Enables moving the legend.
20
+ | LegendPosition
21
+ ///Enables editing the trace name fields from the legend
22
+ | LegendText
23
+ ///Enables moving shapes.
24
+ | ShapePosition
25
+
26
+ static member toString aeo =
27
+ match aeo with
28
+ | AnnotationPosition -> " annotationPosition"
29
+ | AnnotationTail -> " annotationTail"
30
+ | AnnotationText -> " annotationText"
31
+ | AxisTitleText -> " axisTitleText"
32
+ | ColorbarPosition -> " colorbarPosition"
33
+ | ColorbarTitleText -> " colorbarTitleText"
34
+ | LegendPosition -> " legendPosition"
35
+ | LegendText -> " legendText"
36
+ | ShapePosition -> " shapePosition"
13
37
14
- // plotlyServerURL: {
15
- // valType: 'string',
16
- // dflt: 'https://plot.ly',
17
- // description: [
18
- // 'Sets base URL for the \'Edit in Chart Studio\' (aka sendDataToCloud) mode bar button',
19
- // 'and the showLink/sendData on-graph link'
20
- // ].join(' ')
21
- // },
22
38
23
- // editable: {
24
- // valType: 'boolean',
25
- // dflt: false,
26
- // description: [
27
- // 'Determines whether the graph is editable or not.',
28
- // 'Sets all pieces of `edits`',
29
- // 'unless a separate `edits` config item overrides individual parts.'
30
- // ].join(' ')
31
- // },
32
- // edits: {
33
- // annotationPosition: {
34
- // valType: 'boolean',
35
- // dflt: false,
36
- // description: [
37
- // 'Determines if the main anchor of the annotation is editable.',
38
- // 'The main anchor corresponds to the',
39
- // 'text (if no arrow) or the arrow (which drags the whole thing leaving',
40
- // 'the arrow length & direction unchanged).'
41
- // ].join(' ')
42
- // },
43
- // annotationTail: {
44
- // valType: 'boolean',
45
- // dflt: false,
46
- // description: [
47
- // 'Has only an effect for annotations with arrows.',
48
- // 'Enables changing the length and direction of the arrow.'
49
- // ].join(' ')
50
- // },
51
- // annotationText: {
52
- // valType: 'boolean',
53
- // dflt: false,
54
- // description: 'Enables editing annotation text.'
55
- // },
56
- // axisTitleText: {
57
- // valType: 'boolean',
58
- // dflt: false,
59
- // description: 'Enables editing axis title text.'
60
- // },
61
- // colorbarPosition: {
62
- // valType: 'boolean',
63
- // dflt: false,
64
- // description: 'Enables moving colorbars.'
65
- // },
66
- // colorbarTitleText: {
67
- // valType: 'boolean',
68
- // dflt: false,
69
- // description: 'Enables editing colorbar title text.'
70
- // },
71
- // legendPosition: {
72
- // valType: 'boolean',
73
- // dflt: false,
74
- // description: 'Enables moving the legend.'
75
- // },
76
- // legendText: {
77
- // valType: 'boolean',
78
- // dflt: false,
79
- // description: 'Enables editing the trace name fields from the legend'
80
- // },
81
- // shapePosition: {
82
- // valType: 'boolean',
83
- // dflt: false,
84
- // description: 'Enables moving shapes.'
85
- // },
86
- // titleText: {
87
- // valType: 'boolean',
88
- // dflt: false,
89
- // description: 'Enables editing the global layout title.'
90
- // }
91
- // },
92
39
93
- // autosizable: {
94
- // valType: 'boolean',
95
- // dflt: false,
96
- // description: [
97
- // 'Determines whether the graphs are plotted with respect to',
98
- // 'layout.autosize:true and infer its container size.'
99
- // ].join(' ')
100
- // },
101
- // responsive: {
102
- // valType: 'boolean',
103
- // dflt: false,
104
- // description: [
105
- // 'Determines whether to change the layout size when window is resized.',
106
- // 'In v2, this option will be removed and will always be true.'
107
- // ].join(' ')
108
- // },
109
40
// fillFrame: {
110
41
// valType: 'boolean',
111
42
// dflt: false,
@@ -467,7 +398,9 @@ type Config() =
467
398
? Autosizable : bool ,
468
399
? Responsive : bool ,
469
400
? ShowEditInChartStudio : bool ,
470
- ? ToImageButtonOptions : ToImageButtonOptions
401
+ ? ToImageButtonOptions : ToImageButtonOptions ,
402
+ ? Editable : bool ,
403
+ ? EditableAnnotations : seq < AnnotationEditOptions >
471
404
) =
472
405
Config()
473
406
|> Config.style
@@ -476,7 +409,9 @@ type Config() =
476
409
?Autosizable = Autosizable,
477
410
?Responsive = Responsive,
478
411
?ToImageButtonOptions = ToImageButtonOptions,
479
- ?ShowEditInChartStudio = ShowEditInChartStudio
412
+ ?ShowEditInChartStudio = ShowEditInChartStudio,
413
+ ?Editable = Editable,
414
+ ?EditableAnnotations = EditableAnnotations
480
415
)
481
416
482
417
@@ -489,7 +424,9 @@ type Config() =
489
424
? Autosizable : bool ,
490
425
? Responsive : bool ,
491
426
? ToImageButtonOptions : ToImageButtonOptions ,
492
- ? ShowEditInChartStudio : bool
427
+ ? ShowEditInChartStudio : bool ,
428
+ ? Editable : bool ,
429
+ ? EditableAnnotations : seq < AnnotationEditOptions >
493
430
494
431
) =
495
432
fun ( config : Config ) ->
@@ -498,4 +435,20 @@ type Config() =
498
435
Responsive |> DynObj.setValueOpt config " responsive"
499
436
ToImageButtonOptions |> DynObj.setValueOpt config " toImageButtonOptions"
500
437
ShowEditInChartStudio |> DynObj.setValueOpt config " showEditInChartStudio"
438
+ Editable |> DynObj.setValueOpt config " editable"
439
+ EditableAnnotations
440
+ |> Option.map
441
+ ( fun edits ->
442
+ let ed = DynamicObj()
443
+ edits
444
+ |> Seq.iter
445
+ ( fun edit ->
446
+ let fieldName =
447
+ AnnotationEditOptions.toString edit
448
+ ed?( fieldName) <- true
449
+ )
450
+ ed
451
+ )
452
+ |> DynObj.setValueOpt config " edits"
453
+
501
454
config
0 commit comments