Skip to content

Commit 566cd8d

Browse files
authored
Merge pull request #148 from le-sigwal/master
Axis on/off modification
2 parents 3e3fd94 + bb5c1df commit 566cd8d

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

client-api/C++/examples/all_commands.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ int main()
312312
VIBES_TEST( vibes::drawText(2,-2,"My Text",vibesParams("group","group"))) ;
313313
VIBES_TEST( vibes::drawText(2,2,"My Text", 0.1 , "b[k]") );
314314
VIBES_TEST( vibes::drawText(3,6,"My Text",vibesParams("FaceColor","red","EdgeColor","black","fontSize",15,"fontName","Cursive","name","Text") ) );
315-
315+
VIBES_TEST( vibes::showAxis(false) ); //[#148]
316+
316317

317318

318319
vibes::newFigure("test Raster");

client-api/C++/src/vibes.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ namespace vibes {
3939
std::string Value::toJSONString() const {
4040
std::ostringstream ss;
4141
switch (_type) {
42+
case vt_bool: //[#148]
43+
/*ss<<_bool;*/ // /!\ depends on std::noboolalpha (1,0) or std::boolalpha (true,false)
44+
if(_bool){ ss<<"true"; } else{ ss<<"false"; }
45+
break;
4246
case vt_integer:
4347
ss<<_integer; break;
4448
case vt_decimal:
@@ -248,6 +252,17 @@ namespace vibes
248252
setFigureProperty( figureName.empty()?current_fig:figureName, "axislabels", labels);
249253
}
250254

255+
//-------------------------------------------------------------------------
256+
//[>SHOWAXIS] [#148]
257+
//-------------------------------------------------------------------------
258+
void showAxis(bool visible, const std::string &figureName){
259+
setFigureProperty(figureName.empty()?current_fig:figureName,
260+
"showAxis", visible);
261+
}
262+
//-------------------------------------------------------------------------
263+
//[<SHOWAXIS]
264+
//-------------------------------------------------------------------------
265+
251266

252267
//
253268
// Drawing functions

client-api/C++/src/vibes.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ namespace vibes {
8383
class Value {
8484

8585
union {
86+
bool _bool; //[#148]
8687
int _integer;
8788
double _decimal;
8889
const Params *_object;
@@ -91,11 +92,12 @@ namespace vibes {
9192
std::vector<Value> _array;
9293

9394
enum value_type_enum{
94-
vt_none, vt_integer, vt_string, vt_decimal, vt_array, vt_object
95+
vt_none, vt_bool, vt_integer, vt_string, vt_decimal, vt_array, vt_object //[#148]
9596
} _type;
9697

9798
public:
9899
Value() : _type(vt_none) {}
100+
Value(bool b) : _bool(b), _type(vt_bool) {} //[#148]
99101
Value(int i) : _integer(i), _type(vt_integer) {}
100102
Value(const double &d) : _decimal(d), _type(vt_decimal) {}
101103
Value(const std::string &s) : _string(s), _type(vt_string) {}
@@ -276,6 +278,9 @@ namespace vibes {
276278
/// Set axis labels according to the list provided in \a labels
277279
void axisLabels(const std::vector<std::string> &labels, const std::string &figureName = std::string());
278280

281+
/// Display axis if visible is true [#148]
282+
void showAxis(bool visible, const std::string &figureName = std::string());
283+
279284
/// @}
280285
///
281286
///

0 commit comments

Comments
 (0)