Vizit JS-API
Vizit exports via JSNI (javascript native interface) the following methods in the vizit namespace.
Examples of proper usage of the API can be found in https://${CLIENT_COMPANY}-ws.biovista.com/vizit/fixedsize.html
Note: All API methods are initialized after the module load. If the host page tries to access the API too early it is possible to get a NullPointerException. The proper way to access the API is after you get the notification that Vizit is ready. This is done through the onVizitLoad() callback. If the page has specified such a function it will be called when Vizit is ready to interact with the page and the user through its API.
setGraphPanelState
vizit.setGraphPanelState({bv_gid state[, relayout (default: no), clobber (default: true]})
Although Vizit can be initialized during page load with the #!bv_gid hash fragment, it also offers the capability to set the graph state dynamically via javascript without changing the url. The optional variables are:
- relayout: Force a graph relayout after the graph state has been loaded.
- clobber: If true, force overwrite the graph state even if a valid graph state already exists. If false, the state is set only if the graph is empty.
setGraphBlur
vizit.setGraphBlur({blur})
Blurs or unblurs the graph. This is designed to be used as a special effect for web designers.
- blur: If true blurs the graph otherwise it unblurs the graph.
startTour
vizit.startTour({tour_id})
Starts a tour. This is designed to be used as more visible user help at a page level.
- tour_id: The tour to start. Currently 3 tours are implemented and valid values are in [0, 2].
addAndExpand
vizit.addAndExpand({entity_name[, entity_type_name, expand_entity_type_name]})
Another way to load a simple graph (rosetta) without changing the browser’s url is to specify an entity via the entity_name and automatically perform a one-step expansion. The optional variables are:
- entity_type_name: Specify an entity type for the initial entity. If omitted Vizit will try to match to any of the supported entity types.
- expand_entity_type_name: The entity type of the expanded entities. If omitted will try to auto guess an expansion type.
addAndConnect
vizit.addAndConnect({entity_group_1, entity_group_2})
Connects the entities of group1 to the entities of group2 if possible. Both entity groups are JS arrays of strings following Biovista Vizit Entity ProperName convention such as “Drug|Aspirin” where the EntityType comes first before the pipe symbol.
multiAddAndExpand
vizit.multiAddAndExpand({entity_group[, expand_entity_type_names]})
Acts like vizit.addAndExpand() but adds multiple entries at once and expands them to multiple entity types.
- The entity_group is a JS array of strings following Biovista Vizit Entity ProperName convention such as “Drug|Aspirin” where the EntityType comes first before the pipe symbol.
- The expand_entity_type_names is a JS array of strings that are valid EntityType names. Similarly to addAndExpand if omitted or empty will try to auto guess an expansion type.
setFilter
vizit.setFilter(filter)
Sets the current filter. If empty or null it will reset the current filter to empty.
getStateSupportingEvidence
getStateSupportingEvidence(onStateSupportEvidenceHandler[, offset, limit])
Retrieves the Supporting Evidence identifiers from the current graph links.
- The onStateSupportEvidenceHandler(json) is a JS function that gets called with the result (JSON) when all relevant information has been retrieved.
- offset: The offset (default: 0) of the retrieved data. It is used for pagination.
- limit: The number of maximum ids it will retrieve (default: 100). It is used for pagination.