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
385
Composite Legend items dont get displayed initially
posted

Hi,

I'm using a composite chart in my application and adding a composite Legend to chart in the fillscenegraph event. However the problem is that the legend items are not getting displayed initially and when I resize the chart or change the window layout, then the legend becomes visible.

My chart control is on top of a user control which is added to a windows form.Also, find attached the screen shot of the same.

Please find below the sample code for adding the legend: 

 

void

 

m_Chart_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) {

if (tempCollection.Count > 0){

e.SceneGraph.AddRange(tempCollection.ToArray());

 

foreach (Primitive prim in tempCollection)

{

UpdatePrimitives(prim,primitveRangeMap[prim]);

}

}

 

if (m_Parent.DisplayLegend)

AddLegend();

 

 

}

 private void AddLegend(){

 

 

if (m_HistLayerAppearance != null){

if (this.m_Chart.CompositeChart.Legends.Count < 1)

{

CompositeLegend myLegend = new CompositeLegend();

myLegend.ChartLayers.Add(m_HistLayerAppearance);

myLegend.Bounds =

new Rectangle(75, 2, 20, 10);

myLegend.BoundsMeasureType = MeasureType.Percentage;

myLegend.PE.ElementType =

PaintElementType.SolidFill;

myLegend.PE.Fill =

Color.White;

myLegend.PE.FillStopColor =

Color.White;

myLegend.Border.CornerRadius = 5;

myLegend.Border.Thickness = 1;

myLegend.LabelStyle.FontColor =

Color.Black;

myLegend.LabelStyle.FontSizeBestFit =

true;

myLegend.LabelStyle.WrapText =

true;

 

 

this.m_Chart.CompositeChart.Legends.Add(myLegend);

}

 

Regards,

Uday

Legend.zip
Parents
No Data
Reply
  • 26458
    Offline posted

    Sorry, but I'm not entirely sure what you're trying to accomplish and why you're using FillSceneGraph event to do it. First, let me advise against setting properties on your chart instance inside FillSceneGraph. Doing so will likely cause the chart to repaint and FillSceneGraph will be called repeatedly from within itself. Use FillSceneGraph to add shapes (primitives) directly onto the scenegraph only. I would suggest a different approach, but i'm not sure what your goal is.

Children