Commit 1456d2ed authored by Claes Sjofors's avatar Claes Sjofors

Xtt trend add curve bugfix

parent 21c9aed8
...@@ -1407,11 +1407,17 @@ void GrowPolyLine::add_and_shift_y_values( double *values, unsigned int no_of_va ...@@ -1407,11 +1407,17 @@ void GrowPolyLine::add_and_shift_y_values( double *values, unsigned int no_of_va
if ( !no_of_values) if ( !no_of_values)
return; return;
for ( unsigned int i = a_points.size() - 1; i >= no_of_values; i--) if ( no_of_values >= (unsigned int) a_points.size()) {
((GlowPoint *)a_points[i])->y = ((GlowPoint *)a_points[i-no_of_values])->y; for ( unsigned int i = 0; i < (unsigned int)a_points.size(); i++)
((GlowPoint *)a_points[i])->y = *(values + i);
}
else {
for ( unsigned int i = a_points.size() - 1; i >= no_of_values; i--)
((GlowPoint *)a_points[i])->y = ((GlowPoint *)a_points[i-no_of_values])->y;
for ( unsigned int i = 0; i < no_of_values; i++) for ( unsigned int i = 0; i < no_of_values; i++)
((GlowPoint *)a_points[i])->y = *(values + i); ((GlowPoint *)a_points[i])->y = *(values + i);
}
zoom(); zoom();
nav_zoom(); nav_zoom();
} }
......
...@@ -748,10 +748,14 @@ void XttTrend::trend_scan( void *data) ...@@ -748,10 +748,14 @@ void XttTrend::trend_scan( void *data)
size = trend->cb_info[i].size; size = trend->cb_info[i].size;
if ( size > 0) { if ( size > 0) {
// Shift data // Shift data
for ( j = trend->cb_info[i].samples - 1; j >= (int)size; j--)
trend->gcd->y_data[i][j] = trend->gcd->y_data[i][j-size]; for ( j = trend->cb_info[i].samples - 1; j >= (int)size; j--) {
if ( j < trend->gcd->rows[i])
trend->gcd->y_data[i][j] = trend->gcd->y_data[i][j-size];
}
// Insert new value // Insert new value
switch ( trend->element_type[i]) { switch ( trend->element_type[i]) {
case pwr_eType_Float64: case pwr_eType_Float64:
...@@ -1237,7 +1241,7 @@ void XttTrend::curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatu ...@@ -1237,7 +1241,7 @@ void XttTrend::curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatu
} }
for ( i = start_idx; i < trend_cnt; i++) { for ( i = start_idx; i < trend_cnt; i++) {
gcd->y_data[i] = (double *) calloc( 1, 8 * max_points); gcd->y_data[i] = (double *) calloc( 1, 8 * MAX((unsigned int)max_points,actual_data_size[i]));
switch ( element_type[i]) { switch ( element_type[i]) {
case pwr_eType_Float32: case pwr_eType_Float32:
...@@ -1289,7 +1293,7 @@ void XttTrend::curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatu ...@@ -1289,7 +1293,7 @@ void XttTrend::curve_add( pwr_tAttrRef *arp, pwr_tAttrRef *trend_arp, pwr_tStatu
gcd->y_axis_type[i] = curve_eAxis_y; gcd->y_axis_type[i] = curve_eAxis_y;
strcpy( gcd->y_name[i], object_name[i]); strcpy( gcd->y_name[i], object_name[i]);
gcd->rows[i] = max_points; gcd->rows[i] = actual_data_size[i];
} }
gcd->cols = trend_cnt; gcd->cols = trend_cnt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment