TChart - barwidth when uploading lots of data...

From: Sonnich Jensen (sonnich.jensen_at_elektrobit.com)
Date: 09/29/04


Date: 29 Sep 2004 09:29:27 -0700

Hi all!

Yet another thing using TChart

I am uploading a large amount of data, far more than I show. The
BottomAxis is of TDateTime type, and shows 3 days, while I upload e.g.
50 days, into a TBarSeries.
The idea is that the user can scroll through data.

This causes the BarWidth to become 1 pixel, which is not good. The
witdh is normal, if I load only what I need, that is 3 days of data
(by hourlhy offsets, that is 72 samples into the TBarSeries ~ 800
pixels / 72 ~ 11 pixels for each bar).

But when uploading much more, I get a barwidth of 1 pixel (minimum
probably), even that I set the bottomaxis.minimum and maximum to show
only 3 days, meaning I show 72 samples of a total of e.g. 720 - the
user can the scroll and see more. This is faster that calculating it
all the time.

Have anyone any ideas?

This works with TLineSeries, but that is something different.

A solutiuon might be:
Series1.CustomBarWidth :=
  Trunc(
    ( (DBChart1.Width * 100/(100 - DBChart1.MarginRight -
DBChart1.MarginLeft)) /
      fTempDelay ) /
      100 * Series1.BarWidthPercent);

I made this pretty fast, but it kind of work, though I'd prefer having
the component do it itself.

The app run on Win2K with D5.