Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1725
Trying to understand Chart legends, legend bound values and legend item placement
posted
I tried getting at this in another post (http://news.infragistics.com/forums/t/15252.aspx) but it looks like not many people are using charts features and/or IG does not review and respond to items in this forum very often.

In any case, I’m still trying to figure out how to customize the chart legend. The first issue I’m facing is trying to understand something that should be simple like the layer outer and inner bounds rectangle values.

The code I currently have in the FillSceneGraph event handler is something like the following

Infragistics.UltraChart.Core.Layers.LegendLayer legendLayer = e.ChartCore.GetLegendLayer();

 if (null != legendLayer)

 {

     Rectangle outer = legendLayer.GetOuterBounds();

     Rectangle inner = legendLayer.GetInnerBounds();

    ….. do something useful with the information.

}

This would seem to be straight forward and easy. My issue is that when I look at the results of the above I find the following

+        legendLayer.GetOuterBounds()    {X = 7 Y = 220 Width = 1217 Height = 53}    System.Drawing.Rectangle
+        legendLayer.GetInnerBounds()    {X = 7 Y = 7 Width = 1217 Height = 213}    System.Drawing.Rectangle

This leaves me with a couple of questions

1)  Are the X/Y values in the InnerBounds relative to the Outerbounds or relative to something else. If relative to the outer bounds, that would mean that the Inner bounds start at offset X=14 and Y = 227 from something.  If relative to something else, that would mean that the InnerBounds area is outside the OuterBounds area. Is that correct?

2) The height of the InnerBounds is significantly larger than the height of the outrebounds rectangle. Is this correct?

3)  If 2 is correct, are items drawn within legend clipped if positioned below the outerbounds height?

4) If I look at the primitives drawn within the Legend, I’m equally confused by the offset values there. For example, if I get one of the legend box primitives, I find the following

    +        box.rect    {X = 16 Y = 228 Width = 24 Height = 24}    System.Drawing.Rectangle

    So, how do I interpret these X/Y values?  They are relative to what?

 

What I’m trying to accomplish here are 2 things

1st I want to draw a smaller legend box (10x10 vs 24x24). Then, adjust the associated legend text to reduce the wasted space  by moving the text left for each legend element

And

2nd Make sure that all legend elements are displayed. In order to do this I need to be able to make the adjustments described in the first item, then calculate the width of each Legend element (box + text) and if the element extends past the legend width, then grow the legend height and draw elements on a new “row”.

This would seem to be something that I should be able to do here but need to understand what these numbers are telling me.

I hope someone can provide some feedback on this item.

Parents
No Data
Reply Children