Skip to content

Linear Gradient Config

Configure linear gradients to be applied to series.

linearGradients is a list section: it takes an array of config objects (a single object is also accepted and treated as a one-entry array). Values shared by every entry can be set once in linearGradientDefaults; a value set on an individual entry wins over the shared one.

Every property is optional and falls back to its default, except stops, which must be given. Property anchors are stable: link to any entry as #linearGradients.propertyName, and to a member of a nested property as #linearGradients.propertyName.memberName.

A property holding a list of objects documents the members of one entry, headed stops[].color. Their anchors leave the brackets out: #linearGradients.stops.color.

id

The unique identifier for the gradient so that it can be referenced for use.

  • Default: LG${index}
  • Validation: should be a string of letters, digits, dashes and underscores; should be unique; should be unique across linearGradients and radialGradients
  • Used in: Gradients

ignore

Whether to ignore this linear gradient and treat it as though it were not specified.

  • Default: false
  • Validation: should be a boolean

rotation

The rotation (in degrees, -360 to 360) applied to the svg linear gradient.

  • Default: 0
  • Validation: should be a number >= to -360 and <= 360
  • Used in: Gradients

stops

The list of svg gradient stops, each placing a color at a position along the gradient (at least one stop must be given).

  • Required: a value must be given (there is no default)
  • Validation: should be a non-empty array with elements that should be an object with exact properties { color, offset, opacity }
  • Used in: Gradients

stops[].color

The color of the stop.

  • Required: a value must be given (there is no default)
  • Validation: should be a valid color
  • Used in: Gradients

stops[].offset

The position of the stop, as a fraction (0 - 1) of the length of the gradient.

  • Required: a value must be given (there is no default)
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

stops[].opacity

The opacity (0 - 1) of the stop.

  • Required: a value must be given (there is no default)
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

x1

The x1 start position of the svg linear gradient, as a fraction (0 - 1) of the shape bounds.

  • Default: 0
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

x2

The x2 end position of the svg linear gradient, as a fraction (0 - 1) of the shape bounds.

  • Default: 1
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

y1

The y1 start position of the svg linear gradient, as a fraction (0 - 1) of the shape bounds.

  • Default: 0
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

y2

The y2 end position of the svg linear gradient, as a fraction (0 - 1) of the shape bounds.

  • Default: 1
  • Validation: should be a number >= to 0 and <= 1
  • Used in: Gradients

Released under the MIT License.