java.lang.Object
javafx.scene.Node
javafx.scene.image.ImageView
eu.hansolo.fx.heatmap.HeatMap
- All Implemented Interfaces:
javafx.css.Styleable,javafx.event.EventTarget
public class HeatMap
extends javafx.scene.image.ImageView
-
Property Summary
Properties inherited from class javafx.scene.image.ImageView
fitHeight, fitWidth, image, preserveRatio, smooth, viewport, x, yProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Field Summary
Fields inherited from class javafx.scene.image.ImageView
SMOOTH_DEFAULTFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
ConstructorsConstructorDescriptionHeatMap()HeatMap(double width, double height) HeatMap(double width, double height, Mapping colorMapping, double spotRadius, boolean fadeColors, double heatMapOpacity, OpacityDistribution opacityDistribution) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSpot(double x, double y) If you don't need to weight spots you could use this method which will create spots that always use the global weightvoidaddSpot(double x, double y, double offsetX, double offsetY, double spotRadius, OpacityDistribution opacityDistribution) Visualizes a spot with the given radius and opacity gradientvoidaddSpot(double x, double y, javafx.scene.image.Image spotImage, double offsetX, double offsetY) Visualizes a spot with a given image at the given position and with the given offset.voidaddSpot(eu.hansolo.toolboxfx.geom.Point spot) If you don't need to weight spots you could use this method which will create spots that always use the global weightvoidaddSpot(eu.hansolo.toolboxfx.geom.Point spot, javafx.scene.image.Image spotImage, double offsetX, double offsetY) Visualizes a spot with a given image at the given position and with the given offset.voidaddSpots(eu.hansolo.toolboxfx.geom.Point... spots) Add a list of spots and update the heatmap after all spots have been addedvoidAdd a list of spots and update the heatmap after all spots have been addedvoidCalling this method will lead to a clean new heat map without any datajavafx.scene.image.ImagecreateSpotImage(double radius, OpacityDistribution opacityDistribution) Create an image that contains a circle filled with a radial gradient from white to transparentReturns the used color mapping with the gradient that is used to visualize the dataReturns the opacity distribution that will be used to visualize the events in the monochrome map.doubleReturns the radius of the circle that is used to visualize a spot.List<eu.hansolo.toolboxfx.geom.Point> getSpots()booleanReturns true if the heat map is used to visualize frequencies (default)voidSaves the current heat map image as png with the given name to the desktop folder of the current uservoidSaves the given node as png with the given name to the desktop folder of the current uservoidsetColorMapping(Mapping colorMapping) The ColorMapping enum contains some examples for color mappings that might be useful to visualize data and here you could set the one you like most.voidsetFadeColors(boolean fadeColors) If true each event will be visualized by a radial gradient with the colors from the given color mapping and decreasing opacity from the inside to the outside.voidsetOpacityDistribution(OpacityDistribution opacityDistribution) Changing the opacity distribution will affect the smoothing of the heat map.voidsetSize(double width, double height) Because the heat map is based on images you have to create a new writeable image each time you would like to change the size of the heatmapvoidsetSpotRadius(double radius) Each spot will be visualized by a circle filled with a radial gradient with decreasing opacity from the inside to the outside.voidvoidupdateMonochromeMap(OpacityDistribution opacityDistribution) Updates each spot in the monochrome map to the given opacity gradient which could be useful to reduce oversmoothingMethods inherited from class javafx.scene.image.ImageView
fitHeightProperty, fitWidthProperty, getClassCssMetaData, getCssMetaData, getFitHeight, getFitWidth, getImage, getViewport, getX, getY, imageProperty, isPreserveRatio, isSmooth, preserveRatioProperty, setFitHeight, setFitWidth, setImage, setPreserveRatio, setSmooth, setViewport, setX, setY, smoothProperty, viewportProperty, xProperty, yPropertyMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Constructor Details
-
HeatMap
public HeatMap() -
HeatMap
public HeatMap(double width, double height) -
HeatMap
-
HeatMap
-
HeatMap
public HeatMap(double width, double height, Mapping colorMapping, double spotRadius, boolean fadeColors, double heatMapOpacity, OpacityDistribution opacityDistribution)
-
-
Method Details
-
getSpots
-
setSpots
-
addSpots
public void addSpots(eu.hansolo.toolboxfx.geom.Point... spots) Add a list of spots and update the heatmap after all spots have been added- Parameters:
spots-
-
addSpots
Add a list of spots and update the heatmap after all spots have been added- Parameters:
spots-
-
addSpot
public void addSpot(double x, double y) If you don't need to weight spots you could use this method which will create spots that always use the global weight- Parameters:
x-y-
-
addSpot
public void addSpot(eu.hansolo.toolboxfx.geom.Point spot) If you don't need to weight spots you could use this method which will create spots that always use the global weight- Parameters:
spot-
-
addSpot
public void addSpot(double x, double y, double offsetX, double offsetY, double spotRadius, OpacityDistribution opacityDistribution) Visualizes a spot with the given radius and opacity gradient- Parameters:
x-y-offsetX-offsetY-spotRadius-opacityDistribution-
-
addSpot
public void addSpot(double x, double y, javafx.scene.image.Image spotImage, double offsetX, double offsetY) Visualizes a spot with a given image at the given position and with the given offset. So one could use different weighted images for different kinds of spots (e.g. important events more opaque as unimportant spots)- Parameters:
x-y-spotImage-offsetX-offsetY-
-
addSpot
public void addSpot(eu.hansolo.toolboxfx.geom.Point spot, javafx.scene.image.Image spotImage, double offsetX, double offsetY) Visualizes a spot with a given image at the given position and with the given offset. So one could use different weighted images for different kinds of spots (e.g. important events more opaque as unimportant spots)- Parameters:
spot-spotImage-offsetX-offsetY-
-
clearHeatMap
public void clearHeatMap()Calling this method will lead to a clean new heat map without any data -
getColorMapping
Returns the used color mapping with the gradient that is used to visualize the data- Returns:
-
setColorMapping
The ColorMapping enum contains some examples for color mappings that might be useful to visualize data and here you could set the one you like most. Setting another color mapping will recreate the heat map automatically.- Parameters:
colorMapping-
-
isFadeColors
public boolean isFadeColors()Returns true if the heat map is used to visualize frequencies (default)- Returns:
- true if the heat map is used to visualize frequencies
-
setFadeColors
public void setFadeColors(boolean fadeColors) If true each event will be visualized by a radial gradient with the colors from the given color mapping and decreasing opacity from the inside to the outside. If you set it to false the color opacity won't fade out but will be opaque. This might be handy if you would like to visualize the density instead of the frequency- Parameters:
fadeColors-
-
getSpotRadius
public double getSpotRadius()Returns the radius of the circle that is used to visualize a spot.- Returns:
- the radius of the circle that is used to visualize a spot
-
setSpotRadius
public void setSpotRadius(double radius) Each spot will be visualized by a circle filled with a radial gradient with decreasing opacity from the inside to the outside. If you have lot's of spots it makes sense to set the spot radius to a smaller value. The default value is 15.5- Parameters:
radius-
-
getOpacityDistribution
Returns the opacity distribution that will be used to visualize the events in the monochrome map. If you have lot's of events it makes sense to reduce the radius and the set the opacity distribution to exponential.- Returns:
- the opacity distribution of events in the monochrome map
-
setOpacityDistribution
Changing the opacity distribution will affect the smoothing of the heat map. If you choose a linear opacity distribution you will see bigger colored dots for each event than using the exponential opacity distribution (at the same event radius).- Parameters:
opacityDistribution-
-
setSize
public void setSize(double width, double height) Because the heat map is based on images you have to create a new writeable image each time you would like to change the size of the heatmap- Parameters:
width-height-
-
saveAsPng
Saves the current heat map image as png with the given name to the desktop folder of the current user- Parameters:
fileName-
-
saveAsPng
Saves the given node as png with the given name to the desktop folder of the current user- Parameters:
node-fileName-
-
createSpotImage
public javafx.scene.image.Image createSpotImage(double radius, OpacityDistribution opacityDistribution) Create an image that contains a circle filled with a radial gradient from white to transparent- Parameters:
radius-- Returns:
- an image that contains a filled circle
-
updateMonochromeMap
Updates each spot in the monochrome map to the given opacity gradient which could be useful to reduce oversmoothing- Parameters:
opacityDistribution-
-