Hi,
Is it possible to change spacing between two labels rows inside a legend of an ultrachart. I wanted to increase the vertical spacing between two label rows inside the legendn as its inadequate and the two labels rows are nearly getting merged.
Thanks in advance
Hi maheshpanse,
You can handle ChartDrawItem event and to change position, width and height of any primitive drawn on the chart. You need Text and Box primitives in the case with Legend labels. Here's a sample how to change these parameters. Note that Box's Column property can contain -1 that describes external box of the legend.
private void ultraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e) { int newBoxHeight = 25; // try if it is a Box primitive which belongs to legend and it is not the external legend's box Box box = e.Primitive as Box; if (box != null && !string.IsNullOrEmpty(box.Path) && box.Path.EndsWith("Legend") != false && box.Column != -1) { box.rect.Height = newBoxHeight; if (box.Column != 0) { box.rect.Y = box.rect.Y + newBoxHeight * box.Column; } } Text text = e.Primitive as Text; // try if it is a Text primitive which belongs to legend and it is not the external legend's text if (text != null && !string.IsNullOrEmpty(text.Path) && text.Path.EndsWith("Legend") != false && text.Column != -1) { text.bounds.Y += 8; // increase according to newBoxHeight in order to center the text if (text.Column != 0) { text.bounds.Y = text.bounds.Y + newBoxHeight * text.Column; } } }
Please add screen shot of the problem legend in the case this sample will not help you.
Hi Anton,
Thanks for your reply.
With the product version currently with me I am not able to find the ChartDrawItemEventArgs. I have 3.0.2 V3 release with me and need to stick with the same for some reason.
Is there any way out of this.
Thanks