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

scroll chart에서 값이 없을 경우 #155

Open SHINMJ opened 6 years ago

SHINMJ commented 6 years ago

column scroll 차트에서 y축 domain을 domain:function(data){ return [data.column1,data.column2];} 이런식으로 줬을 때 스크롤 되는 부분의 전체 데이터가 0인 경우 화면상으로는 문제 없지만 아래와 같은 스크립트 에러가 쭉납니다. core.js:4170 Error: attribute d: Expected number, "…0,0 0 0,1 30,0 VNaN A3,3 0 0,1 2…". core.js:4170 Error: attribute transform: Trailing garbage, "translate(19.75,NaN)".

테스트 코드입니다. var chart = jui.include("chart.builder");

chart("#result", { axis : { x : { type : "block", domain : "quarter", line : true }, y : { type : "range", domain : function(d) { return [d.sales, d.profit ]; }, step : 10, line : true, orient : "right" }, buffer : 10 , data : [ { quarter : "17Q", sales : 0, profit : 0}, { quarter : "18Q", sales : 0, profit : 0 }, { quarter : "19Q", sales : 0, profit : 0}, { quarter : "20Q", sales : 0, profit : 0}, { quarter : "21Q", sales : 0, profit : 0 }, { quarter : "22Q", sales : 0, profit : 0}, { quarter : "17Q", sales : 0, profit : 0}, { quarter : "18Q", sales : 0, profit : 0 }, { quarter : "19Q", sales : 0, profit : 0}, { quarter : "20Q", sales : 0, profit : 0}, { quarter : "21Q", sales : 0, profit : 0 }, { quarter : "22Q", sales : 0, profit : 0}, { quarter : "17Q", sales : 0, profit : 0}, { quarter : "18Q", sales : 0, profit : 0 }, { quarter : "19Q", sales : 0, profit : 0}, { quarter : "20Q", sales : 0, profit : 0}, { quarter : "21Q", sales : 0, profit : 0 }, { quarter : "22Q", sales : 0, profit : 0}, { quarter : "17Q", sales : 0, profit : 0}, { quarter : "18Q", sales : 0, profit : 0 }, { quarter : "19Q", sales : 0, profit : 0}, { quarter : "20Q", sales : 0, profit : 0}, { quarter : "21Q", sales : 0, profit : 0 }, { quarter : "22Q", sales : 0, profit : 0}, { quarter : "23Q", sales : 0, profit : 0} ] }, brush : { type : "column", target : [ "sales", "profit" ] }, widget : [ { type : "title", text : "Column Sample" }, { type : "tooltip" }, { type : "legend" }, {type:"scroll"} ] });