Network Chart Widget

The Network Chart widget is an implementation of a zk component and enables chart visualization.

Widget Definition

Name

Vis.js Network Chart

ID

com.hybris.cockpitng.visjs.networkchart

Category

Charts

Description

It's a widget implementation that uses Network Chart zk component.

Applied In

Backoffice

Based On

Based on a network chart component.

Network Chart Component and Vis.js

Author

SAP

Inputs

Details of input sockets:
  • initData

    • Type: Item
    • Multiplicity: Single
    • Description: Item passed through this socket is passed to the com.hybris.backoffice.widgets.networkchart.handler.NetworkPopulator#populate method to prepare the initial network structure.
  • updateObject
    • Type: Item
    • Multiplicity: Single
    • Description: Item passed through this socket is passed to the com.hybris.backoffice.widgets.networkchart.handler.NetworkPopulator#update method to update network data.

Outputs

Not applicable

Generated Events

Not applicable

Configuration

No custom configuration applies to this widget.

Example of the widget usage is presented in the Network Chart Component and Vis.js documentation.

If you wish to adapt the example to the Network Chart widget, you should implement the bean which implements com.hybris.backoffice.widgets.networkchart.handler.NetworkPopulator. The content of populate method can be copied from vis.js: protected Network prepareInitStructure(final CatalogModel catalogModel).

If you wish to react on view events, you should implement the spring bean, which implements com.hybris.backoffice.widgets.networkchart.handler.ViewEventHandler. It may be the same bean which implements both NetworkPopulator and ViewEventHandler. Then, you can copy content of the protectedNetworkUpdates handleNodeEvent (final Node clickedNode) method to ViewEventHandler#onClick (final Node node, final NetworkChartContext context).

Widget Preview

You can see an example of the widget usage when you open the Category System tab in Editor Area after selecting a product. You can assign product to category by double-clicking the chosen node, and then selecting required categories. The ones that are in red are the categories that the product is assigned to.

You can also check the widget usage when you access Catalogs in Explorer Tree, and click the edit action in the Editor Area of a selected catalog. There is a popup window, which displays the catalog you selected, and the Edit button. In the chart, you can check the connections between catalogs and categories, by opening each node with a click. You can modify data by assigning or removing the catalogs and categories. In the example below, there are four possibilities: Add Node, Add Edge, Edit Node, and Delete Selected.

Settings

Setting

Type

Description

chartOptions java.lang.String

JSON that represents com.hybris.cockpitng.components.visjs.network.data.Options.

For example:
{
 "physics" : {"enabled" : true},
 "interaction" : {"multiselect" : true, "hover" : true},
 "layout" : {"hierarchical" : {"sortMethod" : "directed"}}
}
dataManipulationHandler java.lang.String

Name of a spring bean which implements com.hybris.backoffice.widgets.networkchart.handler.DataManipulationHandler

networkPopulator java.lang.String

Name of a spring bean which implements com.hybris.backoffice.widgets.networkchart.handler.NetworkPopulator

viewEventHandler java.lang.String

Name of a spring bean which implements com.hybris.backoffice.widgets.networkchart.handler.ViewEventHandler

customAddNodeButton java.lang.Boolean

Enables customization for Add node button in network chart widget. After enabling this flag, the customization can be done by implementing com.hybris.backoffice.widgets.networkchart.handler.DataManipulationHandler#onAddNodeButtonClick method

showControlsButtons java.lang.Boolean

Toggles the visibility of save, refresh, and cancel buttons.

Widget Slots

slotID Multiplicity Type Slots Composition
cockpitWidgetChildrenInvisible multi Not applicable A general-purpose slot available for widgets. Any widget placed on this slot is not displayed in the application view but can be accessed through its socket API.