2017-07-26 78 views
0

enter image description here 請告訴我如何在圖表上更新日期?在X軸上的ID希望以格式「m-d」顯示日期。ExtJS 6如何在圖表上更新日期

請告訴我請熱,讓它。 不幸的是我的圖表在附件中顯示的日期類似「Y-m-d h-i-s」。

axes: [{ 
         type: 'numeric', 
         position: 'left', 
         grid: true 
        }, 
        { 
         type: 'time', 
         position: 'bottom', 
         visibleRange: [0, 1], 
        } 

       ], 

       series: [{ 
        type: 'line', 
        highlight: true, 
        xField: 'date', 
        yField: ['count'], 
        title: ['Настройка из ЛК штук'], 
         // Отображение подсказки при наводке на график 
        tooltip: { 
         trackMouse: true, 
         renderer: function(tip, item) { 
          // Определяем день и месяц для их корректного отображения в tip 
          var date = new Date(item.get('date')); 
          var day = date.getDate(); 
          // Прибавляем к месяцу 1 , т.к getMonth почемуто возвращает на месяц меньше 
          var month = date.getMonth() + 1; 
          tip.setTitle('Количество: ' + item.get('count') + ' шт.'); 
          tip.update('Дата: ' + day + "." + month); 
         } 
        } 
       }] 

回答

0

應設置dateFormat軸配置爲 「Y-M-d H-I-S」。

+0

Thx。我添加此和其確定'軸:[{ 類型: '數字', 位置: '左', 格:真 },{ 類型 : '時間', DATEFORMAT: 'D.M', 位置:'bottom', visibleRange:[0,1], } ] – Masquitos