Tony Lewis
2013-04-15 14:43:43 UTC
Hi, I'm new to Chaco, and new-ish to Python. Apologies in advance for
dumb questions.
I am trying to plot a OHLC finance chart, but also have overlay plots
(e.g. for now, a moving average). I also want to add another plot
below, (e.g. for MACD). All pretty standard trading stuff for now.
I can get the OHLC chart OK, and overlay a moving average, but am
struggling to add the second window, and I think it's because I'm trying
to add the second plot after the _plot_default() gets called
All the VPlotContainer example code seems to assume you know all the
plots you want to do beforehand, and have put them all in the function
that gets called by _plot_default(). But that seems a bit restrictive.
In the long run I want to be able to add and remove plots dynamically,
and have both the plot update, and the underlying data.
So my specific question is: what am I doing wrong, and my general
question is: can Chaco do this kind of dynamic adding and removing of
plots from (say) a VPlotContainer? If so, how do I make that happen.
Here's some trimmed code, derived from your example candle.py. I hope
pastebin is OK.
http://pastebin.com/ytxQfKy1 : CandleChartTest.py - the main code that
creates the instance of CandleChart
http://pastebin.com/qua5Ur1w : CandleChart.py - the class of the plot
Thanks,
Tony
dumb questions.
I am trying to plot a OHLC finance chart, but also have overlay plots
(e.g. for now, a moving average). I also want to add another plot
below, (e.g. for MACD). All pretty standard trading stuff for now.
I can get the OHLC chart OK, and overlay a moving average, but am
struggling to add the second window, and I think it's because I'm trying
to add the second plot after the _plot_default() gets called
All the VPlotContainer example code seems to assume you know all the
plots you want to do beforehand, and have put them all in the function
that gets called by _plot_default(). But that seems a bit restrictive.
In the long run I want to be able to add and remove plots dynamically,
and have both the plot update, and the underlying data.
So my specific question is: what am I doing wrong, and my general
question is: can Chaco do this kind of dynamic adding and removing of
plots from (say) a VPlotContainer? If so, how do I make that happen.
Here's some trimmed code, derived from your example candle.py. I hope
pastebin is OK.
http://pastebin.com/ytxQfKy1 : CandleChartTest.py - the main code that
creates the instance of CandleChart
http://pastebin.com/qua5Ur1w : CandleChart.py - the class of the plot
Thanks,
Tony