Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I need to give condition for color in plotting my graph

C#
// Set Plot Style,Colour and Size

                   if (GWmsgDetails.Latency == 0)

                   pltOutput.Series[Constants.SERIES_RESPONSE_TIME].Color = Color.LawnGreen;

                   if (GWmsgDetails.Latency != 0)

                   pltOutput.Series[Constants.SERIES_RESPONSE_TIME].Color = Color.Red;


I do not understand why it is always taking LawnGreen not Red even when Latency is not equal to zero


Thanks
John
Posted
Comments
Ravi Bhavnani 18-Feb-14 11:11am    
Have you tried setting a breakpoint in your code to ensure Latency is in fact non-zero?

/ravi
Ravi Bhavnani 18-Feb-14 11:37am    
Also, your if statement is formed oddly. See my solution to your previous question.

/ravi

1 solution

Try this:
C#
pltOutput.Series[Constants.SERIES_RESPONSE_TIME].Color = (GWmsgDetails.Latency == 0)
? Color.LawnGreen
: Color.Red;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900