Skip to content

100_900_other_options

Francois Vancoppenolle edited this page Mar 6, 2017 · 10 revisions

Previous Chapter          Previous Page          Next Page          Table of content

Other options

Contents

beforeDrawFunction / endDrawDataFunction / endDrawScaleFunction / initFunction

Description : Animation in chart is generated by drawing successive images; Each time a new image is generated, the scales and the data are redrawn; Before all drawing (before the titles, legend and so on), the function associated to "initFunction" is called ; This function is called only once ; Then the X axis labels and the Y axis labels are drawn. Before the drawing of the labels, the function "beforeLabelsFunction" is called and after the drawing of the labels, the function "afterLabelsFunction" is called. Then the animation starts. Before each new image generation during the animation, the "beforeDrawFunction" is called; when the scale has been produced, the function associated to option "endDrawScaleFunction" is called; when the data are drawn, the function associated to option "endDrawDataFunction" is called. The functions associated to the initFunction, endDrawScaleFunction and endDrawDataFunction are called each time a new image is generated for the animation.

Values : the name of a user defined function

Default value : null (<=> no function to be called)

Sample : endDrawDataFunction : myFunction

    function myFunction(area,ctx,data,statData,posi,posj,othervars) {
    (...)
    }

See also : Shapes-Text-Images_In_Chart

Parameters passed to the function : area,ctx,data,statData,posi,posj,othervars

  • area : parameter 'area' has value "INITFUNCTION" if the call comes from the initFunction parameter, has value "BEFORELABELSFUNCTION" if the call comes from the beforeLabelsFunction parameter, has value "AFTERLABELSFUNCTION" if the call comes from the afterLabelsFunction parameter, has value "ENDDATAFUNCTION" if the calls comes from the endDrawDataFunction and has value "ENDSCALEFUNCTION" if the calls provides from the endDrawScaleFunction parameter;
  • ctx : the context
  • data : the data passed the chart function
  • statData : the statData values (value is null for the "initFunction")
  • posi : value is always -1
  • posj : value is always -1
  • othervars : othervars is an array of other variables (*):
    • cntiter : cntiter is incremented each time a new image is produced for the animation; cntiter will evoluate from 1 to the value of option animationSteps;
    • animationValue : animationValue is an evolutive variable : starting at 0 it will evoluate to 1; 1 means that the whole animation is terminated; the value of animationValue is equal to cntiter/animationSteps;
    • config : the options passed to the chart function
    • borderX : X position of the left of the chart in the context;
    • borderY : Y position of the top of the chart in the context;
    • midPosX : X potition of the middle of the chart;
    • midPosY : Y position of the middle of the chart;

For the "initFunction", "beforeLabelsFunction" and "afterlabelsFunction", only the "config" parameter is passed.

zeroValue

Description : when you have to compate to value, it could happen that Javascript return that they are not equal even if they are because of the way they are stored in memory. In order to avoid this problem, you can set a level of comparaison : if the difference between the two compared values is lower that this level, they are considered as identical. The level is specified with option zeroValue.

Values : a positive value

Default value : 0.0000000001

Sample : zeroValue : 0.0000000000000001

See also :

Previous Chapter          Previous Page          Next Page          Top of Page

Clone this wiki locally