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.
Gets or sets the size of the chamfer neighborhood used when the metric is HeatMapMetric.Euclidean. A value of 3 sweeps a 3x3 neighborhood, approximating Euclidean distance to within about 8%, so large halos look subtly octagonal. A value of 5 also sweeps the knight's-move neighbors of a 5x5 neighborhood, approximating Euclidean distance to within about 2%, so halos look round, at roughly double the rendering cost. This has no effect when the metric is HeatMapMetric.Manhattan, which is computed exactly.
The default value is 3.
Gets or sets whether the heat map image is drawn in front of all Parts, in the "ViewportForeground" Layer, or behind them, in the "ViewportBackground" Layer.
The default value is true.
Gets or sets the distance metric by which heat spreads outward from each Part. HeatMapMetric.Manhattan produces diamond-shaped halos; HeatMapMetric.Euclidean produces approximately circular ones.
The default value is HeatMapMetric.Manhattan.
Gets or sets the coordinate system in which heat spread distances are measured. HeatMapSpreadUnits.Viewport spreads one canvas pixel per colors entry, so halos keep the same size on screen regardless of zoom. HeatMapSpreadUnits.Document spreads one document unit per colors entry, so halos scale together with Parts as the user zooms.
The default value is HeatMapSpreadUnits.Viewport.
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.
a number between zero and one, inclusive
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.
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.
a fraction between zero and one, inclusive
Update the heatMapPart's raster image for the viewport.
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.