Include multiple connections between two points in an amCharts force-directed network

I'm currently utilizing the amcharts force directed network to display a knowledge graph. Within this knowledge graph, it's possible for two nodes to have multiple edges in both directions.

For instance:

A "person" could be linked as "born in" a city

Furthermore,

A "person" could also be connected as "live in" a city.

After reviewing the documentation, I found that I can create connections between edges using "linkWith", however, I'm unable to specify a "type" and include additional links.

View an example of two nodes with two link types here

Below is a snippet from the json file:

{
      "id": "200",
      "type": "City",
      "name": "New York",
      "color": "#2CB186",
      "linkWith": [{
        "115": ["born_in", "lives_in"]
      }]
    }

Answer №1

If you desire

                _label:lives_               
               /             \
  (node:'John')               (node:'New York')
               \__label:born_/

It lacks the capability for parallel relationships between two nodes. The closest alternative is to transform labels into nodes and connect them as follows.

               __(node:'lives')_
              /                 \
 (node:'John')                   (node:'New York')
              \__(Node:'Born')__/

I understand this may not be the ideal solution, but you might consider exploring as an option. This tool allows you to create relationships with multiple line segments between the same node.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The ref.on() method fails to trigger a response from a function, despite producing the intended outcome

I've been working on developing an app called workspace. I previously asked a question, but I've made more additions to the features now. One of the new features is a remarks system. After experimenting with different versions of my code, the ver ...

The use of an OR condition within a return statement

Is there a more efficient way to implement an OR condition in a "return statement"? isFileValid() { return this.myUploadCtrl.nativeElement.value.match(/csv/i) != null; } I would like to validate both lowercase and uppercase versions ...

How can I target a specific element with a data-bind attribute and activate it immediately (using the now-active class)?

<div class="container"> <div class="well" data-id="myApp"> // Data-Bind is Here <input type="text" value="" class="form-control input-sm" data-bind="value:name,valueUpdate:'afterkeyup'" /> ...

Has the ID of the JQuery UI tab been updated?

Can someone assist me? Here's what I have done: <div class="tabs"> <ul> <li><a id="tb-1" position=1 href="tabs-1"> A </a></li> <li><a id="tb-2" position=2 href="tabs-2"> B </a></li> ...

Using plain JavaScript (without any additional libraries like jQuery), you can eliminate a class from an element

I'm attempting to locate an element by its class name, and then remove the class from it. My goal is to achieve this using pure JavaScript, without relying on jQuery. Here is my current approach: <script> var changeController = function() { ...

angular-ui/ui-select dropdown initialized

Is it possible to display items in a dropdown based on the starting letter? I am currently using the Angular UI Select plugin from https://github.com/angular-ui/ui-select, and when I type "a" in the dropdown, it shows all words containing the letter "a". ...

Contrasting Router.push and location.assign: Exploring the variances between

One thing I've noticed in my React app is that when I use Router.push('/') from `import Router from 'next/router', the page I am navigating to doesn't fully refresh. This causes some loading spinners whose states I want to be ...

The navigation menu on my website vanishes from view when I click on the hamburger menu on desktop screens

I successfully converted my mobile menu's JS code to jQuery, and it's working fine! However, this conversion has led to two minor issues. The jQuery code is not provided in the snippet below as it doesn't showcase the problems. I am utilizin ...

Is it possible to customize the appearance of the <audio> tag when used with a playlist?

I am struggling to style an audio tag with a playlist of songs. Does anyone have any pre-made styles that I can use for a normal white MP3 player similar to the one in the picture I attached? The MP3 player I'm aiming for Current player design Her ...

While iterating over the key with a variable in a loop, only one property is displayed consistently instead of four different

Currently, I am working on creating an address book using JavaScript. The problem I am facing is that the properties of my objects are not providing me with the necessary information. I need 4 different properties instead of 4 loops with the same property. ...

Is there a way to stop ng-repeat in AngularJS 1.2 from encoding or escaping my content, or do I have to create my own directive for this?

Is there a way to stop ng-repeat in AngularJS 1.2 from encoding or escaping my content without creating a custom directive? I know that ng-bind-html-unsafe is no longer supported in Angular 1.2, but I'm unsure about its compatibility with ng-repeat. S ...

Executing an onclick event in a Reactjs application

I am currently working on developing an application using reactjs. Below is the code snippet that can be found in my main app.js file: class App extends Component { return ( <div> <ExampleTable header={() = ...

Drag and drop to upload files

Is there a way to enable drag-and-drop functionality for uploading and downloading files between a user's computer and web browser? If so, what is the best approach - ASP.NET with AJAX or JS/JQuery? ...

Troubleshooting a problem with C3.js charts when utilizing an array

When using c3.js to build a stacked bar chart, I am able to achieve the desired results with static data. However, I run into trouble when attempting to utilize dynamic data. There are two fiddles provided: one showcasing the successful use of static data ...

Is it more advantageous to pass a value as a prop to a child component, or should the child component retrieve it from Redux instead?

In my scenario, there are two components called <Parent> and <Child>. The <Parent> component is connected to a Redux state property named prop1 using the mapStateToProps() function. Now, I also need the <Child> component to have acc ...

A guide on dynamically checking the checkbox values in each row of a table using JavaScript or jQuery

My table is dynamically populated with values from a database using the following code: var row = table.insertRow(i); i = i+1; // Insert new cells (<td> elements) at the 1st and 2nd position of the new <tr> element: var cell1 = row.insertCell ...

Generate an array containing the dates of the past 30 days using Moment.js

Currently, I am utilizing momentjs in my project and aiming to generate an array that comprises of the last 30 days. My approach involves creating a counter and subsequently iterating backwards, generating a new moment instance for each day. However, I a ...

What information is displayed on the visible class roster?

I'm feeling a bit lost with this. element.classList.add('visible'); Can someone clarify what the 'visible' in this code snippet is? Is it an event or something else? Appreciate your help! ...

Issue with VueJS computed property failing to update when using a boolean prop

I'm facing an issue with a Vue (2.6.11 via Nuxt) component that receives a Boolean property from its parent and uses it to calculate additional computed properties. Everything displays correctly after the initial rendering. However, when the parent to ...

Generate the hyperlinks with JavaScript

I have successfully implemented a boostrap 4 navbar, and I have a function that creates links. Is there a more efficient method to accomplish this using JavaScript? I currently have three functions that create links for each hyperlink. Would it be possib ...