ColorLines not cleared from chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Charles Cruden
Newbie
Newbie
Posts: 9
Joined: Wed Nov 18, 2009 12:00 am

ColorLines not cleared from chart

Post by Charles Cruden » Thu Jan 14, 2010 8:58 pm

Using Teechart.WPF.dll 4.0.2009.35592, we are using ColorLines to act as cursors for our chart, letting the user know what value a particular series is at a given point. They work fairly well for the most part, but we are running into a problem when the user clears the chart. We do this by removing all custom axes, series and tools. Unfortunately, the cursors are NOT cleared out even though they no longer show up in the chart's tool collection - they are still drawn on the chart. I coded a very simple WPF application to demonstrate the problem:

Code: Select all

    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            Axis axis = new Axis(false, false, chart.Chart);
            axis.MinimumOffset = axis.MaximumOffset = 5;
            chart.Axes.Custom.Add(axis);

            chart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
            chart.Series[0].FillSampleValues();

            ColorLine cursor = new ColorLine();
            cursor.Value = 5;
            cursor.Axis = chart.Axes.Bottom;
            chart.Tools.Add(cursor);

            chart.MouseDoubleClick += DoubleClick;
        }

        void DoubleClick(object sender, MouseEventArgs e)
        {
            chart.Axes.Custom.Clear();
            chart.Series.Clear();
            chart.Tools.Clear();

            Axis axis = new Axis(false, false, chart.Chart);
            axis.MinimumOffset = axis.MaximumOffset = 5;
            chart.Axes.Custom.Add(axis);

            chart.Series.Add(new Steema.TeeChart.WPF.Styles.Line());
            chart.Series[0].FillSampleValues();
        }
    }
The window has a grid with a single TChart object in it called "chart". When the application starts up, you can see a ColorLine at position 5. If you double-click on the chart, I would expect the code in DoubleClick to clear the chart of everything, including the ColorLine, and then display the same sort of chart as before, without a ColorLine visible. (The data's random, but the layout's the same.) However, after double-clicking, the ColorLine is still visible at position 5.

We've found that the ColorLines remain drawn through Chart.Invalidate() and other methods that we would normally expect to force a redraw. However, resizing the window seems to do the trick of removing them. That seems like a rather poor way of getting rid of them though. Are we doing something wrong in the reset code or is this a bug that will be fixed soon?

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

Re: ColorLines not cleared from chart

Post by Yeray » Fri Jan 15, 2010 3:01 pm

Hi Charles,

You are right, I could reproduce it. It seems that the function tChart1.Tools.Clear(); clears the tool list but for some reason the ColorLineTools are still drawn. I've added it to the defect list to be fixed as soon as possible (TW16014640).
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

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

Re: ColorLines not cleared from chart

Post by Narcís » Tue Apr 06, 2010 1:58 pm

Hi Charles,

Please notice TW16014640 has been fixed for next maintenance release.
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