TeeScrollPager

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
xmetman
Newbie
Newbie
Posts: 9
Joined: Fri May 09, 2014 12:00 am

TeeScrollPager

Post by xmetman » Tue Dec 02, 2014 4:32 pm

Hi

I have just installed the latest September update to TeeChart. I would still like to use the TeeScrollPager Tool but still have numerous problems doing it at design time.
Is there any step by step instructions on how you do this at design time?

Having failed to this at design time, I thought I would try to do it in code, but the example in the "Tee Chart Pro Examples" applications is no help because since it was written the method of doing it has changed far too much. So simply by creating a new project and dropping a chart on it and then copying the code from the example does not work.
Do you have a simple real-world example project that uses the TeeScrollPager tool working from code that does work?

I gave up when I couldn't get this working last time and simply linked too charts together, but one of the reasons I bought the latest version of TeeChart was to use this tool and save me the time and effort.

Bruce.

jens.mertelmeyer
Newbie
Newbie
Posts: 31
Joined: Fri Nov 21, 2014 12:00 am

Re: TeeScrollPager

Post by jens.mertelmeyer » Tue Dec 02, 2014 4:38 pm

What "numerous problems" do you have exactly? The only problem I know about is that you cannot place a chart with a TScrollPagerTool on a TFrame at design time, you will have to add the frame (or the tool and the required code to set it up) at runtime.

If you, for example, want to change the view that is zoomed in, you can simply modify the StartValue and EndValue properties of the ColorBandTool-property of your TScrollPagerTool.

xmetman
Newbie
Newbie
Posts: 9
Joined: Fri May 09, 2014 12:00 am

Re: TeeScrollPager

Post by xmetman » Tue Dec 02, 2014 4:48 pm

Hi

I have just rebooted my PC and the example code that didn't work is now working!

I would still appreciate the steps that you have to go though to do in at design time rather than in code though.

Bruce.

xmetman
Newbie
Newbie
Posts: 9
Joined: Fri May 09, 2014 12:00 am

Re: TeeScrollPager

Post by xmetman » Tue Dec 02, 2014 5:33 pm

Hi

I keep running into exceptions when I run this simple example after trying to add a TeeScrollPager at design time. I'm obviously missing something here but the chart looks good in the IDE why doesn't it just work at run-time?
Capture6.png
Capture6.png (14.61 KiB) Viewed 12443 times
This is what the form looks like in the IDE.
Capture7.png
Capture7.png (10.72 KiB) Viewed 12447 times
This is the code - most of its commented out because I would like to get it working from the IDE and not code.

Code: Select all

unit Main;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCLTee.TeEngine, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, VCLTee.Series,
  VCLTee.TeeScrollPagerTool;

type
  TfmMain = class(TForm)
    Chart1: TChart;
    ChartTool1: TScrollPagerTool;
    Series1: TBarSeries;
    Series2: TBarSeries;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmMain: TfmMain;

implementation

{$R *.dfm}

uses
  vcltee.TeeThemes, Math, vcltee.TeeTools, vcltee.EditChar;

procedure TfmMain.FormCreate(Sender: TObject);
var
  i: Integer;
  tmpFast : TFastLineSeries;
  ScrollPagerTool : TScrollPagerTool;
begin
  inherited;

  Chart1.Title.Text.Clear;
  Chart1.Title.Text.Add('ScrollPager Tool');
  Series1.FillSampleValues(300);

{
  // Doing it in code Works Fine

  tmpFast:=TFastLineSeries.Create(Self);
  tmpFast.DrawStyle:=flAll;
  tmpFast.FillSampleValues(1000);
  Chart1.AddSeries(tmpFast);

  ScrollPagerTool := TScrollPagerTool.Create(Self);
  ScrollPagerTool.ParentChart:=Chart1;
  ScrollPagerTool.SubChartTChart.Frame.Visible:=False;

  ScrollPagerTool.ColorBandTool.StartLine.Active:=True;
  ScrollPagerTool.ColorBandTool.EndLine.Active:=True;

  ScrollPagerTool.AddSeries(Chart1[0]);

  // Cosmetics
  ApplyChartTheme(TBlackIsBackTheme,Chart1);
  ApplyChartTheme(TBlackIsBackTheme,ScrollPagerTool.SubChartTChart);

  Chart1.View3D:=False;
  ScrollPagerTool.SubChartTChart.View3D:=False;
  }
end;

end.
This is the DFM

Code: Select all

object fmMain: TfmMain
  Left = 0
  Top = 0
  Caption = 'fmMain'
  ClientHeight = 337
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Chart1: TChart
    Left = 0
    Top = 0
    Width = 635
    Height = 337
    AllowPanning = pmHorizontal
    Legend.Visible = False
    Title.Text.Strings = (
      'TChart')
    BottomAxis.Automatic = False
    BottomAxis.AutomaticMaximum = False
    BottomAxis.AutomaticMinimum = False
    BottomAxis.Maximum = 202.666666666666700000
    BottomAxis.Minimum = 101.333333333333300000
    View3D = False
    Zoom.Direction = tzdHorizontal
    Align = alClient
    TabOrder = 0
    DefaultCanvas = ''
    ColorPaletteIndex = 0
    object Series1: TBarSeries
      HorizAxis = aBothHorizAxis
      Marks.Visible = False
      VertAxis = aBothVertAxis
      MultiBar = mbNone
      XValues.DateTime = True
      XValues.Name = 'X'
      XValues.Order = loAscending
      YValues.Name = 'Bar'
      YValues.Order = loNone
    end
    object ChartTool1: TScrollPagerTool
      DivisionRatio = 4.000000000000000000
      NoLimitDrag = False
      Series = Series1
    end
    object TSubChartTool
      Tag = 1
      ShowInEditor = False
      Charts = <
        item
          AllowDrag = True
          AllowResize = True
          Height = 84
          Left = 0
          Top = 253
          Width = 635
          InnerChart = {
            545046300B54496E6E6572436861727400044C656674020003546F7003FD0005
            5769647468037B020648656967687402540C416C6C6F7750616E6E696E670706
            706D4E6F6E650C4D617267696E426F74746F6D02040A4D617267696E4C656674
            02030B4D617267696E52696768740203094D617267696E546F70020412546974
            6C652E546578742E537472696E677301060B54496E6E65724368617274000656
            6965773344080A5A6F6F6D2E416C6C6F77080754616253746F70080D44656661
            756C7443616E766173120000000011436F6C6F7250616C65747465496E646578
            0200000E54436F6C6F7242616E64546F6F6C0003546167020105436F6C6F7207
            05636C52656406437572736F72070B637248616E64506F696E740A4472617742
            6568696E640808456E6456616C75650500B0AAAAAAAAAACA06400B4E6F4C696D
            697444726167080B50656E2E56697369626C650809526573697A65456E64090B
            526573697A655374617274090A537461727456616C75650500A8AAAAAAAAAACA
            05400C5472616E73706172656E63790232064178697349440200000E54436F6C
            6F724C696E65546F6F6C000B4472616752657061696E74090556616C75650500
            A8AAAAAAAAAACA0540064178697349440200000F54416E6E6F746174696F6E54
            6F6F6C000F53686170652E416C69676E6D656E740708746143656E7465721453
            686170652E536861646F772E56697369626C65081353686170652E5465787441
            6C69676E6D656E740708746143656E7465720D54657874416C69676E6D656E74
            0708746143656E7465720000000E54436F6C6F724C696E65546F6F6C000B4472
            616752657061696E74090556616C75650500B0AAAAAAAAAACA06400641786973
            49440200000F54416E6E6F746174696F6E546F6F6C000F53686170652E416C69
            676E6D656E740708746143656E7465721453686170652E536861646F772E5669
            7369626C65081353686170652E54657874416C69676E6D656E74070874614365
            6E7465720D54657874416C69676E6D656E740708746143656E74657200000000
            00}
        end>
    end
  end
end

jens.mertelmeyer
Newbie
Newbie
Posts: 31
Joined: Fri Nov 21, 2014 12:00 am

Re: TeeScrollPager

Post by jens.mertelmeyer » Wed Dec 03, 2014 9:00 am

This is a known bug (I think) that has been reported in 2013 (#237) and 2014 (#758). Also see this forum thread.

This is what I usually do to help myself:
  • Add a lonely TScrollPagerTool that uses NO SERIES
  • Adding the TScrollPagerTool also adds a TSubChartTool. Make sure that this chart has no series
  • At runtime, call this once:

Code: Select all

scrollPagerTool.AddSeries(yourWantedSeries);
scrollPagerTool.ParentChart := yourOriginalChart;

scrollPagerTool.SetUpScrollPager();
scrollPagerTool.SubChartTChart.Axes.Left.Assign(yourOriginalChart.Axes.Left);

// Some additional stuff you'd normally do at design time
scrollPagerTool.ColorBandTool.Color := clLime;
scrollPagerTool.ColorBandTool.Transparency := 80;

This is what I usually do. I'm really yearning for a fix. :o

xmetman
Newbie
Newbie
Posts: 9
Joined: Fri May 09, 2014 12:00 am

Re: TeeScrollPager

Post by xmetman » Wed Dec 03, 2014 1:18 pm

Hi Jens

Thanks for that work round - I'll give it a try.

I did think that the September update would clear up most of these problems - but obviously they forgot about the rest of the iceberg. I think that company's like Steema are spending so much time keeping up with Embarcadero's two releases a year, and making iOS and Android versions of the their products, that they don't have the time for any Delphi fixes.

Bruce.

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

Re: TeeScrollPager

Post by Yeray » Wed Dec 03, 2014 3:47 pm

Hello,
xmetman wrote:I keep running into exceptions when I run this simple example after trying to add a TeeScrollPager at design time. I'm obviously missing something here but the chart looks good in the IDE why doesn't it just work at run-time?
Solved this "Argument Out Of Range" exception changing the TScrollPagerTool's DivisionRatio in the dfm from 4.000000000000000000 to 3.000000000000000000.

Then, running your application I get this:
2014-12-03_1631.png
2014-12-03_1631.png (17.94 KiB) Viewed 12391 times
I add this code to move the colorband:

Code: Select all

  ChartTool1.ColorBandTool.StartValue:=Series1.XValue[50];
  ChartTool1.ColorBandTool.EndValue:=Series1.XValue[75];
And it works fine for me here:
2014-12-03_1646.png
2014-12-03_1646.png (17.81 KiB) Viewed 12395 times
The ColorBand is undraggable and unresizable, but if you remove the AllowDrag and AllowResize line in your dfm inside the SubChart, then you can drag and resize the colorband on it:

Code: Select all

    object TSubChartTool
      Tag = 1
      ShowInEditor = False
      Charts = <
        item
          AllowDrag = True
          AllowResize = True
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

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

Re: TeeScrollPager

Post by Yeray » Wed Dec 03, 2014 3:53 pm

Hi
xmetman wrote:I did think that the September update would clear up most of these problems - but obviously they forgot about the rest of the iceberg. I think that company's like Steema are spending so much time keeping up with Embarcadero's two releases a year, and making iOS and Android versions of the their products, that they don't have the time for any Delphi fixes.
We indeed have a lot of work to support all the changes in the IDEs as they come, but we still continue fixing other issues:
http://tinyurl.com/TeeChartVCLFMX-2014-12-140923
http://tinyurl.com/TeeChartVCLFMX-2014-11-140512
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

Post Reply