Interface InstrumentDrawingsOptions

interface InstrumentDrawingsOptions {
    key?: (instrument: DrawingInstrument) => null | string;
    onError?: (error: InstrumentDrawingsError) => void;
    prefer?: "live" | "stored";
    store?: DrawingDocumentStore;
}

Properties

key?: (instrument: DrawingInstrument) => null | string

The key an instrument's document is stored under, or null for a context that names no instrument. Default instrumentDrawingsKey. A host that wants drawings per data variant too, or one namespace per chart, says so here.

onError?: (error: InstrumentDrawingsError) => void

Called for every store operation that failed. The document stays in memory for the session.

prefer?: "live" | "stored"

Which document wins when the helper starts on an instrument the store already holds one for while the controller holds another. 'stored' (default) loads the stored one, which is right for a chart built fresh. 'live' keeps the controller's, even an empty one, and writes it to the store, for a host that has just loaded that instrument's drawings itself (a layout, a chart rebuilt from the one it replaces). Either way, drawings the controller holds for an instrument the store has nothing for are kept as that instrument's: that is how a document saved before drawings were per instrument is attached to the instrument it was drawn on.

Where the documents live. Default: memoryDrawingStore(), for the life of the page.