Hi,
I'm trying to align the left hand side of the chart legend with the left axes of my chart (- I say left axes because actually there is more than one stacked on top of eachother but their position is where the default left axis would be I presume?). I've set the legend.customposition property to true and if I hard code a value for the legends.left property (e.g. 20) it appears in the correct position but I'd like to align it relative to the axis position instead rather than hardcoding a value but it always appears way over to the left (e.g. looks like .left is being set to 0).
Thanks,
Norman
Align Legend with Left Axis
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Norman,
Yes, you can do something like this:
Yes, you can do something like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
bar1.FillSampleValues();
tChart1.Legend.CustomPosition = true;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.Draw();
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
tChart1.Legend.Left = tChart1.Axes.Left.Position;
tChart1.Legend.Top = tChart1.Axes.Left.IStartPos;
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |