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
Unfortunately, It is not supported in that version. May be it is a good idea that you will migrate to a newer version.
Hi Anton ,
Thanks for your reply,
Moving to newer verion can be a solution to this.
Our software is currently on .Net 1.x version. The latest Infragistcs release for this I can found from the website is 2007-V1.
But I am not able to conclude whether this release can support your solution suggested in the above thread. I was also interested in showing tooltips on the legend labels as mentioned in my following post.
http://forums.infragistics.com/forums/t/9990.aspx
Please can you throw some light on this that the 2007 V1 can support above two requirements.
Are there any risks, if any, changing previous functionality using 2003 V-3 3.0.2 version and about the maintenance and support for this release.
Thanks,
You can found our releases history at http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Win_Revision_History.html. I believe you canfind information you need there.
Regards
I am trying to do something similar here. I used the sample code from above (I'm using version 2008.2). The code looks something like the following..
if (!String.IsNullOrEmpty(box.Path) && box.Path.EndsWith("Legend") && (-1 != box.Column))
{ ....do something with the legend box
}
{
.... do something with legend text
Looking at the code in debug, when I get the Text Primitive the text column is always -1 and the path is always null. Am I getting the wrong primitive type here or something?
You can try looking at:
http://news.infragistics.com/forums/p/5297/23905.aspx#23905
works fine for me as well. what (4-part) version number is the dll you're using? maybe downloading the latest hotfix will resolve this problem.
I'm using a column chart
Which chart type you are using? I've been trying your code with ColumnChart and it seems to work.
I looked at the item you referenced however it did not actually address my question.