toPercentXCoord method

num toPercentXCoord([
  1. num? x
])

Converts an x value to a percentage from the left to the right of the drawing area.

If the coordinate represents a value visible on the canvas, then the value will be between 0 and 1, where 0 is the left of the canvas. However, this method will return values outside the range, as values can fall outside the canvas.

If x is null, this returns null.

Implementation

external num toPercentXCoord([num? x]);