Custom labels not invisibilising when scrolled off

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Sam F
Newbie
Newbie
Posts: 45
Joined: Wed Sep 10, 2008 12:00 am

Custom labels not invisibilising when scrolled off

Post by Sam F » Mon Feb 28, 2011 9:25 am

Hi,

I recently upgraded to the 2011 version of TChart, and am using CBuilder XE. I use custom labels on some of my charts, and I have been adding extra labels off the end of the axes in case the user panned in that direction. It seems now that these labels are visible and clustering up as garbage at the edge of the panel (see attached, left side).
To experiment, I panned a chart with custom labels, and when the label should scroll off and become invisible, it now stays where it is and seems to stop refreshing (see attached, right side - the 100 should have become invisible). If I scroll back again, the label starts refreshing again and resumes normal behaviour.
I haven't yet looked further into it - so would be interested in a quick fix I can do for this problem.

Sam.
Attachments
CustomLabels.png
CustomLabels.png (11.06 KiB) Viewed 8380 times

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

Re: Custom labels not invisibilising when scrolled off

Post by Yeray » Tue Mar 01, 2011 12:28 pm

Hi Sam,

I'm not sure to understand what should I exactly do to reproduce the problem. Could you please arrange a simple example project we can run as-is to reproduce the problem here (or write detailed step-by-step instructions to follow from zero in a new application).

Thanks in advance.
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

Sam F
Newbie
Newbie
Posts: 45
Joined: Wed Sep 10, 2008 12:00 am

Re: Custom labels not invisibilising when scrolled off

Post by Sam F » Wed Mar 02, 2011 1:20 am

I thought I was pretty clear. Quite simply, you use custom labels, and then drag the chart around to move them off the chart.

But here is your step by step guide:
Create a new project (I'm using C++ Builder XE, TChart 2011).
Plonk a TChart onto the available form.

Add at the top of the cpp file:

Code: Select all

#include <Series.hpp>
Add to the constructor:

Code: Select all

TLineSeries *thisLineSeries = new TLineSeries(Chart1);
  thisLineSeries->AddXY(1,1,"",clBlack);
  thisLineSeries->AddXY(10,10,"",clBlack);
  thisLineSeries->AddXY(100,100,"",clBlack);
  Chart1->AddSeries(thisLineSeries);
  Chart1->LeftAxis->Items->Clear();
  Chart1->LeftAxis->Items->Add(1,"1");
  Chart1->LeftAxis->Items->Add(10,"10");
  Chart1->LeftAxis->Items->Add(100,"100");
Run the application. Using the right mouse button, drag the chart around. Note the behaviour of the labels.

Sam F
Newbie
Newbie
Posts: 45
Joined: Wed Sep 10, 2008 12:00 am

Re: Custom labels not invisibilising when scrolled off

Post by Sam F » Wed Mar 02, 2011 2:28 am

Adding this to the Scroll event seems to work:

Code: Select all

TChartAxis* Axis;
  double dValue(0);
  double dMax(0);
  double dMin(0);
  for(int AxisIndex(0); AxisIndex < Chart1->Axes->Count; AxisIndex++)
  {
    Axis = Chart1->Axes->Items[AxisIndex];
    if(!Axis->Items->Automatic)
    {
      dMax = Axis->Maximum;
      dMin = Axis->Minimum;
      for(int LabelIndex(0); LabelIndex < Axis->Items->Count; LabelIndex++)
      {
        if(Axis->Items->Item[LabelIndex]->Value > dMax ||
           Axis->Items->Item[LabelIndex]->Value < dMin)
        {
          Axis->Items->Item[LabelIndex]->LabelPos = -10;
        }
      }
    }
  }

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

Re: Custom labels not invisibilising when scrolled off

Post by Yeray » Wed Mar 02, 2011 3:05 pm

Hi Sam,

Thanks for the explanation and the code. I could reproduce it so I've added it to the defect list to be fixed in future releases (TV52015428). It seems to be broken since v2010.01.
I'm glad to hear you've found a workaround.
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

Marc
Site Admin
Site Admin
Posts: 1209
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Custom labels not invisibilising when scrolled off

Post by Marc » Thu Jun 07, 2012 8:02 am

Hello,

Status update: An internal fix for his has been added to TeeChart for the next maintenance release.

Regards,
Marc Meumann
Steema Support

Post Reply