# File tk/lib/tkextlib/blt/component.rb, line 429
def self.id2obj(chart, id)
cpath = chart.path
AxisID_TBL.mutex.synchronize{
return id unless AxisID_TBL[cpath]
AxisID_TBL[cpath][id]? AxisID_TBL[cpath][id]: id
}
end
# File tk/lib/tkextlib/blt/component.rb, line 481
def initialize(chart, axis=nil, keys={})
# dummy:: not called by 'new' method
if axis.kind_of?(Hash)
keys = axis
axis = nil
end
if axis
@axis = @id = axis.to_s
else
OBJ_ID.mutex.synchronize{
@axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
OBJ_ID[1].succ!
}
end
@path = @id
@parent = @chart = chart
@cpath = @chart.path
# Axis::AxisID_TBL[@cpath][@axis] = self
keys = _symbolkey2str(keys)
unless keys.delete('without_creating')
# @chart.axis_create(@axis, keys)
tk_call(@chart, 'axis', 'create', @axis, keys)
end
end
# File tk/lib/tkextlib/blt/component.rb, line 437
def self.new(chart, axis=nil, keys={})
if axis.kind_of?(Hash)
keys = axis
axis = nil
end
if keys
keys = _symbolkey2str(keys)
not_create = keys.delete('without_creating')
else
not_create = false
end
obj = nil
AxisID_TBL.mutex.synchronize{
chart_path = chart.path
AxisID_TBL[chart_path] ||= {}
if axis && AxisID_TBL[chart_path][axis]
obj = AxisID_TBL[chart_path][axis]
else
(obj = self.allocate).instance_eval{
if axis
@axis = @id = axis.to_s
else
OBJ_ID.mutex.synchronize{
@axis = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
OBJ_ID[1].succ!
}
end
@path = @id
@parent = @chart = chart
@cpath = @chart.path
Axis::AxisID_TBL[@cpath][@axis] = self
unless not_create
tk_call(@chart, 'axis', 'create', @axis, keys)
return obj
end
}
end
}
obj.configure(keys) if obj && ! keys.empty?
obj
end
# File tk/lib/tkextlib/blt/component.rb, line 518
def cget(option)
@chart.axis_cget(@id, option)
end
# File tk/lib/tkextlib/blt/component.rb, line 521
def cget_strict(option)
@chart.axis_cget_strict(@id, option)
end
# File tk/lib/tkextlib/blt/component.rb, line 515
def cget_tkstring(option)
@chart.axis_cget_tkstring(@id, option)
end
# File tk/lib/tkextlib/blt/component.rb, line 535
def command(cmd=nil, &b)
if cmd
configure('command', cmd)
elsif b
configure('command', Proc.new(&b))
else
cget('command')
end
end
# File tk/lib/tkextlib/blt/component.rb, line 528
def configinfo(key=nil)
@chart.axis_configinfo(@id, key)
end
# File tk/lib/tkextlib/blt/component.rb, line 524
def configure(key, value=None)
@chart.axis_configure(@id, key, value)
self
end
# File tk/lib/tkextlib/blt/component.rb, line 531
def current_configinfo(key=nil)
@chart.current_axis_configinfo(@id, key)
end
# File tk/lib/tkextlib/blt/component.rb, line 545
def delete
@chart.axis_delete(@id)
self
end
# File tk/lib/tkextlib/blt/component.rb, line 550
def invtransform(val)
@chart.axis_invtransform(@id, val)
end
# File tk/lib/tkextlib/blt/component.rb, line 554
def limits
@chart.axis_limits(@id)
end
# File tk/lib/tkextlib/blt/component.rb, line 419
def mutex; @mutex; end
# File tk/lib/tkextlib/blt/component.rb, line 511
def to_eval
@id
end
# File tk/lib/tkextlib/blt/component.rb, line 562
def transform(val)
@chart.axis_transform(@id, val)
end
# File tk/lib/tkextlib/blt/component.rb, line 571
def use(name=None) # if @id == xaxis | x2axis | yaxis | y2axis
@chart.axis_use(@id, name)
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.