James Kuszmaul | 4867136 | 2020-12-24 13:54:16 -0800 | [diff] [blame] | 1 | // This flatbuffer defines the interface that is used by the in-process |
| 2 | // web plotter to plot data dynamically. Both the structure of the plot and |
| 3 | // the data to plot is all packaged within a single Plot message. Each Plot |
| 4 | // message will correspond to a single view/tab on the web-page, and can have |
| 5 | // multiple figures, each of which can have multiple lines. |
| 6 | namespace frc971.analysis; |
| 7 | |
| 8 | // Position within the web-page to plot a figure at. [0, 0] will be the upper |
| 9 | // left corner of the allowable places where plots can be put, and should |
| 10 | // generally be the default location. All values in pixels. |
| 11 | table Position { |
| 12 | top:float (id: 0); |
| 13 | left:float (id: 1); |
| 14 | width:float (id: 2); |
| 15 | height:float (id: 3); |
| 16 | } |
| 17 | |
| 18 | struct Point { |
| 19 | x:double (id: 0); |
| 20 | y:double (id: 1); |
| 21 | } |
| 22 | |
| 23 | // RGB values are in the range [0, 1]. |
| 24 | struct Color { |
| 25 | r:float (id: 0); |
| 26 | g:float (id: 1); |
| 27 | b:float (id: 2); |
| 28 | } |
| 29 | |
| 30 | table Line { |
| 31 | label:string (id: 0); |
| 32 | points:[Point] (id: 1); |
| 33 | color:Color (id: 2); |
| 34 | } |
| 35 | |
| 36 | table Figure { |
| 37 | position:Position (id: 0); |
| 38 | lines:[Line] (id: 1); |
| 39 | // Specifies whether to link the x-axis of this Figure with that of other |
| 40 | // figures in this Plot. Only the axes of Figure's with this flag set will |
| 41 | // be linked. |
| 42 | share_x_axis:bool (id: 2); |
| 43 | title:string (id: 3); |
| 44 | xlabel:string (id: 4); |
| 45 | ylabel:string (id: 5); |
| 46 | } |
| 47 | |
| 48 | table Plot { |
| 49 | figures:[Figure] (id: 0); |
| 50 | title:string (id: 1); |
| 51 | } |
| 52 | |
| 53 | root_type Plot; |