wiki:soc/2007/VisualizationOfContainers

Version 12 (modified by jakevoytko, 15 years ago) ( diff )

--

0. Introduction

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:

  • To provide an easy syntax for graphing data
  • To let users produce a simple plot with minimal intervention by using sane defaults
  • To demonstrate how to incorporate SVG images into Boost documentation
  • To allow users to easily customize graphs to their heart's content
  • To allow the user to talk with the svg_graph class using coordinate units instead of pixels or other arbitrary measures

I have only a student's grasp of C++, so if you have a suggestion to help me with design or implementation, either leave them here or email me at jakevoytko [at] gmail [dot] com

This page will hold examples of what I have implemented thus far, and what my program will be capable of in the future. More complete documentation will be live in a few days on my personal website.

What can it do?

Example

vector<double> data1, data2;

// fill vectors

svg_plot my_plot("./image.svg");

my_plot << image_size(500, 200) << x_scale(-7, 9) << draw_axis()
        << plot_range(data1.begin(), data1.end(), blue)
        << plot_range(data2.begin(), data2.end(), green)
        << write();

produces the following output:

http://www.tcnj.edu/~voytko2/img/1Dtwo_plots_color_demo.svg

To-Do List

For next week

  • Create a more consistent internal name scheme (I'm starting to confuse myself)
  • Accept generic STL containers, Boost.Array
  • Begin to incorporate a key/legend into the graph
  • Allow streams to be specified as output points
  • Move files not to be consumed by users to "detail" folder

By July 2nd

  • Expand workings of program to two dimensions

3. Suggestions (No ETA as of May 28)

By Matias Capeletto:

  • Be able to choose a log scale for either the X or the Y axis
  • Proposal to include a plugable extractor to plot_range()

In general, containers will store other things than double. Starting simple, I want to be able to plot std::vector<int>. This is very easy to support. Add a function:

template<class Iter, class DoubleExtractor >
plot& plot_range( Iter start, Iter end, DoubleExtractor double_extractor)
{
    return your_old_plot_range(
       boost::make_transform_iterator(start, double_extractor),
       boost::make_transform_iterator(end  , double_extractor)
    );
}

This have other implications, for example if we have list<Human> hl, and struct get_age_functor { ... }; We can:

svg << plot_range( hl.begin(), hl.end(), get_age_functor() ); // fun stuff :)

By Paul Bristow

  • Customize background color of plot
  • Customize the background border color
  • Customize the "axis area" background color
  • Title
    • Customize font
    • Customize font color
  • Axis
    • Customize line colors
    • Customize line thickness
    • Define labels for axis
    • Major ticks width, length, color
    • Minor ticks width, length, color
    • Reasonable defaults for ticks
    • Axis marker labels
    • Consider the axis for data where the origin is not in the view window
    • Consider auto-scaling
    • Grid lines
  • Data representation
    • Allow different data representation points
    • Allow appropriate customization of data points
    • Consider labels for data points (combined with exploration of hover-text features of SVG mentioned above)
    • Consider how to concisely represent the scale of data points
    • Multiple data series
  • Legend
    • Border
    • color
    • position
    • border thickness
    • background colors
  • Unicode strings
Note: See TracWiki for help on using the wiki.