I use latest Steema.TeeChart.NET 4.2023.8.31 in my WinForms App targeting .NET Framework 4.8 (I use latest VS Enterprise 2022 17.7.4).
I have two charts on my form: on charts I display same set of hours (0 .. 9) as bars, but on 2nd chart I convert hours to seconds (*3600).
Because on 2nd chart Y values are bigger, the Y axis is moved to the right (to make labels fit) - that's expected behaviour.
If I use GetAxisDrawLabel event to format label text back to hours Y axis still at the same position despite of labels become much smaller:
- How to move the Y axis further to the left (so that there is space needed only to draw the labels)? Do I need to call some extra function to make chart to recalculate Y axis position?
- Is it possible to move the Y axis further to the left (even on 1st chart)? I think chart reserves more space than needed to draw labels.
Code: Select all
public Form1()
{
InitializeComponent();
tChart2.Axes.Left.GetAxisDrawLabel += Left_GetAxisDrawLabel;
Random rnd = new Random();
for (int x = 0; x < 10; x++)
{
var y = rnd.Next(10);
bar1.Add(x, y);
bar2.Add(x, y * 3600);
}
}
private void Left_GetAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
{
e.Text = (e.LabelValue / 3600).ToString("0");
}