diff --git a/src/plotly.ml b/src/plotly.ml index 57dc3d0..65b0327 100644 --- a/src/plotly.ml +++ b/src/plotly.ml @@ -56,9 +56,16 @@ module Layout = struct let axis_tickformat s = ("tickformat", Base.Value.Value (Base.Value.string s)) end + module Font = struct + let font_family s = ("family", Base.Value.Value (Base.Value.string s)) + let font_size sz = ("size", Base.Value.Value (Base.Value.float sz)) + let font_color c = ("color", Base.Value.Value (Base.Value.string c)) + end + let xaxis ax = [("xaxis", Base.Value.Object ax)] let yaxis ay = [("yaxis", Base.Value.Object ay)] let zaxis az = [("zaxis", Base.Value.Object az)] + let font f = [("font", Base.Value.Object f)] let layout ats = ats diff --git a/src/plotly.mli b/src/plotly.mli index 952e0d7..29fca48 100644 --- a/src/plotly.mli +++ b/src/plotly.mli @@ -130,6 +130,15 @@ module Layout : sig val axis_tickformat : string -> string * Base.Value.value end + module Font : sig + (** HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available. *) + val font_family : string -> string * Base.Value.value + + val font_size : float -> string * Base.Value.value + + val font_color : string -> string * Base.Value.value + end + (** Set the x-axis properties *) val xaxis : (string * Base.Value.value) list -> t @@ -139,6 +148,11 @@ module Layout : sig (** Set the z-axis properties *) val zaxis : (string * Base.Value.value) list -> t + (** Set the global font properties for the graph. + + Note that fonts used in traces and other layout components inherit from the global font. *) + val font : (string * Base.Value.value) list -> t + val layout : Attribute.t list -> t val to_json : t -> Ezjsonm.value