Changes between Version 15 and Version 16 of soc/2007/VisualizationOfContainers
- Timestamp:
- Jun 18, 2007, 1:51:51 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
soc/2007/VisualizationOfContainers
v15 v16 2 2 This project is focused on using STL containers in order to graph data on a one-dimensional and two-dimensional (and if time allows, 3D!) plot. The plot would be written in an `svg` image, compliant with the W3C standard. The goals of the project are as follows: 3 3 4 * To provide an easy syntax for graphing data5 4 * To let users produce a simple plot with minimal intervention by using sane defaults 6 5 * To demonstrate how to incorporate SVG images into Boost documentation … … 15 14 16 15 == Example == 16 17 == Potential example == 17 18 {{{ 18 19 #!cpp 19 vector<double> data1, data2; 20 vector<double> data1; 21 deque<double> data2; 20 22 21 // fill vectors22 23 23 svg_plot my_plot(" ./image.svg");24 svg_plot my_plot("D:\\1D_legend_demo.svg"); 24 25 25 my_plot << image_size(500, 200) << x_scale(-7, 9) << draw_axis() 26 << plot_range(data1.begin(), data1.end(), blue) 27 << plot_range(data2.begin(), data2.end(), green) 28 << write(); 29 }}} 26 // size/scale settings 27 my_plot.image_size(500, 350); 28 my_plot.x_scale(-2, 10); 29 30 // command settings 31 my_plot.draw_axis() 32 .show_legend(); 30 33 31 produces the following output: 34 // color settings 35 my_plot.set_background_color(lightgray) 36 .set_legend_background_color(whitesmoke); 32 37 33 [[Image(http://www.tcnj.edu/~voytko2/img/1Dtwo_plots_color_demo.svg)]] 38 // drawing 39 plot_range(my_plot, data2.begin(), data2.end(), "Lions", blue); 40 plot_range(my_plot, data1.begin(), data1.end(), "Tigers", limegreen); 34 41 35 == Using different STL containers == 36 {{{ 37 #!cpp 38 deque<double> data1; 39 vector<double> data2; 40 41 //fill vectors 42 43 svg_plot my_plot("./image.svg"); 44 45 my_plot << image_size(500, 200) << x_scale(-7, 9) << draw_axis() 46 << plot_range(data1.begin(), data1.end(), orange) 47 << plot_range(data2.begin(), data2.end(), blue) 48 << write(); 42 // write to file. NOTE: Will change to write(filename) soon 43 my_plot.write(); 49 44 50 45 }}} … … 52 47 produces the following output: 53 48 54 [ [Image(http://www.tcnj.edu/~voytko2/img/1D_containers_demo.svg)]]49 [http://www.tcnj.edu/~voytko2/svg.htm] 55 50 56 51 == Using Boost.Array == 57 {{{58 #!cpp59 52 60 boost::array<double, 10> arr; 61 62 // fill arr 63 64 my_plot << image_size(500, 200) << x_scale(-7, 9) << draw_axis() 65 << plot_range(arr.begin(), arr.end(), orange) 66 << write(); 67 68 }}} 69 53 Because Boost.Array supports an iterator-like interface, (`my_arr.begin()`, `my_arr.end()`), Boost.Array can freely be used with the program 70 54 produces the following output: 71 55 … … 108 92 {{{ 109 93 #!cpp 110 svg << plot_range(hl.begin(), hl.end(), get_age_functor() ); // fun stuff :)94 plot_range(svg, hl.begin(), hl.end(), get_age_functor() ); // fun stuff :) 111 95 }}} 112 96 113 97 ''By Paul Bristow'' 114 * Customize background color of plot 98 * Customize background color of plot '''''Completed''''' 115 99 * Customize the background border color 116 100 * Customize the "axis area" background color … … 132 116 * Allow different data representation points 133 117 * Allow appropriate customization of data points 134 * Consider labels for data points (combined with exploration of hover-text features of SVG mentioned above) 118 * Consider labels for data points (combined with exploration of hover-text features of SVG mentioned above) '''''Completed in legend''''' 135 119 * Consider how to concisely represent the scale of data points 136 * Multiple data series 120 * Multiple data series '''''Completed''''' 137 121 * Legend 138 122 * Border 139 * color 123 * color '''''Partially Completed''''' 140 124 * position 141 125 * border thickness 142 * background colors 126 * background colors '''''Completed''''' 143 127 * Unicode strings 144 128 145 129 = 4. Bugs D: = 146 * Changing or setting the x_scale after calling my_graph <<draw_axis() makes the axis not be drawn.130 * Changing or setting the x_scale after calling my_graph.draw_axis() makes the axis not be drawn. 147 131 * This is caused because I store points after setting the graph. I will fix this by storing infinity as +NaN in the point, and when outputting, writing it at a location far off the graph