LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Power vs Temperature Graph

Solved!
Go to solution

I need to plot power/current  vs temperature on a graph from data collected by another program.  The program runs from -10C to 60C, back to -10C, then goes to 60C, and finally returns to 25C.  The collecting program stores time, temperature current, and power.

 

I would like to plot power/current on the y axis and temperature on the x axis, but maintain the time reference.  Basically I would like to see the x axis read

 

-10 -5 0 5.....55 60 55.....5 0 -5 -10 -5 0 5.....55 60 55...25

 

When I use PlotXY or PlotLine the x axis plots -10 60 and the y axis plots back on itself.

 

We can do the graph in Excel and have attached a pdf of a plot.

0 Kudos
Message 1 of 10
(5,944 Views)

I have not tried it myself but maybe you could use InsertAxisItem () ? You would need to set the ATTR_XUSE_LABEL_STRINGS attribute to TRUE

0 Kudos
Message 2 of 10
(5,940 Views)

InsertAxisItem did not fix my problem.

0 Kudos
Message 3 of 10
(5,915 Views)

Hi Paul,

 

Do you have two separate data items for the x-axis, namely a set of temperature data which is associated with a set of time data? Are these two independent arrays of points?

0 Kudos
Message 4 of 10
(5,898 Views)

I have two arrays.  One array is for the x axis and has the temperature data. ( -10 ...0....60....0...-10)  The other array is for the y axis and has the power measurement taken at the temperature.  Both arrays are index with a common point and are the same size.

 

Paul

0 Kudos
Message 5 of 10
(5,894 Views)

@Paul Knight wrote:

InsertAxisItem did not fix my problem.



Why not? In the mean time I have tried it myself and it seems to be working...

 

Let's assume that you are using PlotY for the indexed power values, then you could use something like

 

InsertAxisItem (panel, PANEL_GRAPH, 0, 0, item_label [0], 0.0 );

InsertAxisItem (panel, PANEL_GRAPH, 0, 10, item_label [10], 10.0 );

...

to label every tenth's value, with item_label being your temperature values converted to char*. This way any non-linear axis can be simulated, no?

0 Kudos
Message 6 of 10
(5,891 Views)

The graph puts all the minus temperatures and their label to the left of zero.  The graph that I am trying to emulate from Excel has along the x-axis each value taken in order,  so we start at -10 ..... 0 ..... 60 ..... -10.  So there are minus temperatures to the right of the +60 temperature. InsertAxisItem only inserts the label where the graph will be putting the data, it does not effect where the data gets put.

0 Kudos
Message 7 of 10
(5,886 Views)
Solution

@Paul Knight wrote:

The graph puts all the minus temperatures and their label to the left of zero.


Paul,

 

I am not sure I got you right - could it be that you didn't read my post carefully enough? In the line

 

InsertAxisItem (panel, PANEL_GRAPH, 0, 10, item_label [10], 10.0 );

 

the 10.0 is not meant to be your temperature, but the (double) index of the respective array element. This way the x axis values of your graph are monotonously increasing from left to right, but nobody knows Smiley Wink because the x-axis values are labeled with your temperature values... So if your tenth temperature is +20 and your twentieth temperature is -60 degrees, it will be displayed in that order and the graph will not put 'the minus temperatures and their labels to the left of zero'

 

 (One might argue that item_label [ 10 ] should read item_label [ 9 ] but this is a cosmetic issue...)

Message 8 of 10
(5,879 Views)

Need trick.  It now works.

0 Kudos
Message 9 of 10
(5,876 Views)

Ah, I am glad, have fun!

0 Kudos
Message 10 of 10
(5,874 Views)