Skip to content

Initialization phases

hanzo2001 edited this page May 13, 2016 · 4 revisions

The creation of the chart is divided into many smaller pieces for easier maintenance and improvement. To facilitate and guarantee the correct generation of the chart, the plugin makes use of jQuery promises (Deferred objects).

  • Initialization: the wrapper configuration options are setup and the API loading and Data fetching are wrapped in promises.
  • Fetch: once the loading has finished successfully, a third promise is resolved and passed the data retrieved from the server.
  • Setup: every object from the API and the extension is initialized. This phase has two customization points: the preprocessor and the postprocessor. These will be discussed later.
  • Finalize and draw: this is the last step of the setup but it's where the first drawing occurs. The first drawing is not to be confused with the redrawing process which will be discussed later. Some important methods are attached on this phase, as well as every feature once the chart is drawn.

The customization points allow for a fine tuning of the chart's interactivity, the data or both.

  • Preprocessing: methods called in this phase will have access to the raw data, no wrappers are involved. You can extend the amount of preprocessors by adding them to the factory's preprocessors property.

  • Postprocessing: methods generated and called in this phase will have access to the DataView object. In this phase the user may use the available methods to filter out data, add calculated columns or make operations on the view. You can increase the methods available for postprocessing by extending the factory's postprocessors property

  • Adding features: a small list of features are setup and ready to be attached to the charts. More features can be added by extending the factory's features property.