LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change XY Graph's plot point's filling color programatically?

Solved!
Go to solution

Hello every one,

   I want make a graph for my project. This graph in x axis date and y axis is value. I have done this XY graph.

Now I want two conditions

One is draw the average value of total value. Then Plot filling point's Color will be change according to the average value. For example my data values are between 286 to 295 (any value of this in between) my average value is 290.6. So above 290.6 is filling point color is GREEN And below average value is RED. This is actually I want .I have done plot my data and also average value. But I tried to change color I could not get. So please answer me any one. How can I do this Task?

 

Thanks in advance

Arunkumar M

India

I have attached actual output and required output

Download All
0 Kudos
Message 1 of 9
(4,975 Views)
Solution
Accepted by topic author arun575

All points in a plot must have the same color.  What you can do is create a 3rd plot that is no line and has red points.  You can create a plot that contains all of the "bad" XY pairs and plot that.  Make sure your plot number is such that the red points will plot overtop the green points

0 Kudos
Message 2 of 9
(4,949 Views)
Solution
Accepted by topic author arun575

I posted a similar suggestion yesterday on the forum -- if your data being plotted are Floats, then you can use the feature that NaN (Not a Number) values don't plot.  So if you have an array of points, say "Green Values", and want all values greater than 200 to plot Green and all values less than (or equal to) 200 to plot Red, make a copy of Green called (of course) Red, replace all Green values <= 200 with NaN, all values of Red >200 with NaN, set the color of Green to (are you ready?) Green, the color of Red to Red, and plot both.  The non-NaN Green values will appear in Green, the non-NaN values of Red will appear in Red, and the NaN values won't plot.

 

Bob Schor

Message 3 of 9
(4,937 Views)

I saw that too and was first thinking this was the same question.

 

I'd argue two things.

 

1.  The OP says this is an XY plot, so no need to fill in the "missing" data with NAN.

 

2.  You want one plot to contain all the data that way you have all the lines connecting the points.  You want the 2nd plot to have no lines, and only contain the "bad" data so that it plots the red points thata will cover over the green points.

0 Kudos
Message 4 of 9
(4,931 Views)

Good point -- I often confuse Charts and Graphs.  If there are no "connecting lines", I suspect that both ways would be functionally equivalent (though the programming would be slightly different).  Your method has the virtue that it works with integer quantities (without needing to cast the data to a Float to get the inclusion of NaN).

 

BS

0 Kudos
Message 5 of 9
(4,901 Views)

Thank you for your reply Mr.RavansFan and Mr Bob_Schor . I got exactly output .

 

I have attached my output image .

 

again thanks a lot.

 

Arunkumar M

India 

 

 

0 Kudos
Message 6 of 9
(4,871 Views)

Great!  Which solution did you use, mine or Ravens Fan's?  It would be helpful for the next person who wants to do this if you say which method "worked for you".

 

Bob Schor

0 Kudos
Message 7 of 9
(4,831 Views)

Hi Bob,

               Actually First I tried Revan idea. This  is working fine but i couldn't skipped the else values , that place automatically plot zero. So I used your condition (if place i used acutall value and else place i used NaN) this gave accurate output.

 

 

So your Idea is working good.

 

 

Thanks

Arunkumar M

India

0 Kudos
Message 8 of 9
(4,813 Views)

I'd like to see the attempt using my idea.  If the data is actually set up as X,Y pairs like the earlier graphs seemed to indicate, I don't see why it wouldn't work.  (They weren't waveform charts or waveform graphs because the X values weren't equally spaced.)

 

Depending on how the original data was structured, there are multiple ways of sending data to an XY graph, would determine what is the easier method.

0 Kudos
Message 9 of 9
(4,788 Views)