Setting axis maximum doesn't work in BeforeDrawAxes event (only in BeforeDraw event)
Posted: Wed Jan 30, 2019 6:03 am
Hello.
I'm using TeeChart Pro 4.2018.12.17 and I use the following code:
Setting tChart1.Axes.Left.Maximum inside BeforeDrawAxes event doesnt' work (axis will have proper maximum value only if I force TeeChart to redraw immediately - tChart1.Refresh();).
Or I can use BeforeDraw event (and it works correctly without forcing to redraw).
Is that by design or a bug?
BeforeDrawAxes event is supposed to be for all axis manipulations, isn't it?
I'm using TeeChart Pro 4.2018.12.17 and I use the following code:
Code: Select all
using System;
using System.Windows.Forms;
using Steema.TeeChart;
namespace TeeChartTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
tChart1.Axes.Left.Automatic = false;
tChart1.Axes.Left.Minimum = 0;
tChart1.Axes.Left.Maximum = 5;
//adding points which are higher than tChart1.Axes.Left.Maximum
fastLine1.Add(0, 7);
fastLine1.Add(1, 7);
}
private void tChart1_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
//adjust tChart1.Axes.Left.Maximum if there are points that are higher
if (fastLine1[0].Y > tChart1.Axes.Left.Maximum)
tChart1.Axes.Left.Maximum = fastLine1[0].Y;
}
}
}
Or I can use BeforeDraw event (and it works correctly without forcing to redraw).
Is that by design or a bug?
BeforeDrawAxes event is supposed to be for all axis manipulations, isn't it?