简体   繁体   中英

Highstocks: “columnrange” columns are always evenly spaced. How do I make highstocks show any gaps in the data?

I have a columnrange chart with one column per day. There's not necessarily data on every day, so it's a bit spread out.

When this is drawn, each column is always spread out exactly evenly, no matter which gaps exists in the data.

Example: I have 3 columns, on 2019-01-01, 2019-01-03 and 2019-01-28. In this case, it will show all columns with the same spacing between them. This makes it hard to see that the last value is really 25 days after the second.

How do I make them spaced according to their x values? I've tried messing with plotInterval/plotRange to no avail.

See fiddle: http://jsfiddle.net/ywg237bd/1/

You need to disable the ordinal option, which is enabled by default in Highstock:

xAxis: {
    ...,
    ordinal: false,
},

Live demo: http://jsfiddle.net/BlackLabel/n59argLf/

API Reference: https://api.highcharts.com/highstock/xAxis.ordinal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM