diff --git a/Common/onelabUtils.cpp b/Common/onelabUtils.cpp index 40541f5be235ce1276946bb6c4ca01e4d476fb98..ca96de7da906edcc6e0452ee6cb151e4ceff72c1 100644 --- a/Common/onelabUtils.cpp +++ b/Common/onelabUtils.cpp @@ -243,18 +243,22 @@ namespace onelabUtils { int num = atoi(graphNum.c_str()); std::vector<double> x, y; std::string xName, yName; + int graphType = 0; std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers); for(unsigned int i = 0; i < numbers.size(); i++){ std::string v = numbers[i].getAttribute("Graph"); v.resize(36, '0'); - if(v[2 * num] == '1'){ + if(v[2 * num] != '0'){ x = getRange(numbers[i]); xName = numbers[i].getShortName(); } - if(v[2 * num + 1] == '1'){ + if(v[2 * num + 1] != '0'){ y = getRange(numbers[i]); yName = numbers[i].getShortName(); + char t = v[2 * num + 1]; + graphType = (t == '1') ? 1 : (t == '2') ? 2 : (t == '3') ? 3 : + (t == '4') ? 4 : 3; } } if(x.empty()){ @@ -274,7 +278,7 @@ namespace onelabUtils { else{ view = new PView(xName, yName, x, y); view->getData()->setFileName("ONELAB" + graphNum); - view->getOptions()->intervalsType = PViewOptions::Discrete; + view->getOptions()->intervalsType = graphType; view->getOptions()->autoPosition = num / 2 + 2; } changed = true; diff --git a/Fltk/inputRange.h b/Fltk/inputRange.h index 7b799d958dbd8245ff09bbf001f15c5259497605..b755b3365841d6da3befa2a5ae9e3e8c13f69d15 100644 --- a/Fltk/inputRange.h +++ b/Fltk/inputRange.h @@ -173,14 +173,14 @@ class inputRange : public Fl_Group { 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; for(int i = 0; i < 36; i++){ - if(_graph_val[i] == '1') + if(_graph_val[i] != '0') ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].set(); else ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].clear(); } } bool yellow = false; - for(int i = 0; i < 36; i++) if(_graph_val[i] == '1') yellow = true; + for(int i = 0; i < 36; i++) if(_graph_val[i] != '0') yellow = true; if(yellow){ _graph_butt->value(1); _graph_butt->selection_color(FL_YELLOW); @@ -222,8 +222,10 @@ class inputRange : public Fl_Group { 25, 26, 27, 28, 31, 32, 33, 34, 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; - for(int i = 0; i < 36; i++) - v[i] = b->_graph_menu->menu()[index[i]].value() ? '1' : '0'; + for(int i = 0; i < 36; i++){ + // 1=iso, 2=continuous, 3=discrete, 4=numeric + v[i] = b->_graph_menu->menu()[index[i]].value() ? '3' : '0'; + } b->_set_graph_value(v, false); b->doCallbackOnValues(false); b->do_callback(); diff --git a/Fltk/outputRange.h b/Fltk/outputRange.h index 72d09f518563c49959ccfc0702c09d0f20a950b4..4bcf7237da9b80991a4020da26b7d4284ff8e1c0 100644 --- a/Fltk/outputRange.h +++ b/Fltk/outputRange.h @@ -32,14 +32,14 @@ class outputRange : public Fl_Group { 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; for(int i = 0; i < 36; i++){ - if(_graph_val[i] == '1') + if(_graph_val[i] != '0') ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].set(); else ((Fl_Menu_Item*)_graph_menu->menu())[index[i]].clear(); } } bool yellow = false; - for(int i = 0; i < 36; i++) if(_graph_val[i] == '1') yellow = true; + for(int i = 0; i < 36; i++) if(_graph_val[i] != '0') yellow = true; if(yellow){ _graph_butt->value(1); _graph_butt->selection_color(FL_YELLOW); @@ -60,8 +60,10 @@ class outputRange : public Fl_Group { 25, 26, 27, 28, 31, 32, 33, 34, 37, 38, 39, 40, 43, 44, 45, 46, 49, 50, 51, 52}; - for(int i = 0; i < 36; i++) - v[i] = b->_graph_menu->menu()[index[i]].value() ? '1' : '0'; + for(int i = 0; i < 36; i++){ + // 1=iso, 2=continuous, 3=discrete, 4=numeric + v[i] = b->_graph_menu->menu()[index[i]].value() ? '3' : '0'; + } b->_set_graph_value(v, false); b->do_callback(); }