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

full gauge 차트에 색상을 데이터 조건별로 변경하고 싶습니다. #222

Open sewoozz opened 4 years ago

sewoozz commented 4 years ago

ajax 로 데이터를 불러와서 아래와 같이 코딩을 했는데 잘되다가 안될때가 있어서 문의드립니다.

var chart = jui.include("chart.builder"); chart("#chart"+k+""+i+"", { width: 130, height : 130, padding : 0, // theme : "jennifer", axis : { data : [ { title : 'DAY', value : res.list[j].daily, max : 100, min : 0, unit : "%" } ] }, brush : { type : 'fullgauge', size : 14, startAngle : 0, titleY : 17, animate : true, format : function(v) { return v + "%"; }, //colors : [ "#03c589", "#febc06", "#ff7f04", "#f15270" ], colors : function(value) { if (res.list[j].daily >= 90) return "#03c589"; else if (res.list[j].daily >= 80) return "#febc06"; else if (res.list[j].daily >= 70) return "#ff7f04"; else return "#f15270"; } } });

이런 에러가 나네요.. Uncaught TypeError: Cannot read property 'daily' of undefined at UI.init.colors ((index):216) at FullGaugeBrush.CoreBrush.color (jui.js:20583) at FullGaugeBrush.drawUnit (jui.js:24809) at FullGaugeBrush. (jui.js:24828) at FullGaugeBrush.CoreBrush.eachData (jui.js:20343) at FullGaugeBrush.draw (jui.js:24827) at FullGaugeBrush.Draw.render (jui.js:13541) at drawBrush (jui.js:14833) at UI.init.UI.render (jui.js:15561) at UI.init.UI.setSize (jui.js:15697)

도움 좀 부탁드리겠습니다. 감사합니다.

sewoozz commented 4 years ago

해결 완료 하였습니다.