THighLow & Smoothing

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Karsten
Newbie
Newbie
Posts: 3
Joined: Fri Apr 17, 2009 12:00 am

THighLow & Smoothing

Post by Karsten » Fri Oct 15, 2010 10:31 am

Is there an option to get a highlow bar with smoothed low and smooth high curve automatically without adding more points??
Right now the dark red highlow it's not smooth at all (see example)
example.jpg
example.jpg (73.27 KiB) Viewed 2881 times
Cheers
Karsten

BCB5 & TChart 8.04 VCL

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: THighLow & Smoothing

Post by Sandra » Mon Oct 18, 2010 1:49 pm

Hello Karsten,

Sorry for the delay. I recommend three options for solve your problem:
  • - Using GDI+ canvas, you can find an example in Demo of TeeChartVCL, concretely in Canvas/GDI+Canvas.
    - Using AntiAlias canvas, you find an example in Demo Canavas/AntiAlias
    - Using Tool Anti-Alias. There is an example to Tools/AntiAlias Filter in Demo Project of TeeCharVCL
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

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

Re: THighLow & Smoothing

Post by Yeray » Mon Oct 18, 2010 2:16 pm

Hi Karsten,

Another option could be using 2 TSmoothing functions, one for the High Line and one for the Low line. The Smoothing function, however, uses more points internally.
Here it is an example:

Code: Select all

uses Series, ErrorBar, TeeSpline, TeeSeriesBandTool;

procedure TForm1.FormCreate(Sender: TObject);
var HighLow: THighLowSeries;
    Fast1, Fast2, dummy: TFastLineSeries;
    Smooth1, Smooth2: TSmoothingFunction;
    SeriesBand1: TSeriesBandTool;
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  HighLow:=Chart1.AddSeries(THighLowSeries) as THighLowSeries;
  HighLow.FillSampleValues();
  HighLow.Brush.Style:=bsSolid;

  Smooth1:=TSmoothingFunction.Create(self);
  Smooth2:=TSmoothingFunction.Create(self);

  Fast1:=Chart1.AddSeries(TFastLineSeries) as TFastLineSeries;
  Fast2:=Chart1.AddSeries(TFastLineSeries) as TFastLineSeries;
  dummy:=TFastLineSeries.Create(self);
  Fast1.FunctionType:=Smooth1;
  Fast2.FunctionType:=Smooth2;
  Fast1.Color:=clBlack;
  Fast2.Color:=clBlack;

  dummy.XValues.Value:=HighLow.XValues.Value;
  dummy.YValues.Value:=HighLow.LowValues.Value;
  dummy.XValues.Count:=HighLow.XValues.Count;
  dummy.YValues.Count:=HighLow.YValues.Count;

  Fast1.DataSource:=HighLow;
  Fast2.DataSource:=dummy;

  HighLow.Active:=false;

  SeriesBand1:=Chart1.Tools.Add(TSeriesBandTool) as TSeriesBandTool;
  SeriesBand1.Series:=Fast1;
  SeriesBand1.Series2:=Fast2;
  SeriesBand1.Brush.BackColor:=HighLow.Color;
end;
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