Highcharts - 柱状图,包含x轴日期的空列 [英] Highcharts - Column chart with empty columns for date in x-axis

查看:120
本文介绍了Highcharts - 柱状图,包含x轴日期的空列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用 datetime 类型,是否有任何方法可以创建不显示空列的列或折线图?
因为我想在没有周末的情况下显示最近7天,但这似乎不可能。



示例: http://jsfiddle.net/G5S9L/7/



预计:不显示6月17日/ 18日



我尝试的第二件事是使用类别类型。在这种情况下,图表只是呈现系列数据中指定的这些列。但是我的图表由多个系列组成,每个系列都会有一些差距。 Highchart不匹配类别名称并将所有y值放在一起。



例如: http://jsfiddle.net/G5S9L/6/



预计:星期四有2列/栏以及星期一



这些样本非常简单。我知道我可以生成一个包含x轴所有值的主列表,并根据主列表排序每个系列,并用空值填充空位。但是,这为我的统计数据生成繁重的开销。因为并非所有的系列都有相同的来源来确定x轴的范围。

解决方案

使用Highcharts?有没有简单的方法来实现这一点。然而,使用Highstock,只需使用 xAxis.ordinal = true ,并且一切都将起作用。请参阅: http://jsfiddle.net/G5S9L/8/


Is there any way to have a column or line chart which doesn't render empty column if I'm using the datetime type? Because I want to display the last 7 days without the weekends, but this doesn't seems to be possible.

Example: http://jsfiddle.net/G5S9L/7/

Expected: don't display June 17th/18th

The second thing I tried was to use the category type. In this case the chart is just rendering these columns which are specified in the series data. But my chart consists of multiple series and each series will hava some gaps. Highchart doesn't match the category names and puts all y values after each other.

Exmaple: http://jsfiddle.net/G5S9L/6/

Expected: Thursday has 2 columns/bars as well as Monday

These samples are very simplified. I know I could generate a master list with all values of the x-axis and order each series according to the master list and fill the gaps with NULL values. But this a heavy overhead in generating data for my statistics. Because not all series have the same sources to determine the range of the x-axis.

解决方案

With Highcharts? There's not simple way to achieve that.

However, using Highstock, simply use xAxis.ordinal = true and everything will work. See: http://jsfiddle.net/G5S9L/8/

这篇关于Highcharts - 柱状图,包含x轴日期的空列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆