Hey Karun,

2009/8/26 Karun Gahlawat <[email protected]>:
> Newbie..want to know if it is possible to draw candlestick charts
> using witty? I can't find an available widget but would love to create
> one if possible. I believe it will be very helpful in quant-finance
> apps.

I am not familiar with candlesticks, but they are very similar to box
whisker plot (correct me if I'm wrong), and I would prefer to use the
nomenclature of box whiskers plot to plot range and quantile
information for a data point. The way I understand it you can provide
your candle stick information in terms of box whisker information so
that it is plotted all the same ?

That being said, it is not supported actually.

But, it would be fairly straight forward to add this feature to data
series in a cartesian chart, so if you feel like having a stab at it,
here is what I believe the way to extend the current functionality to
include this:

1) Declare additional user data types, which are used to hold this data.

Preferably in the WDataSeries header file, inside Wt::Chart namespace:

e.g.:

int Quantile0Role = UserRole;
int Quantile25Role = UserRole + 1;
int Quantile75Role = UserRole + 2;
int Quantile100Role = UserRole + 3;

2) Add a boolean option to WDataSeries indicating that you want to
draw box whiskers.

This is used to decide when to read those quantile values (which might
be computed on the fly by a some proxy model from the underlying
series data).

3) Abstract the data point, which is currently a simple double (the
actual value) to also hold those quantile information. This is the
most difficult change.

The abstract SeriesIterator class should change the signature of:

  void newValue(const WDataSeries& series, double x, double y, double stackY)

to

  void newValue(const WDataSeries& series, double x, const DataPoint&
y, double stackY)

with DataPoint a class/struct with corresponding data fields and a
constructor based on the model:

struct DataPoint {
  double value;
  bouble quantile0, quantile25, quantile75, quantile100;

  DataPoint(const WModelIndex& index);
};

All current SeriesIterators will then obviously need to be adapted to
use the value in this struct.

4) Implement a SeriesIterator that does the actual drawing, and add it
to WChardt2DRenderer::renderSeries()

I am certainly interested in helping out or finishing an initial
implementation and integrate it into the library !

Regards,
koen

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to