2016-06-30 47 views
0

我想在chartist.js顯示負數,但它似乎不支持負數:如何chartist.js使用負數

我的代碼:

 var _4date = 'D'; 
     var _3date = 'C'; 
     var _2date = 'B'; 
     var _1date = 'A'; 

     var _4all_scores = '-100'; 
     var _3all_scores = '476'; 
     var _2all_scores = '649'; 
     var _1all_scores = '0'; 

     var _4comments_scores = '-100'; 
     var _3comments_scores = '20'; 
     var _2comments_scores = '0'; 
     var _1comments_scores = '0'; 


     var _4transactions_scores = '0'; 
     var _3transactions_scores = '456'; 
     var _2transactions_scores = '649'; 
     var _1transactions_scores = '0'; 



     var chart = new Chartist.Line('.ct-chart', { 
      labels: [_1date, _2date, _3date, _4date], 
      series: [ 
       [_1all_scores, _2all_scores, _3all_scores, _4all_scores], 
       [_1comments_scores, _2comments_scores, _3comments_scores, _4comments_scores], 
       [_1transactions_scores, _2transactions_scores, _3transactions_scores, _4transactions_scores] 
      ] 
     }, { 
      low: 0, 
      showArea: true, 
      showPoint: false, 
      fullWidth: true 
     }); 

     chart.on('draw', function(data) { 
      if(data.type === 'line' || data.type === 'area') { 
       data.element.animate({ 
        d: { 
         begin: 2000 * data.index, 
         dur: 2000, 
         from: data.path.clone().scale(1, 0).translate(0, data.chartRect.height()).stringify(), 
         to: data.path.clone().stringify(), 
         easing: Chartist.Svg.Easing.easeOutQuint 
        } 
       }); 
      } 
     }); 

enter image description here

https://gionkunz.github.io/chartist-js/examples.html

回答

1

已解決:

我剛剛刪除了這個選項:

low: 0