Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the X axis range (maximum)of the chart in RUN time ?

Hello,
Please could you help me. Im using chart  CNiGraph class for displaying of fast measurement.
I need to chage the X axis range in Run time of Chart. (via Knob button).
 

void

CPacemakerAnalysisView::PointerValueChangedCwknob2ECG(long Pointer, VARIANT* Value)

{

CNiAxis ECGaxis = m_ECGgraph.Axes.Item("XAxis");

ECGaxis.Maximum = c_X_ECG.Value;

}

The solution above doesnt work. Thats clear, because this function is called for each change of knob pointer. I used a different function, but the result is the same. THe program is stopped without reason. Are there any technique to change the X axis range in Run time of chart? (Criticalsection or synchronizing....?) Please for example. I know how to do it in LabVIew without problems but in .NET with NI....really I don know. More thanks. emta

0 Kudos
Message 1 of 3
(3,237 Views)

I tried the following and it seem so be working for me. It should work the same as what you are doing. You will need to include comutil.h and comsupp.lib to use the _variant_t helper class. Are you sure the value of the in c_X_ECG.Value is changing?

void CAxisChangeDlg::PointerValueChangedCwknob1(long Pointer, VARIANT* Value)
{
    CNiAxis axis = graph.Axes.Item("XAxis");
    double data =  (double)_variant_t(Value);
    axis.Maximum = data;
}



Bilal Durrani
NI
0 Kudos
Message 2 of 3
(3,228 Views)
Great! Thank You very much. It does work as I wished. Emta
0 Kudos
Message 3 of 3
(3,221 Views)