2016-08-17 5 views
1

저는 Dimensional Charting 자바 스크립트 라이브러리 dc.js를 사용하여 barchart를 만들고 있습니다. 나는 jan, feb, mar, apr과 같은 순서로 barchart를 표시하려고합니다.dc.js에서 순차적으로 월을 표시하는 방법

달을 연속적으로 배치하는 방법을 이해할 수 없습니다. 나는 fiddile을 첨부했습니다 https://jsfiddle.net/jusjkm8j/27/.

데이터 형식은 다음과 같습니다.

Sku  Stars partner review Date 
KBU12  5  Amazon Preferred over the r. 02/05/2016 
KBU12  5  Amazon Gorgeous fixture 05/06/2016 
KBU12  2  Amazon Awesome value! 02/02/2016 
KBU12  2  Homedepot Kitchen Remodel 06/09/2016 
KPF1650 3 Homedepot Wow 02/08/2016 
KPF1650 4 Homedepot Sharp! 05/04/2015 
KPF1650 5 Homedepot cool design 05/05/2015 
KPF1650 1 Amazon Beautiful 09/08/2015 
KPF1650 2 Amazon Very happy 09/11/2016 
GV-100  3 Amazon Great quality 12/12/2015 
GV-100  5 Homedepot Love it 01/03/2015 
GV-100  1 Homedepot Sad I had to return it 12/10/2014 
GV-100  4 Homedepot Beautiful But Stiff 12/11/2014 
GV-100  2 Homedepot Kitchen Faucet 10/04/2014 
KBU24  3 Build  I like the look of faucet 04/05/2014 
KBU24  5 Build  Commercial style without 06/07/2016 
KBU24  4 Build  Very Cool 06/07/2014 
KBU24  1 Build  Excellent! 01/04/2014 
KBU24  3 Build  A beautiful Vessel Sink 07/06/2013 
KBU24  5 Amazon  Beautiful addition 05/04/2013 
+0

내가 https://jsfiddle.net/jusjkm8j/27/ – pramod24

답변

2

순 서적으로 축은 신원 기능에 의해 정렬됩니다. 이를 달성하기

한 가지 방법은

spendHistChart22.xAxis().tickFormat(d => d.substr(3)) 

이 정확하게 주문합니다 않는 차트에 그런

d3.time.format('%m.%b'); // 01.Jan 

당신이 할 수있는에 달 포매터를 변경하고 또한의 이름을 표시하는 것 달.

는 바이올린을 참조하십시오 : 제대로 작동 https://jsfiddle.net/b96exL8b/

+0

Nordfjord fiddile 첨부 해 주셔서 감사합니다 !!!!! – pramod24