Display the Plotted value on x axis using highcharts

依然范特西╮ 提交于 2019-12-13 03:58:31

问题


How to display the plotted value correctly to the exact milliseconds on the chart? How place a point or tooltip to exact milliseconds?

 xAxis: {
        type: 'datetime',
        plotLines: [{
            color: '#FF0000',
            width: 2,
            value: 1366113390066
        }]

    }

JSFiddle Link


回答1:


Your series is not showing because your data array is not in a usable format.

this:

data: [{
                'value': 731,
                    'timestamp': 1366032438641
            }

should be either this:

data: [{
  'x': 1366032438641,
  'y': 731
}

or, more simply, this:

data: [[1366032438641,731]]

reference: http://api.highcharts.com/highcharts#series.data

You'll have to clarify what you mean about the other part of your question.

EDIT:{

If you want actual millisecond precision, you will have to have enough width in your chart to specify a pixel per millisecond. This is not going to happen in any real chart obviously.

There's no way to draw a 2 pixel wide line in a ~600 pixel wide chart displaying 20+ hours and have it be precise to a millisecond.

That's about 72 million milliseconds in 600 pixels, which works out to 0.0000083 pixels per millisecond... (or 120,000 milliseconds per pixel)

:)



来源:https://stackoverflow.com/questions/16036908/display-the-plotted-value-on-x-axis-using-highcharts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!