Drawing tools

23 built-in drawing tools. All tools support magnet snapping, undo/redo, and full JSON serialization.

Activating a tool

chart.activateDrawingTool('trendLine')
// User clicks two points; the drawing is added to the manager.

Auto Fibonacci

One click draws a Fibonacci retracement over the dominant swing (extreme high and low) in the visible range — anchored low→high for an up-swing, high→low for a down-swing. Run it from the command palette ("Auto Fibonacci"), or programmatically:

chart.autoFib()  // returns the new drawing id, or null if no clear swing

// general drawing append (active style applied, id auto-assigned)
chart.addDrawing({ type: 'fibRetracement', anchors: [a, b] })

Catalog

Lines

  • trendLine
  • ray
  • extendedLine
  • horizontalLine
  • verticalLine

Channels

  • parallelChannel
  • regressionChannel

Shapes

  • rectangle
  • ellipse
  • triangle

Fibonacci

  • fibRetracement
  • fibExtension
  • fibTimeZones — vertical Fibonacci interval projections from a two-anchor time span.

Advanced

  • pitchfork
  • elliottWave
  • gannFan
  • gannBox
  • anchoredVWAP
  • volumeProfileRange

Measurement

  • measure
  • priceRange
  • dateRange

Annotations

  • text
  • arrow

Serialization

const json = chart.serialize()              // → string
chart.deserialize(json)                     // validates + restores drawings/indicators/viewport

deserialize filters malformed drawings, orders, and indicators — partial or corrupt payloads no longer poison the chart.