Fibonacci Arc Annotation

Overview

Fibonacci Arc is a charting technique consisting of three curved lines that are drawn for the purpose of anticipating key support and resistance levels, and areas of ranging.

Fibonacci Arc annotation allows to add this type of drawing to the chart, as any other annotation it can be drawn by user or added to the chart via XML or JSON settings. In this article you can learn how to add it via XML or JSON settings and what visual settings can be done.

To learn about basic settings, that can be done with an annotation please refer to: Drawing Tools and Annotations: General Settings.

to top

Adding annotation via settings

To add a Fibonacci Arc annotation to a chart you need to, as with any other annotation, add an annotation node, assign the id, set "FibonacciArc" type and specify the chart id using chart attribute.

In fibonacci_arc_annotation node you need specify value and time anchors, which define two points needed to draw this type of annotation.

All this you can see in the basic XML/JSON snippet below:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation color="#DB2A0E" first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09" />
07       </annotation>
08     </annotation_list>
09   </annotations>
10 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          color: "#DB2A0E",
10          firstTimeAnchor: "2009-03-30",
11          firstValueAnchor: 16.02,
12          secondTimeAnchor: "2009-05-07",
13          secondValueAnchor: 20.09
14        }
15      }
16    ]
17  }
18}

Live sample below shows a chart with this sample basic Fibonacci Arc annotation:

Live Sample:  Adding Fibonacci Arc Annotation

to top

Levels

Since version 1.7 you have an option to choose what levels are displayed and even specify the ratio of levels. It is done in <levels> node, like shown in the snippet below. Please note, that this snippet also shows default levels and ratios: you can define any number of levels and set any ratio in value attribute, even if these values do not match Fibonacci sequence.

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation color="#DB2A0E" first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <levels>
09               <level value="0.236" />
10               <level value="0.382" />
11               <level value="0.5" />
12               <level value="0.618" />
13               <level value="0.764" />
14               <level value="1" />
15             </levels>
16           </settings>
17         </fibonacci_arc_annotation>
18       </annotation>
19     </annotation_list>
20   </annotations>
21 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          color: "#DB2A0E",
10          firstTimeAnchor: "2009-03-30",
11          firstValueAnchor: 16.02,
12          secondTimeAnchor: "2009-05-07",
13          secondValueAnchor: 20.09,
14          settings: {
15            levels: [
16              {
17                value: 0.236
18              },
19              {
20                value: 0.382
21              },
22              {
23                value: 0.5
24              },
25              {
26                value: 0.618
27              },
28              {
29                value: 0.764
30              },
31              {
32                value: 1
33              }
34            ]
35          }
36        }
37      }
38    ]
39  }
40}

Note: in this snippet we show how to alter levels of a single annotation, but you can override defaults and change all annotations of a given type, learn about changing default in Annotations General Settings: Defaults.

Another important thing you should understand is the fact that level node can be used to configure visualization of a level: label, line and states settings, it can be done like that:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation color="#DB2A0E" first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <levels>
09               <level value="0.236">
10                 <label enabled="false" />
11               </level>
12               <level value="0.382">
13                 <line color="LightColor(#00FF00)" />
14                 <label>
15                   <font color="LightColor(#00FF00)" />
16                 </label>
17               </level>
18               <level value="0.5" />
19               <level value="0.618">
20                 <line color="#00FF00" />
21                 <label>
22                   <font color="#00FF00" />
23                 </label>
24               </level>
25               <level value="0.764" />
26               <level value="1">
27                 <line color="DarkColor(#00FF00)" />
28                 <label>
29                   <font color="DarkColor(#00FF00)" />
30                 </label>
31               </level>
32             </levels>
33           </settings>
34         </fibonacci_arc_annotation>
35       </annotation>
36     </annotation_list>
37   </annotations>
38 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          color: "#DB2A0E",
10          firstTimeAnchor: "2009-03-30",
11          firstValueAnchor: 16.02,
12          secondTimeAnchor: "2009-05-07",
13          secondValueAnchor: 20.09,
14          settings: {
15            levels: [
16              {
17                value: 0.236,
18                label: {
19                  enabled: false
20                }
21              },
22              {
23                value: 0.382,
24                line: {
25                  color: "LightColor(#00FF00)"
26                },
27                label: {
28                  font: {
29                    color: "LightColor(#00FF00)"
30                  }
31                }
32              },
33              {
34                value: 0.5
35              },
36              {
37                value: 0.618,
38                line: {
39                  color: "#00FF00"
40                },
41                label: {
42                  font: {
43                    color: "#00FF00"
44                  }
45                }
46              },
47              {
48                value: 0.764
49              },
50              {
51                value: 1,
52                line: {
53                  color: "DarkColor(#00FF00)"
54                },
55                label: {
56                  font: {
57                    color: "DarkColor(#00FF00)"
58                  }
59                }
60              }
61            ]
62          }
63        }
64      }
65    ]
66  }
67}

Take a look at the live sample where levels and visualization are changed in defaults section:

Live Sample:  Fibonacci Arc Annotation - Levels Configuration in Defaults Section

Note: do not forget that only levels specified in <levels> node will be displayed, you can't change one level only - you should at least specify values for all other levels.

to top

Visual settings

You have a total control over the look of the Fibonacci Arc, to define visual settings you need to add settings node and then use line node to set how it should look like. Sample XML/JSON snippet below shows this.

If you click on line node in the snippet, XML or JSON reference will be opened and you will be able to browse all possible settings, including the look of the line in different states.

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation color="#000000" first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <line thickness="2" />
09           </settings>
10         </fibonacci_arc_annotation>
11       </annotation>
12     </annotation_list>
13   </annotations>
14 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          color: "#000000",
10          firstTimeAnchor: "2009-03-30",
11          firstValueAnchor: 16.02,
12          secondTimeAnchor: "2009-05-07",
13          secondValueAnchor: 20.09,
14          settings: {
15            line: {
16              thickness: 2
17            }
18          }
19        }
20      }
21    ]
22  }
23}

Live sample below contains Fibonacci Arc Annotation colored, note that editing markers coloring is also modified here:

Live Sample:  Fibonacci Arc Annotation - Visual Settings

to top

Labels

Since version 1.7 all Fibonacci annotations has labels and they are enabled by default, this section describes how you can disable them, configure text displayed and tune visualization.

Note: in this section we show how to alter settings of a single annotation, but you can override defaults and minimize the size of configs, learn about changing default in Annotations General Settings: Defaults.

to top

Enable/Disable

To disable labels for all levels in all states for a single annotation you need to set the following XML:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <label enabled="false" />
09           </settings>
10         </fibonacci_arc_annotation>
11       </annotation>
12     </annotation_list>
13   </annotations>
14 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          firstTimeAnchor: "2009-03-30",
10          firstValueAnchor: 16.02,
11          secondTimeAnchor: "2009-05-07",
12          secondValueAnchor: 20.09,
13          settings: {
14            label: {
15              enabled: false
16            }
17          }
18        }
19      }
20    ]
21  }
22}

To disable label for one or several selected levels you need to use <levels> node and do enable/disable there, please note that all required levels should be specified, see Levels for clarification:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <levels>
09               <level value="0.236">
10                 <label enabled="false" />
11               </level>
12               <level value="0.382" />
13               <level value="0.5" />
14               <level value="0.618" />
15               <level value="0.764" />
16               <level value="1">
17                 <label enabled="false" />
18               </level>
19             </levels>
20           </settings>
21         </fibonacci_arc_annotation>
22       </annotation>
23     </annotation_list>
24   </annotations>
25 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          firstTimeAnchor: "2009-03-30",
10          firstValueAnchor: 16.02,
11          secondTimeAnchor: "2009-05-07",
12          secondValueAnchor: 20.09,
13          settings: {
14            levels: [
15              {
16                value: 0.236,
17                label: {
18                  enabled: false
19                }
20              },
21              {
22                value: 0.382
23              },
24              {
25                value: 0.5
26              },
27              {
28                value: 0.618
29              },
30              {
31                value: 0.764
32              },
33              {
34                value: 1,
35                label: {
36                  enabled: false
37                }
38              }
39            ]
40          }
41        }
42      }
43    ]
44  }
45}

You can also make labels appear only in some states, for example when annotation is selected or hovered:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_0856719161" type="FibonacciArc" chart="idMainChart">
06         <fibonacci_arc_annotation first_time_anchor="2009-03-30" first_value_anchor="16.02" second_time_anchor="2009-05-07" second_value_anchor="20.09">
07           <settings>
08             <label enabled="false" />
09             <states>
10               <hover>
11                 <label enabled="true" />
12               </hover>
13             </states>
14           </settings>
15         </fibonacci_arc_annotation>
16       </annotation>
17     </annotation_list>
18   </annotations>
19 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_0856719161",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        fibonacciArcAnnotation: {
09          firstTimeAnchor: "2009-03-30",
10          firstValueAnchor: 16.02,
11          secondTimeAnchor: "2009-05-07",
12          secondValueAnchor: 20.09,
13          settings: {
14            label: {
15              enabled: false
16            },
17            states: {
18              hover: {
19                label: {
20                  enabled: true
21                }
22              }
23            }
24          }
25        }
26      }
27    ]
28  }
29}

Here is a sample of a chart with two annotations, one without any labels, and another with labels that appear only if annotation is hovered or selected:

Live Sample:  Fibonacci Arc Annotation - Enable and Disable Level Labels

to top

Format

You can define the text to be displayed in labels, you can either put static text in them or use tokens: {%LevelValue} — to display level value and/or {%Value} — to display value (price) corresponding to the level. Sample XML snippet shows basic formatting syntax:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <annotations>
04     <annotation_list>
05       <annotation id="FArc_6918927153" type="FibonacciArc" chart="idMainChart" axis="primary" allow_edit="true">
06         <fibonacci_arc_annotation color="#2F8F0E" first_time_anchor="2009-01-15" first_value_anchor="15" second_time_anchor="2009-02-02" second_value_anchor="13">
07           <settings>
08             <label>
09               <format><![CDATA[{%LevelValue}{trailingZeros:true,decimalSeparator:\,,numDecimals:3}]]></format>
10             </label>
11           </settings>
12         </fibonacci_arc_annotation>
13       </annotation>
14     </annotation_list>
15   </annotations>
16 </stock>
01{
02  annotations: {
03    annotationList: [
04      {
05        id: "FArc_6918927153",
06        type: "FibonacciArc",
07        chart: "idMainChart",
08        axis: "primary",
09        allowEdit: true,
10        fibonacciArcAnnotation: {
11          color: "#2F8F0E",
12          firstTimeAnchor: "2009-01-15",
13          firstValueAnchor: 15,
14          secondTimeAnchor: "2009-02-02",
15          secondValueAnchor: 13,
16          settings: {
17            label: {
18              format: "{%LevelValue}{trailingZeros:true,decimalSeparator:\,,numDecimals:3}"
19            }
20          }
21        }
22      }
23    ]
24  }
25}

As you can see, you can use common Number and Date Time formatting options. And, of course, you can use all Font configuration options.

See sample chart in the next section to see how formatting, font and visual settings work together.

to top

Visual Settings

Level labels, like any other label, has background with fill and border and font confuguration options, by default labels are formatted like this:

XML/JSON Syntax
Plain code
01 <settings>
02   <label anchor="TopCenter">
03     <background enabled="false">
04       <fill type="Gradient" opacity="0.8">
05         <gradient angle="90">
06           <keys>
07             <key color="#FEFEFE" />
08             <key color="#F1F1F1" />
09           </keys>
10         </gradient>
11       </fill>
12       <border color="#333333" opacity="0.3" />
13       <corners type="Rounded" all="4" />
14       <inside_margin all="2" />
15     </background>
16     <font family="Verdana" bold="false" size="10" align="Center" color="DarkColor(%Color)" render_as_html="false" />
17     <format><![CDATA[{%LevelValue}]]></format>
18   </label>
19 </settings>
01{
02  label: {
03    anchor: "TopCenter",
04    background: {
05      enabled: false,
06      fill: {
07        type: "Gradient",
08        opacity: 0.8,
09        gradient: {
10          angle: 90,
11          keys: [
12            {
13              color: "#FEFEFE"
14            },
15            {
16              color: "#F1F1F1"
17            }
18          ]
19        }
20      },
21      border: {
22        color: "#333333",
23        opacity: 0.3
24      },
25      corners: {
26        type: "Rounded",
27        all: 4
28      },
29      insideMargin: {
30        all: 2
31      }
32    },
33    font: {
34      family: "Verdana",
35      bold: false,
36      size: 10,
37      align: "Center",
38      color: "DarkColor(%Color)",
39      renderAsHtml: false
40    },
41    format: "{%LevelValue}"
42  }
43}

You can change these settings for any annotation or all of them, you can change the look of the label in some state, you can even change the labels behavior for the given levels. Please take a look at the sample below: defaults section and labels visual settings can completely change the look of annotations:

Live Sample:  Fibonacci Arc Annotation - Levels Labels Visual Settings

to top