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

Drawing

Overview

Coming soon.

Sample App

To make the integration process easier and give you the general idea how AnyStock Stock Drawing Tools can be implemented we have created a sample web application with open source.

You can see the application live at http://www.anychart.com/products/anystock/drawing_tools/.

You can download application source or simply fork it on GitHub: AnyStock - Drawing Tools and Annotations Demo page.

Initiate

startDrawing()startDrawing()

plot.annotations().startDrawing("infiniteLine");
plot.annotations().startDrawing({type: "infiniteLine", color: "red"});

Cancel

cancelDrawing()cancelDrawing()

plot.annotations().cancelDrawing()

Forbid

To forbid drawing annotations on some of the plots use enabled() method.

anychart.onDocumentReady(function() {
var dataTable = anychart.data.table();
dataTable.addData(get_dji_daily_short_data());

var mapping = dataTable.mapAs({value: 1});

chart = anychart.stock();

chart.plot(0).line(mapping);
chart.plot(1).line(mapping);

// allow drawing on the first plot
chart.plot(0).annotations().enabled(true);
// forbid drawing on the second plot
chart.plot(1).annotations().enabled(false);

chart.title("Start annotation drawing. Use mouse to draw annotation.");
chart.container("container");
chart.draw();

// Start annotation drawing.
chart.annotations().startDrawing("triangle");
});

Managing

getAnnotationAt() getAnnotationsCount() removeAnnotation() removeAnnotationAt() removeAllAnnotations() getSelectedAnnotation() select(Annotation) unselect()

Events

The following events can be handled when working with annotations:

Enum ConstantString ValueDescription
ANNOTATIONDRAWINGFINISHannotationDrawingFinishEvent type for the annotation drawing finish.
ANNOTATION_SELECTannotationSelectEvent type for the annotation select.
ANNOTATION_UNSELECTannotationUnselectEvent type for the annotation unselect.