I have an array of Candle objects as shown below:
Is there a way in Pharo to display the array in a tabular format?
| date | open | high | low | close |
|------------+------+------+-----+-------|
| 2018-12-28 | 10 | 20 | 30 | 40 |
| 2019-12-28 | 50 | 60 | 70 | 80 |
gtoolkit
The gtoolkit tour has a slide that seems to mention this:
However, it seems that I'd have to define a special collection for holding Candle objects and then define a gtViewCandlesOn method on it to customize how the candles will be rendered.
Just wondering if there's an approach that will work with normal arrays or if the gtoolkit approach is the way to go.


It depends on context of use. You can use GToolkit, if you use it on other activities as well. GToolkit is whole framework and probably it is quite overkill to use it just for this tabular view.
Anyway, I did something similar for Pharo launcher command line interface - calling it
ConsoleListFormatter. It is pretty straightforward to use, you need to define 2 methods on your candle class (#listPrintAttributeBlocks:#listPrintAttributeLabels:) and set collection of Candles to formatter instance. Calling printList will do the job.You can use it here ConsoleListFormatter class
Furthermore, if you want to print as collection in the inspector, you would need to override original implementation of
#printOn:(orgtViewCandlesOn:in case of use GToolkit inspector) method on Collection class. Rather I would define model class, e.g.CandleListthat would use instance var with collection of candles, then you can define your own#printOn:onCandleListwithout interfering original collection implementation.Let me know, if you need more details!
Cheers, David