Hi;
Is it possible that I can custom the legend's location? I saw only 4 locations currently available (top, left, right, bottom), and i can not drag the legend icon to the location I prefer, such as in the middle of the chart.
If it is, how can i implement?
thanks ...
if you create a Composite Chart, you can add a legend with a custom bounding rectangle.
Isn't there an easier way then just building the legend from scratch?
here's a simple example using the FillSceneGraph event to get you started. if you are using version 7.2 or earlier, you will need to move this code into a class implementing ILayer, as the FillSceneGraph event is new to 7.3.
{
int legendBoxY = (int)(this.ultraChart1.Height * .1);
int legendBoxH = (int)(this.ultraChart1.Height * .5);
e.SceneGraph.Add(legendBox);
LabelStyle legendLabelStyle = new LabelStyle();
int legendItemW, legendItemH;
int legendItemSpace = (int)(legendItemW * .25);
int legendItemTextW = legendBoxX + legendBoxW - legendItemTextX;
e.SceneGraph.Add(legendItem1Box);
e.SceneGraph.Add(legendItem1Text);
legendItemY += legendItemH + legendItemSpace;
e.SceneGraph.Add(legendItem2Box);
e.SceneGraph.Add(legendItem2Text);
}
Can u provide me some sample code on how to put a legend in a custom layer?
So far as i know there isnt a "custom location" mode with x/y positioning for legends. What i have been doing is just using the margin offsets. So you set the location general position (left/right/top/bottom) then offset as you need from there.
<Legend Location="Right">
<Margins Bottom="15" Right="0" Top="10" />
</Legend>