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.
yes, the legend icons are Box primitives just like the columns in a column chart, so they can be changed using the same technique.
Can I change the color of the content of the legend? Because, firstly I use ChartDrawItemEventHandler to change the color of the column chart, but after that I found the color of the legend didn't change according to the color of the column chart.
Thanks,
Michael
you are correct - it is not possible to create a composite chart with a 3D chart layer.
if you need an immediate response in the future, please contact Infragistics Developer Support at http://infragistics.com/gethelp - these forums are an unofficial support channel and thus a timely response is not guaranteed. on the data visualization forums, we are committed to a 1-2 week response.
1: the inner and outer bounds are both relative to the chart control. it would appear that in your test case, the inner boundsare outside the outer bounds, which seems odd, but this doesn't necessarily impact the chart rendering. not all layers use these bounds as their clip bounds.
2: it seems wrong, but i wouldn't consider it a bug if the chart is rendering OK. i can't recall offhand, but likely those rectangles are storing bounds that are somehow relevant to the chart rendering.
3: i believe the outer bounds are used for the legend's clip bounds, but couldn't tell you for sure without examining the source code (and knowing your chart settings, as not all legend layers use the same code).
4: these X/Y values should be relative to the chart control.
for your task, i recommend just hiding the legend and drawing a custom one from scratch - by the time your custom layer is called, it might be too late to restore some of the legend items if they have been clipped (i.e. if the "More..." indicator is shown).
One other thing here. While my "test case" is a 2d column chart, I also have the same requirement and I'm trying to solve the same type of problem with 3d charts. I present the user with a chart galary that they can use to select a graph style. As I understand it, composite charts are not supported for 3d charts even if all I am using that chart type for is to be able to get to the ability to set the legend the way I want.
Is that correct?