I have a standard financial timeseries of data which has gaps for when the market is closed.
The problem is Chaco displays these gaps, I could use a formatter in matplotlib as follows and apply to the x-axis to get around this but I am unsure what I should do about this in Chaco.
In matplotlib:
class MyFormatter(Formatter):
def __init__(self, dates, fmt='%Y-%m-%d %H:%M'):
self.dates = dates
self.fmt = fmt
def __call__(self, x, pos=0):
'Return the label for time x at position pos'
ind = int(round(x))
if ind>=len(self.dates) or ind<0: return ''
return self.dates[ind].strftime(self.fmt)
What would be the efficient way to implement this in Chaco? Thanks
pass the parameters like this
from enthought.chaco.scales.formatters import TimeFormatter
TimeFormatter._formats['days'] = ('%d/%m', '%d%a',)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With