Skip to content
Snippets Groups Projects
Commit 997323f9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Graph attribute can now be used to select graph type

parent afc2ef81
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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();
......
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment