在Highcharts php中x轴显示不正确

时间:2016-02-23 16:34:16

标签: javascript php highcharts

我有以下代码:

  <script>
    $.getJSON('https://www.quandl.com/api/v3/datasets/ECB/RTD_M_S0_N_C_EUR1Y_E.json?start_date=2003-01-01', function(json) {
      var hiJson = json.dataset.data.map(function(d) {
        return [new Date(d[0]), d[1]]
      });
//		var hiJson = json.dataset.data.map(function(d) { 
//		  return { x: new Date(d[0]), y: d[1] }; 
//	    });
        // Create the chart
        $('#Euribor').highcharts('chart', {
	      xAxis: {
	        type: 'datetime',
			dateTimeLabelFormats: {
			                  day: '%Y'
			              }  
	      },			
		  rangeSelector: {
			  selected: 1
          },
          title: {
            text: 'Euribor Interest Rates',
          },
          series: [{
			type: 'line',
            name: 'Interest Rate',
            data: hiJson,
          }]
        });
    });
  </script>

这会打印出Highcharts图表,但x轴不正确。它应该是几年,但它看起来更像是时间格式。

非常感谢您的帮助!

[R

0 个答案:

没有答案