Changeset 38770


Ignore:
Timestamp:
Aug 19, 2007, 9:06:26 PM (11 years ago)
Author:
jakevoytko
Message:

Added documentation dealing with stylesheets

Location:
sandbox/SOC/2007/visualization/libs/svg_plot
Files:
10 added
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/SOC/2007/visualization/libs/svg_plot/doc/svg_plot.qbk

    r38640 r38770  
    572572[section:2d_special Tutorial: 2D Special Features]
    573573
    574 [header Y Axis Grid Lines]
     574[heading Y Axis Grid Lines]
    575575
    576576If you would like grid lines that go across the graph, you can make the
     
    589589[$images/2d_y_grid.png]
    590590
    591 [header External Y Axis Style]
     591[heading External Y Axis Style]
    592592
    593593For an alternate way to display a regular axis, you can use an external style:
     
    599599
    600600
    601 [header Fill the area between the plot and the axis]
     601[heading Fill the area between the plot and the axis]
    602602
    603603When there is a call to the plot() method, define `_area_fill_color`
     
    612612[$images/2d_area_fill.png]
    613613
    614 [header Curve Interpolation]
     614[heading Curve Interpolation]
    615615
    616616If you would like an interpolated curve shown over your data, simply use the following command:
     
    626626[endsect] [/2d_special Tutorial: 2D Special Features]
    627627[endsect] [/2d_tutorial]
    628 [section:svg_boxplot_tutorial Boxplot]
     628[section:svg_boxplot_tutorial Tutorial: Boxplot]
    629629[section:svg_boxplot_tutorial_simple Simple Example]
    630630
     
    726726[section:svg_boxplot_tutorial_full_layout Full Layout]
    727727
    728 [endsect]
    729 [endsect] [/svg_boxplot_tutorial Boxplot]
     728[endsect][/svg_boxplot_tutorial Boxplot]
     729
     730[endsect][/section:tutorial]
     731[section:tutorial_stylesheet Stylesheet Tutorial]
     732
     733To include a stylesheet into a program with any plot, simply use the `load_stylesheet(const std::string& filename)` method to load an external stylesheet. To load the file ./style.css, for instance, we would call:
     734
     735        my_plot.load_stylesheet("./style.css");
     736
     737There are a few instances when a `std::runtime_error` exception may be thrown.
     738
     739* If the filename is incorrect
     740* If the file does not pass the parsing phase
     741
     742[heading Using the stylesheet]
     743Here is the output file for the simple 1D example, used before:
     744
     745[$images/1d_simple.png]
     746
     747Here it is with a simple stylesheet applied (from $PROJECT_ROOT/libs/svg_plot/example/style.css):
     748
     749[caution When the user will have the option to convert the graph to another image format, the stylesheets will be ignored. These would provide the user with an even more complex function object that they would need to implement. If you provide a stylesheet, make sure you know what will not be converted. (Currently, that is everything in the stylesheets)]
     750[$images/1d_simple_style.png]
     751
     752[endsect][/stylesheet tutorial]
    730753[section:behavior Behavior]
    731754[section:behavior_limits Numerical Limits]
     
    737760This will become customizable.
    738761
    739 [header NaN]
     762[heading NaN]
    740763Any double precision floating point numbers that return a nonzero value for the
    741764function `_isnan(double)` is considered to be a NaN value. When plotted, the
    742765number will appear in the user-defined coordinates as 0.
    743766
    744 [header Infinity]
     767[heading Infinity]
    745768
    746769Any double precision floating point number that is equal to either of the
     
    754777the graph.
    755778
    756 [header Negative Infinity]
     779[heading Negative Infinity]
    757780
    758781Any double precision floating point number that is equal to either of the
     
    771794[$images/2d_limit.png]
    772795[endsect][/section:numerical_limits]
     796[section:behavior_stylesheets Stylesheets]
     797Stylesheets currently have only a single way of being used with the program: they are parsed by the `svg` class, and if the stylesheet parses correctly, they are loaded directly into the SVG file. I recognize that it may also be desired to link to an external stylesheet, but this presents a few problems.
     798
     799* Both of the files now need to be transported with the produced document
     800* Any user-provided function object that is used to convert between image formats now suddenly needs to be able to load the image format from an external source.
     801
     802When the image converter portion of the project is completed, the image format function object will not be forced to deal with CSS. This is primarily a practical matter, and keeps simple an already difficult task. This will not preclude a method that extracts appropriate data from the CSS file and calls the appropriate functions. For example, if the user provides the following:
     803
     804        #Background
     805        {
     806                fill : #FFF;
     807                stroke : #041010 ;
     808        }
     809
     810why shouldn't
     811
     812        my_plot.background_color(black);
     813        my_plot.background_border_color(svg_color(4, 16, 16));
     814
     815be called?
     816
     817[caution Please note that the language that is accepted by the parser is actually stricter than the real CSS standard allows for. Following GSoC, the parser will be reimplemented to reflect the parser suggested by the CSS standard. All identifiers (class, ID, or otherwise), must be the only identifier on the line. The following is not accepted:
     818``
     819rect, circle
     820{
     821        fill : #00FF00;
     822        stroke : #000000;
     823}
     824``
     825
     826But the following is:
     827
     828``
     829rect
     830{
     831        fill : #00FF00;
     832        stroke : #00FF00;
     833}
     834
     835circle
     836{
     837        fill : #00FF00;
     838        stroke : #00FF00;
     839}
     840``
     841
     842None of the power of CSS is compromised (or at least, I hope not), but it becomes more verbose.
     843][/caution]
     844
     845[endsect][/section:behavior_stylesheets]
    773846[endsect][/section:behavior Behavior]
    774847
     
    10601133(Note: Getters omitted for now)
    10611134
    1062 [header The `plot()` Method]
     1135[heading The `plot()` Method]
    10631136The `plot()` method is defined using Boost.Parameter. As such, it supports a
    10641137few extra named parameters, as well as a deduced parameter.
Note: See TracChangeset for help on using the changeset viewer.