TeeChart 3 CursorTool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
AndreasL
Newbie
Newbie
Posts: 8
Joined: Wed May 23, 2007 12:00 am
Contact:

TeeChart 3 CursorTool

Post by AndreasL » Fri Jan 25, 2008 6:27 pm

Hello,

I have a problem with the TeeChart CursorTool. I use the lastest version.

private void fastLine1_AfterDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
// Call cursorTool1.XValue -> does not work
cursorTool1.XValue = 100;

// Call cursorTool1.XValue again -> it works....
// Comment this line and try again...
cursorTool1.XValue = 100;
}


Thank you for your help.

Best regards

Andreas Lindenthal

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Mon Jan 28, 2008 11:47 am

Hi Andreas,

I seems that the X and Y values for the CursorTool aren't stored correctly if you don't repaint or update chart's the internal values before. You can force it but take care because then OnAfterDraw event will be called. So, don't call those methods inside OnAfterDraw event.

For example:

Code: Select all

public partial class Form1 : Form
    {
        Steema.TeeChart.Tools.CursorTool cursor1;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Points point1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
            
            point1.FillSampleValues(25);

            cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);

            Bitmap bmp = tChart1.Bitmap;
            cursor1.XValue = 10;
        }

        private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            tChart1.Header.Text = Convert.ToString(cursor1.XValue);
        }

    }
In this example, if you don't use

Code: Select all

Bitmap bmp = tChart1.Bitmap; 
, the first time the Chart title won't be updated.

Finally, note that I've added to the wish-list this issue to be studied if this "repaint" should be done internally or not (TF02012775).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

AndreasL
Newbie
Newbie
Posts: 8
Joined: Wed May 23, 2007 12:00 am
Contact:

Post by AndreasL » Mon Feb 11, 2008 11:03 am

Hi Yeray Alonso

Is this the only solution ?

We have to call 'Bitmap bmp = tChart1.Bitmap;' to be shure, that 'cursor1.XValue = value' works correct....?

Best regards
Andreas Lindenthal

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 12, 2008 9:42 am

Hi Andreas,

Yes, you need to use this method to force TeeChart being internally repainted and therefore such properties having valid values.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AndreasL
Newbie
Newbie
Posts: 8
Joined: Wed May 23, 2007 12:00 am
Contact:

Post by AndreasL » Tue Feb 12, 2008 12:08 pm

Hello Narcis,

okay but this is more an workaround.

You wrote you add it to as a wish-list issue, but form me is more like a bug.

I hope you will fix it next time.

Best regards

Andreas

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 12, 2008 12:44 pm

Hi Andreas,

We think it's a feature request for BeforeDrawAxis and AfterDrawAxis events. The cursor tool needs the axis calculations to work. These are only available after the axis is drawn and the axis is drawn after the series. However, there is no event between the axis being drawn and the tools being drawn, that's why the chart has to be painted twice. Anyway, you could use tChart1.Draw() instead of creating a temporary bitmap.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply