Как я могу сортировать даты по убыванию с помощью JS? - PullRequest
0 голосов
/ 13 мая 2019

Я хочу отсортировать даты по убыванию с помощью библиотеки dygraphs, при передаче объекта данных с нисходящими датами или временем метки x на оси x не отображаются

var ReadingsValue = [
  [{
    Sun Apr 07 2019 21: 09: 10 GMT + 0200(Eastern European Standard Time)
  }, 1, 2, 1],  
  [{
    Mon Apr 01 2019 09: 52: 17 GMT + 0200(Eastern European Standard Time)
  }, 5, 5, 8]  
];




var g = new Dygraph(document.getElementById(ContainerDivId), ReadingsValue, {
  drawPoints: true,

  showRoller: true,

  valueRange: [, defaultMax],

  labels: headers,

  drawGrid: DrawFlag,

  gridLineColor: GridColor,

  axisLabelColor: AxisColor,

  showRangeSelector: showRangeSelector,

  highlightSeriesOpts: highlightSeriesOptsValues,

  // legend: 'follow',

  ylabel: ylabel,

  xlabel: xlabel,

  strokeWidth: strokeWidth,

  yLabelWidth: 30,

  xLabelWidth: 100,

  animatedZooms: true,

  fillAlpha: fillAlpha,

  // yAxisLabelWidth: 50,

  axisLabelFontSize: parseInt(axisLabelFontSize),

  //  colors: GlobalColorsArr,

  legend: legendBehav,

  xAxisHeight: 100,


  axisLabelWidth: parseInt(axisLabelWidth),

  rangeSelectorHeight: rangeSelectorHeight,
  axes: {

    x: {

      pixelsPerLabel: XpixelsPerLabel,

    },

    y: {

      pixelsPerLabel: YpixelsPerLabel,

    }
  },

  rangeSelectorPlotStrokeColor: axisColorVal,

  rangeSelectorPlotFillColor: rangeSelectorPlotFillColor,

  showInRangeSelector: true,

  xRangePad: 1,

  stackedGraph: true,

  axisTickSize: 15,

  colors: GlobalColorsArr,

  legend: legendBehav,


  drawAxesAtZero: true,

  includeZero: true,

  pointSize: PointSize,

  title: ChartHeader,

});
...