Hi,
I'm currently trying to add an Annotation (Callout) to a line which is an element inside a ColumnLineChart. It shall be positioned on the height of the line outside the chart next to the Y2-Axis.
Two ways:
First I could try to position it in the normal (default) layer but i don't get the coordinates of the line - or can I and how?
Second trying to accomplish that in the FillSceneGraph but there are tons of lines - how can i get the one from the ColumnLineChart?
Still using 2006.1 :(
Thanks for your help
Daniel
I think using FillSceneGraph is the right approach, because you do need to map a data value into coordinates and that can only be done in the custom layer.If you're trying to distinguish the columnline chart line from a gridline, then it's pretty simple. The line in the chart is actually a Polyline primitive. Other line elements are Line primitives with Layer property set to null. However, if your column line chart displays multiple lines (from multiple rows of data), it'll be trickier to tell one line from another. For that scenario, you'd have to somehow compare the line's point values to the data table values bound to the chart.
Max,
Do you have a sample c# code where callout created dynamically using fillscenegraph?
ex
Callout callout = new Callout();
.
e.SceneGraph.Add(callout);
Thanks,
James
Sure, you can do something like this:Callout callout = new Callout(); callout.Origin = new Point(100, 100); callout.BubbleRectangle = new Rectangle(85, 55, 50, 20); callout.PE.Fill = Color.LightGray; callout.PE.Stroke = Color.DarkGray; callout.PE.StrokeWidth = 2; callout.CornerRadius = 15; e.SceneGraph.Add(callout);
As long as you set the colors, origin and the bounds you should see the callout appear in the scenegraph.
Maxi,
Thanks, I was able to show the callout next to the datapoint. You said earlier that the text is a separate object to add to the scenegraph. i tried that but still unsuccessful. can you show me how to add the text in the callout.
I got it.
var paintElement = new PaintElement(Color.Red) { FillOpacity = 255 }; point.PE = paintElement;
var callout = new Callout(); callout.Origin = new Point(point.point.X, point.point.Y - 2); callout.BubbleRectangle = new Rectangle(point.point.X - 7, point.point.Y - 30, 14, 14); callout.PE.Fill = Color.LightGray; callout.PE.FillOpacity = 255; callout.PE.Stroke = Color.Red; callout.PE.StrokeWidth = 1; callout.CornerRadius = 2;
var text = new Text();text.SetTextString(string.Format("{0}", textToDisplay));text.PE.Fill = Color.Red;text.bounds = callout.BubbleRectangle;
e.SceneGraph.Add(wecoText);
Regards,