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

jui - chart 색상관련해서 문의드립니다. #172

Closed cofham closed 6 years ago

cofham commented 6 years ago

현재 jui-chart 를 이용하여 차트를 구현하고 있습니다. 혹시 차트 색상에 변수를 받아서 적용시킬수있는지 문의드립니다.

예를들어 html 텍스트에 "red"입력후 차트를 생성하면 차트 색상을 red로 적용시킬수 있나요?

brush : [{ type : "line", target : ["ch1","ch2","ch3","ch4"], colors : ["ch1color","ch2color","ch3color","ch4color"] }

각각의 채널에 ch1color라는 변수값을 색상으로 적용시키는 방법을 알려주세요..

seogi1004 commented 6 years ago

chartObj.updateBrush(0, { colors: [ ... ] }); 를 통해 동적으로 변경하면 될 것 같습니다. 또는 colors 옵션에 배열을 넣지 말고, 콜백함수를 넣어 처리할 수도 있습니다.

cofham commented 6 years ago

답변감사드립니다. 아래와 같이 객체생성후 각각 값을 지정한 후 콜백함수로 불러오는 방식을 해보았는데 적용이 되지않습니다. 그리고 chart.updateBrush(0,{colors:[,,,,]}); 를 사용해봤는데 마찬가지로 변하지않았습니다. 혹시 제가 잘못 접근한 부분이 있을까요?

var channelcolorlist = { first : channel1color, second : channel2color, third : channel3color, fourth : channel4color }

colors : function(){ return channelcolorlist; }