Line Chart Series markers and Legend Boxes

Answered (Not Verified) This post has 0 verified answers | 6 Replies | 3 Followers Thread's RSS feed.

msrushton
Points 65
Replied On: Thu, Mar 26 2009 12:36 PM Reply

Hi,

 

I've created a line chart, but need to print it out. These means I need to use Icons in the Legend

rather than colored boxes. And for the icons in the Legend to match the icon that mark the data points

on the Line.

I saw a post that uses a scatter chart to achieve the effect but it seems the scatter chart requires X and Y to be numerical

and my X vaules are text.

Thanks in advance

 

 

 

  • Post Points: 20

All Replies

Replied On: Mon, Mar 30 2009 12:38 PM Reply

Although you can easily add icons to each line using the LineChart.LineAppearances collection, the legend is still only capable of showing colored boxes.

The best way to solve that problem is to handle the FillSceneGraph event, find those colored boxes in your legend, and replace them with Symbols at the same location.

  • Post Points: 20
msrushton
Points 65
Replied On: Tue, Mar 31 2009 4:08 AM Reply

Thanks, I suspected as much. i was'nt sure whether a 'primitive' could be re-created as a different type...or would I just hide the boxes and draw icons over the top?

  • Post Points: 20
Answered (Not Verified) Replied On: Tue, Mar 31 2009 12:54 PM Reply

you can use the setter in e.SceneGraph to replace the primitive...

e.SceneGraph[n] = new Symbol();

or you can set the PE to transparent on the old primitive and then add the new one...

e.SceneGraph[n].PE.FillOpacity = 0;

e.SceneGraph.Add(new Symbol());

or you can remove the old primitive and add the new one.

e.SceneGraph.Remove(old);

e.SceneGraph.Add(new);

 

  • Post Points: 20
msrushton
Points 65
Replied On: Wed, Apr 1 2009 3:28 AM Reply

Thanks

  • Post Points: 20
muthukumarit
Points 225
Replied On: Mon, Aug 3 2009 12:36 AM Reply

I am also having the Same Problem . I am new to Infragistics .Can u please post the code that you Achieved.

Thanks in advance

  • Post Points: 20
msrushton
Points 65
Answered (Not Verified) Replied On: Mon, Aug 3 2009 4:44 AM Reply

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

void

 

 

chart_FillSceneGraph( object

sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e )

{

System.Collections.

 

ArrayList boxes = new System.Collections.ArrayList

( );

 

 

foreach( Infragistics.UltraChart.Core.Primitives.Primitive p in

e.SceneGraph )

{

 

 

Type

type = p.GetType( );

 

 

if( p.Path != null

)

{

 

 

if( p.Path.Contains( "Legend" ) & type.Name.Contains( "Box"

) & p.Row >= 0 )

{

boxes.Add( p );

 

 

}

}

}

 

 

foreach( Infragistics.UltraChart.Core.Primitives.Box b in

boxes )

{

 

 

// draw a circle, horizontally & vertically centered in the Box.

 

 

int

circleCenterX, circleCenterY;

circleCenterX = b.rect.X + ( b.rect.Width / 2 );

circleCenterY = b.rect.Y + ( b.rect.Height / 2 );

Infragistics.UltraChart.Resources.Appearance.LineAppearance appearance = ( sender

 

as

UltraChart ).LineChart.LineAppearances[ b.Row ];

Infragistics.UltraChart.Shared.Styles.SymbolIcon icon = appearance.IconAppearance.Icon;

 

 

char

ch = appearance.IconAppearance.Character;

 

 

if

( icon != Infragistics.UltraChart.Shared.Styles.SymbolIcon.Character )

{

 

Symbol myCircle =

 

new Symbol( new Point

( circleCenterX, circleCenterY ), icon, Infragistics.UltraChart.Shared.Styles.SymbolIconSize.Medium );

myCircle.drawColor =

 

Color

.Black;

myCircle.PE = b.PE;

 

 

// turn off tooltips for the Box and turn them on for myCircle.

b.Caps = PCaps.None;

b.Visible =

 

false

;

myCircle.Caps = PCaps.Tooltip | PCaps.HitTest;

myCircle.Chart = b.Chart;

;

myCircle.Value = b.Value;

myCircle.Row = b.Row;

myCircle.Column = b.Column;

myCircle.Layer = b.Layer;

 

 

// add the circle to the scene.

e.SceneGraph.Add( myCircle );

}

 

 

else

{

Infragistics.UltraChart.Core.Primitives.Text text =

 

new Text( new Point( circleCenterX, circleCenterY ), new string( new char

[ ] { ch } ) );

text.drawColor =

 

Color

.Black;

text.labelStyle.Font = appearance.IconAppearance.CharacterFont;

text.PE = b.PE;

text.bounds = b.rect;

 

 

// turn off tooltips for the Box and turn them on for myCircle.

b.Caps = PCaps.None;

b.Visible =

 

false

;

text.Caps = PCaps.Tooltip | PCaps.HitTest;

text.Chart = b.Chart;

;

text.Value = b.Value;

text.Row = b.Row;

text.Column = b.Column;

text.Layer = b.Layer;

 

 

// add the text to the scene.

e.SceneGraph.Add( text );

}

 

}

}

  • Post Points: 5
Page 1 of 1 (7 items) | RSS