# Need help to position image in fxruby Main window

**URL:** <https://www.ruby-forum.com/t/need-help-to-position-image-in-fxruby-main-window/176192>\
**Category:** Ruby\
**Created:** [September 26, 2009, 12:55am UTC](https://www.ruby-forum.com/t/need-help-to-position-image-in-fxruby-main-window/176192 "2009-09-26T00:55:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_old](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9f8e36/32.png) [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Post date:** [September 26, 2009, 12:55am UTC](https://www.ruby-forum.com/t/need-help-to-position-image-in-fxruby-main-window/176192/1 "2009-09-26T00:55:47Z")

</div>

Please suggest how chart4.rb can be modified, to position the 4  
image  
in the four corners of the main window. Desired layout shown below.

|------------------------|  
| chart1 | chart2 |  
|------------------------|  
| chart3 | chart4 |  
|------------------------|

Thanks,  
John

# Chart4.rb

require ‘fox16’  
require ‘google\_chart’  
require ‘open-uri’

include Fox

class ChartsWindow \< FXMainWindow  
def initialize(app)  
super(app, “Google Charts Demo”, :width =\> 650, :height =\> 450)  
FXImageFrame.new(self, nil, :opts =\> FRAME\_SUNKEN) do |f|  
f.image = FXPNGImage.new(app, open(pie\_chart.to\_escaped\_url,  
“rb”).read)  
end  
FXImageFrame.new(self, nil ) do |f|  
f.image = FXPNGImage.new(app, open(line\_chart.to\_escaped\_url,  
“rb”).read)  
end  
FXImageFrame.new(self, nil ) do |f|  
f.image = FXPNGImage.new(app, open(ven\_chart.to\_escaped\_url,  
“rb”).read)  
end  
FXImageFrame.new(self, nil ) do |f|  
f.image = FXPNGImage.new(app, open(scatter\_chart.to\_escaped\_url,  
“rb”).read)  
end  
end

def pie\_chart  
# Pie Chart  
GoogleChart::PieChart.new(‘320x200’, “Pie Chart”,false) do |pc|  
pc.data “Apples”, 40  
pc.data “Banana”, 20  
pc.data “Peach”, 30  
pc.data “Orange”, 60  
end  
end

def line\_chart  
GoogleChart::LineChart.new(‘320x200’, “Line Chart”, false) do |lc|  
lc.data “Trend 1”, [5,4,3,1,3,5,6], ‘0000ff’  
lc.show\_legend = true  
lc.data “Trend 2”, [1,2,3,4,5,6], ‘00ff00’  
lc.data “Trend 3”, [6,5,4,3,2,1], ‘ff0000’  
lc.axis :y, :range =\> [0,6], :color =\> ‘ff00ff’, :font\_size =\>  
16, :alignment =\> :center  
lc.axis :x, :range =\> [0,6], :color =\> ‘00ffff’, :font\_size =\>  
16, :alignment =\> :center  
lc.grid :x\_step =\> 100.0/6.0, :y\_step =\>  
100.0/6.0, :length\_segment =\> 1, :length\_blank =\> 0  
end  
end

def ven\_chart  
GoogleChart::VennDiagram.new(“320x200”, ‘Venn Diagram’) do |vd|  
vd.data “Blue”, 100, ‘0000ff’  
vd.data “Green”, 80, ‘00ff00’  
vd.data “Red”, 60, ‘ff0000’  
vd.intersections 30,30,30,10  
end  
end

def scatter\_chart  
GoogleChart::ScatterChart.new(‘320x200’,“Scatter Chart”) do |sc|  
sc.data “Scatter Set”, [[1,1,], [2,2], [3,3], [4,4]]  
sc.max\_value [5,5] # Setting the max value  
sc.axis :x, :range =\> [0,5]  
sc.axis :y, :range =\> [0,5], :labels =\> [0,1,2,3,4,5]  
sc.point\_sizes [10,15,30,55] # Optional  
end  
end

def create  
super  
show(PLACEMENT\_SCREEN)  
end  
end

if **FILE** == $0  
FXApp.new do |app|  
ChartsWindow.new(app)  
app.create  
app.run  
end  
end
