juijs / jui-chart

SVG-based JUI chart that can be used in the browser and Node.js. Support many types of charts. (Dashboard, Map, Topology, Full 3D, Realtime)
https://codepen.io/collection/nLydod/
57 stars 25 forks source link

콜백함수로 그래프를 그리는 경우 매번 타겟을 다르게 설정할수 있는지 궁금합니다. #176

Open cofham opened 6 years ago

cofham commented 6 years ago

function drawchart(){ 차트를 그리는 함수 }

target_list = [ ]; brush:[{ target: target_list, },

socket.on('target_a',function(){ target_list.push("a"); } socket.on('target_b',function(){ target_list.push("b"); }

div 이벤트에 drawchart()를 연결시켜서 이벤트에 따라 차트의 타겟을 변경할수 있는지 궁금합니다 소켓으로 콜백함수를 설정하여 타겟 변수에 요소를 추가하여 경우에 따라 a차트 b차트 이런식으로 작성이 가능한가요?

easylogic commented 6 years ago

https://github.com/juijs/jui-chart/issues/174

여기 하신 것 처럼 updateBrush 에 target 을 넣어서 갱신하시면 되요

cofham commented 6 years ago

target_list 이 비어있는 경우 차트는 생성할수 없는건가요 ?

easylogic commented 6 years ago

에 그건 그려야할 대상 자체가 없는거라서요

cofham commented 6 years ago

brush:[{ target: ["1","2"] }, chart.updateBrush(0,{ target : target_list }); 이런식으로 하면되는건가요?

easylogic commented 6 years ago

네 같은 방식으로 하시면 됩니다.