Dynamic Icons Scripting Reference - v1.3.0
    Preparing search index...

    Class BarGraph

    Draws a values series as a basic vertical bar graph onto a canvas context.

    Implements

    • ILayerElement
    • IRenderable
    • IValuedElement
    • IColorElement
    Index

    Accessors

    • get values(): number[]

      Returns the currently stored numeric values as a new array. Values are represented as decimal percentages in the range of 0.0 - 1.0, inclusive.

      Returns number[]

    Constructors

    Methods

    • Adds value to current array along with the current bar drawing style and shifts out old values if necessary based on available size and bar width.

      Parameters

      • value: number

        Fractional percentage, 0.0 - 1.0. The given value is clamped to this range.

      Returns void

    • Clears all stored values.

      Returns void

    • Evaluates string value to a number, divides by 100 and calls (@link addValue} with the result.

      Parameters

      • value: string

      Returns void

    Properties

    barColor: BrushStyle = ...
    barWidth: number = 10

    Width of each bar section, in pixels.

    backgroundColorOn: boolean = true
    backgroundColor: BrushStyle = ...
    maxExtent: number = PluginSettings.defaultIconSize.width

    Maximum width, in pixels, into which the bars need to fit (or height if an orientation option is added). Typically this is the size of the icon/image being drawn. Values that would cause the graph to draw beyond this extent are removed from the stored values array.