Page 2 of 2

Re: TeeChart Animation

Posted: Tue Dec 12, 2017 8:50 am
by 16880166
Thanks. Just what I needed to see.

Re: TeeChart Animation

Posted: Sat Apr 07, 2018 6:27 pm
by 16880166
I have since moved to Tokyo, update 3 and purchased the Pro version. But every time I try to add to change things in the Chart Editor, Delphi seems to crash with the attached error.

After downloading AnimationsChart.zip and automated the Pie Chart using the timer method. I'm a bit surprised that the animation requires it's own timer. But I am having a problem automating the 4 series Bar Chart. Since I can't mess with the editor, what I would like is a bit of example code.

I want to be able to animate all the bars at once after ALL of their queries are executed. Just like the zip file, but with all series if active.

Thanks.

Re: TeeChart Animation

Posted: Mon Apr 09, 2018 11:59 am
by yeray
Hello,

I've cleaned the project a little bit and added several bar series to it.
AnimationCharts.zip
(2.15 KiB) Downloaded 487 times
See how it moves in this gif:
2018-04-09_14-00-07.gif
2018-04-09_14-00-07.gif (229.48 KiB) Viewed 13498 times

Re: TeeChart Animation

Posted: Mon Apr 09, 2018 3:42 pm
by 16880166
Thanks.

1. Can you tell me what controls the spacing between the bars? As you can see from this image, the bars kinda overlap. I would like them to be evenly spaced and not overlapping.
2. After I drill down to a small pie slice, the bar char is hardly noticeable. How do I adjust the chart so the Bar height is recognizable? In other words, how do I lower the grid to match the bar size so when I drill down, it will fill the bar chart.
3. How can I tell which bars are checked?

Re: TeeChart Animation

Posted: Wed Apr 11, 2018 4:24 am
by 16880166
- Bump -

Re: TeeChart Animation

Posted: Wed Apr 11, 2018 8:15 am
by yeray
Hello,
realsol wrote:1. Can you tell me what controls the spacing between the bars? As you can see from this image, the bars kinda overlap. I would like them to be evenly spaced and not overlapping.
Sounds as a rounding issue. I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=2027
realsol wrote:2. After I drill down to a small pie slice, the bar char is hardly noticeable. How do I adjust the chart so the Bar height is recognizable? In other words, how do I lower the grid to match the bar size so when I drill down, it will fill the bar chart.
How are you doing that drill down? Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
realsol wrote:3. How can I tell which bars are checked?
You can loop all the series and see which ones are "TBarSeries" and "Active". Ie:

Code: Select all

var i: Integer;
//...
  for i:=0 to Chart1.SeriesCount-1 do
    if (Chart1[i] is TBarSeries) and (Chart1[i].Active) then
      //do whatever
realsol wrote:- Bump -
You may be interested in the Pro Support option.

Re: TeeChart Animation

Posted: Wed Apr 11, 2018 4:11 pm
by 16880166
Sounds like a rounding issue. I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=2027
This was the same as the regular rectangle bars as all my other images in my other posts show. There are so many setting (a tribute to a mature component offering), I know I was the one that caused it. I don't know how.
How are you doing that drill down? Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
I can demonstrate with two graphics.

1. This first one shows a bar graph representing all income and expense category totals by month.
2. The second chart represents the result after a user clicks on the shopping category slice

I would like to redraw the grid to match the highest bar like on the first chart. For the user, it is hard to tell the shopping totals which such $7000 grid.

Re: TeeChart Animation

Posted: Thu Apr 12, 2018 6:53 am
by yeray
Hello,

The exact place and exact values depend on the exact code in your project, but you probably have to call SetMinMax(min, max) on the Left axis to set the axis scale that better fits the data to show.

Re: TeeChart Animation

Posted: Thu Apr 12, 2018 7:35 pm
by 16880166
Thanks. I'll give it a shot. My Bar Chart has 4 series each controlled by a Query.

If I display the chart with animation (with queries that lower the values of the bars), the bars are updated, but the OnGetLegendText never gets called, so the amounts and text remain the same. Here is the code:

Code: Select all

          if DBChart2.Tools.Count = 1 then
          with DBChart2.Tools.Add(TSeriesAnimationTool) as TSeriesAnimationTool do
          begin
            duration := 250;
            Series:=DBChart2[4];
            Play;
          end;
If I comment out the above code, both the bars and legend are updated when the queries are updated. How can I update the legend to the correct values when using animation?

Re: TeeChart Animation

Posted: Tue Apr 17, 2018 6:37 am
by yeray
Hello,

I'm trying to reproduce the problem with this code but it seems to work fine for me here:

Code: Select all

uses Series, TeeAnimations;

var animationTool: TSeriesAnimationTool;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=False;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    ColorEachPoint:=True;
    Marks.Hide;
    FillSampleValues;
  end;

  animationTool:=Chart1.Tools.Add(TSeriesAnimationTool) as TSeriesAnimationTool;
  with animationTool do
  begin
    Duration:=250;
    Series:=Chart1[0];
    Play;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1[0].Count-1 do
    Chart1[0].YValue[i]:=Chart1[0].YValue[i] - 10;

  animationTool.Play;
end;
If you still find problems, please arrange a simple example project we can run as-is the problem here.