Commit 8a6f5f81 authored by Claes Sjofors's avatar Claes Sjofors

Ge xy-curve and trend. Dynamic horizontal and vertical marker lines added

parent baa2fc00
......@@ -2948,6 +2948,7 @@ with or without scrollbars.
<h2>Limitations
Connections within the window object are scaled properly.
In object graphs, $object only works in two levels of window objects.
<h2>Attributes
<b>Attribute <t><t>Description
......@@ -2970,6 +2971,7 @@ and when that folder is activated, the stated graph is displayed in the window.
<h2>Limitations
Sliders within the window object are disabled.
You can not state an hierarchy or class object.
In object graphs, $object only works in two levels of window objects.
<h2>Attributes
<b>Attribute <t><t>Description
......
......@@ -2928,6 +2928,7 @@ med eller utan skroll-lister.
<h2>Begränsningar
Kopplingar i fönstret skalas inte på rätt sätt.
I objektsbilder fungerar $object endast i två nivåer av windowobjekt.
<h2>Attribut
<b>Attribut <t><t>Beskrivning
......@@ -2949,6 +2950,7 @@ och n
<h2>Begränsningar
Kopplingar i fönstret skalas inte på rätt sätt.
I objektsbilder fungerar $object endast i två nivåer av windowobjekt.
<h2>Attribut
<b>Attribut <t><t>Beskrivning
......
This diff is collapsed.
......@@ -476,6 +476,10 @@
ge_eSave_Trend_maxvalue_attr2 = 2305,
ge_eSave_Trend_hold_attr = 2306,
ge_eSave_Trend_timerange_attr = 2307,
ge_eSave_Trend_mark1_attr = 2308,
ge_eSave_Trend_mark2_attr = 2309,
ge_eSave_Trend_mark1_color = 2310,
ge_eSave_Trend_mark2_color = 2311,
ge_eSave_DigFlash_attribute = 2600,
ge_eSave_DigFlash_color = 2601,
ge_eSave_DigFlash_color2 = 2602,
......@@ -554,6 +558,13 @@
ge_eSave_XY_Curve_instance_mask = 3415,
ge_eSave_XY_Curve_curve_color = 3416,
ge_eSave_XY_Curve_fill_color = 3417,
ge_eSave_XY_Curve_horizontal_padding = 3418,
ge_eSave_XY_Curve_x_mark1_attr = 3419,
ge_eSave_XY_Curve_x_mark2_attr = 3420,
ge_eSave_XY_Curve_y_mark1_attr = 3421,
ge_eSave_XY_Curve_y_mark2_attr = 3422,
ge_eSave_XY_Curve_mark1_color = 3423,
ge_eSave_XY_Curve_mark2_color = 3424,
ge_eSave_DigCommand_attribute = 3500,
ge_eSave_DigCommand_command = 3501,
ge_eSave_DigCommand_instance = 3502,
......@@ -2557,6 +2568,8 @@ class GeTrend : public GeDynElem {
pwr_tAName maxvalue_attr2;
pwr_tAName hold_attr;
pwr_tAName timerange_attr;
pwr_tAName mark1_attr;
pwr_tAName mark2_attr;
bool first_scan;
double scan_time;
......@@ -2597,22 +2610,34 @@ class GeTrend : public GeDynElem {
double orig_graph_scan_time;
double orig_graph_fast_scan_time;
double orig_graph_animation_scan_time;
pwr_tFloat32 *mark1_p;
pwr_tFloat32 *mark2_p;
pwr_tFloat32 old_mark1;
pwr_tFloat32 old_mark2;
pwr_tSubid mark1_subid;
pwr_tSubid mark2_subid;
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
GeTrend( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType1_Trend, ge_mDynType2_No, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_Trend),
min_value1_p(0), max_value1_p(0), old_min_value1(0), old_max_value1(0),
min_value2_p(0), max_value2_p(0), old_min_value2(0), old_max_value2(0),
hold_p(0), timerange_p(0), old_timerange(0)
hold_p(0), timerange_p(0), old_timerange(0), mark1_color(glow_eDrawType_Inherit),
mark2_color(glow_eDrawType_Inherit)
{ strcpy( attribute1, ""); strcpy( attribute2, "");
strcpy( minvalue_attr1, ""); strcpy( maxvalue_attr1, "");
strcpy( minvalue_attr2, ""); strcpy( maxvalue_attr2, "");
strcpy( hold_attr, ""); strcpy( timerange_attr, "");}
strcpy( hold_attr, ""); strcpy( timerange_attr, "");
strcpy( mark1_attr, ""); strcpy( mark2_attr, "");}
GeTrend( const GeTrend& x) :
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio)
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio),
mark1_color(x.mark1_color), mark2_color(x.mark2_color)
{ strcpy( attribute1, x.attribute1); strcpy( attribute2, x.attribute2);
strcpy( minvalue_attr1, x.minvalue_attr1); strcpy( maxvalue_attr1, x.maxvalue_attr1);
strcpy( minvalue_attr2, x.minvalue_attr2); strcpy( maxvalue_attr2, x.maxvalue_attr2);
strcpy( hold_attr, x.hold_attr); strcpy( timerange_attr, x.timerange_attr);}
strcpy( hold_attr, x.hold_attr); strcpy( timerange_attr, x.timerange_attr);
strcpy( mark1_attr, x.mark1_attr); strcpy( mark2_attr, x.mark2_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
......@@ -2634,6 +2659,10 @@ class GeXY_Curve : public GeDynElem {
pwr_tAName x_maxvalue_attr;
pwr_tAName noofpoints_attr;
pwr_tAName update_attr;
pwr_tAName x_mark1_attr;
pwr_tAName x_mark2_attr;
pwr_tAName y_mark1_attr;
pwr_tAName y_mark2_attr;
double y_min_value;
double y_max_value;
double x_min_value;
......@@ -2642,6 +2671,7 @@ class GeXY_Curve : public GeDynElem {
int datatype;
glow_eDrawType curve_color;
glow_eDrawType fill_color;
int horizontal_padding;
bool first_scan;
pwr_tBoolean *update_p;
......@@ -2663,31 +2693,52 @@ class GeXY_Curve : public GeDynElem {
pwr_tSubid y_max_value_subid;
pwr_tSubid x_min_value_subid;
pwr_tSubid x_max_value_subid;
pwr_tFloat32 *x_mark1_p;
pwr_tFloat32 *x_mark2_p;
pwr_tFloat32 *y_mark1_p;
pwr_tFloat32 *y_mark2_p;
pwr_tFloat32 old_x_mark1;
pwr_tFloat32 old_x_mark2;
pwr_tFloat32 old_y_mark1;
pwr_tFloat32 old_y_mark2;
pwr_tSubid x_mark1_subid;
pwr_tSubid x_mark2_subid;
pwr_tSubid y_mark1_subid;
pwr_tSubid y_mark2_subid;
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
int curve_number;
GeXY_Curve( GeDyn *e_dyn, ge_mInstance e_instance = ge_mInstance_1) :
GeDynElem(e_dyn, ge_mDynType1_XY_Curve, ge_mDynType2_No, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_XY_Curve),
y_min_value(0), y_max_value(100), x_min_value(0), x_max_value(100),
noofpoints(100), datatype(0), curve_color(glow_eDrawType_Inherit),
fill_color(glow_eDrawType_Inherit), update_p(0), old_update(0),
fill_color(glow_eDrawType_Inherit), horizontal_padding(0), update_p(0), old_update(0),
noofpoints_p(0), old_noofpoints(0),
y_min_value_p(0), y_max_value_p(0), x_min_value_p(0), x_max_value_p(0),
old_y_min_value(0), old_y_max_value(0), old_x_min_value(0), old_x_max_value(0)
old_y_min_value(0), old_y_max_value(0), old_x_min_value(0), old_x_max_value(0),
x_mark1_p(0), x_mark2_p(0), y_mark1_p(0), y_mark2_p(0), old_x_mark1(0), old_x_mark2(0),
old_y_mark1(0), old_y_mark2(0), mark1_color(glow_eDrawType_Inherit), mark2_color(glow_eDrawType_Inherit)
{ instance = e_instance; strcpy( x_attr, ""); strcpy( y_attr, "");
strcpy( y_minvalue_attr, ""); strcpy( y_maxvalue_attr, "");
strcpy( x_minvalue_attr, ""); strcpy( x_maxvalue_attr, "");
strcpy( noofpoints_attr, ""); strcpy( update_attr, "");}
strcpy( noofpoints_attr, ""); strcpy( update_attr, "");
strcpy( x_mark1_attr, ""); strcpy( x_mark2_attr, "");
strcpy( y_mark1_attr, ""); strcpy( y_mark2_attr, "");}
GeXY_Curve( const GeXY_Curve& x) :
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio),
y_min_value(x.y_min_value), y_max_value(x.y_max_value),
x_min_value(x.x_min_value), x_max_value(x.x_max_value),
noofpoints(x.noofpoints), datatype(x.datatype), curve_color(x.curve_color),
fill_color(x.fill_color)
fill_color(x.fill_color), horizontal_padding(x.horizontal_padding),
mark1_color(x.mark1_color), mark2_color(x.mark2_color)
{ instance = x.instance; instance_mask = x.instance_mask;
strcpy( x_attr, x.x_attr); strcpy( y_attr, x.y_attr);
strcpy( y_minvalue_attr, x.y_minvalue_attr); strcpy( y_maxvalue_attr, x.y_maxvalue_attr);
strcpy( x_minvalue_attr, x.x_minvalue_attr); strcpy( x_maxvalue_attr, x.x_maxvalue_attr);
strcpy( noofpoints_attr, x.noofpoints_attr); strcpy( update_attr, x.update_attr);}
strcpy( noofpoints_attr, x.noofpoints_attr); strcpy( update_attr, x.update_attr);
strcpy( x_mark1_attr, x.x_mark1_attr); strcpy( x_mark2_attr, x.x_mark2_attr);
strcpy( y_mark1_attr, x.y_mark1_attr); strcpy( y_mark2_attr, x.y_mark2_attr);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
void open( ifstream& fp);
......
......@@ -5232,12 +5232,16 @@ void Graph::create_trend( grow_tObject *object, double x, double y,
info.curve_drawtype[1] = glow_eCtColor_OrangeCurve;
info.curve_fill_drawtype[0] = glow_eCtColor_BarBarColor;
info.curve_fill_drawtype[1] = glow_eCtColor_OrangeBar;
info.mark1_color = glow_eCtColor_YellowCurve;
info.mark2_color = glow_eCtColor_RedCurve;
}
else {
info.curve_drawtype[0] = glow_eDrawType_Color145;
info.curve_drawtype[1] = glow_eDrawType_Color295;
info.curve_fill_drawtype[0] = glow_eDrawType_Color139;
info.curve_fill_drawtype[1] = glow_eDrawType_Color289;
info.mark1_color = glow_eDrawType_ColorYellow;
info.mark2_color = glow_eDrawType_ColorRed;
}
grow_SetTrendInfo( *object, &info);
......@@ -5277,6 +5281,8 @@ void Graph::create_xycurve( grow_tObject *object, double x, double y,
info.curve_drawtype[1] = glow_eDrawType_Color295;
info.curve_fill_drawtype[0] = glow_eDrawType_Color139;
info.curve_fill_drawtype[1] = glow_eDrawType_Color289;
info.mark1_color = glow_eDrawType_ColorYellow;
info.mark2_color = glow_eDrawType_ColorRed;
grow_SetTrendInfo( *object, &info);
grow_Redraw( grow->ctx);
......
......@@ -2367,6 +2367,8 @@ typedef struct {
int curve_width;
glow_eDrawType curve_drawtype[TREND_MAX_CURVES];
glow_eDrawType curve_fill_drawtype[TREND_MAX_CURVES];
glow_eDrawType mark1_color;
glow_eDrawType mark2_color;
} glow_sTrendInfo;
//! Data for a GrowBar object
......
......@@ -4887,6 +4887,25 @@ void grow_SetTrendRangeY( grow_tObject object, int curve,
((GrowTrend *)object)->set_range_y( curve, min, max);
}
void grow_SetTrendXMark1( grow_tObject object, double mark)
{
((GrowTrend *)object)->set_x_mark1( mark);
}
void grow_SetTrendXMark2( grow_tObject object, double mark)
{
((GrowTrend *)object)->set_x_mark2( mark);
}
void grow_SetTrendYMark1( grow_tObject object, double mark)
{
((GrowTrend *)object)->set_y_mark1( mark);
}
void grow_SetTrendYMark2( grow_tObject object, double mark)
{
((GrowTrend *)object)->set_y_mark2( mark);
}
void grow_SetXYCurveRangeY( grow_tObject object, int curve,
double min, double max)
{
......@@ -4899,7 +4918,27 @@ void grow_SetXYCurveRangeX( grow_tObject object, int curve,
((GrowXYCurve *)object)->set_xy_range_x( curve, min, max);
}
void grow_SetTrendXYNoOfCurves( grow_tObject object, int noofcurves)
void grow_SetXYCurveXMark1( grow_tObject object, double mark)
{
((GrowXYCurve *)object)->set_x_mark1( mark);
}
void grow_SetXYCurveXMark2( grow_tObject object, double mark)
{
((GrowXYCurve *)object)->set_x_mark2( mark);
}
void grow_SetXYCurveYMark1( grow_tObject object, double mark)
{
((GrowXYCurve *)object)->set_y_mark1( mark);
}
void grow_SetXYCurveYMark2( grow_tObject object, double mark)
{
((GrowXYCurve *)object)->set_y_mark2( mark);
}
void grow_SetXYCurveNoOfCurves( grow_tObject object, int noofcurves)
{
((GrowXYCurve *)object)->set_xy_noofcurves( noofcurves);
}
......@@ -5412,12 +5451,23 @@ void grow_SetTrendData( grow_tObject object, double *data[3], int data_curves, i
((GrowTrend *)object)->set_data( data, data_curves, data_points);
}
void grow_SetTrendMarkColor( grow_tObject object, glow_eDrawType mark1_color,
glow_eDrawType mark2_color)
{
((GrowTrend *)object)->set_mark_color( mark1_color, mark2_color);
}
void grow_SetXYCurveCurveColor( grow_tObject object, int curve, glow_eDrawType curve_color,
glow_eDrawType fill_color)
{
((GrowXYCurve *)object)->set_xy_curve_color( curve, curve_color, fill_color);
}
void grow_SetXYCurveMarkColor( grow_tObject object, glow_eDrawType mark1_color,
glow_eDrawType mark2_color)
{
((GrowXYCurve *)object)->set_mark_color( mark1_color, mark2_color);
}
void grow_SetXYCurveData( grow_tObject object, double *y_data, double *x_data, int curve_idx,
int data_points)
{
......
......@@ -2317,6 +2317,30 @@ extern "C" {
void grow_SetTrendRangeY( grow_tObject object, int curve,
double min, double max);
//! Set vertical mark 1.
/*!
\param mark Mark value.
*/
void grow_SetTrendXMark1( grow_tObject object, double mark);
//! Set vertical mark 2.
/*!
\param mark Mark value.
*/
void grow_SetTrendXMark2( grow_tObject object, double mark);
//! Set horizontal mark 1.
/*!
\param mark Mark value.
*/
void grow_SetTrendYMark1( grow_tObject object, double mark);
//! Set horizontal mark 2.
/*!
\param mark Mark value.
*/
void grow_SetTrendYMark2( grow_tObject object, double mark);
//! Set the range of a xy curve object.
/*!
\param object Trend object.
......@@ -2337,12 +2361,36 @@ extern "C" {
void grow_SetXYCurveRangeX( grow_tObject object, int curve,
double min, double max);
//! Set vertical mark 1.
/*!
\param mark Mark value.
*/
void grow_SetXYCurveXMark1( grow_tObject object, double mark);
//! Set vertical mark 2.
/*!
\param mark Mark value.
*/
void grow_SetXYCurveXMark2( grow_tObject object, double mark);
//! Set horizontal mark 1.
/*!
\param mark Mark value.
*/
void grow_SetXYCurveYMark1( grow_tObject object, double mark);
//! Set horizontal mark 2.
/*!
\param mark Mark value.
*/
void grow_SetXYCurveYMark2( grow_tObject object, double mark);
//! Set number of curves a xy curve object.
/*!
\param object Trend object.
\param noofcurve Number of curves.
*/
void grow_SetTrendXYNoOfCurves( grow_tObject object, int noofcurves);
void grow_SetXYCurveNoOfCurves( grow_tObject object, int noofcurves);
//! Get the scantime of a trend object.
/*!
......@@ -3042,6 +3090,8 @@ extern "C" {
int grow_GetTrendNoOfPoints( grow_tObject object);
int grow_GetTrendFillCurve( grow_tObject object);
void grow_SetTrendMarkColor( grow_tObject object, glow_eDrawType mark1_color,
glow_eDrawType mark2_color);
//! Set fast curve data for a GrowTrend object.
/*!
......@@ -3053,6 +3103,8 @@ extern "C" {
void grow_SetTrendData( grow_tObject object, double *data[3], int data_curves, int data_points);
void grow_SetXYCurveCurveColor( grow_tObject object, int curve, glow_eDrawType curve_color,
glow_eDrawType fill_color);
void grow_SetXYCurveMarkColor( grow_tObject object, glow_eDrawType mark1_color,
glow_eDrawType mark2_color);
void grow_SetXYCurveData( grow_tObject object, double *y_data, double *x_data, int curve_idx,
int data_points);
void grow_SetPieValues( grow_tObject object, double *values);
......
......@@ -71,7 +71,10 @@ GrowTrend::GrowTrend( GrowCtx *glow_ctx, const char *name, double x, double y,
display_lev,fill_rect,display_border,0,fill_d_type,nodraw),
horizontal_lines(0), vertical_lines(0), fill_curve(0),
no_of_points(100), curve_width(1),
curve_cnt(0), scan_time(1), user_data(0)
curve_cnt(0), scan_time(1), user_data(0),
display_x_mark1(0), display_x_mark2(0), display_y_mark1(0), display_y_mark2(0),
x_mark1(0), x_mark2(0), y_mark1(0), y_mark2(0), mark1_color(glow_eDrawType_Inherit),
mark2_color(glow_eDrawType_Inherit)
{
for ( int i = 0; i < TREND_MAX_CURVES; i++) {
y_min_value[i] = 0;
......@@ -607,6 +610,58 @@ void GrowTrend::draw( GlowWind *w, GlowTransform *t, int highlight, int hot, voi
curve[i]->fill = 1;
}
}
if ( display_x_mark1) {
int xm;
if (!t)
xm = int( trf.x( x_mark1, ll.y) * w->zoom_factor_x) - w->offset_x;
else
xm = int( trf.x( t, x_mark1, ll.y) * w->zoom_factor_x) - w->offset_x;
if ( xm >= ll_x && xm <= ur_x) {
drawtype = mark1_color;
if ( drawtype == glow_eDrawType_Inherit)
drawtype = glow_eDrawType_ColorYellow;
ctx->gdraw->line( w, xm, ll_y, xm, ur_y, drawtype, idx, 0);
}
}
if ( display_x_mark2) {
int xm;
if (!t)
xm = int( trf.x( x_mark2, ll.y) * w->zoom_factor_x) - w->offset_x;
else
xm = int( trf.x( t, x_mark2, ll.y) * w->zoom_factor_x) - w->offset_x;
if ( xm >= ll_x && xm <= ur_x) {
drawtype = mark2_color;
if ( drawtype == glow_eDrawType_Inherit)
drawtype = glow_eDrawType_ColorRed;
ctx->gdraw->line( w, xm, ll_y, xm, ur_y, drawtype, idx, 0);
}
}
if ( display_y_mark1) {
int ym;
if (!t)
ym = int( trf.y( ll.x, y_mark1) * w->zoom_factor_y) - w->offset_y;
else
ym = int( trf.y( t, ll.x, y_mark1) * w->zoom_factor_y) - w->offset_y;
if ( ym >= ll_y && ym <= ur_y) {
drawtype = mark1_color;
if ( drawtype == glow_eDrawType_Inherit)
drawtype = glow_eDrawType_ColorYellow;
ctx->gdraw->line( w, ll_x, ym, ur_x, ym, drawtype, idx, 0);
}
}
if ( display_y_mark2) {
int ym;
if (!t)
ym = int( trf.y( ll.x, y_mark2) * w->zoom_factor_y) - w->offset_y;
else
ym = int( trf.y( t, ll.x, y_mark2) * w->zoom_factor_y) - w->offset_y;
if ( ym >= ll_y && ym <= ur_y) {
drawtype = mark2_color;
if ( drawtype == glow_eDrawType_Inherit)
drawtype = glow_eDrawType_ColorRed;
ctx->gdraw->line( w, ll_x, ym, ur_x, ym, drawtype, idx, 0);
}
}
}
//! Erase the object.
......@@ -834,6 +889,18 @@ void GrowTrend::set_range_y( int curve, double min, double max)
{
if ( !( curve == 0 || curve == 1))
return;
if ( curve == 0) {
if ( display_y_mark1) {
double mark = y_min_value[0] - (y_mark1 - ur.y) *(y_max_value[0] - y_min_value[0]) / (ur.y - ll.y);
y_mark1 = ur.y - (mark - min) / (max - min) * (ur.y - ll.y);
}
if ( display_y_mark2) {
double mark = y_min_value[0] - (y_mark2 - ur.y) *(y_max_value[0] - y_min_value[0]) / (ur.y - ll.y);
y_mark2 = ur.y - (mark - min) / (max - min) * (ur.y - ll.y);
}
}
y_max_value[curve] = max;
y_min_value[curve] = min;
configure_curves();
......@@ -913,6 +980,8 @@ void GrowTrend::set_trend_info( glow_sTrendInfo *info)
curve_drawtype[i] = info->curve_drawtype[i];
curve_fill_drawtype[i] = info->curve_fill_drawtype[i];
}
mark1_color = info->mark1_color;
mark2_color = info->mark2_color;
configure_curves();
}
......@@ -1019,3 +1088,57 @@ void GrowTrend::set_data( double *data[3], int data_curves, int data_points)
draw();
}
//! Set vertical mark 1.
/*!
\param mark Mark value.
*/
void GrowTrend::set_x_mark1( double mark)
{
display_x_mark1 = 1;
x_mark1 = ll.x + (mark - x_min_value[0]) /
(x_max_value[0] - x_min_value[0]) * (ur.x - ll.x);
draw();
}
//! Set vertical mark 2.
/*!
\param mark Mark value.
*/
void GrowTrend::set_x_mark2( double mark)
{
display_x_mark2 = 1;
x_mark2 = ll.x + (mark - x_min_value[0]) /
(x_max_value[0] - x_min_value[0]) * (ur.x - ll.x);
draw();
}
//! Set horizontal mark 1.
/*!
\param mark Mark value.
*/
void GrowTrend::set_y_mark1( double mark)
{
display_y_mark1 = 1;
y_mark1 = ur.y - (mark - y_min_value[0]) /
(y_max_value[0] - y_min_value[0]) * (ur.y - ll.y);
draw();
}
//! Set horizontal mark 2.
/*!
\param mark Mark value.
*/
void GrowTrend::set_y_mark2( double mark)
{
display_y_mark2 = 1;
y_mark2 = ur.y - (mark - y_min_value[0]) /
(y_max_value[0] - y_min_value[0]) * (ur.y - ll.y);
draw();
}
void GrowTrend::set_mark_color( glow_eDrawType m1color, glow_eDrawType m2color)
{
mark1_color = m1color;
mark2_color = m2color;
}
......@@ -115,6 +115,16 @@ class GrowTrend : public GrowRect {
int curve_cnt; //!< Number of curves.
double scan_time; //!< Scantime. Time interval between two points.
void *user_data; //!< User data.
int display_x_mark1; //!< Display vertical marker line 1.
int display_x_mark2; //!< Display vertical marker line 2.
int display_y_mark1; //!< Display horizontal marker line 1.
int display_y_mark2; //!< Display horizontal marker line 2.
double x_mark1; //!< Vertical marker line 1 position.
double x_mark2; //!< Vertical marker line 2 position.
double y_mark1; //!< Horizontal marker line 1 position.
double y_mark2; //!< Horizontal marker line 2 position.
glow_eDrawType mark1_color; //!< Marker line 1 color.
glow_eDrawType mark2_color; //!< Marker line 2 color.
void draw( GlowWind *w, GlowTransform *t, int highlight, int hot, void *node, void *colornode);
......@@ -173,6 +183,11 @@ class GrowTrend : public GrowRect {
void set_data( double *data[3], int data_curves, int data_points);
int get_no_of_points() { return no_of_points;}
int get_fill_curve() { return fill_curve;}
void set_mark_color( glow_eDrawType m1color, glow_eDrawType m2color);
void set_x_mark1( double mark);
void set_x_mark2( double mark);
void set_y_mark1( double mark);
void set_y_mark2( double mark);
};
......
......@@ -110,6 +110,17 @@ void GrowXYCurve::set_xy_range_x( int curve, double min, double max)
{
if ( curve > TREND_MAX_CURVES)
return;
if ( curve == 0) {
if ( display_x_mark1) {
double mark = (x_mark1 - ll.x) * (x_max_value[0] - x_min_value[0]) / (ur.x - ll.x) + x_min_value[0];
x_mark1 = ll.x + (mark - min) / (max - min) * (ur.x - ll.x);
}
if ( display_x_mark2) {
double mark = (x_mark2 - ll.x) * (x_max_value[0] - x_min_value[0]) / (ur.x - ll.x) + x_min_value[0];
x_mark2 = ll.x + (mark - min) / (max - min) * (ur.x - ll.x);
}
}
x_max_value[curve] = max;
x_min_value[curve] = min;
}
......@@ -124,6 +135,16 @@ void GrowXYCurve::set_xy_range_y( int curve, double min, double max)
{
if ( curve > TREND_MAX_CURVES)
return;
if ( curve == 0) {
if ( display_y_mark1) {
double mark = y_min_value[0] - (y_mark1 - ur.y) *(y_max_value[0] - y_min_value[0]) / (ur.y - ll.y);
y_mark1 = ur.y - (mark - min) / (max - min) * (ur.y - ll.y);
}
if ( display_y_mark2) {
double mark = y_min_value[0] - (y_mark2 - ur.y) *(y_max_value[0] - y_min_value[0]) / (ur.y - ll.y);
y_mark2 = ur.y - (mark - min) / (max - min) * (ur.y - ll.y);
}
}
y_max_value[curve] = max;
y_min_value[curve] = min;
}
......
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