Need help to position image in fxruby Main window

J

John

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, :eek:pts => 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top