![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
TChart и KOL
Дмитрий Галин © (2004-10-01 16:04:00)Интересно, а существует ли в KOL какой-нибудь аналог компонента для рисования диаграм и графиков, наподобие TChart в VCL?
thaddy (2005-03-28 14:48:00) [1]Today I released a new and much improved version of my KOL charting component.
http://www.thaddy.com/kolchart.zip
It has clipboard and printer support (with kolprinters.pas)
And supports the following charts:
1. Lines
2. Lines with marks
3. Marks
4. Delta values
5. Pie
6. Bars
7. Stacked bars
8. Bars with average line
9. Bars with values in percentages
That should do for now :)
thaddy (2005-03-28 10:51:00) [2]Then you need to keep the handle!
Btw:
I have made a new indicator based on another source that is much better and cleaner.
http://www.thaddy.com/ledladder.zip.
Note that the original scope doesn't update too, when it is not visible! Better sourcematerial gives better KOL versions :-)
Zoom (2005-03-18 20:41:00) [3]And second trouble:
Scope doesn't work, when it's not active. For example:
I have tabbed notebook. On the 1st page i have scope, and on the second have something else. When i have second page active scope doesn't work, but it have to :)
thaddy (2005-03-18 11:47:00) [4]?? Let's debug! shall we...
Zoom (2005-03-18 07:45:00) [5]My variant:
http://rulezmaker.fatal.ru/kolindicator.rar
Also i've found a trouble:
When i make a repaint on form resize, it works with your
WndProcIndicator and WndProcScope procedures, but when i minimize the window program crashes. Why?
Zoom (2005-03-18 07:41:00) [6]OK. I did only 2 changes. This:
procedure TIndicator.UpdateDrawBuffer;
var
a,b,c,d1,d2,n : integer;
begin
With PIndicatordata(CustomObj)^ do
begin
FDrawBuffer.canvas.Brush.Color:=FBackground;
FDrawBuffer.canvas.Pen.Color:=FBackground;
FDrawBuffer.Canvas.Rectangle(0,0,width,height);
n:=(height) div 3-2;
b:=(width div 2);
d1:=round(n/100*(100-fpositionL));
// if flink then
d2:=d1;
{else
d2:=round(n/100*(100-fpositionR));}
FDrawBuffer.Canvas.Pen.Color:=FShadow;
For a:=0 to n do
begin
if a >= d1 then
FDrawBuffer.Canvas.pen.Color:=FForeground;
c:=3*a+2;
FDrawBuffer.Canvas.MoveTo(b-1,c);
FDrawBuffer.Canvas.LineTo(4,c);
c:=3*a+3;
FDrawBuffer.Canvas.MoveTo(b-1,c);
FDrawBuffer.Canvas.LineTo(4,c);
end;
FDrawBuffer.Canvas.pen.Color:=Fshadow;
For a:=0 to n do
begin
if a >= d2 then
FDrawBuffer.Canvas.pen.Color:=FForeground;
c:=3*a+2;
FDrawBuffer.Canvas.MoveTo(b+1,c);
FDrawBuffer.Canvas.LineTo(Width-5,c);
c:=3*a+3;
FDrawBuffer.Canvas.MoveTo(b+1,c);
FDrawBuffer.Canvas.LineTo(Width-5,c);
end;
FDrawBuffer.Canvas.pen.Color:=Fshadow;
end;
end;
This:
function NewIndicator(anOwner:PControl;H,W:integer):PIndicator;
And this:
procedure TIndicator.setcolors(bckgrnd,fgrnd,shdw:TColor);
begin
pIndicatordata(CustomObj).FBackground:=bckgrnd;
PIndicatordata(CustomObj).FForeground:=fgrnd;
PIndicatordata(CustomObj).FShadow:=shdw;
UpdateDrawBuffer;
Invalidate;
end;
thaddy (2005-03-17 22:20:00) [7]I tried it: It failed. No update, unless zoom provides me with a working version;-) He has the code!
thaddy (2005-03-17 22:13:00) [8]Zoom's suggestion will be available within the next hour (GMT+1)
Same link.
thaddy (2005-03-17 22:09:00) [9]Good suggestion! But all I do is provide you with quick faithfull translations, right?
There's a major optimization pending for the scope:
The original author shoud have used Scrollwindowex, and since Kol provides the cliprect as well, this really saves on processor time.
b.t.w: your demo is good, but it can't properly recognize some AMD processors. Have a look at the fastcode things in the borland newsgroups for a better cpu recognizing algo, (or chat).
Zoom (2005-03-17 20:26:00) [10]Why didn't you make it like this?:
For a:=0 to n do
begin
if a >= d1 then
FDrawBuffer.Canvas.pen.Color:=FForeground;
c:=3*a+2;
FDrawBuffer.Canvas.MoveTo(b-1,c);
FDrawBuffer.Canvas.LineTo(4,c);
c:=3*a+3;
FDrawBuffer.Canvas.MoveTo(b-1,c);
FDrawBuffer.Canvas.LineTo(4,c);
end;
instead of
For a:=0 to n do
begin
if a >= d1 then
FDrawBuffer.Canvas.pen.Color:=FForeground;
c:=3*a+2;
FDrawBuffer.Canvas.MoveTo(b-1,c);
FDrawBuffer.Canvas.LineTo(4,c);
end;
(and same on the other channel)
thaddy (2005-03-15 21:51:00) [11]Ok, made it stereo. Same link :)
Zoom (2005-03-15 20:42:00) [12]About indicator: i think it would be better if there were controling not only 2 columns at once but individual to each column (for example to make a sound channels indicator)
thaddy (2005-03-14 23:55:00) [13]Last: No, I will *not* write MCK component for it. Someone else has to do that. I only use kol myself, not the MCK! (I type faster than I can recover broken mck generated code. I break it all the time :-))
First: I will attempt to improve the code when I have the time. Drawing of legend is still awkward/buggy, but drawing of the charts is ok.
Paha (2005-03-14 23:48:00) [14]>> thaddy
Работа над KOL_graphеще продолжается? В последующем можешь выкладывать чтоб его инсталировать как компонент??? И напиши ридми что к нему надо в довесок(со ссылками желательно). Жду с нетерпением.
Zoom (2005-03-14 20:39:00) [15]Sorry, for not answering so long.
Cool. Works well. Respect! Now those 2 comp. are very good & useful set :)
thaddy (2005-03-12 22:51:00) [16]http://www.thaddy.com/kolindicator.zip
thaddy (2005-03-12 22:51:00) [17]http://www.kolindicator.zipavailable. Ok zoom?
Zoom (2005-03-10 20:24:00) [18]To make that scope ideal, need to do ranging of graph, when you change size of scope. :)
thaddy (2005-03-09 22:38:00) [19]Again, link does not work here (: please email!
thaddy (2005-03-09 22:36:00) [20]You notice updated - RC1- version on my website? It has a demo and paints better. It is better than the version I send you by email :-)
Ok. Try to do this as well... You study mirrors ;-)