I am trying to create a Box and Whisker Chart (an example is in the word document within the ZIP file). This is very similar to a candlestick chart except that:
I have created an prototype (a very bad example) of what we need, but I think I am really headed in the wrong direction. It seems to me extending the functionality of the Candlestick would be a lot easier, but I am not sure what direction to proceede.
Any suggestions/examples of a simpler more direct path?
Thanks
Rod,
We are wanting to do box and whisker plots. Would you be willing to share your solution?
Thanks Rob,
I have done something very similar to what you have suggested. Its just the number of internal methods that are used in the rendering make it kind of difficult in determineing some of the drawing coordinates - But I have managed.
thanks for all the help!
Rod
Hi Rod,
If your data values match up with the already existing ones then extending the FinancialPriceSeries should be possible. You're still going to need to either provide your own rendering logic or use the FinancialPriceSeries rendering and then modify the updated RootCanvas to add in your median and mean values. As long as you call base.RenderSeriesOverride() in your custom series then you will use the FinancialPriceSeries default rendering.
public class MyTestSeries : FinancialPriceSeries { protected override void RenderSeriesOverride(bool animate) { // Use FinancialPriceSeries rendering. base.RenderSeriesOverride(animate); if (RootCanvas != null) { // Add median and mean values to canvas. } } }
Why do I think I am headed the wrong direction:
Basically I felt like I was rewriting a lot of the stuff that was already done for me in the Financial Series. For what we are doing, Open/Close/High/Low handles our Min/Max/Upperquartile/LowerQuartile . All I need to add is the median and mean values (and the little tag lines at the end of the wick). In my render code I have lots of little issues with aligning the Candlestick with the axis when there are only 1-2 values in the series.
I was really hoping it was easier to extend the financial series vs creating my own custom one.
Actually from what I see in your example, your doing this the correct way. You technically could extend the FinancialPriceSeries which contains the candlestick code but you would still need to manually render out the series with your own custom code. If you wanted to use the candlestick render code, you would need to call the candlestick render code and then go into the root canvas and remove/add extra UIElements to adjust the final look which would require a lot of extra work to figure out what you need to remove and where to add things in the canvas.
What I suggest doing instead is downloading and taking a look at the source code for FinancialPriceSeries. In particular, taking a look at the render code in the RenderFrame internal method. This will show you how we render the candlesticks which you can copy and make changes to, to add your visual adjustments. The bottom line is that since the render code is handled internally by each series and since you need to change the way the series looks visually, you would generally just create a new custom series as you have already done. The exception might be if the series you want to extend has properties that you want/need and don't want to rewrite them in a seperate custom series. This would save time in setting up the property changed notifications as well. You'd basically just need to override the RenderSeriesOverride method and supply your custom render code, using the already existing properties. Your properties seem to function differently than the ones used by the candlestick series so I think your approach is the best option here.
May I ask why you think you are headed in the wrong direction?