[Rt-commit] rt branch, 4.2/charts, updated. rt-4.1.13-156-gf487fd0

Thomas Sibley trs at bestpractical.com
Tue Jul 2 14:52:47 EDT 2013


The branch, 4.2/charts has been updated
       via  f487fd06bb9326f8feaf4cfaeb687e0c8790a557 (commit)
      from  15ffd62c9807f6454c2f068bc0d41358bce5cae7 (commit)

Summary of changes:
 share/html/Search/Chart          |  1 +
 share/html/Search/Chart.html     | 15 ++++++++++++---
 share/static/css/base/charts.css |  6 ++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit f487fd06bb9326f8feaf4cfaeb687e0c8790a557
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Jul 2 11:52:23 2013 -0700

    Pie charts must always be a circle; force Height from Width

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index c785309..52d59cd 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -65,6 +65,7 @@ my $font = $font_config{ $session{CurrentUser}->UserObj->Lang || '' }
 s/\D//g for grep defined, $Width, $Height;
 $Width  ||= 600;
 $Height ||= ($ChartStyle eq 'pie' ? $Width : 400);
+$Height = $Width if $ChartStyle eq 'pie';
 
 my $plot_error = sub {
     my $text = shift;
diff --git a/share/html/Search/Chart.html b/share/html/Search/Chart.html
index fc15117..3daffbe 100644
--- a/share/html/Search/Chart.html
+++ b/share/html/Search/Chart.html
@@ -152,11 +152,20 @@ my %query;
 
 </&>
 
-<&| /Widgets/TitleBox, title => loc('Picture') &>
+<&| /Widgets/TitleBox, title => loc('Picture'), class => "chart-picture" &>
 <label><% loc('Style') %> <& Elements/SelectChartType, Default => $ChartStyle, Name => 'ChartStyle' &></label>
-<label><% loc("Width") %> <input type="text" name="Width" value="<% $Width || "" %>" size=4></label>
-<label><% loc("Height") %> <input type="text" name="Height" value="<% $Height || "" %>" size=4></label>
+<label><% loc("Width") %> <input type="text" name="Width" value="<% $Width || "" %>"> <% loc("px") %></label>
+<span class="height">
+  &#x00d7;
+  <label><% loc("Height") %> <input type="text" name="Height" value="<% $Height || "" %>"> <% loc("px") %></label>
+</span>
 </&>
+<script type="text/javascript">
+jQuery(".chart-picture [name=ChartStyle]").change(function(){
+    var t = jQuery(this);
+    t.closest("form").find("[name=Height]").closest(".height").toggle( t.val() !== "pie" );
+}).change();
+</script>
 
 <& /Elements/Submit, Label => loc('Update Chart'), Name => 'Update' &>
 </form>
diff --git a/share/static/css/base/charts.css b/share/static/css/base/charts.css
index c651e1f..ef9c129 100644
--- a/share/static/css/base/charts.css
+++ b/share/static/css/base/charts.css
@@ -9,3 +9,9 @@
 .chart-calculate fieldset legend {
     padding: 0 1em;
 }
+
+.chart-picture input[name=Width],
+.chart-picture input[name=Height] {
+    width: 3em;
+    text-align: right;
+}

-----------------------------------------------------------------------


More information about the Rt-commit mailing list