To modify a drawing, including moving it, you first need to capture its
For example, creating a drawing and recording the
// Create a drawing, storing the ID for future use (for example, in Framework.$myDrawingId)
Framework.ChartChange({
mode: "active", // or "all", or "single" plus a .chartId value
command: "create-drawing",
drawing: { … }
}, function (MsgResponse) {
if (MsgResponse.result.success) {
// Drawing added. Store the ID for later use:
Framework.$myDrawingId = MsgResponse.result.drawingId;
} else {
// Failed.
// Textual error message in MsgResponse.result.error
}
});
You can then modify the drawing by passing in the
Framework.ChartChange({
mode: "active", // or "all", or "single" plus a .chartId value
command: "change-drawing",
drawingId: Framework.$myDrawingId,
drawing: {
// Properties to change.
// Can include any or all of the properties which are
// accepted by create-drawing (apart from the .type).
// For example, moving the drawing (while leaving properties such as
// the colour unchanged):
points: [
{date: 1777939200000, value: 1.171},
{date: 1777968000000, value: 1.173}
]
}
});