Releases: cosmograph-org/cosmos
Release v1.6
What's new
- Support for accessor function in
linkArrows
: Added support for using accessor function inlinkArrows
to customize the appearance of the arrows. This feature was contributed by WanQiyang. - Support for linking to minified library: Added support for linking to the minified version of the library through jsDelivr CDN links.
- Initial zoom behavior updates: The
initialZoomLevel
configuration parameter is nowundefined
by default. IfinitialZoomLevel
is set, the view will not be fit to the initial zoom level. - Zoom the view without d3 transition: Zoom the view without d3 transition if the duration parameter is 0.
- Support color with transparency in
backgroundColor
configuration property: For example,rgba(0, 0, 0, 0)
would set the background color to black with no opacity. Thanks miklevin for raising issue in the cosmograph-issues repository (cosmograph-org/cosmograph-issues#14). - Improved point detection accuracy on mouse hover
- Paddings when Fitting the View: When fitting the view, the paddings are now taken into account as a percentage of the view size.
Fixes
- Canvas Resizing: Previously, centering of the view was lost when resizing the canvas. Now, the centering is saved during resizing.
Optimization
- Prevent Maximum call stack size exceeded: Calculating the minimum and maximum values using
Math.min
andMath.max
with spread operators can lead to Maximum call stack size exceeded error, especially when dealing with large arrays. To address this issue, the d3-arrayextend
method is used instead, which is more memory-efficient and provides the same functionality.
Bumps
ttypescript
from 1.5.13 to 1.5.15
Release v1.5
Cosmograph 1.5 brings a few exciting new features, along with bug fixes and optimizations.
What's new
- Node Sampling: A new method
getSampledNodePositionsMap
has been introduced to enable you to sample a number of evenly distributed nodes visible on the screen. It comes in handy when you want to implement feature like dynamic node labels. You can control the number of nodes in the sample by specifying thenodeSamplingDistance
configuration parameter. Thanks to this feature, we were able to introduce dynamic node labels in the latest Cosmograph.app update:
- Fitting Nodes in the Scene on Initialization: Cosmos will now center and zoom the view to include all nodes in the scene upon initialization. You can use the following configuration options to control this behavior:
fitViewOnInit
,fitViewDelay
, andfitViewByNodesInRect
.
- Rescaling Initial Position of Nodes: To avoid issues related to nodes having coordinates outside the simulation space boundaries, Cosmos will now rescale the initial coordinates of the nodes to fit within the simulation space if the simulation is active. This is useful when you load a graph with pre-calculated initial coordinates and want Cosmos to calculate the force layout for it.
Fixes
- We have resolved the issue of switching between curve/straight line rendering after Cosmos initialization.
Optimization
- Node sizes are now stored in an array for faster access.
Release v1.4
In version 1.4
Cosmos introduces features like curved links, enhanced node focus/hover distinctions with new configurations, options for initial zoom level and disabling zoom/simulation, and more.
What's new:
-
Curved Links: The
curvedLinks
config parameter turns line curvature on/off. -
New
onTick
callback arguments: The hoverednode
,index
, andnodePosition
are now available as second, third, and fourth callback arguments. -
Hovered and focused nodes introduced: We've separated the highlighted nodes into two categories: hovered and focused nodes. We also added new methods to control the focused node such as
setFocusedNodeById
andsetFocusedNodeByIndex
. Additionally, we have introduced new configuration parameters that allow for more customization, such asrenderHoveredNodeRing
,hoveredNodeRingColor
, andfocusedNodeRingColor
. These new changes will be available alongside the old configurations to ensure compatibility until version 2.0. For more detailed information, please see our wiki page. -
Adjusted transparency of the hovered and focused node's ring:** The transparency of the hovered and focused node's ring is now inherited from the parent node.
-
Assigning the initial zoom level to the graph when it is first created: The `initialZoomLevel' configuration parameter can be set once during graph initialization.
-
Disable Zooming. If the
disableZoom
configuration parameter is set totrue
, zooming in and out using the mouse wheel is disabled. -
Cosmos can be run without the simulation, e.g. if you just want to visualize your data set with provided node coordinates. Use the
disableSimulation
config parameter to turn on that behavior (please note that it can be set on graph initialization only).
Fixes:
-
Smart destruction of WebGL buffers and frame buffers and preventing a zero-sized texture from attaching to a WebGL frame buffer.
-
Cosmos will not crash if there are no nodes or links.
-
Fixed the
fitView
method execution, when calling before the animation starts. -
Adjusting
spaceSize
if it exceeds the WebGL limit (#49 (comment)). -
Cosmos can now run the simulation even if the graph contains only nodes and no links.
-
We made the
graph
property public in the mainGraph
class (where the data processing takes place). -
Added a second argument -
index
to the config accessor functionsnodeSize
andnodeColor
.
Optimization
- We have improved the method for finding the hovered node to minimize the chance of slowdowns or lags.
Other
- We've also added a citation file that you can use if you use Cosmos or Cosmograph.
Release v1.3
Release 1.3 of Cosmos implements a bunch of new features making your work with graphs way more comfortable. Our personal highlight is the trackNodePositionsBy
methods allowing you to continuously get coordinates for chosen nodes and render labels for them.
We deliberately decided not to add labels rendering functionality to Cosmos itself to keep the library tiny. Instead we've created a separate package @interacta/css-labels
that you can use along with Cosmos to add labels to your graph. Check out this CodeSanbox example for copy-pastable sample code.
What's new:
- π€ New API methods
getNodeRadiusByIndex
,getNodeRadiusById
,spaceToScreenPosition
,spaceToScreenRadius
,trackNodePositionsByIds
,trackNodePositionsByIndices
andgetTrackedNodePositionsMap
; - π± Random seed. You can now provide
randomSeed
in the config. It allows you to control the randomness of the layout across different simulation runs. This feature was implemented thanks to @jorrit-hdrn's feedback in issue #19; - π±οΈ Mouse events. You can now add callbacks to
onMouseMove
,onNodeMouseOver
andonNodeMouseOut
events in the config; - βͺ Highlight nodes with a ring when hovered or clicked. Config properties
renderHighlightedNodeRing
allow you to turn on/off highlighting andhighlightedNodeRingColor
allow you to set the color of the ring #24; - π Define scale when zooming to a node programmatically. New arguments
scale
andcanZoomOut
are available in thezoomToNodeById
andzoomToNodeByIndex
methods; - π¨βπ» Renamed Types:
InputNode
toCosmosInputNode
andInputLink
toCosmosInputLink
(old naming will also be available till version 2.0 to preserve compatibility).
Release v1.2.0
What's new:
- Zoom events. You can now add callbacks to
onZoomStart
,onZoom
andonZoomEnd
events in the config; - New API method
fitViewByNodeIds
. This feature was implemented thanks to @GoodNovember's feedback in issue #13.
Fixed:
- More precise point search on mouse click.
Release v1.1.3
What's new:
- Selecting adjacent nodes. We've added a second argument to the
selectNodeById
andselectNodeByIndex
API methods for selecting adjacent nodes. When it'strue
, calling those functions will also select the adjacent nodes to the specified node. The default value isfalse
. This feature was implemented thanks to @GoodNovember's feedback in issue #13. - New API method
getAdjacentNodes
. - Empty selection. You can now set an empty selection by providing an empty array to the
selectNodesByIds
andselectNodesByIndices
API methods. If you want to reset the selection, passnull
.
See version 1.1.0 release notes for the latest new features announcement.
Release v1.1.2
Fixes:
- Adding
"type":"module"
to package.json for correct library import
See version 1.1.0 release notes for the latest new features announcement.
Release v1.1.1
Fixes:
- #9
getNodePositions
returns incorrect positions - Vulnerability detected in d3-color
See version 1.1.0 release notes for the latest new features announcement.
Release v1.1.0
Cosmos 1.1.0 introduces a number of graph interactions, such as:
- Select a node or multiple nodes by their indices or ids;
- Select all nodes in a rectangular area;
- Zoom to a specific node;
- Fit the graph view to contain all the nodes.
There're three new configuration properties:
nodeGreyoutOpacity
andlinkGreyoutOpacity
allow you to set the opacity of non-selected nodes and links when selection is active;scaleNodesOnZoom
(true
by default) enables node scaling depending on the zoom level. This will allow to easier pick a node when you zoom in.
The onClick
callback will now have four arguments instead of two: node, its index, position, and the corresponding event.
You can find the full list of available methods and properties in the readme file. We've also updated our CodeSandbox example to show you how to use them.
Nikita & The Cosmograph Team
Release v1.0.0
The first public release