当前位置: 动力学知识库 > 问答 > 编程问答 >

Highcharts: show multiple days data on same chart making them overlpa each other to comparison

问题描述:

I have a set of N values for each day logged from a webserver (N is not always the same each day, but this is not relevant).

I need to show a comparison chart with values from multiple days, eg:

  1. today (16/01/2017)
  2. yeasterday (15/01/2017)
  3. a month ago (15/12/2016)

To do that, I though about something similar to:

  • the 3) as 'area chart'
  • the 2) as 'dotted line chart'
  • the 1) as 'continue line chart'

This is easy, but now I have a problem: if I declare X axis as 'datetime' obviously the 3 chart series are not 'overlapped' because each one represent a different day along datetime axis.

Instead I need them to overlalp, so user can quickly compare values.

Ho can I do that?

Categorized X axis? Multiple X axes

网友答案:

I prefer to handle this with a single datetime axis, using a common pointStart and poiintInterval for all series (set in the plotOptions).

This plots each series on the same date from a technical standpoint, but with some basic formatting accomplishes the goal of viewing each date along the same time axis.

The benefits to this approach over categories and using multiple axes, IMO, are

  • Makes full use of the datetime axis type features

  • Does not require any additional overhead for adding more series - this works just as well with 2 or 20 series

Example fiddles:

  • http://jsfiddle.net/jlbriggs/b3t7ueam/ (two dates)

  • http://jsfiddle.net/jlbriggs/hbfap864/ (many dates)

Example Output:

分享给朋友:
您可能感兴趣的文章:
随机阅读: