Highcharts: Displaying Linechart with missing datapoints

本小妞迷上赌 提交于 2019-12-12 09:19:09

问题


I am calculating the average-value of properties for each week of the year. And I want to display these information in a line chart (x-Axis is the week of year, y-Axis the average value and the different lines represent different properties).

But for any given property I do not necessarily have a datapoint for each week of the year. If I do not have such a datapoint I want my line for this property to interpolate between the datapoints I have.

Anyone else run into a similiar issue?


回答1:


Highcharts does not really do interpolation. Sure, if your series has a missing point it will draw the line between the adjacent two...but it is not a calculated "value" that you would want to publish. It is just the shortest distance between those two adjacent points. I would pre-process your data to fill in the missing points and then label these points as calculated with either a Note: value or maybe a color: value. Example where the second value is coming from your pre-processing:

data: [{ y: 7.0},
        {y: 6.9,
         Note: 'calculated',
         color: '#BF0B23'},
        {y: 9.5}]


来源:https://stackoverflow.com/questions/13029368/highcharts-displaying-linechart-with-missing-datapoints

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