different colors in one gantt bar

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
cbr
Newbie
Newbie
Posts: 7
Joined: Thu Jul 21, 2005 4:00 am
Location: Germany

different colors in one gantt bar

Post by cbr » Wed Sep 14, 2005 8:49 am

Hi.

Is there anyway to draw a second color in a gantt bar???

For example, I want to draw an thin colored line a the bottom of a gantt bar to express the priority of the task.


Thanks in advance.

(D7 & TeeChart Pro 7)

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Sep 14, 2005 11:21 am

Hi cbr,

You can use gradients in gantt bars. You'll find the gradient editor when using Chart Editor at Series\Gantt\Gradient.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

cbr
Newbie
Newbie
Posts: 7
Joined: Thu Jul 21, 2005 4:00 am
Location: Germany

Post by cbr » Thu Sep 15, 2005 6:17 am

Hi Narcis,

thanks a lot, but it doesn't work. Because I have to draw every gantt bar in a different color according to its priority. Any idea? Is it possible to change the gradient color for each gantt bar?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Sep 15, 2005 7:45 am

Hi cbr,

Yes, it is possible using the series OnGetPointerStyle event and using code similar to:

Code: Select all

function TForm1.Series1GetPointerStyle(Sender: TChartSeries;
  ValueIndex: Integer): TSeriesPointerStyle;
begin
  With Series1.Pointer.Gradient do
    if (Series1.YValue[ValueIndex]<5) then
    begin
      StartColor:=clBlue;
      MidColor:=clRed;
    end
    else
      begin
        StartColor:=clYellow;
        MidColor:=clGreen;
      end;

  result:=psRectangle;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  With Series1 do
  begin
    FillSampleValues();
    ColorEachPoint:=False;
    Color:=clNone;
    Pointer.Gradient.Visible:=True;
  end;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

cbr
Newbie
Newbie
Posts: 7
Joined: Thu Jul 21, 2005 4:00 am
Location: Germany

Post by cbr » Fri Sep 16, 2005 12:32 pm

Hi narcis,

i've tried the code you send and it works quite good. But there is one last problem. By using the gradients, the gantt bars are drawn outside the axis. That means the gantt bars are not restricted by the axis.

Any Idea?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Sep 16, 2005 2:06 pm

Hi cbr,

That doesn't happen here using latest TeeChart sources in a new Delphi 7 project, dropping a TChart in a form, adding a TGanttSeries to it and using the code I posted.

Could you please post an example we can run "as-is" to reproduce the problem here? You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Sep 21, 2005 2:53 pm

Hi,
gradients, the gantt bars are drawn outside the axis. That means the gantt bars are not restricted by the axis.

Any Idea?
As I can see this is not related with Gradients, you can set Gradient visible to False and you will still seeing one bar outside the Axis limits. This is because you've set a SetMinMax values which are bigger and smaller of the gant start and end values respectively, changing :
Chart1.BottomAxis.SetMinMax(today - 3, today + 5);
by:
Chart1.BottomAxis.SetMinMax(today - 5, today + 7);

you will be able to see the complete gantt bar.

cbr
Newbie
Newbie
Posts: 7
Joined: Thu Jul 21, 2005 4:00 am
Location: Germany

Post by cbr » Thu Sep 22, 2005 7:35 am

Hi,

sorry, but in my opinion this is related with gradients.

I set gradient visible to false and the bars are restricted by the axis limits.

And I don't want to set the Axis MinMax Values depending on the start and end values because I want to use scrollbars to change the view.

There must be another way, any ideas ???

Thanks in advance.

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Sep 26, 2005 8:07 am

Hi,

I'm sorry, you're correct, I just test it with a non CLX app. and worked fine. I've been able to reproduce it with a CLX app. It seems to be a bug, it has been added on our defect list and a fix for it will be considered to inclusion for the next maintenance releases.
For the moment I've not found a workaround.

Post Reply