Method: PAES_Analysis#appendAnnotations
- Defined in:
- lib/flukso/plots.rb
#appendAnnotations(drawcmd) ⇒ Object
takes a drawcommand as an argument and adds annotations as needed. TODO: Points are not plotted if they are out of the range of the plot - this might be necessary in the future.
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/flukso/plots.rb', line 293 def appendAnnotations(drawcmd) if @annotations != nil puts "Adding annotations\n#{@annotations.to_s}" colors=Array.new() labels=Array.new() ltyInfo=Array.new() pchInfo=Array.new() counter=0; pointlines="" @annotations.each{|a| counter+=1; colors << counter; labels << a.text; pointlines+="points(#{a.qt}, #{a.price}, type=\"p\", pty=2, col=#{counter})\n" ltyInfo << -1; pchInfo << 1; } cols=arrayToC(colors) labelList=arrayToC(labels) ltyList=arrayToC(ltyInfo) pchList=arrayToC(pchInfo) drawcmd+=" cols=\#{cols}\n labels=\#{labelList}\n \#{pointlines}\n legend(\"topright\", labels, col = cols,\n text.col = \"black\", lty = \#{ltyList}, pch = \#{pchList},\n bg = 'gray90')\n EOC\n end\n return drawcmd\nend\n" |