Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1470
Why are my Composite Chart Legend Items Overlapping?
posted

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;
        }
Parents Reply Children
No Data