문제

I've created the following dygraphs chart for stock data:

enter image description here

As you would expect, there is no market data present for weekend days (note that quotes are in UTC time). Dygraphs, however, insists on showing these days in the chart, which results in a [undesirable] straight line.

Is there any way to not show days that have no data in a dygraphs chart?

도움이 되었습니까?

해결책

Drawing a discontinuous x-axis for financial charts is a difficult problem. dygraphs only supports continuous axes, so your only option is to make your axis continuous. Instead of having dates as your x-values, you'll need to have something continuous like "minutes that the market has been open since January 1". This will give you the plot that you want, but it will also give meaningless x-axis ticks and values in the legend when you hover. You'll have to write a custom x-axis ticker and valueFormatter (see dygraphs.com/options.html) to undo the mapping.

Does this sound like a lot of work? It is! That's one of the reasons dygraphs doesn't support it out of the box. If you do get something to work, please share it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top