tiffany Posted April 10, 2008 Report Share Posted April 10, 2008 Hi, I was wondering if there's any way to change the order of the items in the legend box. It currently shows the items in alpha and numerical ascending order. I have pie chart where the legend have the items shown in this order: Below 100MB Below 1GB Below 2GB Below 500MB Over 2GB I would like the legend to show the items in this order: Below 100MB Below 500MB Below 1GB Below 2GB Over 2GB Thanks Tiffany Quote Link to comment Share on other sites More sharing options...
maximop Posted April 11, 2008 Report Share Posted April 11, 2008 Unfortunately, the standard legend box in ChartFX for .NET 6.2 does not provide a way to order the legend box items; however, you could hide the standard legend box and create your own UserLegendBox adding each UserLegendBoxItem in the order in which you need them to show. You could do something like the following: chart1.UserLegendBox = true; UserLegendBoxItem userLegendBoxItem = chart1.UserLegendBoxObj.Item[0];userLegendBoxItem.Label = "Below 100MB"; userLegendBoxItem.Color = System.Drawing. Color.Red;userLegendBoxItem.MarkerShape = SoftwareFX.ChartFX.MarkerShape.Rect; userLegendBoxItem.BorderEffect = SoftwareFX.ChartFX. BorderEffect.None;userLegendBoxItem.BorderColor = System.Drawing.Color.Black; userLegendBoxItem = chart1.UserLegendBoxObj.Item[1];userLegendBoxItem.Label = "Below 500MB"; userLegendBoxItem.Color = System.Drawing. Color.Yellow;userLegendBoxItem.MarkerShape = SoftwareFX.ChartFX.MarkerShape.Rect; userLegendBoxItem.BorderEffect = SoftwareFX.ChartFX. BorderEffect.None;userLegendBoxItem.BorderColor = System.Drawing.Color.Black; userLegendBoxItem = chart1.UserLegendBoxObj.Item[2]; userLegendBoxItem.Label = "Below 1GB"; userLegendBoxItem.Color = System.Drawing.Color.Green; userLegendBoxItem.MarkerShape = SoftwareFX.ChartFX. MarkerShape.Rect; userLegendBoxItem.BorderEffect = SoftwareFX.ChartFX.BorderEffect.None; userLegendBoxItem.BorderColor = System.Drawing. Color.Black;Please note that the functionality you are looking for is available in ChartFX 7 via the LegendItemAttributes Collection. Charts.zip Quote Link to comment Share on other sites More sharing options...
tiffany Posted April 11, 2008 Author Report Share Posted April 11, 2008 Thanks for the info Maximop. I'm not very familiar with ChartFX. So does the sample codes you gave go under chartModifer customization? <Customize> <chartModifier> </chartModifier> </Customize> Thanks again, Tiffany Quote Link to comment Share on other sites More sharing options...
maximop Posted April 11, 2008 Report Share Posted April 11, 2008 The UserLegendBox is not available as part of the design-time properties exposed by ChartFX. You need to set this in the code-behind file of the WebForm.aspx. This is normally a .cs or .vb file. The above code is for C# though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.