package chartjs-annotation
OCaml bindigns for Chart.js annotation plugin
Install
Dune Dependency
Authors
Maintainers
Sources
v0.2.2.tar.gz
sha256=370fbff01351b354a7947dfc44fd6bda49306f1b9b8712395bcd3651269af27b
sha512=19aebed340aaf2084a126bc28e0aabad490bb361a7b055b506e7a930576098ec6e48775057c2fbce68a12b86576586df2b982381f5639706725c7a12d4780c50
doc/src/chartjs-annotation/chartjs_annotation.ml.html
Source file chartjs_annotation.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
open Js_of_ocaml open Chartjs module Line_mode = struct type t = Js.js_string let vertical = Js.string "vertical" let horizontal = Js.string "horizontal" end module Draw_time = struct type t = Js.js_string let afterDraw = Js.string "afterDraw" let afterDatasetsDraw = Js.string "afterDatasetsDraw" let beforeDatasetsDraw = Js.string "beforeDatasetsDraw" end module Position = struct include Position let center = of_string "center" end class type baseAnnotation = object method _type : Js.js_string Js.t Js.prop method drawTime : Draw_time.t Js.t Js.optdef Js.prop method id : Js.js_string Js.t Js.prop end class type label = object method backgroundColor : Color.t Js.t Js.prop method fontFamily : Js.js_string Js.t Js.prop method fontSize : int Js.prop method fontStyle : Js.js_string Js.t Js.prop method fontColor : Js.js_string Js.t Js.prop method xPadding : int Js.prop method yPadding : int Js.prop method cornerRadius : int Js.prop method position : Position.t Js.t Js.prop method xAdjust : int Js.prop method yAdjust : int Js.prop method enabled : bool Js.t Js.prop method content : Js.js_string Js.t Indexable.t Js.t Js.opt Js.prop end class type ['a] lineAnnotation = object inherit baseAnnotation method mode : Line_mode.t Js.t Js.prop method scaleID : Js.js_string Js.t Js.prop method value : 'a Js.prop method endValue : 'a Js.prop method borderColor : Color.t Js.t Js.prop method borderWidth : int Js.prop method borderDash : line_dash Js.prop method borderDashOffset : line_dash_offset Js.prop method label : label Js.t Js.prop end class type ['a, 'b] boxAnnotation = object inherit baseAnnotation method xScaleID : Js.js_string Js.t Js.prop method yScaleID : Js.js_string Js.t Js.prop method xMin : 'a Js.optdef Js.prop method xMax : 'a Js.optdef Js.prop method yMin : 'b Js.optdef Js.prop method yMax : 'b Js.optdef Js.prop method borderColor : Color.t Js.t Js.prop method borderWidth : int Js.prop method backgroundColor : Color.t Js.t Js.prop end class type annotation = object method drawTime : Draw_time.t Js.t Js.prop method events : Js.js_string Js.t Js.js_array Js.t Js.prop method dblClickSpeed : float Js.prop method annotations : #baseAnnotation Js.t Js.js_array Js.t Js.prop end module CoerceTo = struct let lineAnnotation (x : #baseAnnotation Js.t) : 'a lineAnnotation Js.t Js.opt = if Js.string "line" == x##._type then Js.some (Js.Unsafe.coerce x) else Js.null let boxAnnotation (x : #baseAnnotation Js.t) : ('a, 'b) boxAnnotation Js.t Js.opt = if Js.string "box" == x##._type then Js.some (Js.Unsafe.coerce x) else Js.null end let coerce_annotation a = (a :> baseAnnotation Js.t) let empty_label () : label Js.t = Js.Unsafe.obj [||] let empty_box_annotation () = let (obj : ('a, 'b) boxAnnotation Js.t) = Js.Unsafe.obj [||] in obj##._type := Js.string "box"; obj let empty_line_annotation () = let (obj : 'a lineAnnotation Js.t) = Js.Unsafe.obj [||] in obj##._type := Js.string "line"; obj let empty_annotation_config () : annotation Js.t = Js.Unsafe.obj [||] let of_chart_options options = (Js.Unsafe.coerce options)##.annotation let set_to_chart_options options plugin = (Js.Unsafe.coerce options)##.annotation := plugin
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>