<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -50,11 +50,42 @@ module GoogleChart
       @title = title.gsub(&quot;\n&quot;, &quot;|&quot;)
     end
 
-    # Size in WIDTHxHEIGHT format
+    # Sets the chart's width, in pixels. Raises +ArgumentError+
+    # if +width+ is less than 1 or greater than 1,000.
+    def width=(width)
+      if width.nil? || width &lt; 1 || width &gt; 1_000
+        raise ArgumentError, &quot;Invalid width: #{width.inspect}&quot;
+      end
+
+      @width = width
+    end
+
+    # Sets the chart's height, in pixels. Raises +ArgumentError+
+    # if +height+ is less than 1 or greater than 1,000.
+    def height=(height)
+      if height.nil? || height &lt; 1 || height &gt; 1_000
+        raise ArgumentError, &quot;Invalid height: #{height.inspect}&quot;
+      end
+
+      @height = height
+    end
+
+    # Returns the chart's size as &quot;WIDTHxHEIGHT&quot;.
     def size
       &quot;#{width}x#{height}&quot;
     end
 
+    # Sets the chart's size as &quot;WIDTHxHEIGHT&quot;. Raises +ArgumentError+
+    # if +width+ * +height+ is greater than 300,000 pixels.
+    def size=(size)
+      self.width, self.height = size.split(&quot;x&quot;).collect { |n| Integer(n) }
+
+      if (width * height) &gt; 300_000
+        raise ArgumentError, &quot;Invalid size: #{size.inspect} yields a graph with more than 300,000 pixels&quot;
+      end
+    end
+
+
     # Set the data encoding to one of :simple, :text or :extended
     def encoding=(enc)
       raise ArgumentError.new(&quot;unsupported encoding: #{encoding.inspect}&quot;) unless GoogleChart::ENCODINGS.include?(enc)</diff>
      <filename>lib/google_chart/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,22 @@ describe GoogleChart::Base do
       @dummy.height.should == 200
     end
 
+    it &quot;should able to initialise size via a WIDTHxHEIGHT string&quot; do
+      @dummy.size.should == &quot;320x200&quot;
+      @dummy.size = &quot;400x500&quot;
+      @dummy.width.should == 400
+      @dummy.height.should == 500
+    end
+
+    it &quot;should raise an error if the height or width is greater than 1000&quot; do
+      lambda { @dummy.height = 1001  }.should raise_error(ArgumentError)
+      lambda { @dummy.width = 1001  }.should raise_error(ArgumentError)
+    end
+
+    it &quot;should raise error if width x height is greater than 300000&quot; do
+      lambda { @dummy.size = &quot;400x1000&quot; }.should raise_error(ArgumentError)
+    end
+
     it &quot;should have a default encoding of :simple&quot; do
       @dummy.encoding.should == :simple
     end</diff>
      <filename>spec/gchartrb_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7f81e62e3e7572eb4b5f232b1b1ed6b76a3cc385</id>
    </parent>
  </parents>
  <author>
    <name>Deepak Jois</name>
    <email>deepak.jois@gmail.com</email>
  </author>
  <url>http://github.com/deepakjois/gchartrb/commit/5e6cd1ea4cea52f1bfef2510fbf158683d58d37d</url>
  <id>5e6cd1ea4cea52f1bfef2510fbf158683d58d37d</id>
  <committed-date>2008-05-25T07:29:49-07:00</committed-date>
  <authored-date>2008-05-25T07:29:49-07:00</authored-date>
  <message>Adding accessors and validation for size</message>
  <tree>3f47a2e7ba8dbdbda93adce3082a31116c593f49</tree>
  <committer>
    <name>Deepak Jois</name>
    <email>deepak.jois@gmail.com</email>
  </committer>
</commit>
