0

enter image description here Tell me please how to redner date on chart?On x axis id like to show date in format "m-d".

Tell me please hot to make it. Unfortunately my graph shows date like "Y-m-d h-i-s" in attachment.

 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);
                        }
                    }
                }]
Matthew Verstraete
  • 6,335
  • 22
  • 67
  • 123
Masquitos
  • 554
  • 4
  • 22

1 Answers1

0

You should set the dateFormat axis config to "Y-m-d h-i-s".

scebotari66
  • 3,395
  • 2
  • 27
  • 34
  • Thx. i add this and its ok `axes: [{ type: 'numeric', position: 'left', grid: true }, { type: 'time', dateFormat: 'd.m', position: 'bottom', visibleRange: [0, 1], } ]` – Masquitos Jul 26 '17 at 12:50