我如何使用JS对字形中降序的日期进行排序?

时间:2019-05-13 09:27:48

标签: javascript dygraphs

我想使用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,

});

0 个答案:

没有答案