# Need hellp to position 4 images in fxfuby main window

**URL:** <https://www.ruby-forum.com/t/need-hellp-to-position-4-images-in-fxfuby-main-window/176220>\
**Category:** FXRuby\
**Created:** [September 27, 2009, 12:23am UTC](https://www.ruby-forum.com/t/need-hellp-to-position-4-images-in-fxfuby-main-window/176220 "2009-09-27T00:23:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [September 27, 2009, 12:23am UTC](https://www.ruby-forum.com/t/need-hellp-to-position-4-images-in-fxfuby-main-window/176220/1 "2009-09-27T00:23:42Z")

</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

---

<div class="post-metadata">

**Author:** ![captaffy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Post date:** [November 11, 2009, 9:07pm UTC](https://www.ruby-forum.com/t/need-hellp-to-position-4-images-in-fxfuby-main-window/176220/2 "2009-11-11T21:07:41Z")

</div>

You should try an FX4Splitter instead of the four frames. In your gems  
directory, under your Ruby installation, you should find fxruby’s  
directory, and inside an examples directory. There should be an example  
fxfold.rb which demonstrates how to use a FX4Splitter.
