$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: pbristow_at_[hidden]
Date: 2007-12-04 07:28:43
Author: pbristow
Date: 2007-12-04 07:28:43 EST (Tue, 04 Dec 2007)
New Revision: 41685
URL: http://svn.boost.org/trac/boost/changeset/41685
Log:
Separated font size & family of X and Y labels, and the values against the ticks.
Text files modified: 
   sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp |    55 ++++++++++++++------------------------- 
   sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp            |    30 ++++++++++----------                    
   2 files changed, 35 insertions(+), 50 deletions(-)
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp	(original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/detail/axis_plot_frame.hpp	2007-12-04 07:28:43 EST (Tue, 04 Dec 2007)
@@ -242,8 +242,7 @@
         align_style alignment = center_align;
         if(derived().use_down_ticks)
         {  // No need to shift if derived().use_up_ticks as labels are below the X-axis.
-          y += derived().x_label_info.font_size();
-          // Move down a font height below bottom end of tick.
+          // y += derived().x_label_value.font_size();
         }
         if (derived().x_label_rotation_ == upward)
         { // 
@@ -254,40 +253,33 @@
         else if((derived().x_label_rotation_ == downward)
           || (derived().x_label_rotation_ == downhill))
         { // start from tick and write down.
+          y += derived().x_label_value.font_size() * 0.5;
           alignment = left_align;
         }
         else if(derived().x_label_rotation_ == horizontal)
         {
+          y += derived().x_label_value.font_size() * 1.5;
           alignment = center_align; // center on the tick.
         }
         else if(derived().x_label_rotation_ == uphill)
         { // 45 slope up,
           alignment = left_align; // Uphill to end at tick.
           y += label.str().size() * derived().x_label_info.font_size() * 0.7;
-          // sloping so need about sin(45) = 0.707 less space,
+          // sloping up so need about sin(45) = 0.707 less space,
           // so the last digit is by the tick.
         }
         else
-        { // 45 slope down
+        { // 45 slope down.
           alignment = left_align; // Assume downhill from tick,
-          // so no need to y adjustment.
+          // so no need for y adjustment.
         }
 
-        //if(derived().use_x_ticks_on_plot_window_) // External style.
-        //{ // Always want all values including "0" if labelling on the external plot window.
-        //  derived().image.get_g_element(detail::PLOT_VALUE_LABELS).text(
-        //    x1, y, // x centered on tick, 
-        //    label.str(), derived().x_label_info.font_size(), derived().x_label_info.font_family(),
-        //    "", "", "", "", alignment,  // center label on the tick.
-        //    derived().x_label_rotation_);
-        //}
-        //else
         { // ! use_x_ticks_on_plot_window_ = Internal - value labels just below horizontal X-axis.
           if (derived().use_x_ticks_on_plot_window_ || ((value != 0) && derived().use_x_axis_lines_))
           { // Avoid a "0" below the X-axis if it would be cut through by any internal vertical Y-axis line.
            derived().image.get_g_element(detail::PLOT_VALUE_LABELS).text(
               x1, y,
-              label.str(), derived().x_label_info.font_size(), derived().x_label_info.font_family(),
+              label.str(), derived().x_label_value.font_size(), derived().x_label_value.font_family(),
               "", "", "", "", alignment, // center label on the tick.
               derived().x_label_rotation_);
           }
@@ -528,24 +520,7 @@
       label += "  (" + derived().x_units_info.text() + ")";
     }
     // Simplest to start from the bottom of the image.
-    // and move up to give enough sapce for the X-axis label.
-
-    //double y(0.);
-    //transform_y(y);
-    //derived().x_axis = y; // X-axis line at y = 0.
-    //y += derived().x_label_font_size() * 2.5; // values & label & half line space.
-    //if (derived().use_down_ticks)
-    //{ // Make space for ticks down.
-    //  y += (std::max)(derived().x_major_tick_length(), derived().x_minor_tick_length());
-    //  // Brackets avoid trouble with any nasty macro max.
-    //  // Use max in case some joker uses longer minor ticks than major.
-    //}
-    //if (derived().x_ticks_on_plot_window_on())
-    //{ // Allow space for the values labelling the ticks.
-    //  y += derived().x_label_font_size() * derived().text_margin_;
-    //}
-    // Bottom of plot window plus two char height.
-    // derived().plot_y2 + (derived().x_label_font_size() * derived().text_margin_),
+    // and move up to give enough space for the X-axis label.
 
     double y = derived().image.y_size();  // bottom edge of image.
     y -= derived().x_label_font_size(); // Up enough for a space underneath label.
@@ -1442,9 +1417,8 @@
   }
 
   Derived& x_label_font_size(unsigned int i)
-  { // TODO May be best to tie these two font sizes together?
+  { 
     derived().x_label_info.font_size(i);
-    derived().x_units_info.font_size(i);
     return derived();
   }
 
@@ -1453,6 +1427,17 @@
     return derived().x_label_info.font_size();
   }
 
+  Derived& x_value_font_size(unsigned int i)
+  { 
+    derived().x_value_value.font_size(i);
+    return derived();
+  }
+
+  unsigned int x_value_font_size()
+  {
+    return derived().x_value_value.font_size();
+  }
+
   Derived& x_label_font_family(const std::string& family)
   {
     derived().x_label_info.font_family(family);
Modified: sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp
==============================================================================
--- sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp	(original)
+++ sandbox/SOC/2007/visualization/boost/svg_plot/svg_2d_plot.hpp	2007-12-04 07:28:43 EST (Tue, 04 Dec 2007)
@@ -266,8 +266,8 @@
     legend_width_(200), // width of legend box (pixels)
     legend_header_(0, 0, "", 14, "Verdana", "", "", "", "", center_align, horizontal),
     legend_font_width_(0.5),
-    x_label_info(0, 0, "X Axis", 14, "Verdana", "", "", "", "", center_align, horizontal),
-    x_label_value(0, 0, "", 12, "Verdana", "", "", "", "", center_align, horizontal),
+    x_label_info(0, 0, "X Axis", 16, "Verdana", "", "", "", "", center_align, horizontal),
+    x_label_value(0, 0, "", 10, "Verdana", "", "", "", "", center_align, horizontal),
     // TODO use this and provide way to set'n'get separately.
     x_label_width_(0.5),
     y_label_info(0, 0, "Y Axis", 14, "Verdana", "", "", "", "", center_align, upward),
@@ -504,16 +504,16 @@
          }
         if (y_label_rotation_ == horizontal)
         { // Move edge right to give space for y_value_precision_ digits.
-          plot_x1 += y_label_info.font_size() * (l * wh);
+          plot_x1 += y_label_value.font_size() * (l * wh);
         }
         else if((y_label_rotation_ == upward) || (y_label_rotation_ == downward))
         { // Only need one char width.
-          plot_x1 += y_label_info.font_size() * 1.5;
+          plot_x1 += y_label_value.font_size() * 1.5;
         }
         else
         { // assume some slope 45? So diagonally down from tick,
           // and takes a bit less room.
-          plot_x1 +=  y_label_info.font_size() * l * wh * sin45;
+          plot_x1 +=  y_label_value.font_size() * l * wh * sin45;
         }
       }
       if (use_x_major_labels && use_x_ticks_on_plot_window_)
@@ -532,17 +532,17 @@
 
         if ((x_label_rotation_ == upward) || (x_label_rotation_ == downward))
         { // need
-          l += 2; // space at top and bottom?
+          l += 2; // extra space at top and bottom?
         }
         else if(x_label_rotation_ != horizontal)
-        { // Only 1 char height needed if horizontal.
+        { // Only 1 char height & 1 space needed if horizontal.
           l = 2;
         }
         else
         { // assume some slope, say 45 sin(45) = 0.707?
           l *= 0.707;
         }
-        plot_y2 -= x_label_info.font_size() * (l * wh);
+        plot_y2 -= x_label_value.font_size() * l;
       }
       if(use_left_ticks)
       { // Reduce plot to give space for biggest of any external left ticks.
@@ -640,7 +640,7 @@
         //}
         if(use_y_label)
         { // Start further right to give space for y axis value label.
-          y1 -= y_label_info.font_size() * text_margin_ ;
+          y1 -= y_label_value.font_size() * text_margin_ ;
         }
 
         if(use_left_ticks)
@@ -694,7 +694,7 @@
           // we might need to move left more for the longer tick.
           x1 -= (y_minor_tick_length_ - y_minor_tick_length_);
         }
-        x1 -= y_label_info.font_size(); // move left by a font width.
+        x1 -= y_label_value.font_size(); // move left by a font width.
       }
       else
       { // No need to move if right tick, or none.
@@ -707,7 +707,7 @@
         if(y_label_rotation_ == horizontal)
         {  // Just shift down half a digit to center value digits on tick.
           alignment = right_align;
-          y += y_label_info.font_size() / 2;
+          y += y_label_value.font_size() / 2;
         }
         else if ((y_label_rotation_ == upward) || (y_label_rotation_ == downward))
         {// Tick value label straight up or down vertically on y axis.
@@ -716,7 +716,7 @@
         }
         else
         { // Assume some 45 slope, so need about sqrt(2) less space?
-           x1 += y_label_info.font_size() * 0.5; // move left by half a font width.
+           x1 += y_label_value.font_size() * 0.5; // move left by half a font width.
           // no y shift needed.
           alignment = right_align;
         }
@@ -724,16 +724,16 @@
         image.get_g_element(detail::PLOT_VALUE_LABELS).text(
           x1,
           y,
-          label.str(), y_label_info.font_size(), "", "", "", "", "", alignment, y_label_rotation_);
+          label.str(), y_label_value.font_size(), "", "", "", "", "", alignment, y_label_rotation_);
       }
       else
       { // ! use_y_ticks_on_plot_window_Internal - value labels close to left of vertical Y-axis.
         if ((value != 0) && use_x_axis_lines_)
         { // Avoid a zero ON the Y-axis as it would be cut through by the horizontal X-axis line.
-          y += y_label_info.font_size() / 2; 
+          y += y_label_value.font_size() / 2; 
           image.get_g_element(detail::PLOT_VALUE_LABELS).text(x1, 
             y, // Just shift down half a digit to center value digits on tick.
-            label.str(), y_label_info.font_size(), y_label_info.font_family(), "", "", "", "",
+            label.str(), y_label_value.font_size(), y_label_value.font_family(), "", "", "", "",
             center_align, // on the tick ???
             y_label_rotation_); 
         }