Still have questions?
Contact support
You are looking at an outdated 7.12.0 version of this document. Switch to the 7.13.0 version to see the up to date information.

Andrews' Pitchfork

Overview

The Andrews' Pitchfork annotation allows to add an Andrews' pitchfork (an analysis tool developed by Alan Andrews) to a chart.

This article explains how to add an Andrews' Pitchfork and configure its basic and visual settings. You can find more settings and other useful information in the articles describing annotations in general:

Basic Settings

To add an Andrews' Pitchfork annotation to a chart, call the andrewsPitchfork() method of the annotations() object.

Next, use the xAnchor(), valueAnchor(), secondXAnchor(), secondValueAnchor(), thirdXAnchor() and thirdValueAnchor() methods to set 3 points that determine the position of the Andrews' pitchfork. Usually, the most convenient way to do this is object notation:

// create a stock chart
chart = anychart.stock();

// create a plot on the chart
var plot = chart.plot(0);

// access the annotations() object of the plot to work with annotations
var controller = plot.annotations();

// create an Andrews' Pitchfork annotation
controller.andrewsPitchfork({
xAnchor: "2006-10-15",
valueAnchor: 24.55,
secondXAnchor: "2007-01-07",
secondValueAnchor: 28.92,
thirdXAnchor: "2007-05-20",
thirdValueAnchor: 25.52
});

This is how it looks like:

JsFiddle Playground

Visual Settings

You can also configure the visual settings of an Andrews' Pitchfork annotation:

In the sample below, there are two Andrews' Pitchfork annotations with some of the visual settings configured (by using an object in the first case and methods in the second):

// create the first Andrews' Pitchfork annotation and configure its visual settings
andrewsPitchfork1 = controller.andrewsPitchfork({
xAnchor: "2006-10-15",
valueAnchor: 24.55,
secondXAnchor: "2007-01-07",
secondValueAnchor: 28.92,
thirdXAnchor: "2007-05-20",
thirdValueAnchor: 25.52,
hoverStroke: "2 #FF0000",
selectStroke: "5 #FF0000"
});

// create the second Andrews' Pitchfork annotation
andrewsPitchfork2 = controller.andrewsPitchfork();

// set the position of the second annotation
andrewsPitchfork2.xAnchor("2007-12-16");
andrewsPitchfork2.valueAnchor(28.60);
andrewsPitchfork2.secondXAnchor("2008-08-10");
andrewsPitchfork2.secondValueAnchor(24.91);
andrewsPitchfork2.thirdXAnchor("2008-02-10");
andrewsPitchfork2.thirdValueAnchor(23.30);

// configure the visual settings of the second annotation
andrewsPitchfork2.stroke("#2196F3", 3, "10 2");

JsFiddle Playground