startDrawingAnnotation() Method
Description
Starts drawing annotation of a given type.
If the drawing started successfuly, fires onAnnotationDrawingStart event. When all required points of annotation are added to the chart, component leaves drawing mode and fires onAnnotationDrawingFinish event. If you want to leave drawing mode compulsory you need to use stopDrawingAnnotation() method.
Note: You can call this method only after onChartDraw is fired.
Parameters
- type: String
Sets annotation type. Can be:
Line
VerticalLine
HorizontalLine
InfiniteLine
Ray
Rectangle
Ellipse
Triangle
TrendChannel
AndrewsPitchfork
FibonacciFan
FibonacciArc
FibonacciRetracement
FibonacciTimezones
Arrow
Label - [optional] config: Object or XML String
Sets additional options, such as color, line width, text style and so on. It is optional and default settings are used if it is not set.
Settings can be defined as:- JSON object of annotation type, note that: type, chart and axis are ignored in this case.
- XML srting formatted as <annotation> node, note that: type, chart and axis attributes are ignored in this case.
Note: To set anything you want you don't have to put all JSON or XML attributes and values, you can specify only the things you want to be not like in default.
Returns
Boolean.
Returns "true", if annotation is added successfully, returns "true" - if drawing is impossible.
Samples
Calling sample - simple line drawing:
Calling sample - Line with additional settings in JSON format:
Calling sample - Line with additional settings in XML format:
Calling sample - Label with additional font, background and position settings in JSON format:
Sample: