Hi
Jonathan!
The version of the control that I am using in the application is 8.1.11 Release (377) (602).
The CPU consumption stays high after I create them and move them to my application. The creation of the controls is dynamic. I will post here part of the code that prints the data.
The code:
void Util_DrawData ( TControl *p_ptCtlControlList, ds_param_value *p_dpvSampleContents,
double p_dblTimeToPlot, ListType p_lstParameterListCode, double p_dblTimeStamp ) {
......
if (plot) {
// Pointer to the right function
(*p_ptCtlControlList->pShowData)(p_ptCtlControlList, p_dblTimeToPlot, p_dblTimeStamp,
&g_ptDPVParameterValue[0], g_ptDPTParameterType[0]);
}
....
return;
}
// The function which I use in this case (in order to print data into an activex control)
void Util_StripChart(TControl * p_ptControlList, double p_dblTimeToPlot, double p_dblTimeStamp,
ds_param_value *p_dpvParameterValue, ds_param_type p_dptParameterType) {
CAObjHandle m_objActiveXHandle;
CWUIControlsLibObj_CWAxes AxesHandle;
CWUIControlsLibObj_CWAxis AxisHandle;
double time = 0;
GetObjHandleFromActiveXCtrl ( p_ptControlList->panelID, p_ptControlList->controlID,
&m_objActiveXHandle);
CWUIControlsLib_Get_DCWGraphProperty (m_objActiveXHandle, NULL, CWUIControlsLib__DCWGraphAxes,
CAVT_OBJHANDLE, &AxesHandle);
CWUIControlsLib_CWAxesItem (AxesHandle, NULL, CA_VariantInt(1), &AxisHandle);
CWUIControlsLib_GetCWAxisProperty (AxisHandle, NULL, CWUIControlsLib_CWAxisMaximum,
CAVT_DOUBLE, &time);
if ( p_dblTimeToPlot >= time || time >= 1) {
g_blnControlTime = 0;
Util_TimeStampToPlotTime ((float) p_dblTimeStamp); //Function that only adjusts time
CWUIControlsLib_CWAxisSetMinMax (AxisHandle, NULL, CA_VariantDouble(g_dblGraphInitTime),
CA_VariantDouble(g_dblGraphEndTime));
}
Util_getSimpleGraphValuetoPrint ( p_ptControlList, g_ptDPVParameterValue, g_ptDPTParameterType[0],p_dblTimeToPlot,
p_ptControlList->numberOfTraces, m_objActiveXHandle );
CA_DiscardObjHandle(AxisHandle);
CA_DiscardObjHandle(AxesHandle);
CA_DiscardObjHandle(m_objActiveXHandle);
return;
}
void Util_getSimpleGraphValuetoPrint ( TControl *p_ptControlList, ds_param_value *p_dpvParameterValue,
ds_param_type p_dptParameterType, double p_dblTimeToPlot, int p_intNumberOfTraces, CAObjHandle p_objActiveXHandle ) {
// ActiveX variables controls
VARIANT m_varDataToPlotY;
switch ( p_dptParameterType ) {
case PT_FLOAT: CA_VariantSet1DArray ( &m_varDataToPlotY, CAVT_FLOAT, p_intNumberOfTraces, &p_dpvParameterValue->pvflt );
break;
case PT_DOUBLE: CA_VariantSet1DArray ( &m_varDataToPlotY, CAVT_DOUBLE, p_intNumberOfTraces, &p_dpvParameterValue->pvdbl );
break;
}
CWUIControlsLib__DCWGraphChartXvsY( p_objActiveXHandle, NULL, CA_VariantDouble (p_dblTimeToPlot), m_varDataToPlotY, CA_VariantBool(0) );
if ( p_dpvParameterValue->pvdbl >= p_ptControlList->list->max_range*0.95 || p_dpvParameterValue->pvdbl <= p_ptControlList->list->min_range*1.05 ) {
int max, min;
CWUIControlsLibObj_CWAxes AxesHandle;
CWUIControlsLibObj_CWAxis AxisHandle;
if (p_dpvParameterValue->pvdbl >= p_ptControlList->list->max_range ) {
max = p_ptControlList->list->max_range *0.2;
p_ptControlList->list->min_range = p_ptControlList->list->min_range + max;
p_ptControlList->list->max_range = p_ptControlList->list->max_range + max;
}
else {
min = p_ptControlList->list->min_range *0.2;
p_ptControlList->list->max_range = p_ptControlList->list->max_range -min;
p_ptControlList->list->min_range = p_ptControlList->list->min_range - min;
}
CWUIControlsLib_Get_DCWGraphProperty (p_objActiveXHandle, NULL, CWUIControlsLib__DCWGraphAxes,
CAVT_OBJHANDLE, &AxesHandle);
CWUIControlsLib_CWAxesItem (AxesHandle, NULL, CA_VariantInt(2), &AxisHandle);
CWUIControlsLib_SetCWAxisProperty (AxisHandle,NULL,CWUIControlsLib_CWAxisMaximum,
CAVT_VARIANT,CA_VariantInt(p_ptControlList->list->max_range));
CWUIControlsLib_SetCWAxisProperty (AxisHandle,NULL,CWUIControlsLib_CWAxisMinimum,
CAVT_VARIANT,CA_VariantInt(p_ptControlList->list->min_range));
CA_DiscardObjHandle(AxisHandle);
CA_DiscardObjHandle(AxesHandle);
}
CA_VariantClear (&m_varDataToPlotY);
return;
}