Hi there
We are using the UltraWinChart v13.2.20132.2023 in a .NET 4.0 C# WinForms application and I am getting some odd behaviour in regards to the legend in a composite chart
If I add my line series layer (containing 3 series) to the chart BEFORE I had my column series layer I get all my legend items correctly layed out in terms of size and spacing.
But if I do the reverse and add my column series layer BEFORE my line series layer then the legend text for my 3 line series items overlap!!
I have attached a png image, showing both legend layouts.
I have also pasted in below the method I use to construct the chart legend
My question is how can I correctly get my legend displayed when showing column layer BEFORE the line layer????
Thanks in advance
Geoff
protected static void CreateChartLegend(UltraChart ultraChart, ChartLayerAppearance columnLayer, ChartLayerAppearance lineLayer, ChartArea chartArea) { ultraChart.Legend.DataAssociation = ChartTypeData.SplitData; CompositeLegend chartLegend = new CompositeLegend(); // if you add the line layer AFTER // column layer the line series items overlap!! if (lineLayer != null) { chartLegend.ChartLayers.Add(lineLayer); lineLayer.LegendItem = LegendItemType.Series; } if (columnLayer != null) { chartLegend.ChartLayers.Add(columnLayer); columnLayer.LegendItem = LegendItemType.Series; } chartLegend.BoundsMeasureType = MeasureType.Percentage; chartLegend.Bounds = new Rectangle(8, 96, 80, 4); chartArea.BoundsMeasureType = MeasureType.Percentage; chartArea.Bounds = new Rectangle(0, 10, 98, 100); chartLegend.PE.ElementType = PaintElementType.Gradient; chartLegend.PE.FillGradientStyle = Infragistics.UltraChart.Shared.Styles.GradientStyle.Circular; chartLegend.PE.Fill = Color.White; chartLegend.PE.FillStopColor = Color.White; chartLegend.Border.CornerRadius = 10; chartLegend.Border.Thickness = 1; chartLegend.LabelStyle.FontSizeBestFit = true; ultraChart.CompositeChart.Legends.Add(chartLegend); ultraChart.Legend.Location = LegendLocation.Bottom; }
Hello Geoff,
I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.
Thank you for using Infragistics Components.
Hi Dimitar
I found a not so perfect workaround.
The issue is that if I have multiple column series, say 12, but only wish to display the first 3 in the legend then I set this series labels to those other 9 column series items to an empty string. The consequence to that is that the line series items which are added AFTER the column series to the legend are then overlayed!! I think the Infragistics code get's confused about how to lay out the items in the legend for that 2nd group of line series items.
So my workaround is to set the series labels of those column series I do NOT want displayed to a single space char. This causes the legend to display a place for those items in the legend. Then in the FillSceneGraph event handler I remove the primitive where the legend item is a single char string, thus removing those items single char items.
The upshot is that the there is then a 9 space gap between my column series items and line series but at least they do NOT overlap.
Thanks