In Files

  • tk/lib/tkextlib/blt/component.rb

Class/Module Index [+]

Quicksearch

Tk::BLT::PlotComponent::Axis

Constants

AxisID_TBL
OBJ_ID

Public Class Methods

id2obj(chart, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 428
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
            
new(chart, axis=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 436
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
            
new(chart, axis=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 480
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
            

Public Instance Methods

cget(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 517
def cget(option)
  @chart.axis_cget(@id, option)
end
            
cget_strict(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 520
def cget_strict(option)
  @chart.axis_cget_strict(@id, option)
end
            
cget_tkstring(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 514
def cget_tkstring(option)
  @chart.axis_cget_tkstring(@id, option)
end
            
command(cmd=nil, &b) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 534
def command(cmd=nil, &b)
  if cmd
    configure('command', cmd)
  elsif b
    configure('command', Proc.new(&b))
  else
    cget('command')
  end
end
            
configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 527
def configinfo(key=nil)
  @chart.axis_configinfo(@id, key)
end
            
configure(key, value=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 523
def configure(key, value=None)
  @chart.axis_configure(@id, key, value)
  self
end
            
current_configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 530
def current_configinfo(key=nil)
  @chart.current_axis_configinfo(@id, key)
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 544
def delete
  @chart.axis_delete(@id)
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 506
def id
  @id
end
            
invtransform(val) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 549
def invtransform(val)
  @chart.axis_invtransform(@id, val)
end
            
limits() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 553
def limits
  @chart.axis_limits(@id)
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 418
def mutex; @mutex; end
            
name() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 557
def name
  @axis
end
            
to_eval() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 510
def to_eval
  @id
end
            
transform(val) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 561
def transform(val)
  @chart.axis_transform(@id, val)
end
            
use(name=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 570
def use(name=None) # if @id == xaxis | x2axis | yaxis | y2axis
  @chart.axis_use(@id, name)
end
            
use_as(axis) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 574
def use_as(axis) # axis := xaxis | x2axis | yaxis | y2axis
  @chart.axis_use(axis, @id)
end
            
view() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 565
def view
  @chart.axis_view(@id)
  self
end