Box and Whisker Chart (candlestick extension)

Answered (Verified) This post has 1 verified answer | 5 Replies | 3 Followers Thread's RSS feed.

RodBillett
Points 1,886
Replied On: Thu, Oct 18 2012 8:53 AM Reply

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:

  • The ends of the candlestick wick are terminated with a ‘T’ line
  • Median is displayed as a crossing line inside of the candlestick body
  • Mean is displayed as a Marker on the candlestick Wick.

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

 

  • Post Points: 20

Verified Answer

Rob
Points 34,280
Infragistics Employee
Answered (Verified) Replied On: Tue, Oct 23 2012 11:11 AM Reply
Verified by RodBillett

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.
        }
    }
}
 
 

Sincerely,
Rob
Software Developer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 40

All Replies

Rob
Points 34,280
Infragistics Employee
Replied On: Thu, Oct 18 2012 4:56 PM Reply

Hi Rod,

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?

Sincerely,
Rob
Software Developer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 20
RodBillett
Points 1,886
Replied On: Thu, Oct 18 2012 5:43 PM Reply

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.

  • Post Points: 20
Rob
Points 34,280
Infragistics Employee
Answered (Verified) Replied On: Tue, Oct 23 2012 11:11 AM Reply
Verified by RodBillett

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.
        }
    }
}
 
 

Sincerely,
Rob
Software Developer
Infragistics, Inc.
www.infragistics.com/support

  • Post Points: 40
RodBillett
Points 1,886
Replied On: Tue, Oct 23 2012 11:19 AM Reply

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

  • Post Points: 20
Walter Williams
Points 955
Replied On: Wed, Apr 1 2015 1:22 PM Reply

Rod,

We are wanting to do box and whisker plots.  Would you be willing to share your solution?

  • Post Points: 5
Page 1 of 1 (6 items) | RSS