doc/classes/Lilygraph.src/M000003.html in lilygraph-0.3.0 vs doc/classes/Lilygraph.src/M000003.html in lilygraph-0.4.0

- old
+ new

@@ -8,11 +8,11 @@ <title>render (Lilygraph)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre><span class="ruby-comment cmt"># File lib/lilygraph.rb, line 101</span> + <pre><span class="ruby-comment cmt"># File lib/lilygraph.rb, line 110</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">render</span> <span class="ruby-identifier">output</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-identifier">xml</span> = <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:target</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">output</span>, <span class="ruby-identifier">:indent</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:indent</span>]) <span class="ruby-comment cmt"># Output headers unless we specified otherwise</span> @@ -115,9 +115,22 @@ <span class="ruby-identifier">text_y</span> = <span class="ruby-identifier">bar_y</span> <span class="ruby-operator">-</span> <span class="ruby-value">3</span> <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">text</span> <span class="ruby-identifier">number</span>, <span class="ruby-identifier">:x</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">text_x</span>, <span class="ruby-identifier">:y</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">text_y</span>, <span class="ruby-value str">'text-anchor'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'middle'</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-comment cmt"># Legend</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@legend</span> + <span class="ruby-identifier">legend_x</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:viewbox</span>][<span class="ruby-identifier">:width</span>] <span class="ruby-operator">-</span> (<span class="ruby-value">3</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:margin</span>][<span class="ruby-identifier">:right</span>]) + <span class="ruby-identifier">legend_y</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:margin</span>][<span class="ruby-identifier">:top</span>] <span class="ruby-operator">/</span> <span class="ruby-value">2</span> + <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">rect</span> <span class="ruby-identifier">:fill</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'#ffffff'</span>, <span class="ruby-identifier">:stroke</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'#000000'</span>, <span class="ruby-value str">'stroke-width'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">2</span>, <span class="ruby-identifier">:x</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_x</span>, <span class="ruby-identifier">:y</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_y</span>, <span class="ruby-identifier">:width</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-value">2.5</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:margin</span>][<span class="ruby-identifier">:right</span>]), <span class="ruby-identifier">:height</span> =<span class="ruby-operator">&gt;</span> (<span class="ruby-ivar">@legend</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">*</span> <span class="ruby-value">15</span>) <span class="ruby-operator">+</span> <span class="ruby-value">16</span> + + <span class="ruby-ivar">@legend</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">data</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">color</span>, <span class="ruby-identifier">label</span> = <span class="ruby-identifier">data</span> + <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">rect</span> <span class="ruby-identifier">:fill</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">color</span>, <span class="ruby-identifier">:stroke</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">color</span>, <span class="ruby-value str">'stroke-width'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>, <span class="ruby-identifier">:x</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_x</span> <span class="ruby-operator">+</span> <span class="ruby-value">10</span>, <span class="ruby-identifier">:y</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_y</span> <span class="ruby-operator">+</span> <span class="ruby-value">10</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">index</span> <span class="ruby-operator">*</span> <span class="ruby-value">15</span>), <span class="ruby-identifier">:width</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">35</span>, <span class="ruby-identifier">:height</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">10</span> + <span class="ruby-identifier">xml</span>.<span class="ruby-identifier">text</span> <span class="ruby-identifier">label</span>, <span class="ruby-identifier">:x</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_x</span> <span class="ruby-operator">+</span> <span class="ruby-value">70</span>, <span class="ruby-identifier">:y</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">legend_y</span> <span class="ruby-operator">+</span> <span class="ruby-value">18</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">index</span> <span class="ruby-operator">*</span> <span class="ruby-value">15</span>), <span class="ruby-value str">'text-anchor'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'left'</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># Yield in case they want to do some custom drawing and have a block ready</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">xml</span>, <span class="ruby-ivar">@options</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span> \ No newline at end of file