package chartjs

  1. Overview
  2. Docs
method height : int Js_of_ocaml.Js.readonly_prop
method width : int Js_of_ocaml.Js.readonly_prop
method offsetX : int Js_of_ocaml.Js.readonly_prop
method offsetY : int Js_of_ocaml.Js.readonly_prop
method borderWidth : int Js_of_ocaml.Js.readonly_prop
method aspectRatio : float Js_of_ocaml.Js.readonly_prop

Chart API

method destroy : unit Js_of_ocaml.Js.meth

Use this to destroy any chart instances that are created. This will clean up any references stored to the chart object within Chart.js, along with any associated event listeners attached by Chart.js. This must be called before the canvas is reused for a new chart.

method update : unit Js_of_ocaml.Js.meth
method update_withConfig : updateConfig Js_of_ocaml.Js.t -> unit Js_of_ocaml.Js.meth

Triggers an update of the chart. This can be safely called after updating the data object. This will update all scales, legends, and then re-render the chart. A config object can be provided with additional configuration for the update process. This is useful when update is manually called inside an event handler and some different animation is desired. The following properties are supported: duration: Time for the animation of the redraw in milliseconds lazy: If true, the animation can be interrupted by other animations easing: The animation easing function.

method reset : unit Js_of_ocaml.Js.meth

Reset the chart to it's state before the initial animation. A new animation can then be triggered using update.

method render : unit Js_of_ocaml.Js.meth
method render_withConfig : updateConfig Js_of_ocaml.Js.t -> unit Js_of_ocaml.Js.meth

Triggers a redraw of all chart elements. Note, this does not update elements for new data. Use update in that case. See update_withConfig for more details on the config object.

Use this to stop any current animation loop. This will pause the chart during any current animation frame. Call render to re-animate.

Use this to manually resize the canvas element. This is run each time the canvas container is resized, but you can call this method manually if you change the size of the canvas nodes container element.

Will clear the chart canvas. Used extensively internally between animation frames, but you might find it useful.

This returns a base 64 encoded string of the chart in it's current state.

Returns an HTML string of a legend for that chart. The legend is generated from the legendCallback in the options.

method getDatasetMeta : int -> 'a Js_of_ocaml.Js.t Js_of_ocaml.Js.meth

Looks for the dataset that matches the current index and returns that metadata. This returned data has all of the metadata that is used to construct the chart. The data property of the metadata will contain information about each point, rectangle, etc. depending on the chart type.