Re: [Lazarus] TAChart Localization

2015-12-17 Thread Werner Pamler


Am 17.12.2015 um 12:09 schrieb Maxim Ganetsky:


17.12.2015 04:19, Werner Pamler пишет:

Am 17.12.2015 um 01:01 schrieb Maxim Ganetsky:

16.12.2015 17:34, Werner Pamler пишет:

Another question related: Is it possible to find the address of a
resource string in the internal resource string table by using its hash
value? This would allow me to go back to the old calling convention
which had a "string" in the Register procedure (instead of a pointer
to a string): In this procedure I could calculate the hash value of the
passed untranslated resource string, store it and use it later to
retrieve the translated string from the tables.

See here for the list of available resource string functions:

http://www.freepascal.org/docs-html/3.0.0/prog/progse40.html#x229-2420009.3



Thanks. I know this page, but my fpc-trunk does not find these
functions, even if I "search in files" of the entire fpc folder, they do
not show up. They do exist in the objpas of fpc3.0.0, but only enclosed
by a define "RESSTRSECTIONS" which is not active, and I can't make
TAChart depend on a non-standard define of fpc...

FPC changed its format of resource strings from RST to RSJ. So
documentation seems to be outdated in this regard. Maybe resource string
functions were changed too.

In any case I think that it is not worth all the hassle. The current
implementation is basically OK IMO.

I added an overloaded version of each registration procedure which 
accepts a string as parameter like in the old version (of course, this 
one will not be translated). Therefore, TAChart is backward-compatible 
again. All related changes were added to the list for merging to RC2.


Thank you for the Russian translation.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-17 Thread Maxim Ganetsky


17.12.2015 04:19, Werner Pamler пишет:
> Am 17.12.2015 um 01:01 schrieb Maxim Ganetsky:
>> 16.12.2015 17:34, Werner Pamler пишет:
>>> Another question related: Is it possible to find the address of a
>>> resource string in the internal resource string table by using its hash
>>> value? This would allow me to go back to the old calling convention
>>> which had a "string" in the Register procedure (instead of a pointer
>>> to a string): In this procedure I could calculate the hash value of the
>>> passed untranslated resource string, store it and use it later to
>>> retrieve the translated string from the tables.
>>
>> See here for the list of available resource string functions:
>>
>> http://www.freepascal.org/docs-html/3.0.0/prog/progse40.html#x229-2420009.3
>>
>>
> Thanks. I know this page, but my fpc-trunk does not find these
> functions, even if I "search in files" of the entire fpc folder, they do
> not show up. They do exist in the objpas of fpc3.0.0, but only enclosed
> by a define "RESSTRSECTIONS" which is not active, and I can't make
> TAChart depend on a non-standard define of fpc...

FPC changed its format of resource strings from RST to RSJ. So
documentation seems to be outdated in this regard. Maybe resource string
functions were changed too.

In any case I think that it is not worth all the hassle. The current
implementation is basically OK IMO.

-- 
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Werner Pamler

Am 17.12.2015 um 01:01 schrieb Maxim Ganetsky:

16.12.2015 17:34, Werner Pamler пишет:

Another question related: Is it possible to find the address of a
resource string in the internal resource string table by using its hash
value? This would allow me to go back to the old calling convention
which had a "string" in the Register procedure (instead of a pointer
to a string): In this procedure I could calculate the hash value of the
passed untranslated resource string, store it and use it later to
retrieve the translated string from the tables.


See here for the list of available resource string functions:

http://www.freepascal.org/docs-html/3.0.0/prog/progse40.html#x229-2420009.3 



Thanks. I know this page, but my fpc-trunk does not find these 
functions, even if I "search in files" of the entire fpc folder, they do 
not show up. They do exist in the objpas of fpc3.0.0, but only enclosed 
by a define "RESSTRSECTIONS" which is not active, and I can't make 
TAChart depend on a non-standard define of fpc...


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Maxim Ganetsky

16.12.2015 17:34, Werner Pamler пишет:

Another question related: Is it possible to find the address of a
resource string in the internal resource string table by using its hash
value? This would allow me to go back to the old calling convention
which had a "string" in the Register procedure (instead of a pointer
to a string): In this procedure I could calculate the hash value of the
passed untranslated resource string, store it and use it later to
retrieve the translated string from the tables.


See here for the list of available resource string functions:

http://www.freepascal.org/docs-html/3.0.0/prog/progse40.html#x229-2420009.3

--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Werner Pamler

Am 13.12.2015 um 13:26 schrieb Maxim Ganetsky:

It does not look nice. You are hacking around const specifier.

Hacking? At least in good company:

excerpt from SysUtils:
constructor Exception.CreateRes(ResString: PString);
begin
  inherited create;
  fmessage:=ResString^;
end;

Isn't this the same? If the address of the resource string is fed into 
the CreateRes constructor then the exception will be raised with the 
translated string.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Werner Pamler

Am 16.12.2015 um 15:16 schrieb Maxim Ganetsky:
There is no const modifier in this excerpt. 


Oh, I see your point now. Fortunately, the "const" is really not 
necessary here. Without the "const", would this idea of accessing the 
translated string be ok?


I do not want to translate the string again because this would bring the 
hassle of finding the po file into TAChart.


Another question related: Is it possible to find the address of a 
resource string in the internal resource string table by using its hash 
value? This would allow me to go back to the old calling convention 
which had a "string" in the Register procedure (instead of a pointer 
to a string): In this procedure I could calculate the hash value of the 
passed untranslated resource string, store it and use it later to 
retrieve the translated string from the tables.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Maxim Ganetsky


16.12.2015 16:30, Werner Pamler пишет:
> Am 13.12.2015 um 13:26 schrieb Maxim Ganetsky:
>> It does not look nice. You are hacking around const specifier.
> Hacking? At least in good company:
> 
> excerpt from SysUtils:
> constructor Exception.CreateRes(ResString: PString);
> begin
>   inherited create;
>   fmessage:=ResString^;
> end;
> 
> Isn't this the same? If the address of the resource string is fed into
> the CreateRes constructor then the exception will be raised with the
> translated string.

There is no const modifier in this excerpt.

-- 
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-16 Thread Maxim Ganetsky


16.12.2015 17:34, Werner Pamler пишет:
> Am 16.12.2015 um 15:16 schrieb Maxim Ganetsky:
>> There is no const modifier in this excerpt. 
> 
> Oh, I see your point now. Fortunately, the "const" is really not
> necessary here. Without the "const", would this idea of accessing the
> translated string be ok?

Yes.

> I do not want to translate the string again because this would bring the
> hassle of finding the po file into TAChart.
> 
> Another question related: Is it possible to find the address of a
> resource string in the internal resource string table by using its hash
> value? This would allow me to go back to the old calling convention
> which had a "string" in the Register procedure (instead of a pointer
> to a string): In this procedure I could calculate the hash value of the
> passed untranslated resource string, store it and use it later to
> retrieve the translated string from the tables.

I don't know, TBH.

-- 
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-13 Thread Alexander Klenin
On Sun, Dec 13, 2015 at 7:54 AM, Werner Pamler  wrote:
> Am 12.12.2015 um 22:23 schrieb Maxim Ganetsky:
>>
>> The basic method to solve this is to move these assignments (or assign
>> these values for a second time) to a later stage, e.g. OnCreate event of the
>> GUI designer form.
>
> I could solve it in the meantime by modifying the Register procedures
> used throughout TAChart to store the pointer to the resource string instead
> of the string directly. Hmmh, it does break backward-compatibility, but I
> bet nobody has ever written his own chart series so far... Let me see who
> complains in the forum
Well, I actually did (i.e. I have some project-specific custom series
which I did not commit to TAChat).
However, they are in an old defunct project, and I can upgrade easily
enough should it became relevant.
So, just a data point.

As for the translation problem, is it not possible to query
translation engine at run-time?
Something similar to _('Line series') from gettext?

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-13 Thread Werner Pamler

Am 13.12.2015 um 13:26 schrieb Maxim Ganetsky:

It does not look nice. You are hacking around const specifier.
Isn't this what the translation system is doing, replace a "constant" 
string by a translated one?



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-13 Thread Maxim Ganetsky

13.12.2015 0:54, Werner Pamler пишет:

Am 12.12.2015 um 22:23 schrieb Maxim Ganetsky:

The basic method to solve this is to move these assignments (or assign
these values for a second time) to a later stage, e.g. OnCreate event
of the GUI designer form.

I could solve it in the meantime by modifying the Register
procedures used throughout TAChart to store the pointer to the resource
string instead of the string directly. Hmmh, it does break
backward-compatibility, but I bet nobody has ever written his own chart
series so far... Let me see who complains in the forum

--- code begin ---
type
   PStr = ^String;

procedure RegisterSeriesClass(
   ASeriesClass: TSeriesClass; const ACaption: PStr);  // ACaption was a
string before...
begin
   if SeriesClassRegistry.IndexOfClass(ASeriesClass) < 0 then
 SeriesClassRegistry.Add(TClassRegistryItem.Create(ASeriesClass,
ACaption));
end;
...
resourcestring
   rsLineSeries = 'Line series';

initalization
   RegisterSeriesClass(TLineSeries, @rsLineSeries);
 code end ---


It does not look nice. You are hacking around const specifier.

--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-13 Thread Maxim Ganetsky

13.12.2015 18:49, Werner Pamler пишет:

Am 13.12.2015 um 13:26 schrieb Maxim Ganetsky:

It does not look nice. You are hacking around const specifier.

Isn't this what the translation system is doing, replace a "constant"
string by a translated one?


As I wrote earlier, we translate captions by assigning resourcestring 
values to them after the translation system was initialized, e.g in 
OnCreate caption of the form.


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart Localization

2015-12-12 Thread Péter Gábor
Hi!

At r50753 "wp" created the support for localization of TAChart, but it
is in 6 separate files.
Most of these files contains only 1 (one) sentence (four is the most).

I think there is no reason for this fragmentation, especially because
these strings are used only in the GUI designer of Lazarus IDE.

Please pack them into one PO file.

Thanks!

-- 
Péter Gábor
p...@freemail.hu


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-12 Thread Werner Pamler
This is work in progress and will probably change. I just wanted to 
store a working stage before I'd dive into a more difficult part - maybe 
somebody can help me with that: TAChart registers the names of series 
types in an internal stringlist. These texts are used in the dropdown 
for series selection in the GUI designer. But this registration is 
called by the initialization section of the corresponding unit, i.e. 
before translation is performed.


Does anybody know of similar situations in the IDE or other packages 
from which I could learn how to handle this case correctly?


Am 12.12.2015 um 15:30 schrieb Péter Gábor:

Hi!

At r50753 "wp" created the support for localization of TAChart, but it
is in 6 separate files.
Most of these files contains only 1 (one) sentence (four is the most).

I think there is no reason for this fragmentation, especially because
these strings are used only in the GUI designer of Lazarus IDE.

Please pack them into one PO file.

Thanks!




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-12 Thread Maxim Ganetsky

12.12.2015 19:44, Werner Pamler пишет:

This is work in progress and will probably change. I just wanted to
store a working stage before I'd dive into a more difficult part - maybe
somebody can help me with that: TAChart registers the names of series
types in an internal stringlist. These texts are used in the dropdown
for series selection in the GUI designer. But this registration is
called by the initialization section of the corresponding unit, i.e.
before translation is performed.

Does anybody know of similar situations in the IDE or other packages
from which I could learn how to handle this case correctly?


The basic method to solve this is to move these assignments (or assign 
these values for a second time) to a later stage, e.g. OnCreate event of 
the GUI designer form.



Am 12.12.2015 um 15:30 schrieb Péter Gábor:

Hi!

At r50753 "wp" created the support for localization of TAChart, but it
is in 6 separate files.
Most of these files contains only 1 (one) sentence (four is the most).

I think there is no reason for this fragmentation, especially because
these strings are used only in the GUI designer of Lazarus IDE.

Please pack them into one PO file.

Thanks!


--
Best regards,
 Maxim Ganetsky  mailto:gan...@narod.ru

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Localization

2015-12-12 Thread Werner Pamler

Am 12.12.2015 um 22:23 schrieb Maxim Ganetsky:
The basic method to solve this is to move these assignments (or assign 
these values for a second time) to a later stage, e.g. OnCreate event 
of the GUI designer form.
I could solve it in the meantime by modifying the Register 
procedures used throughout TAChart to store the pointer to the resource 
string instead of the string directly. Hmmh, it does break 
backward-compatibility, but I bet nobody has ever written his own chart 
series so far... Let me see who complains in the forum


--- code begin ---
type
  PStr = ^String;

procedure RegisterSeriesClass(
  ASeriesClass: TSeriesClass; const ACaption: PStr);  // ACaption was a 
string before...

begin
  if SeriesClassRegistry.IndexOfClass(ASeriesClass) < 0 then
SeriesClassRegistry.Add(TClassRegistryItem.Create(ASeriesClass, 
ACaption));

end;
...
resourcestring
  rsLineSeries = 'Line series';

initalization
  RegisterSeriesClass(TLineSeries, @rsLineSeries);
 code end ---



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-06 Thread Richard Mace
Thanks, that worked a treat.

Richard

On 5 June 2015 at 14:24, Salvatore Coppola coppolastu...@gmail.com wrote:

 Maybe

 TChart.ZoomFull

 can help you

 2015-06-04 21:35 GMT+02:00 Richard Mace richard.m...@gmail.com:

 Hi,
 Another quick question. How can you, via code, zoom out of a chart,
 effectively back to what it was by default? If that makes sense?

 Thanks

 Richard

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-05 Thread Salvatore Coppola
Maybe

TChart.ZoomFull

can help you

2015-06-04 21:35 GMT+02:00 Richard Mace richard.m...@gmail.com:

 Hi,
 Another quick question. How can you, via code, zoom out of a chart,
 effectively back to what it was by default? If that makes sense?

 Thanks

 Richard

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-04 Thread Werner Pamler
The rectangle enclosing the shown data range is called the LogicalExtent 
of the Chart. Therefore, store the LogicalExtent before performing a 
zoom in a TDoubleRect (savedExtent := Chart.LogicalExtent), and to go 
back you just assign it the other way: Chart.LogicalExtent := savedExtent.

(The  unzoomed extent already is available as Chart.GetFullExtent).

All this is managed by the TChartExtentHistory. Details are explained in 
the Mandelbrot-Tutorial 
(http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming#Zoom_history).


Am 04.06.2015 um 21:35 schrieb Richard Mace:

Hi,
Another quick question. How can you, via code, zoom out of a chart, 
effectively back to what it was by default? If that makes sense?


Thanks

Richard


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-04 Thread Werner Pamler
And I forgot to mention that you can unzoom in the standard 
configuration by just clicking into the chart


Am 04.06.2015 um 21:35 schrieb Richard Mace:

Hi,
Another quick question. How can you, via code, zoom out of a chart, 
effectively back to what it was by default? If that makes sense?


Thanks

Richard


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart

2015-06-04 Thread Richard Mace
Hi,
Another quick question. How can you, via code, zoom out of a chart,
effectively back to what it was by default? If that makes sense?

Thanks

Richard
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-03 Thread Richard Mace
On 3 June 2015 at 17:49, Werner Pamler werner.pam...@freenet.de wrote:

 I suppose you use a TLineSeries, but the same principle should work for
 TBSplineSeries and TCubicSplineSeries

 ​​
 Chart1LineSeries1.Pointer.Style := psCircle; // round points
 Chart1LineSeries1.Pointer.Pen.Style := psClear;// no border


​Thanks Werner.
That's interesting,
  ​
Chart1LineSeries1.Pointer.Style := psCircle;
Doesn't compile, but I can navigate to it at design time?

  chartMain.ClearSeries;
  FLine := TLineSeries.Create(chartMain);
  FLine.Marks.Style := TSeriesMarksStyle(4);
  FLine.Marks.OverlapPolicy := opHideNeighbour;
  FLine.ShowLines := true;
  FLine.ShowPoints := true;
  FLine.Pointer.Brush.Color := clBlue;
  FLine.Pointer.Style := psCircle;  this line won't compile

Richard


​
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2015-06-03 Thread Werner Pamler
Oh - the old uses issue... psCircle is declared in unit TATypes 
which is not added to uses automatically at runtime.


At designtime, just use the ObjectInspector: The tree above the Object 
Inspector shows the chart and the series as a child of the chart. Click 
on the series to brings the series properties into the Object Inspector. 
Scroll down a bit to see the Pointer property, open the node and find 
the Style.


Maybe you are interested also in my forum posting of today containing a 
lot of TAChart runtime code: 
http://forum.lazarus.freepascal.org/index.php/topic,28628.msg179298.html#msg179298


Am 03.06.2015 um 22:38 schrieb Richard Mace:



On 3 June 2015 at 17:49, Werner Pamler werner.pam...@freenet.de 
mailto:werner.pam...@freenet.de wrote:


I suppose you use a TLineSeries, but the same principle should
work for TBSplineSeries and TCubicSplineSeries

​ ​
Chart1LineSeries1.Pointer.Style := psCircle; // round points
Chart1LineSeries1.Pointer.Pen.Style := psClear;// no border


​ Thanks Werner.
That's interesting,
  ​
Chart1LineSeries1.Pointer.Style := psCircle;
Doesn't compile, but I can navigate to it at design time?

  chartMain.ClearSeries;
  FLine := TLineSeries.Create(chartMain);
  FLine.Marks.Style := TSeriesMarksStyle(4);
  FLine.Marks.OverlapPolicy := opHideNeighbour;
  FLine.ShowLines := true;
  FLine.ShowPoints := true;
  FLine.Pointer.Brush.Color := clBlue;
  FLine.Pointer.Style := psCircle;  this line won't compile

Richard


​


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart

2015-06-03 Thread Richard Mace
Hi.
When drawing points on a line graph, is it possible, via code, to make the
points round and without a black boarder?
Could someone give me any code examples please?
Thanks
Richard
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart cannot zoom

2014-10-22 Thread Leonardo M. Ramé


El 21/10/14 a las 15:32, Werner Pamler escibió:

You have added a ChartToolset and have assigned it to the chart. This
deactivates the built-in toolset which is responsible for default
zooming and panning. All you have to do is to add another ZoomDragTool
to your toolset. To make it respond to dragging with the left mouse
button set its Shift property to ssLeft, this is the standard behavior
of the built-in zoom tool. If you need panning as well add a
ZoomPanTool; by default, it becomes active with the right mouse button.
But if you already use these Shift values in tools that are currently in
your toolset, select something else, or add a key like ssCtrl, or
ssShift (or both) - there are many possibilities.

There are several tutorial which cover zooming in TAChart:

  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Chart_Tools,
  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Function_Series
  * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming



Thanks Werner, I'll take a look at it.

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart cannot zoom

2014-10-21 Thread Leonardo M. Ramé
Hi, I don't know what I did, but I no longer can zoom in / zoom out (by 
dragging the mouse pointer) my chart. If I draw 1000 data points, they 
all are drawn into the chart, but I only want to display part of that 
data, for example 100 points.


Here's the definition of my TAChart object (extracted from the lfm), I 
hope this help:


  object HAChart: TChart
Left = 0
Height = 206
Top = 302
Width = 582
AxisList = 
  item
Grid.Color = 2434341
TickColor = clSilver
Alignment = calRight
Group = 1
Marks.Format = '%0.2f'
Marks.Range.Max = 50
Marks.Style = smsCustom
Minors = 
Title.LabelFont.Orientation = 900
  end
  item
Grid.Color = clGray
Grid.Visible = False
Intervals.MaxLength = 100
Intervals.MinLength = 30
Alignment = calBottom
Marks.LabelFont.Orientation = 750
Marks.Format = '%2:s'
Marks.Source = ListChartSource1
Marks.Style = smsLabel
Minors = 
  end
BackColor = clBlack
ExpandPercentage = 5
Extent.UseYMin = True
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Frame.Color = clMedGray
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
  'TAChart'
)
Toolset = ChartToolset1
OnAfterDrawBackWall = CandleStickChartAfterDrawBackWall
OnAfterPaint = CandleStickChartAfterPaint
Align = alClient
Color = clBlack
ParentColor = False
ParentShowHint = False
OnMouseMove = CandleStickChartMouseMove
  end


Regards,

--
Leonardo M. Ramébr
Medical IT - Griensu S.A.br
Av. Colón 636 - Piso 8 Of. Abr
X5000EPT -- Córdobabr
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19br
Cel.: +54 9 (011) 40871877


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart cannot zoom

2014-10-21 Thread Werner Pamler
You have added a ChartToolset and have assigned it to the chart. This 
deactivates the built-in toolset which is responsible for default 
zooming and panning. All you have to do is to add another ZoomDragTool 
to your toolset. To make it respond to dragging with the left mouse 
button set its Shift property to ssLeft, this is the standard behavior 
of the built-in zoom tool. If you need panning as well add a 
ZoomPanTool; by default, it becomes active with the right mouse button. 
But if you already use these Shift values in tools that are currently in 
your toolset, select something else, or add a key like ssCtrl, or 
ssShift (or both) - there are many possibilities.


There are several tutorial which cover zooming in TAChart:

 * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Chart_Tools,
 * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Function_Series
 * http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-10-08 Thread Kamen Ketev
 
What did you do? Replace the 

tamultiseries.pas in a TAChart of Lazarus 1.2.4?
 
Yes. Ok, I'll try svn. Thank you! 
Regards,
Kamen
 
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-10-07 Thread Kamen Ketev
 
Thank you very much!
 
Regards,
Kamen
 




 Оригинално писмо 
От:  Werner Pamler  
Относно: [Lazarus] TAChart CandleStick Chart
До: lazarus@lists.lazarus.freepascal.org
Изпратено на: Понеделник, 2014, Октомври 6 21:45:30 EEST


  How can I make color of the tails like body?

I uploaded a small modification today which takes care of your request: 

the color of the body border and the tails of the CandleStick series is 

determined by the property CandleStickLinePen. If you set this color to 

clDefault these lines will be painted in the color of the body. Please 

see the updated financial demo.



  How can I add HorzScrollBar or something like this and keep the 

scale of CandleStick?

In TAChart you can zoom by left-dragging a rectangle across the chart. 

And you can pan the zoomed window by dragging with the right-mouse 

button down. Or you can implement more sophisticated features by using 

the chart tools.



In addition, there is a TChartNavScrollbar which you can use to scroll 

the zoomed window across the chart range. You just have to link its 

Chart property to the chart which you want to control. The Min and 

Max of the scrollbar map to the data range used in the chart. To get 

day-by-day scrolling set the scrollbar's Min and Max to the 

corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x 

and b.x) at run-time.



Moreover, there is also a TChartNavPanel which displays the full range 

of the data and encloses the zoomed range by a rectangle. You can drag 

this rectangle over the chart, and the zoom window will follow 

automatically. Having MiniMap true displays a miniature chart for 

rough orientation. Again, you have to couple it to the chart of interest 

by means of the Chart property. In my feeling, however, there are 

still some weaknesses of this component, maybe I can look after them in 

the next days.



BTW: Do you know the TAChart documentation 

 http://wiki.lazarus.freepascal.org/TAChart_documentation? 





--

___

Lazarus mailing list

 Lazarus@lists.lazarus.freepascal.org 

 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 


 --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-10-07 Thread Kamen Ketev
 
When I am loading new
financialdemo there is an error (please see attached image). I was updated only 
tamultiseries.pas from 
http://svn.freepascal.org/svn/lazarus/trunk/components/tachart/. Which other 
files I must update?
 
Regards,
Kamen
 




 Оригинално писмо 
От:  Werner Pamler  
Относно: [Lazarus] TAChart CandleStick Chart
До: lazarus@lists.lazarus.freepascal.org
Изпратено на: Понеделник, 2014, Октомври 6 21:45:30 EEST


  How can I make color of the tails like body?

I uploaded a small modification today which takes care of your request: 

the color of the body border and the tails of the CandleStick series is 

determined by the property CandleStickLinePen. If you set this color to 

clDefault these lines will be painted in the color of the body. Please 

see the updated financial demo.



  How can I add HorzScrollBar or something like this and keep the 

scale of CandleStick?

In TAChart you can zoom by left-dragging a rectangle across the chart. 

And you can pan the zoomed window by dragging with the right-mouse 

button down. Or you can implement more sophisticated features by using 

the chart tools.



In addition, there is a TChartNavScrollbar which you can use to scroll 

the zoomed window across the chart range. You just have to link its 

Chart property to the chart which you want to control. The Min and 

Max of the scrollbar map to the data range used in the chart. To get 

day-by-day scrolling set the scrollbar's Min and Max to the 

corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x 

and b.x) at run-time.



Moreover, there is also a TChartNavPanel which displays the full range 

of the data and encloses the zoomed range by a rectangle. You can drag 

this rectangle over the chart, and the zoom window will follow 

automatically. Having MiniMap true displays a miniature chart for 

rough orientation. Again, you have to couple it to the chart of interest 

by means of the Chart property. In my feeling, however, there are 

still some weaknesses of this component, maybe I can look after them in 

the next days.



BTW: Do you know the TAChart documentation 

 http://wiki.lazarus.freepascal.org/TAChart_documentation? 





--

___

Lazarus mailing list

 Lazarus@lists.lazarus.freepascal.org 

 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 


 attachment: Error.jpg
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-10-07 Thread Werner Pamler

 (please see attached image)

Sorry I can't find an attachment here... What did you do? Replace the 
tamultiseries.pas in a TAChart of Lazarus 1.2.4? I'm not sure if this is 
gonna work because there have been several changes since 1.2.4. Switch 
to trunk, and you won't see an error.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-10-06 Thread Kamen Ketev
 
Thank you for adding CandleStick Chart!
 
I have 2 questions: 
In OHLC tails are in the same color like body but in CandleStick is not. When I 
change background to black tails hides. How can I make color of the tails like 
body? Maybe in
CandlestickLinePen add option to copy color from body? 
When I add big portion of data for example 2 years all period are in screen and
 CandleStick are too small. How can I add HorzScrollBar or something like this 
and keep the scale of 
CandleStick? I can zoom it but I want to scroll back to earlier time period. 
Kamen
 




 Оригинално писмо 
От:  Werner Pamler  
Относно: [Lazarus] TAChart CandleStick Chart
До: lazarus@lists.lazarus.freepascal.org
Изпратено на: Вторник, 2014, Септември 16 22:09:11 EEST


In r46244 the TOpenHighLowCloseSeries has a new property Mode: 

selection mOHLC does the standard painting as before while 

mChandleStick paints the candlesticks that you requested. Since your 

code was mostly a copy of existing code I decided to stick to the old 

series type, but just add the painting modes. There are also properties 

CandleStickUpBrush, CandleStickDownBrush and CandleStickLinePen to 

control painting of the up and down bars and the border and shadow line. 

I also added a little demo financial to the demo folder of the 

TAChart installation which demonstrates both modes. It would be nice if 

you could have a look if everything is fine - I'm not an expert in 

financial charts.



I also fixed the bug which ignored the true minimum of the data - 

therefore, it is no longer necessary to calculate the minimum by 

yourself, just have a look at the code in the demo project. And, 

finally, I modified the AddXOHLC method such that it automatically 

initializes the size of the YCount of the chart source if the current 

size would not be enough.



--

___

Lazarus mailing list

 Lazarus@lists.lazarus.freepascal.org 

 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 


 --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-10-06 Thread Werner Pamler

 How can I make color of the tails like body?
I uploaded a small modification today which takes care of your request: 
the color of the body border and the tails of the CandleStick series is 
determined by the property CandleStickLinePen. If you set this color to 
clDefault these lines will be painted in the color of the body. Please 
see the updated financial demo.


 How can I add HorzScrollBar or something like this and keep the 
scale of CandleStick?
In TAChart you can zoom by left-dragging a rectangle across the chart. 
And you can pan the zoomed window by dragging with the right-mouse 
button down. Or you can implement more sophisticated features by using 
the chart tools.


In addition, there is a TChartNavScrollbar which you can use to scroll 
the zoomed window across the chart range. You just have to link its 
Chart property to the chart which you want to control. The Min and 
Max of the scrollbar map to the data range used in the chart. To get 
day-by-day scrolling set the scrollbar's Min and Max to the 
corresponding values of the horizontal axis (Chart1.GetFullExtent.a.x 
and b.x) at run-time.


Moreover, there is also a TChartNavPanel which displays the full range 
of the data and encloses the zoomed range by a rectangle. You can drag 
this rectangle over the chart, and the zoom window will follow 
automatically. Having MiniMap true displays a miniature chart for 
rough orientation. Again, you have to couple it to the chart of interest 
by means of the Chart property. In my feeling, however, there are 
still some weaknesses of this component, maybe I can look after them in 
the next days.


BTW: Do you know the TAChart documentation 
http://wiki.lazarus.freepascal.org/TAChart_documentation?



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAchart frame left and top values

2014-09-21 Thread Werner Pamler

Sorry - my answer is in the other thread...

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé
Hi, I'm playing with the DataPointCrossHairTool, and I would like to 
know if it's possible to display the horizontal line on cursor's 
position, instead as the default data point value.


If mean, for example, my points are:

1: 10
2: 20
3: 30

When the mouse cursor is between 20 and 10, say 13 for example, the 
default behavior is displaying a line at 10 or 20, but what if I want to 
display the line just at 13?.



Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Werner Pamler

Hi, I'm playing with the DataPointCrossHairTool, and I would like to
know if it's possible to display the horizontal line on cursor's
position, instead as the default data point value.


Not 100% sure, but I believe that this tool always snaps to the data points.
An alternative would be to add a constant line series to the chart and use
a TDatapointDragTool to drag the line. Use the chart's MouseDown to show and
the MouseUp to hide the line. The toolsdemo in TAChart's demo folder is an
example of the basic idea (the green and purple dashed vertical lines).


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé

On 21/09/14 11:56, Werner Pamler wrote:

Hi, I'm playing with the DataPointCrossHairTool, and I would like to
know if it's possible to display the horizontal line on cursor's
position, instead as the default data point value.


Not 100% sure, but I believe that this tool always snaps to the data
points.
An alternative would be to add a constant line series to the chart and use
a TDatapointDragTool to drag the line. Use the chart's MouseDown to show
and
the MouseUp to hide the line. The toolsdemo in TAChart's demo folder
is an
example of the basic idea (the green and purple dashed vertical lines).


--


I kind of got what I need, based on Mouse.CursorPos and 
TAChart.ScreenToClient.


Now, I need to convert the mouse pos to a relative value to the axis.

In the AfterDrawBackWall event, to get current Y cursos position, I have:

ASender.ScreenToClient(Mouse.CursorPos).Y

Now, how can I convert that value to its relative to axis value.

Please, take a look at the attached screenshot, in the bottom chart, you 
can see the cursor and an horizontal line, with its value at the rigth 
axis, in this case is a 64 (yellow bold) between 3.50 and 4.00, instead 
of 64 I want to display the correct value (approx. 3.95).



--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Werner Pamler
To convert image coordinates (pixels within the chart rectangle which 
you, indeed, can obtain from the global mouse position converted to the 
local chart pixels) to graph coordinates you call the chart methods


* XImageToGraph(x:Integer): Double for x coordinates,
* YImageToGraph(y:Integer): Double for y coordinates, or
* ImageToGraph(P:TPoint): TDoublePoint (for both).

(or XGraphToImage() etc for the other direction).

If you do not use axis transformations, then graph coordinates directly 
refer to the units of your data. If, on the other hand, axis 
transformations are involved (logarithmic axes, multiple axes etc) the 
values on the axes may be different from the graph units used in an 
internal coordinate system. In this case, you have to link the series to 
the axis (by means of the AxisIndexX and AxisIndexY properties) and call 
the GraphToAxis or AxisToGraph methods of the AxisTransformation which 
is obtained from the method GetTransform of the axis. In your example of 
y values the transformation chain would be


  mouse point yi -- graph coords by yg := Chart.YImageToGraph(yi) --  
axis coords by ya := Chart.LeftAxis.GetTransform.GraphToAxis(yg).


Here, ya refers to your input data, yi to the pixel data.

But since you don't use transformations YImageToGraph is sufficient.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart DataPointCrossHairTool

2014-09-21 Thread Leonardo M. Ramé

On 21/09/14 16:54, Werner Pamler wrote:

To convert image coordinates (pixels within the chart rectangle which
you, indeed, can obtain from the global mouse position converted to the
local chart pixels) to graph coordinates you call the chart methods

* XImageToGraph(x:Integer): Double for x coordinates,
* YImageToGraph(y:Integer): Double for y coordinates, or
* ImageToGraph(P:TPoint): TDoublePoint (for both).

(or XGraphToImage() etc for the other direction).

If you do not use axis transformations, then graph coordinates directly
refer to the units of your data. If, on the other hand, axis
transformations are involved (logarithmic axes, multiple axes etc) the
values on the axes may be different from the graph units used in an
internal coordinate system. In this case, you have to link the series to
the axis (by means of the AxisIndexX and AxisIndexY properties) and call
the GraphToAxis or AxisToGraph methods of the AxisTransformation which
is obtained from the method GetTransform of the axis. In your example of
y values the transformation chain would be

   mouse point yi -- graph coords by yg := Chart.YImageToGraph(yi) --
axis coords by ya := Chart.LeftAxis.GetTransform.GraphToAxis(yg).

Here, ya refers to your input data, yi to the pixel data.

But since you don't use transformations YImageToGraph is sufficient.




Great!, here's a screenshot.

Meanwhile I found a way to get the Y pixel value of a point, as you can 
see, the 19.60 with yellow background refers to the last point in my 
series, and is drawn exactly at the same position of the Close Y Point. 
For this I used GetYImgValue( Index of last point ) of the series.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAchart frame left and top values

2014-09-20 Thread Leonardo M. Ramé
I need to draw text just at the top left corner of a chart, is there a 
property to allow me to know the top, left (and of course right and 
bottom) points of the frame containing the chart?.


I attached a screenshot showing what I'm looking for.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-09-17 Thread Leonardo M. Ramé

El 16/09/14 a las 16:09, Werner Pamler escibió:

In r46244 the TOpenHighLowCloseSeries has a new property Mode:
selection mOHLC does the standard painting as before while
mChandleStick paints the candlesticks that you requested. Since your
code was mostly a copy of existing code I decided to stick to the old
series type, but just add the painting modes. There are also properties
CandleStickUpBrush, CandleStickDownBrush and CandleStickLinePen to
control painting of the up and down bars and the border and shadow line.
I also added a little demo financial to the demo folder of the
TAChart installation which demonstrates both modes. It would be nice if
you could have a look if everything is fine - I'm not an expert in
financial charts.

I also fixed the bug which ignored the true minimum of the data -
therefore, it is no longer necessary to calculate the minimum by
yourself, just have a look at the code in the demo project. And,
finally, I modified the AddXOHLC method such that it automatically
initializes the size of the YCount of the chart source if the current
size would not be enough.




Great!, I'll take a look later today.

--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart with transparent background

2014-09-16 Thread Werner Pamler
I see. If you can keep the chart size unchanged then it is certainly a 
good idea to stretch the image to the requested size immediately after 
loading and use a simple Draw of the obtained image while charting. If 
you know the range of your data in advance it may also help to freeze 
the chart extent to avoid unnecessary repaints when data arrive. And you 
could also enclose the AddXY calls by calls to Begin/EndUpdate of the 
ChartSource. Avoiding unnecessary repainting can have a dramatic effect 
on speed.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-09-16 Thread Werner Pamler
In r46244 the TOpenHighLowCloseSeries has a new property Mode: 
selection mOHLC does the standard painting as before while 
mChandleStick paints the candlesticks that you requested. Since your 
code was mostly a copy of existing code I decided to stick to the old 
series type, but just add the painting modes. There are also properties 
CandleStickUpBrush, CandleStickDownBrush and CandleStickLinePen to 
control painting of the up and down bars and the border and shadow line. 
I also added a little demo financial to the demo folder of the 
TAChart installation which demonstrates both modes. It would be nice if 
you could have a look if everything is fine - I'm not an expert in 
financial charts.


I also fixed the bug which ignored the true minimum of the data - 
therefore, it is no longer necessary to calculate the minimum by 
yourself, just have a look at the code in the demo project. And, 
finally, I modified the AddXOHLC method such that it automatically 
initializes the size of the YCount of the chart source if the current 
size would not be enough.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-09-15 Thread Leonardo M. Ramé

El 14/09/14 a las 11:46, Werner Pamler escibió:

I'm not familiar with the multivalued series. But you chandlestick
series looks much like the Box/Whisker series which is included in
TAChart. Can you point out the difference?

--


Mm, they look similar, but Box/Whisker, has a top and bottom horizontal 
lines and an horizontal line in the middle of the candle, maybe adding a 
couple of boolean properties like TopMark, BottomMark and MiddleMark to 
the Box/Whisker chart will let use it as a CandleStick chart.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-09-15 Thread Werner Pamler
The TopMark and BottomMark, as you call it, can be removed by 
setting WhiskerWidth to 0, and the MiddleMark disappears with 
MedianPen.Style set to psClear. The Up and Down colors can be set by 
some logics when adding data points (there's the color parameter in the 
Add method...). The intrinsic problem that Box/Whisker expects 
ordered y values, while the Candle obviously does not (open can be 
greater or smaller then close), could be overcome by pre-sorting the 
data which should also take account of the Up/Down colors. Well, in 
total, these are a few lines of code, but relatively straightforward. 
Nevertheless, maybe too much for less code-centered guys?


Anyway, I'll try to add your contribution to a new CandleStick series. A 
few question before I begin: Your posting says that Candlestick plots do 
not have top and bottom marks, but the wikipedia reference that you gave 
does show them. What is true? What should be the default up and down colors?



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart CandleStick Chart

2014-09-15 Thread Leonardo M. Ramé




El 15/09/14 a las 15:49, Werner Pamler escibió:

The TopMark and BottomMark, as you call it, can be removed by
setting WhiskerWidth to 0, and the MiddleMark disappears with
MedianPen.Style set to psClear. The Up and Down colors can be set by
some logics when adding data points (there's the color parameter in the
Add method...). The intrinsic problem that Box/Whisker expects
ordered y values, while the Candle obviously does not (open can be
greater or smaller then close), could be overcome by pre-sorting the
data which should also take account of the Up/Down colors. Well, in
total, these are a few lines of code, but relatively straightforward.
Nevertheless, maybe too much for less code-centered guys?

Anyway, I'll try to add your contribution to a new CandleStick series. A
few question before I begin: Your posting says that Candlestick plots do
not have top and bottom marks, but the wikipedia reference that you gave
does show them. What is true? What should be the default up and down
colors?


Thanks. I'm used to see CandleStick charts in many Stock Trading 
software, and I never saw thos top and bottom marks. Default UP can be 
clLime and Down clRed.


P.S.: the next chart type is Heikin Ashi, a variation of CandleStick.


--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart with transparent background

2014-09-15 Thread Roberto P.
Though really late, I can confirm that the solution is working fine.
I still have to add some profiling code to measure it, though with added
background it seems perceivably slower even on a recent PC (core i5 vpro).
Are BGRA or other backends known to be faster?

thanks anyway for the help!

R#

2014-09-04 1:08 GMT+02:00 Roberto P. padovan...@gmail.com:

 Thank  you very much.
 I need a background image, therefore as soon as I am back at the office
 I'll try your code.
 Thank you again!

 R#


 2014-09-02 18:18 GMT+02:00 Werner Pamler werner.pam...@freenet.de:

 It is not fully clear to me what you mean by a chart with transparent
 background. Do you want to see the form underneath the chart? I fear this
 is not easily possible. Or do you want to have a background image in the
 chart? For the latter case this code is working fine with me:

 type
   TForm1 = class(TForm)
 Chart1: TChart;
 procedure Chart1BeforeDrawBackground(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 procedure Chart1BeforeDrawBackWall(ASender: TChart; ACanvas: TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 procedure FormCreate(Sender: TObject);
 procedure FormDestroy(Sender: TObject);
   private
 { private declarations }
 FBackImage: TPicture;
   public
 { public declarations }
   end;
 
 procedure TForm1.Chart1BeforeDrawBackWall(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 begin
   ADoDefaultDrawing := false;
   ACanvas.StretchDraw(ARect, FBackImage.Graphic);
 end;

 procedure TForm1.Chart1BeforeDrawBackground(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 begin
   ACanvas.GradientFill(ARect, clSkyBlue, clWhite, gdVertical);
   ADoDefaultDrawing := false;
 end;

 procedure TForm1.FormCreate(Sender: TObject);
 begin
   FBackImage := TPicture.Create;
   FBackImage.LoadFromFile('C:\lazarus-svn\images\splash_logo.png');
   // please adapt this path to your lazarus installation
 end;

 procedure TForm1.FormDestroy(Sender: TObject);
 begin
   FBackImage.Free;
 end;

 The basic idea is to assign a handler to the chart events
 OnBeforeDrawBackWall or OnBeforeDrawBackground and disable the default
 background painting by setting ADoDefaultDrawing to false. The first event
 replaces painting of the area enclosed by the chart's frame (Back wall),
 the other one replaces painting of the entire chart background. Above
 example paints the Lazarus splash-logo as BackWall and a gradient as
 background.

 Maybe I'll once write a tutorial on this topic...


 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart with transparent background

2014-09-15 Thread Werner Pamler
I added some simple time measuring code (using GetTickCount) to the 
background image tutorial to see the speed loss that you mention: 
Without the backgrounds (Lazarus logo and gradient) the GetTickCount 
reports 0 ms between the OnBeforeDrawBackground and OnAfterPaint events, 
while with the backgrounds it reports 16 ms, sometimes 0 ms. Replacing 
the StretchDraw by a simple Draw in the painting of the logo,  brings 
down the time also to 0. Therefore I'd guess that the background 
painting is not perceivable unless you squeeze a 20 mega-pixel photo 
into the chart area or load the image during the painting event.


What exactly are you doing?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart with transparent background

2014-09-15 Thread Roberto P.
The image is a 30KB png, not much.
It is smaller than the area, so it gets actually stretched.
Can I use Draw instead of StretchDraw if I make the image exactly the size
I need?
I can force the form size.

I think that tens of milliseconds can be actually relevant, because I am
plotting data received (and processed) every 50ms from a serial port.

R#

2014-09-16 0:07 GMT+02:00 Werner Pamler werner.pam...@freenet.de:

 I added some simple time measuring code (using GetTickCount) to the
 background image tutorial to see the speed loss that you mention: Without
 the backgrounds (Lazarus logo and gradient) the GetTickCount reports 0 ms
 between the OnBeforeDrawBackground and OnAfterPaint events, while with the
 backgrounds it reports 16 ms, sometimes 0 ms. Replacing the StretchDraw by
 a simple Draw in the painting of the logo,  brings down the time also to 0.
 Therefore I'd guess that the background painting is not perceivable unless
 you squeeze a 20 mega-pixel photo into the chart area or load the image
 during the painting event.

 What exactly are you doing?


 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart Date Axis Remove Weekends

2014-09-14 Thread Werner Pamler
Don't use the real date as x value. Instead, use a counter value that is 
incremented every time you add a value to the series. Don't add data if 
the DayOfWeek of their date is 6 (Friday) or 7 (Saturday). In the data 
you posted in your previous message the weekends are already messing, 
therefore you can simply use the line index I for the x coordinate of 
the data point.


The problem left is the display of the axis labels. Your code in the 
other posting already adds a data label to each series point (last 
parameter of AddXOHLC shown). To activate it set the Style of the 
Chart.BottomAxis.Marks to smsLabel, and don't forget to link the 
ListSource of the series (that's where your AddXOHLC data go to) to the 
Source of the BottomAxis.Marks.


However, the x labels will be quite crowded and overlapping. There are 
several ways to get rid of that: Use some logics in creating the data 
labels - for example, if you want labels only for Monday set the 
DateToStr(lDate) to the data label only if the DayOfWeek(lDate) is 2 
(Monday), and use an empty string otherwise. Or you can play with the 
Intervals property of the BottomAxis to increase the distance of the 
labels, e.g. Intervals.MinLength=100, Intervals.MaxLength=200. Or you 
can rotate the label by 90 degrees 
(BottomAxis.Marks.LabelFont.Orientation = 900)



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Date Axis Remove Weekends

2014-09-14 Thread Leonardo M. Ramé

On 14/09/14 06:57, Werner Pamler wrote:

Don't use the real date as x value. Instead, use a counter value that is
incremented every time you add a value to the series. Don't add data if
the DayOfWeek of their date is 6 (Friday) or 7 (Saturday). In the data
you posted in your previous message the weekends are already messing,
therefore you can simply use the line index I for the x coordinate of
the data point.

The problem left is the display of the axis labels. Your code in the
other posting already adds a data label to each series point (last
parameter of AddXOHLC shown). To activate it set the Style of the
Chart.BottomAxis.Marks to smsLabel, and don't forget to link the
ListSource of the series (that's where your AddXOHLC data go to) to the
Source of the BottomAxis.Marks.

However, the x labels will be quite crowded and overlapping. There are
several ways to get rid of that: Use some logics in creating the data
labels - for example, if you want labels only for Monday set the
DateToStr(lDate) to the data label only if the DayOfWeek(lDate) is 2
(Monday), and use an empty string otherwise. Or you can play with the
Intervals property of the BottomAxis to increase the distance of the
labels, e.g. Intervals.MinLength=100, Intervals.MaxLength=200. Or you
can rotate the label by 90 degrees
(BottomAxis.Marks.LabelFont.Orientation = 900)




Thanks! Werner, the chart is starting to look very good.

Now, I need to define the range of left axis. By default it starts on 0 
(bottom left) and ends in the highest value of my data. How can I change 
the starting value, to the minimum value of the data source?.


Currently all the data poins are displayed at the top part of the chart, 
and from 0 to 70 is empty.



--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart Date Axis Remove Weekends

2014-09-14 Thread Werner Pamler
I don't know, at the moment, where the minimum is forced to 0 - normally 
this does not happen, it is probably a bug with the multi-value series 
which I don't use that much, I don't know...


Until this is fixed you have to determine the minimum of the y axis on 
your own. Declare a variable mn: Double, set it to a very large value 
before you begin reading data (mn := 1E308), and then, each time after 
adding a value to the series, compare the currently added Low-value (it 
should be the smallest one of this record) with the current mn value and 
update it: if lLow  mn then mn := lLow.


At the end, use the Chart's Extent property to force the yMin to the 
final result obtained for mn: Chart1.Extent.YMin := mn. And this 
setting has to be activated by setting the Extent's UseYMin to true: 
Chart1.Extent.UseYMin := true.




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart Date Axis Remove Weekends

2014-09-14 Thread Leonardo M. Ramé

On 14/09/14 08:35, Leonardo M. Ramé wrote:

On 14/09/14 06:57, Werner Pamler wrote:

Don't use the real date as x value. Instead, use a counter value that is
incremented every time you add a value to the series. Don't add data if
the DayOfWeek of their date is 6 (Friday) or 7 (Saturday). In the data
you posted in your previous message the weekends are already messing,
therefore you can simply use the line index I for the x coordinate of
the data point.

The problem left is the display of the axis labels. Your code in the
other posting already adds a data label to each series point (last
parameter of AddXOHLC shown). To activate it set the Style of the
Chart.BottomAxis.Marks to smsLabel, and don't forget to link the
ListSource of the series (that's where your AddXOHLC data go to) to the
Source of the BottomAxis.Marks.

However, the x labels will be quite crowded and overlapping. There are
several ways to get rid of that: Use some logics in creating the data
labels - for example, if you want labels only for Monday set the
DateToStr(lDate) to the data label only if the DayOfWeek(lDate) is 2
(Monday), and use an empty string otherwise. Or you can play with the
Intervals property of the BottomAxis to increase the distance of the
labels, e.g. Intervals.MinLength=100, Intervals.MaxLength=200. Or you
can rotate the label by 90 degrees
(BottomAxis.Marks.LabelFont.Orientation = 900)




Thanks! Werner, the chart is starting to look very good.

Now, I need to define the range of left axis. By default it starts on 0
(bottom left) and ends in the highest value of my data. How can I change
the starting value, to the minimum value of the data source?.

Currently all the data poins are displayed at the top part of the chart,
and from 0 to 70 is empty.




Please forget about this, solved by setting Chart1.Extent.UseYMax and 
UseYMin.


Regards,

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-09-14 Thread Leonardo M. Ramé
Hi, I inherited TOpenHighLowCloseSeries to implement CandleStick Charts: 
http://en.wikipedia.org/wiki/Candlestick_chart


I only implemented the Draw method, but it would be nice to have this 
properties in the final version also:


CandleColor: fill color of default or UP candle.
DownCandleColor: fill color of down candle

By now I use LinePen.Color and DownLinePen.Color as color of brush (fill 
of candle color) and the border is allways clBlack.


Can someone include it in TAMultiseries?

// interface

{ TCandleStickChart }

TCandleStickChart = class(TOpenHighLowCloseSeries)
public
  procedure Draw(ADrawer: IChartDrawer); override;
end;

// implementation

procedure TCandleStickChart.Draw(ADrawer: IChartDrawer);

  function MaybeRotate(AX, AY: Double): TPoint;
  begin
if IsRotated then
  Exchange(AX, AY);
Result := ParentChart.GraphToImage(DoublePoint(AX, AY));
  end;

  procedure DoLine(AX1, AY1, AX2, AY2: Double);
  begin
ADrawer.Line(MaybeRotate(AX1, AY1), MaybeRotate(AX2, AY2));
  end;

  function GetGraphPointYIndex(AIndex, AYIndex: Integer): Double;
  begin
if AYIndex = 0 then
  Result := GetGraphPointY(AIndex)
else
  Result := AxisToGraphY(Source[AIndex]^.YList[AYIndex - 1]);
  end;

  procedure DoRect(AX1, AY1, AX2, AY2: Double);
  var
r: TRect;
  begin
with ParentChart do begin
  r.TopLeft := MaybeRotate(AX1, AY1);
  r.BottomRight := MaybeRotate(AX2, AY2);
end;
ADrawer.FillRect(r.Left, r.Top, r.Right, r.Bottom);
ADrawer.Rectangle(r);
  end;

var
  my: Cardinal;
  ext2: TDoubleRect;
  i: Integer;
  x, tw, yopen, yhigh, ylow, yclose: Double;
  p: TPen;
begin
  my := MaxIntValue([YIndexOpen, YIndexHigh, YIndexLow, YIndexClose]);
  if IsEmpty or (my = Source.YCount) then exit;

  ext2 := ParentChart.CurrentExtent;
  ExpandRange(ext2.a.X, ext2.b.X, 1.0);
  ExpandRange(ext2.a.Y, ext2.b.Y, 1.0);

  PrepareGraphPoints(ext2, true);

  for i := FLoBound to FUpBound do begin
x := GetGraphPointX(i);
yopen := GetGraphPointYIndex(i, YIndexOpen);
yhigh := GetGraphPointYIndex(i, YIndexHigh);
ylow := GetGraphPointYIndex(i, YIndexLow);
yclose := GetGraphPointYIndex(i, YIndexClose);
tw := GetXRange(x, i) * PERCENT * TickWidth;

if (DownLinePen.Color = clTAColor) or (yopen = yclose) then
  p := LinePen
else
  p := DownLinePen;
ADrawer.BrushColor:= P.Color;
// set border black
ADrawer.SetPenParams(p.Style, clBlack);
DoLine(x, yhigh, x, ylow);
DoRect(x - tw, yopen, x + tw, yclose);
  end;
end;

I attached a screenshot of the result.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart CandleStick Chart

2014-09-14 Thread Werner Pamler
I'm not familiar with the multivalued series. But you chandlestick 
series looks much like the Box/Whisker series which is included in 
TAChart. Can you point out the difference?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart OHLC

2014-09-13 Thread Leonardo M. Ramé
Hi, I'm trying to create a basic Open High Low Close chart using 
TAChart, but I'm getting a RunError(201) on tacustomsource.pas line 
433, aparently YList is not initialized.


Here's the lfm:

object Form1: TForm1
  Left = 364
  Height = 354
  Top = 255
  Width = 582
  Caption = 'Form1'
  ClientHeight = 354
  ClientWidth = 582
  OnShow = FormShow
  LCLVersion = '1.3'
  object Chart1: TChart
Left = 0
Height = 354
Top = 0
Width = 582
AxisList = 
  item
Minors = 
Title.LabelFont.Orientation = 900
  end
  item
Alignment = calBottom
Minors = 
  end
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
  'TAChart'
)
Align = alClient
ParentColor = False
object Chart1OpenHighLowCloseSeries1: TOpenHighLowCloseSeries
end
  end
end

And Here's the .pas

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, TAGraph, TASources, TAIntervalSources,
  TAMultiSeries, Forms, Controls, Graphics, Dialogs,
  StrUtils, DateUtils, TACustomSeries;

type

  { TForm1 }

  TForm1 = class(TForm)
Chart1: TChart;
Chart1OpenHighLowCloseSeries1: TOpenHighLowCloseSeries;
procedure FormShow(Sender: TObject);
  private
{ private declarations }
  public
{ public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }


procedure TForm1.FormShow(Sender: TObject);
var
  lCSV: TStringList;
  lLine: TStringList;
  I: Integer;
  lDate: TDate;
  lOpen: double;
  lHigh: double;
  lLow: double;
  lClose: double;
  lStr: string;
begin
  lCSV := TStringList.Create;
  lLine := TStringList.Create;
  DefaultFormatSettings.DateSeparator:='-';
  DefaultFormatSettings.ShortDateFormat:='D-MMM-Y';
  DefaultFormatSettings.ShortMonthNames[1] := 'Jan';
  DefaultFormatSettings.ShortMonthNames[2] := 'Feb';
  DefaultFormatSettings.ShortMonthNames[3] := 'Mar';
  DefaultFormatSettings.ShortMonthNames[4] := 'Apr';
  DefaultFormatSettings.ShortMonthNames[5] := 'May';
  DefaultFormatSettings.ShortMonthNames[6] := 'Jun';
  DefaultFormatSettings.ShortMonthNames[7] := 'Jul';
  DefaultFormatSettings.ShortMonthNames[8] := 'Aug';
  DefaultFormatSettings.ShortMonthNames[9] := 'Sep';
  DefaultFormatSettings.ShortMonthNames[10] := 'Oct';
  DefaultFormatSettings.ShortMonthNames[11] := 'Nov';
  DefaultFormatSettings.ShortMonthNames[12] := 'Dec';
  try
lCSV.LoadFromFile('aapl.csv');
for I := 0 to lCSV.Count - 1 do
begin
  if I = 0 then
continue;
  lLine.CommaText:= lCSV[I];
  lDate := ScanDateTime('d-mmm-y', lLine[0]);
  lOpen := StrToFloat(lLine[1]);
  lHigh := StrToFloat(lLine[2]);
  lLow := StrToFloat(lLine[3]);
  lClose := StrToFloat(lLine[4]);
  Chart1OpenHighLowCloseSeries1.AddXOHLC(I, lOpen, lHigh, lLow, 
lClose, DateToStr(lDate));

end;
  finally
lLine.Free;
lCSV.Free;
  end;
end;

end.

Also I attached the file aapl.csv I'm using to feed the data.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com
Date,Open,High,Low,Close,Volume
10-Sep-14,98.01,101.11,97.76,101.00,100869587
9-Sep-14,99.08,103.08,96.14,97.99,189846255
8-Sep-14,99.30,99.31,98.05,98.36,46356742
5-Sep-14,98.80,99.39,98.31,98.97,58457035
4-Sep-14,98.85,100.09,97.79,98.12,85718221
3-Sep-14,103.10,103.20,98.58,98.94,125420521
2-Sep-14,103.06,103.74,102.72,103.30,53564262
29-Aug-14,102.86,102.90,102.20,102.50,44595247
28-Aug-14,102.13,102.78,101.56,102.25,68459801
27-Aug-14,101.02,102.57,100.70,102.13,52369011
26-Aug-14,101.42,101.50,100.86,100.89,33151984
25-Aug-14,101.79,102.17,101.28,101.54,40270173
22-Aug-14,100.29,101.47,100.19,101.32,44183834
21-Aug-14,100.57,100.94,100.11,100.58,33478198
20-Aug-14,100.44,101.09,99.95,100.57,52699192
19-Aug-14,99.41,100.68,99.32,100.53,69399270
18-Aug-14,98.49,99.37,97.98,99.16,47572413
15-Aug-14,97.90,98.19,96.86,97.98,48951331
14-Aug-14,97.33,97.57,96.80,97.50,28115566
13-Aug-14,96.15,97.24,96.04,97.24,31916439
12-Aug-14,96.04,96.88,95.61,95.97,33795352
11-Aug-14,95.27,96.08,94.84,95.99,36584844
8-Aug-14,94.26,94.82,93.28,94.74,41865193
7-Aug-14,94.93,95.95,94.10,94.48,46711179
6-Aug-14,94.75,95.48,94.71,94.96,38558342
5-Aug-14,95.36,95.68,94.36,95.12,55932663
4-Aug-14,96.37,96.58,95.17,95.59,39958144
1-Aug-14,94.90,96.62,94.81,96.13,48511286
31-Jul-14,97.16,97.45,95.33,95.60,56842647
30-Jul-14,98.44,98.70,97.67,98.15,33010001
29-Jul-14,99.33,99.44,98.25,98.38,43143095
28-Jul-14,97.82,99.24,97.55,99.02,55317689
25-Jul-14,96.85,97.84,96.64,97.67,43469117
24-Jul-14,97.04,97.32,96.42,97.03,45728843
23-Jul-14,95.42,97.88,95.17,97.19,92917719
22-Jul-14,94.68,94.89,94.12,94.72,55196597
21-Jul-14,94.99,95.00,93.72,93.94,39079002
18-Jul-14,93.62,94.74,93.02,94.43,49987593
17-Jul-14,95.03,95.28,92.57,93.09,57298243
16-Jul-14,96.97,97.10,94.74,94.78,53502415
15-Jul-14,96.80,96.85,95.03,95.32,45696176
14-Jul-14,95.86,96.89,95.65,96.45,42810155

[Lazarus] TAChart OHLC

2014-09-13 Thread Werner Pamler
You need to initialize the YCount of the chart source. Just call 
Chart1OpenHighLowCloseSeries1.ListSource.YCount := 4 before adding the 
data. 
(http://wiki.lazarus.freepascal.org/TAChart_documentation#Open-high-low-close_series)



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart Date Axis Remove Weekends

2014-09-13 Thread Leonardo M. Ramé
Hi, I'm using TAChart to plot OHLC Stock prices and would like to ignore 
weekends. Is it possible to do that?.


--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart with transparent background

2014-09-03 Thread Roberto P.
Thank  you very much.
I need a background image, therefore as soon as I am back at the office
I'll try your code.
Thank you again!

R#


2014-09-02 18:18 GMT+02:00 Werner Pamler werner.pam...@freenet.de:

 It is not fully clear to me what you mean by a chart with transparent
 background. Do you want to see the form underneath the chart? I fear this
 is not easily possible. Or do you want to have a background image in the
 chart? For the latter case this code is working fine with me:

 type
   TForm1 = class(TForm)
 Chart1: TChart;
 procedure Chart1BeforeDrawBackground(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 procedure Chart1BeforeDrawBackWall(ASender: TChart; ACanvas: TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 procedure FormCreate(Sender: TObject);
 procedure FormDestroy(Sender: TObject);
   private
 { private declarations }
 FBackImage: TPicture;
   public
 { public declarations }
   end;
 
 procedure TForm1.Chart1BeforeDrawBackWall(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 begin
   ADoDefaultDrawing := false;
   ACanvas.StretchDraw(ARect, FBackImage.Graphic);
 end;

 procedure TForm1.Chart1BeforeDrawBackground(ASender: TChart; ACanvas:
 TCanvas;
   const ARect: TRect; var ADoDefaultDrawing: Boolean);
 begin
   ACanvas.GradientFill(ARect, clSkyBlue, clWhite, gdVertical);
   ADoDefaultDrawing := false;
 end;

 procedure TForm1.FormCreate(Sender: TObject);
 begin
   FBackImage := TPicture.Create;
   FBackImage.LoadFromFile('C:\lazarus-svn\images\splash_logo.png');
   // please adapt this path to your lazarus installation
 end;

 procedure TForm1.FormDestroy(Sender: TObject);
 begin
   FBackImage.Free;
 end;

 The basic idea is to assign a handler to the chart events
 OnBeforeDrawBackWall or OnBeforeDrawBackground and disable the default
 background painting by setting ADoDefaultDrawing to false. The first event
 replaces painting of the area enclosed by the chart's frame (Back wall),
 the other one replaces painting of the entire chart background. Above
 example paints the Lazarus splash-logo as BackWall and a gradient as
 background.

 Maybe I'll once write a tutorial on this topic...


 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart with transparent background

2014-09-02 Thread Roberto P.
Dear List,

is it possible to have a chart with transparent background, so that a
picture behind the plot is visible?

From the wiki I understand that TAChart does not support BackImage property
as in Delphi, which would fit the purpouse.
However I read thay using BGRAbitmap as a back-end it is possible to use
transparency. I managed to install the required packages and activate the
back-end, but I did not understand from the tutorial (
http://wiki.freepascal.org/BGRABitmap_tutorial_TAChart) how to go on.

Does anyone has an example?

Thanks a lot,

  R#
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart with transparent background

2014-09-02 Thread Werner Pamler
It is not fully clear to me what you mean by a chart with transparent 
background. Do you want to see the form underneath the chart? I fear 
this is not easily possible. Or do you want to have a background image 
in the chart? For the latter case this code is working fine with me:


type
  TForm1 = class(TForm)
Chart1: TChart;
procedure Chart1BeforeDrawBackground(ASender: TChart; ACanvas: TCanvas;
  const ARect: TRect; var ADoDefaultDrawing: Boolean);
procedure Chart1BeforeDrawBackWall(ASender: TChart; ACanvas: TCanvas;
  const ARect: TRect; var ADoDefaultDrawing: Boolean);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
  private
{ private declarations }
FBackImage: TPicture;
  public
{ public declarations }
  end;

procedure TForm1.Chart1BeforeDrawBackWall(ASender: TChart; ACanvas: TCanvas;
  const ARect: TRect; var ADoDefaultDrawing: Boolean);
begin
  ADoDefaultDrawing := false;
  ACanvas.StretchDraw(ARect, FBackImage.Graphic);
end;

procedure TForm1.Chart1BeforeDrawBackground(ASender: TChart; ACanvas: 
TCanvas;

  const ARect: TRect; var ADoDefaultDrawing: Boolean);
begin
  ACanvas.GradientFill(ARect, clSkyBlue, clWhite, gdVertical);
  ADoDefaultDrawing := false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  FBackImage := TPicture.Create;
  FBackImage.LoadFromFile('C:\lazarus-svn\images\splash_logo.png');
  // please adapt this path to your lazarus installation
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FBackImage.Free;
end;

The basic idea is to assign a handler to the chart events 
OnBeforeDrawBackWall or OnBeforeDrawBackground and disable the default 
background painting by setting ADoDefaultDrawing to false. The first 
event replaces painting of the area enclosed by the chart's frame (Back 
wall), the other one replaces painting of the entire chart background. 
Above example paints the Lazarus splash-logo as BackWall and a gradient 
as background.


Maybe I'll once write a tutorial on this topic...


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] tachart legend colorbar

2014-03-31 Thread Andrea Mauri

Dear all,

I would like to know if it is possible to add to a TAChart a legend as a 
colorbar (see 
http://www.google.it/imgres?imgurl=http%3A%2F%2Fi45.tinypic.com%2F2qsqvrk.pngimgrefurl=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F2925806%2Ffixing-color-in-scatter-plots-in-matplotlibh=407w=978tbnid=458f2PJaHo4RkM%3Azoom=1docid=Ycay3CVBtNtDgMei=gC45U5nKEIaLtAbpyYGAAQtbm=ischved=0CGIQhBwwBAiact=rcdur=349page=1start=0ndsp=36)


I would like to add a serie where points are coloured depending on a 
value (e.g. 0 - blue, 1 - red and values between 0 and 1 coloured 
changing gradually between blue and red) and I would like to display the 
legend accordingly in a gradient colorbar manner. Is it possible?


Best regards,
Andrea Mauri

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart stopped working

2014-03-07 Thread Marc Santhoff
Replying to myself:

On Mo, 2014-03-03 at 02:41 +0100, Marc Santhoff wrote:
 Hi,
 
 while running a program using TAChart with a newer version of Lazarus
 (1.0.10 or 1.0.14) and fpc 2.6.2 an exception ERangeError is thrown.
 The program dates before Lazarus 1.0.10 and worked flawlessly then.
 
 The error occurs in line 1103 of TACustomSeries:
 
 code
 procedure TBasicPointSeries.PrepareGraphPoints(
   const AExtent: TDoubleRect; AFilterByExtent: Boolean);
 ...
   SetLength(FGraphPoints, FUpBound - FLoBound + 1);
   if (AxisIndexX  0) and (AxisIndexY  0) then
 ...
 /code
 
 when SetLength is called.
 
 I'm using 4 UserDefinedChartSeries for drawing 4 graphs. The
 PointsNumber is 256. When SetLenght is called, in FGraphPoints does have
 approriate contents, FUpBound is 0 and FLoBound is 255.
 
 Before I document the complete workings of my program I'd like to ask:
 Has there been any change making this one a known issue?

Actually there have been lots of changes since 1.0.10. A new (short)
test using laz 1.2 works flawlessly.

Thanks for the effort, fpc + lazarus is still the best thing one can
get. :)

-- 
Marc Santhoff m.santh...@web.de


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart stopped working

2014-03-02 Thread Marc Santhoff
Hi,

while running a program using TAChart with a newer version of Lazarus
(1.0.10 or 1.0.14) and fpc 2.6.2 an exception ERangeError is thrown.
The program dates before Lazarus 1.0.10 and worked flawlessly then.

The error occurs in line 1103 of TACustomSeries:

code
procedure TBasicPointSeries.PrepareGraphPoints(
  const AExtent: TDoubleRect; AFilterByExtent: Boolean);
...
  SetLength(FGraphPoints, FUpBound - FLoBound + 1);
  if (AxisIndexX  0) and (AxisIndexY  0) then
...
/code

when SetLength is called.

I'm using 4 UserDefinedChartSeries for drawing 4 graphs. The
PointsNumber is 256. When SetLenght is called, in FGraphPoints does have
approriate contents, FUpBound is 0 and FLoBound is 255.

Before I document the complete workings of my program I'd like to ask:
Has there been any change making this one a known issue?

TIA,
Marc


-- 
Marc Santhoff m.santh...@web.de


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart - Logarithmic Transform fails for X Axis

2013-12-13 Thread Peter Thurner


Hello again,

I changed now from Lazarus 64 Bit to 32 Bit version and there it works 
as expected.

BR Peter


Am 13.12.2013 22:18, schrieb Peter Thurner:

Hello *,

here is an example which I use to try log transform for x-axis:
Can anybody try out please the code below which plots a sin(x)/x curve 
between 1 ... 100 in linear scale.

(please see attached picture).

If I apply a log10 transform to the x axis, then I always get a Range 
Check Error!

What do I do wrong here?
Thanks in advance for your help.

===
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, TAGraph, TATransformations, TASeries,
  TAFuncSeries, TAIntervalSources, Forms, Controls, Graphics, Dialogs;

type

  { TForm1 }

  TForm1 = class(TForm)
Chart1: TChart;
ChartAxisTransformations1: TChartAxisTransformations;
LogarithmAxis: TLogarithmAxisTransform;
SincSeries: TLineSeries;
procedure FormCreate(Sender: TObject);
  private
{ private declarations }
  public
{ public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
const
  N = 1000;
  MIN = 0.1;
  MAX = 100;
var
  i: integer;
  x: double;
begin
  for i := 0 to N - 1 do
  begin
x := MIN + (MAX - MIN) * i / (N - 1);
SincSeries.AddXY(x, sin(x)/x);
  end;
end;

end.
===


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart - Logarithmic Transform fails for X Axis

2013-12-09 Thread Peter Thurner

Hello Salvatore,
Thanks for the reply.
Yes, I used the same dataset and switched x and y. It worked when I did 
log transform with left-axis.

the same dataset fails if I switch x and y and do transform on bottom axis.
BR Peter


Am 08.12.2013 18:44, schrieb Salvatore Coppola:

Have you checked data (0)?
Salvatore


2013/12/7 Peter Thurner pm.thur...@gmx.at mailto:pm.thur...@gmx.at

Hello *,

This is the first time that I post something, so please be patient
with me :-)

I have been using Plotpanel now for a while to plot Bode diagrams
within Lazarus GUIs.
Now I would like to switch to TAChart which seems very powerfull too.
I tried it out with linear graphs and it works very well.

But If I try to plot a bode diagram with a logarithmic x Axis then
it crashes.
I followed the tutorial about logarithmic transform:

http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting
and I did all the steps successfully.

BUT If I try to apply a logarithmic transform to the bottom axis
(x-axis) then it crashes.
It displays the graph but the grid lines are gone.
Has anybody tried already to apply log transform to bottom axis?
It works for left axis.

Thanks
PeterT

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
mailto:Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart - Logarithmic Transform fails for X Axis

2013-12-08 Thread Salvatore Coppola
Have you checked data (0)?
Salvatore


2013/12/7 Peter Thurner pm.thur...@gmx.at

 Hello *,

 This is the first time that I post something, so please be patient with me
 :-)

 I have been using Plotpanel now for a while to plot Bode diagrams within
 Lazarus GUIs.
 Now I would like to switch to TAChart which seems very powerfull too.
 I tried it out with linear graphs and it works very well.

 But If I try to plot a bode diagram with a logarithmic x Axis then it
 crashes.
 I followed the tutorial about logarithmic transform:
 http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_
 Axis,_Fitting
 and I did all the steps successfully.

 BUT If I try to apply a logarithmic transform to the bottom axis (x-axis)
 then it crashes.
 It displays the graph but the grid lines are gone.
 Has anybody tried already to apply log transform to bottom axis? It works
 for left axis.

 Thanks
 PeterT

 --
 ___
 Lazarus mailing list
 Lazarus@lists.lazarus.freepascal.org
 http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart - Logarithmic Transform fails for X Axis

2013-12-07 Thread Peter Thurner

Hello *,

This is the first time that I post something, so please be patient with 
me :-)


I have been using Plotpanel now for a while to plot Bode diagrams within 
Lazarus GUIs.

Now I would like to switch to TAChart which seems very powerfull too.
I tried it out with linear graphs and it works very well.

But If I try to plot a bode diagram with a logarithmic x Axis then it 
crashes.

I followed the tutorial about logarithmic transform:
http://wiki.freepascal.org/TAChart_Tutorial:_ListChartSource,_Logarithmic_Axis,_Fitting
and I did all the steps successfully.

BUT If I try to apply a logarithmic transform to the bottom axis 
(x-axis) then it crashes.

It displays the graph but the grid lines are gone.
Has anybody tried already to apply log transform to bottom axis? It 
works for left axis.


Thanks
PeterT

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart with AggPas drawer

2013-05-12 Thread Graeme Geldenhuys
Hi,

http://wiki.lazarus.freepascal.org/TAChart_documentation#AggPas_drawer

Based on the above URL, it states that there are some limitations in
TAChart support.

Unfortunately there is no content or links listing those limitations.
Anybody no where I could find this information?



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart : not reading the OnMarkToText event handler from lfm ?

2013-03-27 Thread Lukasz Sokol
Hello TAChart devs,

on Lazarus 0.9.30 r29749 FPC 2.4.2 i386-win32-win32/win64

it seems the TAChart.AxisList[1] (Bottom) is forgetting
to read the OnMarkToText assignment from lfm (excerpt below)

 item
Alignment = calBottom
Marks.AtDataOnly = True
Title.Visible = True
Title.Caption = 'Date'
OnMarkToText = Chart2AxisList1MarkToText
  end

(i.e. when starting Lazarus or reopening a project,
the OnMarkToText event is empty in the Object Inspector,
which leads to a problem if the form is modified,
because the assignment is lost and has to be reinstated by hand)

Shall I bug or is it fixed in later release(s)?

(I guess it's not worth to create example app, try this:
- put a TChart on a form
- add 3 items to AxisList (left, bottom, right) (this is the order I have them 
at)
- in object inspector go to Chart1, AxisList, 1 - Bottom
- change the Title and other properties to it (see above excerpt of lfm)
- add a function to OnMarkToText event
- save project, compile, etc,
- close project/ close lazarus
- reopen project / launch lazarus
- the title and alignment and visibility is preserved, event OnMarkToText is 
NOT.)

Kind Regards

Lukasz


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart : not reading the OnMarkToText event handler from lfm ?

2013-03-27 Thread Alexander Klenin
On Wed, Mar 27, 2013 at 5:17 PM, Lukasz Sokol el.es...@gmail.com wrote:
 on Lazarus 0.9.30 r29749 FPC 2.4.2 i386-win32-win32/win64

 it seems the TAChart.AxisList[1] (Bottom) is forgetting
 to read the OnMarkToText assignment from lfm (excerpt below)

 Shall I bug or is it fixed in later release(s)?

It should be.


--
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart

2013-01-28 Thread Mattias Gaertner
On Tue, 29 Jan 2013 07:34:22 +1100
Alexander Klenin kle...@gmail.com wrote:

 On Tue, Jan 29, 2013 at 7:11 AM, Mattias Gaertner
 nc-gaert...@netcologne.de wrote:
  Hi Alexander,
 If you do not mind, I would prefer public discussion of TAChart-related 
 topics.

No problem.
Maybe someone knows a nice graph visualization control.

 
  Does TAChart has something like this:
  http://bost.ocks.org/mike/uberdata/
 
 No. This is quite interestiong diagram type, which I would like to add.
 However, it requires graph data as input, completely different from usual
 linear data used for all other diargam types, so is not easy.
 
  or some force layout like this:
  http://bost.ocks.org/mike/fisheye/
 
 Do you mean points-and-lines graph representation or fisheye distortion?

I meant force layouted graph with fisheye distortion.
I need to show strong connected components of a graph.

 If first, then yes, you can use one point series and one line series
 to draw such diargam.
 If second -- the no, currently only single-axis transformations are supported.
 However, Cartesian distortion depicted lower on this page is possible --
 see axistransf demo for similar example.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart equal range in two charts

2012-11-04 Thread Leonardo M . Ramé
Hi, I need to set the same range in two contiguous charts. 

To let you easily understand what I need, I attached a screenshot of two
charts. Aftert the first chart is created, the range is defined
automatically by TAChart, then I need the 2nd chart use the same Y
range (from 520 to 700). How can get that range to use in the 2nd
chart?.

Regards,
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
attachment: graphs.png--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart equal range in two charts

2012-11-04 Thread Alexander Klenin
On Mon, Nov 5, 2012 at 4:55 AM, Leonardo M. Ramé l.r...@griensu.com wrote:
 Hi, I need to set the same range in two contiguous charts.

 To let you easily understand what I need, I attached a screenshot of two
 charts. Aftert the first chart is created, the range is defined
 automatically by TAChart, then I need the 2nd chart use the same Y
 range (from 520 to 700). How can get that range to use in the 2nd
 chart?.

http://wiki.lazarus.freepascal.org/TAChart_documentation#Linked_extents

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] tachart breaks trunk compilation

2012-10-07 Thread Marco van de Voort

tachartaxis.pas(337,46) Error: identifier idents no member GetAlignment


Lazarus trunk, fpc trunk.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] tachart breaks trunk compilation

2012-10-07 Thread zeljko
On Sunday 07 of October 2012 12:26:11 Marco van de Voort wrote:
 tachartaxis.pas(337,46) Error: identifier idents no member GetAlignment
 
 
 Lazarus trunk, fpc trunk.

I've successfully compiled laz trunk (r38980) with fpc-2.6.1.

zeljko

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] tachart breaks trunk compilation

2012-10-07 Thread Marco van de Voort
On Sun, Oct 07, 2012 at 12:43:34PM +0200, zeljko wrote:
  tachartaxis.pas(337,46) Error: identifier idents no member GetAlignment
  
  
  Lazarus trunk, fpc trunk.
 
 I've successfully compiled laz trunk (r38980) with fpc-2.6.1.

(including tachart?)

I've looked deeper into it, and it seems Alexander is fond of strict
protected and private, but calls getalignment in a not inherited fashion.
(on another class)

Afaik that was where FPC was more lax than Delphi and Jonas corrected that
yesterday.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] tachart breaks trunk compilation

2012-10-07 Thread Alexander Klenin
On Sun, Oct 7, 2012 at 9:58 PM, Marco van de Voort mar...@stack.nl wrote:
 On Sun, Oct 07, 2012 at 12:43:34PM +0200, zeljko wrote:
  tachartaxis.pas(337,46) Error: identifier idents no member GetAlignment
 
 
  Lazarus trunk, fpc trunk.

 I've successfully compiled laz trunk (r38980) with fpc-2.6.1.

 (including tachart?)

 I've looked deeper into it, and it seems Alexander is fond of strict
 protected and private, but calls getalignment in a not inherited fashion.
 (on another class)

Fixed in r38981

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] tachart breaks trunk compilation

2012-10-07 Thread Alexander Klenin
On Sun, Oct 7, 2012 at 9:58 PM, Marco van de Voort mar...@stack.nl wrote:
 I've looked deeper into it, and it seems Alexander is fond of strict
 protected and private, but calls getalignment in a not inherited fashion.
 (on another class)

 Afaik that was where FPC was more lax than Delphi and Jonas corrected that
 yesterday.


It seems, however, that the description on the wiki is incorrect (or
incomplete),
since it speaks about strict private, while this change is about
strict protected.

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] tachart breaks trunk compilation

2012-10-07 Thread Marco van de Voort
On Mon, Oct 08, 2012 at 12:11:38AM +1100, Alexander Klenin wrote:
  I've looked deeper into it, and it seems Alexander is fond of strict
  protected and private, but calls getalignment in a not inherited fashion.
  (on another class)
 
 Fixed in r38981

Thanks.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart and legend items

2012-09-17 Thread ik
Hello,

How can I make sure that the Legend of TAChart breaks each item to
it's own line ?
At the moment it seems like it just try to align everything into one line

Thanks,

Ido

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart and legend items

2012-09-17 Thread ik
On Mon, Sep 17, 2012 at 4:55 PM, ik ido...@gmail.com wrote:
 Hello,

 How can I make sure that the Legend of TAChart breaks each item to
 it's own line ?

Answering myself : the problem was that I added columncount of two

 At the moment it seems like it just try to align everything into one line

 Thanks,

 Ido

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart transparency implementation questions

2012-09-17 Thread Alexander Klenin
This is a re-post of
http://forum.lazarus.freepascal.org/index.php/topic,18051.0.html
where I report on newly added transparency support in TAChart
and ask some questions.

I suspect that most of people who could answer do not read the forum,
so questions are copied below. Apologies to those who already read it.

1) Transparency support for the canvas drawer is quite a hack: see source.
  
https://github.com/graemeg/lazarus/blob/f320da3d4b5b72de7df7055ec1004def71db3693/components/tachart/tadrawercanvas.pas#L293
  Is there a better way? (I think not, but maybe I missed something).
Is it portable enough?
2) Is there a way to support transparency at the TFPCustomCanvas
level? (Again, I think not)
3) Are there any plans for transparency support in FPVectorial?
4) Does anyone have any idea about possibility to support transparency
on printer canvas?


-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart tutorials not visible on Category:Tutorials page

2012-09-04 Thread Vincent Snijders
2012/9/4 Alexander Klenin kle...@gmail.com:
 As reported on forum:
 http://forum.lazarus.freepascal.org/index.php/topic,18068.0/topicseen.html
 tutorials do not appear on this page unless the user is logged in.

 Perhaps some caching issue?

Indeed, for users that are not logged in, a file cache is enabled as
described here:
http://www.mediawiki.org/wiki/Manual:File_cache

It seems it doesn't expire the category page.

You can that yourself by adding ?action=purge to the page url. I just
did that and now the page shows with the new tutorials.

Maybe I should install the purge plugin:
http://www.mediawiki.org/wiki/Extension:Purge

What do you think?

Vincent

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart tutorials not visible on Category:Tutorials page

2012-09-04 Thread Vincent Snijders
2012/9/4 Vincent Snijders vincent.snijd...@gmail.com:
 2012/9/4 Alexander Klenin kle...@gmail.com:
 As reported on forum:
 http://forum.lazarus.freepascal.org/index.php/topic,18068.0/topicseen.html
 tutorials do not appear on this page unless the user is logged in.

 Perhaps some caching issue?


See also:
http://www.mediawiki.org/wiki/Manual_talk:File_cache#category_pages_in_cache_do_not_get_updated

Vincent

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart tutorials not visible on Category:Tutorials page

2012-09-04 Thread Reinier Olislagers
On 4-9-2012 9:27, Vincent Snijders wrote:
 2012/9/4 Vincent Snijders vincent.snijd...@gmail.com:
 2012/9/4 Alexander Klenin kle...@gmail.com:
 As reported on forum:
 http://forum.lazarus.freepascal.org/index.php/topic,18068.0/topicseen.html
 tutorials do not appear on this page unless the user is logged in.

 Perhaps some caching issue?

 
 See also:
 http://www.mediawiki.org/wiki/Manual_talk:File_cache#category_pages_in_cache_do_not_get_updated

Argh. If I read that correctly, having the extension would be useless
because it would put the burden of clearing the cache on the user, who
may very well not even know he should
... so the shell script solution may well be the right one!??! I'd
assume most of our wiki readers are not logged in - only editors have a
reason to create an account - so this is a problem.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart tutorials not visible on Category:Tutorials page

2012-09-04 Thread Vincent Snijders
2012/9/4 Alexander Klenin kle...@gmail.com:
 As reported on forum:
 http://forum.lazarus.freepascal.org/index.php/topic,18068.0/topicseen.html
 tutorials do not appear on this page unless the user is logged in.

 Perhaps some caching issue?

I think I succesfully disabled caching for the category page. Please,
test and let me know your experiences.

Vincent

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart tutorials not visible on Category:Tutorials page

2012-09-03 Thread Alexander Klenin
As reported on forum:
http://forum.lazarus.freepascal.org/index.php/topic,18068.0/topicseen.html
tutorials do not appear on this page unless the user is logged in.

Perhaps some caching issue?

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart compilation error (issue 22365)

2012-07-06 Thread Mattias Gaertner
On Fri, 6 Jul 2012 14:35:52 +1100
Alexander Klenin kle...@gmail.com wrote:

 Issue http://bugs.freepascal.org/view.php?id=22365 was about the
 compilation error
 when the TAChart code is compiled by FPC trunk.
 
 I did not notice the issue in time, because bug tracker is unusably slow,
 so I use Google Alerts to track bugs. This usually works, but sometimes causes
 a delay of a few days before Google notification. Sorry for that.
 
 The issue is resolved, so it is impossible to discuss -- this is why I
 start discussion here.
 I Cc'd original reporter -- hopefully he does not mind.
 
 I am grateful for Mattias for stepping up and resolving the issue,
 but I'd appreciate some discussion for such controversial changes.
 
 Regarding the specifics of the problem -- FPC trunk (suddently?)
 stopped compiling
 TAChart source. Affected code did not change recently, so this is
 either a FPC regression
 or some general issue like out-of-date object files, wrong
 installation paths leading to version conflicts etc.

 So I have a few questions/suggestions:
 1) Can anybody (Mattias?) reproduce this?

yes

 2) Why did this suddently happened? Why do not all other trunk users complain?

I guess tachart uses a seldom combination of generics,
implementation uses and operators.

 3) Can this be isolated to a smaller testcase and reported as an FPC bug?

Maybe these hints can help to create a smaller example:

TGenericChartMarks is a generic, which uses in its implementation some
identifiers defined by the uses section of the implementation section.

operator +(const A: TPoint; B: TSize): TPoint of unit
TAGeometry
and
TCustomChartSource of unit TACustomSource


 4) Alternatively, is this an intentional backwards-incompatible change
 in FPC? Should it be documented as such?
 5) If the bug is too subtle/hard to fix, at least the workaround in TAChart 
 code
   should be clearly marked as such -- there are a few examples in
 TAChart, search for 'workaround'



Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart compilation error (issue 22365)

2012-07-06 Thread Reinier Olislagers
On 6-7-2012 5:35, Alexander Klenin wrote:
 So I have a few questions/suggestions:
 1) Can anybody (Mattias?) reproduce this?
Yes, had the same problem, 32 bit and IIRC also 64 bit FPC on Win x64.

As mentioned in the BT, John Repucci (IPGuy on the forum) had the same
problem on x86, Windows; forum posts:
http://lazarus.freepascal.org/index.php/topic,15919.msg96174.html#msg96174

 2) Why did this suddently happened? Why do not all other trunk users complain?
To be honest, I don't report every build issue with Lazarus and FPC
trunk because jshand2010 seems to do so quite diligently...

I don't know whether any automated system exists that shows Lazarus
build failures for stable platforms and injects them into the bugtracker
and/or shows a publically available status page... which might help
these kind of things.

FPC does have/used to have at least compiler (but not e.g. database)
test suite run output on a web page but I can't find the link...
remember a post in fpc-dev a while back (2010 perhaps?) mentioning that.
Don't know if build status is also available.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart compilation error (issue 22365)

2012-07-06 Thread Sven Barth
Am 06.07.2012 10:14 schrieb Mattias Gaertner nc-gaert...@netcologne.de:

  2) Why did this suddently happened? Why do not all other trunk users
complain?

 I guess tachart uses a seldom combination of generics,
 implementation uses and operators.


The lovely topic generics *sigh*

  3) Can this be isolated to a smaller testcase and reported as an FPC
bug?

 Maybe these hints can help to create a smaller example:

 TGenericChartMarks is a generic, which uses in its implementation some
 identifiers defined by the uses section of the implementation section.

Outch! That would explain it... As a general rule: don't use implementation
only stuff inside generics that are made available in the interface
section. The only exception to this might be untyped constants in Delphi
mode, because Delphi allows them as well (there is a bug report from Marco
about this)

 operator +(const A: TPoint; B: TSize): TPoint of unit
 TAGeometry
 and
 TCustomChartSource of unit TACustomSource

Regards,
Sven
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart compilation error (issue 22365)

2012-07-05 Thread Alexander Klenin
Issue http://bugs.freepascal.org/view.php?id=22365 was about the
compilation error
when the TAChart code is compiled by FPC trunk.

I did not notice the issue in time, because bug tracker is unusably slow,
so I use Google Alerts to track bugs. This usually works, but sometimes causes
a delay of a few days before Google notification. Sorry for that.

The issue is resolved, so it is impossible to discuss -- this is why I
start discussion here.
I Cc'd original reporter -- hopefully he does not mind.

I am grateful for Mattias for stepping up and resolving the issue,
but I'd appreciate some discussion for such controversial changes.

Regarding the specifics of the problem -- FPC trunk (suddently?)
stopped compiling
TAChart source. Affected code did not change recently, so this is
either a FPC regression
or some general issue like out-of-date object files, wrong
installation paths leading to version conflicts etc.
So I have a few questions/suggestions:
1) Can anybody (Mattias?) reproduce this?
2) Why did this suddently happened? Why do not all other trunk users complain?
3) Can this be isolated to a smaller testcase and reported as an FPC bug?
4) Alternatively, is this an intentional backwards-incompatible change
in FPC? Should it be documented as such?
5) If the bug is too subtle/hard to fix, at least the workaround in TAChart code
  should be clearly marked as such -- there are a few examples in
TAChart, search for 'workaround'

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart ?

2012-07-02 Thread Terry Haimann

Is it possible to do something like TeeChart's Bubble Chart?

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart ?

2012-07-02 Thread Alexander Klenin
On Tue, Jul 3, 2012 at 5:35 AM, Terry Haimann te...@haimannonline.com wrote:
 Is it possible to do something like TeeChart's Bubble Chart?

Yes, see http://wiki.lazarus.freepascal.org/TAChart_documentation#Bubble_series
and multi demo.

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart legends

2011-08-21 Thread Alexander Klenin
On Sun, Aug 21, 2011 at 16:58, David M. Lawrence d...@fuzzo.com wrote:
 Set Alignment=laBottomCenter and UseSidebar=true

 What version of TAchart is the laBottomCenter option in?

Svn trunk.

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart legends

2011-08-21 Thread David M. Lawrence


On 8/21/2011 2:02 AM, Alexander Klenin wrote:

On Sun, Aug 21, 2011 at 16:58, David M. Lawrenced...@fuzzo.com  wrote:

Set Alignment=laBottomCenter and UseSidebar=true


What version of TAchart is the laBottomCenter option in?

Svn trunk.

I have downloaded the latest version of the TAChart files, but I get the 
following error when I try to compile it in Lazarus:


C:\lazarus\components\tachart\tagraph.pas(532,5) Error: Wrong number of 
parameters specified for call to 'ReadComponentFromBinaryStream'


Dave

--
--
 David M. Lawrence| Home:  (804) 559-9786
 7471 Brook Way Court | Fax:   (804) 559-9787
 Mechanicsville, VA 23111 | Email: d...@fuzzo.com
 USA  | http:  http://fuzzo.com
--

All drains lead to the ocean.  -- Gill, Finding Nemo

We have met the enemy and he is us.  -- Pogo

No trespassing
 4/17 of a haiku  --  Richard Brautigan


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart legends

2011-08-21 Thread Alexander Klenin
On Mon, Aug 22, 2011 at 04:37, David M. Lawrence d...@fuzzo.com wrote:
 Svn trunk.

 I have downloaded the latest version of the TAChart files, but I get the
 following error when I try to compile it in Lazarus:

 C:\lazarus\components\tachart\tagraph.pas(532,5) Error: Wrong number of
 parameters specified for call to 'ReadComponentFromBinaryStream'

It seems new TAChart will not compile with old Lazarus.
Either get and compile whole Lazarus:
http://wiki.lazarus.freepascal.org/Getting_Lazarus
Or get a binary snapshot:
http://www.hu.freepascal.org/lazarus/


-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart legends

2011-08-20 Thread David M. Lawrence
Is there a way to have the legend aligned bottom center and BELOW the 
frame of the graph.  The only alignment I could find was top or bottom 
right or left, with the legend parked on top of the data I'd like to 
show.  The graph would benefit from the legend, but not if the only way 
to have the legend ends up hiding some of the data is it supposed to 
explain.


Dave

--
--
 David M. Lawrence| Home:  (804) 559-9786
 7471 Brook Way Court | Fax:   (804) 559-9787
 Mechanicsville, VA 23111 | Email: d...@fuzzo.com
 USA  | http:  http://fuzzo.com
--

All drains lead to the ocean.  -- Gill, Finding Nemo

We have met the enemy and he is us.  -- Pogo

No trespassing
 4/17 of a haiku  --  Richard Brautigan


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TAChart legends

2011-08-20 Thread Alexander Klenin
On Sun, Aug 21, 2011 at 16:18, David M. Lawrence d...@fuzzo.com wrote:
 Is there a way to have the legend aligned bottom center and BELOW the frame
 of the graph.  The only alignment I could find was top or bottom right or
 left, with the legend parked on top of the data I'd like to show.  The graph
 would benefit from the legend, but not if the only way to have the legend
 ends up hiding some of the data is it supposed to explain.

Set Alignment=laBottomCenter and UseSidebar=true

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TAChart: reticule reimplemented, questions on deprecation

2011-08-13 Thread Alexander Klenin
Last year, there were several discussions both on this list and the forum about
deficiences of reticule implementation.
As of r31973, I have implemented a new TDataPointCrosshairTool, which:
1) Does not require extra properties neither in chart nor in series
2) Should work on Qt and MacOS
3) Allows arbitrary pen for drawing (at the cost of slowdown)
4) Is less confusingly named ;-)

So I have few requests for interested parties:
1) Please test on Linux/Qt and MacOS -- I have tested Windows/Qt only
2) Should I remove TReticuleTool together with all reticule-related
properties now,
  or wait for another release? Note that built-in properties
  (ReticulePos, ReticuleMode, UseReticule, OnDrawReticule) were
already deprecated
  in 0.9.30: http://wiki.freepascal.org/Lazarus_0.9.30_release_notes#TAChart
3) Is the new name really better? If I remove old TReticuleTool,
should I rename TDataPointCrosshair tool to TReticuleTool?
The old name was invented by original TAChart developer, who is probably French.
I actually like the name, but many users expressed confusion as to the
meaning of the word reticule.

-- 
Alexander S. Klenin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


  1   2   >