question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Candlestick chart: How to remove gaps if there are no data (OHLC) on some date-time intervals

See original GitHub issue

Before submitting this issue, I have already read the docs about this problem but had no luck to find the option that let me remove gaps if some date-time intervals are missing.

Is your feature request related to a problem? Please describe. When I plot stock price data, there are gaps in some DateTime intervals because stock price data is only available on the days that the market opens. There will be no candlestick data in the days market closes.

For example, if I plot stock prices in a range of the last 7 days, and the date-time interval is 1 day. I would have gaps on Saturday and Sunday because these are the days market closes.

Describe the solution you’d like Allow us to remove or skip date-time intervals that there are no OHLC data. Something similar to spanGaps in Chart.js

Additional context This is what the library does for me to render stock prices with a range of 7 days and 1-day intervals (no data on Sat. and Sun.) See on Codepen here: https://codepen.io/aptarmy/pen/VwYyoyj Apexcharts result

This is the result I would like to have (skip those with no data) Expected result

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
CreativeWarlockcommented, Sep 28, 2021

What setting precisely makes the candlestick chart not render gaps? I still see gaps from the 2 days on each weekend on my chart and I have taken the exact option parameters as given by your example here: https://apexcharts.com/javascript-chart-demos/candlestick-charts/category-x-axis/

Anyone else having the same issues or am I just missing out something that is very very obvious to everyone else? 😄

EDIT: I noticed when adding a debugger in the formatter function, val is shown as undefined. I was trying to figure out why the x-axis also renders the dates in a very close timespan (like the days around present) - whereas the data I use reaches back to a year. I used timestamps with both a multiple of 1000 and without, both leading to the same erroneous x-axis.

xaxis: { type: 'category', labels: { formatter: function(val) { debugger; // shows val is undefined in brower dev console return dayjs(val).format('MMM DD HH:mm') } } },

1reaction
junedchhipacommented, Jan 14, 2020

I have enabled zooming on category x-axis since v3.15.0 which will help to solve the issue of gaps.

Live example - https://apexcharts.com/javascript-chart-demos/candlestick-charts/category-x-axis/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Plotly How to remove datetime gaps in candle stick ...
You can achieve this by rangebreaks in plotly. Below is the code to hide outside trading hours and weekends. fig = go.Figure(data=[go.
Read more >
Candlestick plot: how to remove non-trading periods? - hvPlot
Sometimes charting software has a setting to show intraday periods where the market was open, but no trading happened.
Read more >
Python Trading Toolbox: introducing OHLC charts with ...
There are some visible horizontal gaps in the chart: they are generated by non-trading days (weekends and public holidays). Removing them ...
Read more >
Candlestick Charts - Google Developers
Overview. An interactive candlestick chart. A candlestick chart is used to show an opening and closing value overlaid on top of a total...
Read more >
Showing Date-Time values on a Chart Axis - CanvasJS.com
If date time values are stored in UTC format (on the server), it can be ... Hello, i am using line graph with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found