简体   繁体   English

Highcharts折线图未显示所有日期

[英]Highcharts line charts not displaying all the dates

I have a line chart that displays the data from a Google Spreadsheet, the datetime data is being updated every 3 to 4 seconds and I want the chart to only display some of it, like the hour for example. 我有一个折线图,它显示一个Google Spreadsheet中的数据,日期时间数据每3到4秒更新一次,我希望该图表仅显示其中的一部分,例如小时。 I can't use any of the highstocks funcionalities because it doesn't support the Google Spreadsheet service, at least that I know and feeding the CSV or JSON to highchart doesnt update automatically. 我无法使用任何高库存功能,因为它不支持Google Spreadsheet服务,至少我知道,并且将CSV或JSON馈入highchart不会自动更新。 Again, as far as I know. 再一次,据我所知。

So I'm stuck with Highcharts line chart, but I dont want the X axis to look so crowded. 因此,我坚持使用Highcharts折线图,但我不希望X轴看起来如此拥挤。 Take a look at the fiddle. 看看小提琴。 http://jsfiddle.net/AYYCv/167/light/ And there's only little data. http://jsfiddle.net/AYYCv/167/light/数据很少。

Highcharts.setOptions({
chart: {
    zoomType: 'x'
},
plotOptions: {
    series: {
        visible: false,
    }

},
    legend: {
    enabled: true,
    align: 'right',
    backgroundColor: '#FFFFFF',
    borderColor: 'white',
    borderWidth: 2,
    layout: 'vertical',
    verticalAlign: 'top',
    y: 100,
},
title: {
    text: 'Produccion de Energía Solar'
},
xAxis: {
    type: 'datetime'
},
yAxis: {
    title: {
        text: 'Magnitud'
    }
}

});
$('#container4').highcharts({
data: {
    googleSpreadsheetKey: '0Aj8kPfvDA7mOdHpVMDVFbktmM0E4YjFIUkVUVC1RYlE'
},
plotOptions: {
    series: {
        visible: false
    }
}
 function(chart) {
chart.series[0].show();   
});`

您可以增加tickInterval参数

Change the XAxis like this... It will rotate labels to specified degrees 像这样更改XAxis ...它将标签旋转到指定的角度

xAxis: {
    type: 'datetime', labels:{rotation: -40}
  },

Thisl link helps for date formating http://api.highcharts.com/highstock#xAxis.dateTimeLabelFormats 该链接有助于日期格式设置http://api.highcharts.com/highstock#xAxis.dateTimeLabelFormats

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM