Jump to content
Software FX Community

Different colors on gannt-bar, but not based on bar-value


Tobias
 Share

Recommended Posts

Hi!

I have a gannt-chart which I would like to set different colors on the bars depending on a value different from the actual bar. Lets say i have 3 incoming values:

x = name of bar

y = value of bar

z = value to determine color, could be 1,2,3 or "black", "red", "green"...

I've checked out the ConditionalAttributes-class but it seems that it needs to use the value of the actual bar.

Any advise would be appreciated!

Link to comment
Share on other sites

I can think of two ways you can do this. You could add a dummy condition to the ConditionalAttributes collection (chart1.ConditionalAttributes.Add(new ConditionalAttributes());) then use the event chart1_ConditionalAttributesCallback to iterate through every point and evaluate your own condition. This can also be done if you implement the PaintMarker event.

Link to comment
Share on other sites

Hello Andre and thank you for your reply.

I'm still struggling with the ConditionalAttributesCallback. I've got the method to work on point-based valued with ex:

if (Chart1.Data.Y[e.Series, e.Point] == 13){ e.Attributes = 1;}

...which applies the settingsĀ of index 1 of the conditional attribute collection. What I don't get is how to use another value than the actual value of the bar. I've searched the resource center and forums to find answers but I'm obviously missing some part of the part on how to use the Tag-attribute or something.

Any point in the right direction would be appreciated!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...