NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Paul_Knight_Lockheed_Martin
Posts: 91
0 Kudos
Accepted Solution

Power vs Temperature Graph

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.

Active Participant
Wolfgang
Posts: 1,929
0 Kudos

Re: Power vs Temperature Graph

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

Member
Paul_Knight_Lockheed_Martin
Posts: 91
0 Kudos

Re: Power vs Temperature Graph

InsertAxisItem did not fix my problem.

Member
Courtney_L
Posts: 137
0 Kudos

Re: Power vs Temperature Graph

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?

Member
Paul_Knight_Lockheed_Martin
Posts: 91
0 Kudos

Re: Power vs Temperature Graph

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

Active Participant
Wolfgang
Posts: 1,929
0 Kudos

Re: Power vs Temperature Graph


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?

Member
Paul_Knight_Lockheed_Martin
Posts: 91
0 Kudos

Re: Power vs Temperature Graph

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.

Active Participant
Wolfgang
Posts: 1,929

Re: Power vs Temperature Graph


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 :smileywink: 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...)

Member
Paul_Knight_Lockheed_Martin
Posts: 91
0 Kudos

Re: Power vs Temperature Graph

Need trick.  It now works.

Active Participant
Wolfgang
Posts: 1,929
0 Kudos

Re: Power vs Temperature Graph

Ah, I am glad, have fun!

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page