Plotly Format Axis Date

Viewed 220

In the following code, if I choose scatter3d instead of scatter, all parameter tickformat and title inside xaxis are completely ignored, and it is impossible to format anything under any axis.

Any suggetion would be appreciated.

Failing 3D Plot with outrageous date format

enter image description here

Working Plot with proper HH:MM:SS Format

enter image description here

function setup_plot(){
    type='scatter';
    var x=[],x0=new Date();
    for (i=0;i<5;i++){
        x[i]=new Date();
        x[i].setTime(x0.getTime()+i*12*3600000);
    }
    var trace = [
        {
            type: type,
            mode: 'lines',
            x: x,
            y: [1.0,1.0,1.0,1.0,1.0],
            z: [2.6,1.2,6.3,4.8,4.7]
        },
        {
            type: type,
            mode: 'lines',
            x: x,
            y: [2.0,2.0,2.0,2.0,.0],
            z: [3.1,2.6,4.8,3.8,1.7]
        }
    ];
    var layout = {
        title: "Failing Plot",
        xaxis:{
            title:'Dates',
            tickformat: '%H:%M:%S',
            tickformatstops: [
                {
                dtickrange: [1000,60000],
                value: '%H:%M:%S'
                },
                {
                dtickrange: [60000,3600000],
                value: '%H:%M:%S'
                },
                {
                dtickrange: [3600000,86400000],
                value: '%H:%M:%S'
                },
                {
                dtickrange: [86400000,604800000],
                value: '%d'
                }
            ]
        }
    };
    Plotly.newPlot('plot',trace,layout);

}
1 Answers
Related