GoJS API
/ to search
    Preparing search index...

    Class HeatMap

    This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.

    A class for drawing a heat map based on the "temperatures" of Parts.

    This class adds a heat map image in the "ViewportForeground" Layer that is dynamically computed as the user scrolls or zooms or when a transaction/undo/redo is finished.

    It also has a method, renderImageData, that renders a heat map for a given area of the document, not just for the viewport, returning an ImageData.

    Index

    Constructors

    • Construct a HeatMap for a Diagram, optionally setting some properties.

      Parameters

      • Optionaldiag: any

        if not supplied, the diagram will be null

      • Optionalinit: Partial<HeatMap>

      Returns HeatMap

    Accessors

    • get colors(): number[][]

      Returns number[][]

    • get diagram(): any

      Returns any

    • get heatMapPart(): Part

      Returns Part

    Methods

    • Override this method to customize the computation of the starting index in the colors Array given the fraction computed by normalizeTemperature. The default behavior is a simple linear interpolation. The value must be a valid index into the colors Array.

      Parameters

      • frac: number

        a number between zero and one, inclusive

      Returns number

      an index into colors

    • Override this method to customize getting the value for how "hot" the given Part is. Typically this is overridden to return some numeric property of the Part.data. By default it returns one, the maximum, assuming the normalizeTemperature method does not scale the value.

      Parameters

      • part: Part

      Returns number

      a number indicating the Part's temperature, where smaller values are cooler.

    • Override this method to shift and scale the given temperature to get a fraction between zero and one, inclusive. A value of zero indicates that the given Part not participate in the heat map. Values between zero and one select the starting color from the colors Array -- higher values get more colors. By default it just returns the given value, making sure the value is between zero and one.

      Parameters

      • temp: number

      Returns number

      a fraction between zero and one, inclusive

    • Return an ImageData of the given SIZE in pixels for the given AREA in document coordinates.

      Parameters

      • area: Rect

        a Rect in document coordinates

      • size: Size

        a Size in device-independent-pixel/viewport coordinates

      Returns ImageData | null

      ImageData or null

    • Update the heatMapPart's raster image for the viewport.

      Returns void