简体   繁体   English

高库存显示没有数据的日期

[英]Highstock showing dates where there's no Data

I'm using Highstock, but not as it should be used, i'm more using it as a highcharts plus the navigator functionality 我使用的是Highstock,但不是应该使用的那样,我更多地将其用作Highcharts和导航器功能

http://jsfiddle.net/ygyx5r9r/ http://jsfiddle.net/ygyx5r9r/

 $(function () {
        $('#container').highcharts('StockChart',{
            chart: {
                type: 'column'
            },
            title: {
                text: 'Monthly Average Rainfall'
            },
            subtitle: {
                text: 'Source: WorldClimate.com'
            },
            xAxis: {
                'type': 'datetime',
                        'title': {
                            'text': 'Time'
                        }
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Rainfall (mm)'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                    '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: 'Tokyo',
                data: [[Date.UTC(2013,5,2),0.7695],
    [Date.UTC(2013,5,3),0.7648],
    [Date.UTC(2013,5,4),0.7645],
    [Date.UTC(2013,5,5),0.7638],
    [Date.UTC(2013,5,6),0.7549],
    [Date.UTC(2013,5,7),0.7562],
    [Date.UTC(2013,5,9),0.7574],
    [Date.UTC(2013,5,10),0.7543],
    [Date.UTC(2013,5,11),0.7510],
    [Date.UTC(2013,5,12),0.7498],
    [Date.UTC(2013,5,13),0.7477],
    [Date.UTC(2013,5,14),0.7492]]

            }, ]
        });
    });

And as exposed in my jsfiddle you can see that theres no data between the 6 and 9 Jun, and that's not shown in my highstock chart are they anyway to keep the dates where theres no data as highcharts does ? 就像我在jsfiddle中所看到的那样,您可以看到6月6日至9月9日之间没有数据,并且在highstock图表中没有显示,它们是否仍然像highcharts一样保留没有数据的日期? i'm using it for diagnostic but i like the navigator i find it very convenient . 我正在用它进行诊断,但是我喜欢导航器,觉得很方便。

Any help would be great . 任何帮助都会很棒。

Highstock's xAxis is by default ordinal - this means that empty spaces will not be shown. Highstock的xAxis默认情况下为ordinal -这意味着将不显示空格。 To fix your problem you could set ordinal to false for xAxis . 要解决您的问题,您可以将xAxis ordinal设置为false

...
xAxis: {
  ordinal: false,
...

Example: http://jsfiddle.net/mxtv0ztc/ 示例: http//jsfiddle.net/mxtv0ztc/

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

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