2016-09-06 10 views
-1

내가 vis.js를 사용하여 네트워크를 만들고 physics configurationvis.js 네트워크 physicsConfiguration

physics:{ 
    stabilization: false, 
}, 
configure: { 
    filter:function (option, path) { 
     if (path.indexOf('physics') !== -1) { 
      return true; 
     } 
     if (path.indexOf('smooth') !== -1 || option === 'smooth') { 
      return true; 
     } 
     return false; 
    }, 
    showButton: false, 
    container: document.getElementById('config') 
}, 
내 문제는 내가 모든 옵션을하지 않을 것입니다

screenshot of the result

내 네트워크를 사용자 정의하고, 난 그냥 몇 가지를 원한다 옵션과 라디오 버튼 만. 특정 옵션이나 슬라이더 만 선택하려면 어떻게합니까? 사전에

감사

PS

I asked same question on github 내가 같은 응답 가지고로서

:

죄송하지만 유일한 방법은 자신의 설정 패널을 구축하는 것을

네트워크에 대한 고유 한 구성 패널을 만들어야합니다.

그래서 네트워크 plz 공유의 구성을 사용자 정의하는 다른 아이디어가있는 경우 매우 유용합니다.

답변

0

표시 할 옵션을 조정하려면 optionpath 매개 변수를 사용하여 filter 기능을 조정하고 실제로 필터 옵션을 조정하면됩니다. Here 나는 smoothforceDirection 옵션을 제외하고 physics 중 옵션의 barnesHut 일부를 왼쪽 :

configure: { 
    filter:function (option, path) { 
    if ((path.indexOf('physics') !== -1) && path.indexOf('barnesHut') !== -1) { 
     //alert(path); 
     return true; 
    } 
    if ((path.indexOf('smooth') !== -1 || option === 'smooth') && option != 'forceDirection') { 
     //alert(option); 
     return true; 
    } 
    return false; 
    }, 

또한 주석 alert의 더 pathoption의 값을 찾아 (이상 편의를 위해 console.log 사용) 할 수 있습니다.