QCustomPlot Discussion and Comments

QCPFinancial - Hiding weekend data?Return to overview

Hello Emanuel,

First of all, thanks for sharing such a magnificent and mature library. The financial plot brought my special attention to it. In principle everything is fine with it, except one problem:
The test data that you use is unrealistic in the sense that they go through the whole week, including the weekend, while in reality during the weekends the markets are closed and no data is being fed. Feeding “dead” data on the other hand would confuse technical indicators, because they average price over time, and could not provide realistic readouts anymore. The real data generates the following gaps during weekends:
Getting more into detail, daily bars are not the only granularity available, because it may go even down to 1 minute. Plotting this on the Financial plot would create wide gaps in data because of weekends.

So the question is: would there be a chance of hiding the weekend data somehow? I recognize that the library is mainly a scientific library, where the X axis is always continuous, and solving my problem would require the axis' manipulation. Is this really possible at all?


Hey Enjo,

your problem can be solved by

1/ setting the data in QCPFinancial such that you specify 'false' keys - you pretent the chart is continuous.
2/ provide manually created tickVectroLabels that reflect the real timestamp of the bar's close.


Hi Eubie,

Thanks for your reply. I already set the data for the trading days only (no weekend data). Using setTickVector and setTickVectorLabels didn't help either. These methods seem to only control the display of the ticks. They don't control the axis itself.
When I find some time, I will paste some minimalistic example code to experiment.

Thanks anyway,

Ah, I think I understand you now, Mate! You just put next week's data (Monday, Tueseday) into the just starting weekend (-> Sat, Sun), and then adapt the labels. Is this correct?


exactly. The price series is presented "as-is", i.e. if there is no price action on weekend, there is no data to be plotted. Just the timestamps on the x-axis need to show the real timestamps of bar closes.


It would be really great if there is a generic solution to this problem,
maybe as part of future release (?).

shuke: I totally agree. This would be a major plus for this library.

I'm sorry for my English, I'm from Russia :) Who decided voiced Enjo problem?

Is there any solution for this in QCP 2.0 ?

So how im trying to solve this, is instead of using actual time for key, i just set 0,1,2,3.. for each bar, i also added time to qcpfinancialdatacontainer, i created custom QCPAxisTickerChart, i override createTickVector and createLabelVector, now i would be great if i could access to my bars data from QCPAxisTickerChart class, is this possible ?
That way i could create correct time string, using index of my bars.

Just asking for the same feature: I need to show a set of data logged in the past that can have gaps (because the sensor was not powered). So I'd need to have a x axis with discontinuous values. Reimplement some methods it's a big work for me so I add one sign under this request of new feature!

I've been working for a similar problem, I try to show discontinuous time series data plot in a continuous way that cuts those time values corresponding to no data off from the xAsix... but, I finally realize it seems not working if I use UnixTime as the key of QCPFinancial instance... I figure out a way to solve this, similar with what Robert has memtioned.. use a index instead of actual time as the key.. but I comes with a lot more coding when I try to build a real time data update plot ... please add new features for QCP 2.0!

The issue is steel actual. Anyone solved it?