-
Notifications
You must be signed in to change notification settings - Fork 141
075_Return_value
Previous Chapter Previous Page Next Page Table of content
In order to check if the chart is drawn, some variables are added to the context.
The firstPass variable is a first variable that can be used. This is a variable used internally by ChartNew.js. The variable firstPass is initialised with the value 9 when the chart is completely drawn.
A second set of variables have been defined. Those variables are grouped under the object pieces_drawn.
Variables available under pieces_drawn :
-
completed
-
all_drawn
-
total_data
-
total_non_missing_data
-
total_missing_data
-
total_drawn
-
points
-
rectangles
-
slices
Let's explain each of these variables.
"completed" is a boolean variable; The value of "completed" is true when the chart function is completed. So during the animation, "completed" is false.
"all_drawn" is another boolean variable; The value of "all_drawn" is true when the chart function is completed and when a chart has been drawn in the canvas. When the size of the canvas is too small, the chart is not drawn. So when the variable "completed" has the value "true", the variable "all_drawn" can be used to determine if something has been drawn.
"completed" equal to "true" and "all_drawn" equal to "false" means that nothing has been drawn in the canvas because the canvas is too small.
"completed" equal to "true" and "all_drawn" equal to "true" means that the chart has been drawn in the canvas and that the animation is completed.
total_data is the number of data that are passed through the data variable; total_non_missing_data is the number of not missing data and total_missing_data is the number of missing data. total_data=total_non_missing_data+total_non_missing_data.
When the chart is completely drawn, points is equal to the number of points drawn in the chart, rectangles is equal to the number of bars drawn in the chart and slices, the number of slices drawn in the chart. total_drawn is the sum of those three variables.
Those variables are initialised at the end of the animation.
For an example, check Samples\testChartIsDrawn.html