File tree Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Expand file tree Collapse file tree 4 files changed +84
-0
lines changed Original file line number Diff line number Diff line change @@ -83,3 +83,8 @@ TextBlock* AdafruitIO_Dashboard::addTextBlock(AdafruitIO_Feed *feed)
83
83
{
84
84
return new TextBlock (this , feed);
85
85
}
86
+
87
+ ChartBlock* AdafruitIO_Dashboard::addChartBlock (AdafruitIO_Feed *feed)
88
+ {
89
+ return new ChartBlock (this , feed);
90
+ }
Original file line number Diff line number Diff line change 19
19
#include " blocks/SliderBlock.h"
20
20
#include " blocks/GaugeBlock.h"
21
21
#include " blocks/TextBlock.h"
22
+ #include " blocks/ChartBlock.h"
22
23
23
24
// forward declaration
24
25
class AdafruitIO ;
@@ -40,6 +41,7 @@ class AdafruitIO_Dashboard {
40
41
SliderBlock* addSliderBlock (AdafruitIO_Feed *feed);
41
42
GaugeBlock* addGaugeBlock (AdafruitIO_Feed *feed);
42
43
TextBlock* addTextBlock (AdafruitIO_Feed *feed);
44
+ ChartBlock* addChartBlock (AdafruitIO_Feed *feed);
43
45
44
46
private:
45
47
AdafruitIO *_io;
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #include " ChartBlock.h"
13
+
14
+ ChartBlock::ChartBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f) : AdafruitIO_Block(d, f)
15
+ {
16
+ historyHours = 0 ;
17
+ xAxisLabel = " X" ;
18
+ yAxisLabel = " Y" ;
19
+ yAxisMin = 0 ;
20
+ yAxisMax = 100 ;
21
+ }
22
+
23
+ ChartBlock::~ChartBlock (){}
24
+
25
+ String ChartBlock::properties ()
26
+ {
27
+
28
+ String props = " {\" historyHours\" :\" " ;
29
+ props += historyHours;
30
+ props += " \" ,\" xAxisLabel\" :" ;
31
+ props += xAxisLabel;
32
+ props += " \" ,\" yAxisLabel\" :" ;
33
+ props += yAxisLabel;
34
+ props += " \" ,\" yAxisMin\" :" ;
35
+ props += yAxisMin;
36
+ props += " \" ,\" yAxisMax\" :" ;
37
+ props += yAxisMax;
38
+ props += " \" }" ;
39
+
40
+ return props;
41
+ }
Original file line number Diff line number Diff line change
1
+ //
2
+ // Adafruit invests time and resources providing this open source code.
3
+ // Please support Adafruit and open source hardware by purchasing
4
+ // products from Adafruit!
5
+ //
6
+ // Copyright (c) 2015-2016 Adafruit Industries
7
+ // Authors: Tony DiCola, Todd Treece
8
+ // Licensed under the MIT license.
9
+ //
10
+ // All text above must be included in any redistribution.
11
+ //
12
+ #ifndef ADAFRUITIO_CHARTBLOCK_H
13
+ #define ADAFRUITIO_CHARTBLOCK_H
14
+
15
+ #include " AdafruitIO_Block.h"
16
+
17
+ class ChartBlock : public AdafruitIO_Block {
18
+
19
+ public:
20
+ ChartBlock (AdafruitIO_Dashboard *d, AdafruitIO_Feed *f);
21
+ ~ChartBlock ();
22
+
23
+ int historyHours;
24
+ const char *xAxisLabel;
25
+ const char *yAxisLabel;
26
+ int yAxisMin;
27
+ int yAxisMax;
28
+
29
+ String properties ();
30
+
31
+ private:
32
+ const char *_visual_type = " line_chart" ;
33
+
34
+ };
35
+
36
+ #endif // ADAFRUITIO_CHARTBLOCK_H
You can’t perform that action at this time.
0 commit comments