highchartsscatter

Highchart Scatterplot with x axis only


I am trying to use Highchart to display scatter plot with x axis only. Plea see the attachment. I would like to plot along the x axis. Any directions is highly appreciated. enter image description here


Solution

  • You can use the timeline series type or a basic scatter with constant y values. For example:

    const data = [1656316375158, 1656316385158, 1656316395158];
    
    Highcharts.chart('container', {
        ...,
        series: [{
            type: 'scatter',
            data: data.map(el => [el, 0])
        }],
        xAxis: {
            type: 'datetime'
        },
        yAxis: {
            visible: false
        }
    });
    

    Live demo: http://jsfiddle.net/BlackLabel/0b3pk49v/

    Docs: https://www.highcharts.com/docs/chart-and-series-types/timeline-series