Class type Chartjs.chart
method id : int Js_of_ocaml.Js.readonly_propmethod height : int Js_of_ocaml.Js.readonly_propmethod width : int Js_of_ocaml.Js.readonly_propmethod offsetX : int Js_of_ocaml.Js.readonly_propmethod offsetY : int Js_of_ocaml.Js.readonly_propmethod borderWidth : int Js_of_ocaml.Js.readonly_propmethod animating : bool Js_of_ocaml.Js.t Js_of_ocaml.Js.readonly_propmethod aspectRatio : float Js_of_ocaml.Js.readonly_propmethod canvas : Js_of_ocaml.Dom_html.canvasElement Js_of_ocaml.Js.t Js_of_ocaml.Js.readonly_propmethod ctx : Js_of_ocaml.Dom_html.canvasRenderingContext2D Js_of_ocaml.Js.t Js_of_ocaml.Js.readonly_propmethod data : data Js_of_ocaml.Js.t Js_of_ocaml.Js.propmethod _options : chartOptions Js_of_ocaml.Js.t Js_of_ocaml.Js.propmethod _config : chartConfig Js_of_ocaml.Js.t Js_of_ocaml.Js.prop
Chart API
method destroy : unit Js_of_ocaml.Js.methUse 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.methmethod update_withConfig : updateConfig Js_of_ocaml.Js.t -> unit Js_of_ocaml.Js.methTriggers 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 millisecondslazy: Iftrue, the animation can be interrupted by other animationseasing: The animation easing function.
method reset : unit Js_of_ocaml.Js.methReset 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.methmethod render_withConfig : updateConfig Js_of_ocaml.Js.t -> unit Js_of_ocaml.Js.methTriggers a redraw of all chart elements. Note, this does not update elements for new data. Use
updatein that case. Seeupdate_withConfigfor more details on the config object.
method stop : 'self Js_of_ocaml.Js.t Js_of_ocaml.Js.methUse this to stop any current animation loop. This will pause the chart during any current animation frame. Call
renderto re-animate.
method resize : 'self Js_of_ocaml.Js.t Js_of_ocaml.Js.methUse 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.
method clear : 'self Js_of_ocaml.Js.t Js_of_ocaml.Js.methWill clear the chart canvas. Used extensively internally between animation frames, but you might find it useful.
method toBase64Image : Js_of_ocaml.Js.js_string Js_of_ocaml.Js.t Js_of_ocaml.Js.methThis returns a base 64 encoded string of the chart in it's current state.
method generateLegend : Js_of_ocaml.Js.js_string Js_of_ocaml.Js.t Js_of_ocaml.Js.methReturns 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.methLooks 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
dataproperty of the metadata will contain information about each point, rectangle, etc. depending on the chart type.