简体   繁体   中英

How to set xAxis only with time in Highstock step graph

Is there any possibility to set the xAxis of the Highstock graph to display only the time?

Here it shows both date and time and I need to display only time:

高库存图形图像

Thanks in advance.

$(function () {

    // Create the chart
    Highcharts.stockChart('container1', {
        chart: {
        width: 500,
        height: 300
        },
        title: {
            text: 'AAPL Stock Price'
        },
         xAxis: {
        tickInterval: 1
    },
        rangeSelector: {
            selected: 4,
            inputEnabled: false,
            buttonTheme: {
                visibility: 'hidden'
            },
            labelStyle: {
                visibility: 'hidden'
            }
        },
        navigator: {
            enabled: false
        },
        scrollbar: {
            enabled: false
        },
        series: [{
            name: 'AAPL Stock Price',
            data: [45,90,90,45,50,90,39,50,90,39],
            step: true,
            tooltip: {
                valueDecimals: 2
            }
        }]
    });

});

$(function () {
        Highcharts.stockChart('container', {
            chart: {
            width: 500,
            height: 300
            },
            title: {
                text: 'AAPL Stock Price'
            },
             xAxis: {
                type: 'datetime',  
                tickInterval : 1,
                dateTimeLabelFormats : {
                    day: '%M min'
                }
            },
            rangeSelector: {
                selected: 0,
                inputEnabled: false,
                buttonTheme: {
                    visibility: 'hidden'
                },
                labelStyle: {
                    visibility: 'hidden'
                }
            },
            navigator: {
                enabled: false
            },
            scrollbar: {
                enabled: false
            },
            series: [{
                name: 'AAPL Stock Price',
                data: [45,90,90,45,50,90,39,50,90,39],
                pointStart: Date.UTC(2010, 0, 1),
                pointInterval: 3600 * 1000 , 
                step: true,
                tooltip: {
                    valueDecimals: 2
                }
            }]
        });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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