Hi,
I'm trying to upgrade my project from TTeeCanvas3D to TGDIPlusCanvas for more eye candy.
Currently there are 2 noticeable differences that I'd like to ask for advice.
1. How can I have a sharp TCandleSeries in TGDIPlusCanvas? just like TBarSeries does. They are all about rectangle and straight line after all.
2. 1 pixel setting is not presenting any more. Can I have it back? they are all straight lines though.
Some questions about TGDIPlusCanvas
Some questions about TGDIPlusCanvas
- Attachments
-
- error.png (11.5 KiB) Viewed 9431 times
Re: Some questions about TGDIPlusCanvas
The question 1 is more important because it actually makes visual comparison of OHLC prices more harder for our customers.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Some questions about TGDIPlusCanvas
Hi sswang,
Yes, this is possible disabling GDI+ canvas AntiAlias property, for example:
A complete example comparing identical charts in GDI+ and GDI Win32:
Yes, this is possible disabling GDI+ canvas AntiAlias property, for example:
Code: Select all
(GDIPChart.Canvas as TGDIPlusCanvas).AntiAlias:=False;
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Chart, TeCanvas, CandleCh, TeeProcs, TeeGDIPlus;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure SetChart(Chart: TChart);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
GDIPChart : TChart;
GDIChart : TChart;
begin
GDIPChart:=TChart.Create(Self);
GDIPChart.Parent:=Self;
GDIPChart.Align:=alTop;
(GDIPChart.Canvas as TGDIPlusCanvas).AntiAlias:=False;
SetChart(GDIPChart);
GDIChart:=TChart.Create(Self);
GDIChart.Parent:=Self;
GDIChart.Align:=alBottom;
GDIChart.Canvas:=TTeeCanvas3D.Create;
SetChart(GDIChart);
end;
procedure TForm1.SetChart(Chart: TChart);
var
Candle : TCandleSeries;
begin
Candle:=TCandleSeries.Create(Self);
Candle.ParentChart:=Chart;
Candle.FillSampleValues();
Candle.Pen.Visible:=False;
Chart.View3D:=False;
end;
end.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Some questions about TGDIPlusCanvas
Hi,
How can I make TCandleSeries to be as sharp as TBarSeries does while AntiAlias:=True?
How can I make TCandleSeries to be as sharp as TBarSeries does while AntiAlias:=True?
- Attachments
-
- p1.png (4.67 KiB) Viewed 9410 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Some questions about TGDIPlusCanvas
Hello,
You can disable AntiAlias por TCandleSeries only, for example:
The complete example:
You can disable AntiAlias por TCandleSeries only, for example:
Code: Select all
procedure TForm1.Series1BeforeDrawValues(Sender: TObject);
begin
(Chart1.Canvas as TGDIPlusCanvas).AntiAlias:=False;
end;
procedure TForm1.Series1AfterDrawValues(Sender: TObject);
begin
(Chart1.Canvas as TGDIPlusCanvas).AntiAlias:=True;
end;
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Chart, TeCanvas, CandleCh, TeeProcs, TeeGDIPlus;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure SetChart(Chart: TChart);
procedure Series1BeforeDrawValues(Sender: TObject);
procedure Series1AfterDrawValues(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
GDIPChart : TChart;
GDIChart : TChart;
begin
GDIPChart:=TChart.Create(Self);
GDIPChart.Parent:=Self;
GDIPChart.Align:=alTop;
//(GDIPChart.Canvas as TGDIPlusCanvas).AntiAlias:=False;
SetChart(GDIPChart);
GDIChart:=TChart.Create(Self);
GDIChart.Parent:=Self;
GDIChart.Align:=alBottom;
GDIChart.Canvas:=TTeeCanvas3D.Create;
SetChart(GDIChart);
end;
procedure TForm1.SetChart(Chart: TChart);
var
Candle : TCandleSeries;
begin
Candle:=TCandleSeries.Create(Self);
Candle.ParentChart:=Chart;
Candle.FillSampleValues();
Candle.Pen.Visible:=False;
if (Chart.Canvas is TGDIPlusCanvas) then
begin
Candle.BeforeDrawValues:=Series1BeforeDrawValues;
Candle.AfterDrawValues:=Series1AfterDrawValues;
end;
Chart.View3D:=False;
end;
procedure TForm1.Series1BeforeDrawValues(Sender: TObject);
begin
((Sender as TCandleSeries).ParentChart.Canvas as TGDIPlusCanvas).AntiAlias:=False;
end;
procedure TForm1.Series1AfterDrawValues(Sender: TObject);
begin
((Sender as TCandleSeries).ParentChart.Canvas as TGDIPlusCanvas).AntiAlias:=True;
end;
end.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Some questions about TGDIPlusCanvas
This is really helpful, thanks!