comp.lang.tcl
[Top] [All Lists]

blt graph element element - add points to a line

Subject: blt graph element element - add points to a line
From:
Date: Fri, 30 May 2008 09:12:20 -0700 PDT
Newsgroups: comp.lang.tcl

Hello,

I'm already trying since a few hours to simple add point, which I
first defined by pen how they should look like to a graph. I
encountered two problems.

  1) I'm not sure about the correct parameter arguments "-weight"
seems to expect Integers, but on the below described document they use
"y"?

  2) when I'm trying to explicitly pass the x,y coordinates I get
"float value expected" exception

My code looks like the following and I stole it from
http://www.ing.iac.es/~docs/external/tcl/BLT/handouts.pdf ;)

  package require Tk
  package require BLT
  # prepare graph and data
  set ::X [ blt::vector #auto ]
  $::X seq 0 15 1
  set data1 [ blt::vector #auto ]
  $data1 set "0.1 2.0 3.3 4.0 4.3 2.4 6.8 5.0 4.6 3.0 2.0 2.0 3.0 3.2
4.0"
  set g [blt::graph .g]
  $g element create line1 -xdata $::X -ydata $data1 -symbol none -
color blue
  pack $g
  # add some point at position 2.0 3.3
  set x 2.0
  set y 3.3
  $g pen create pen1 -color red -symbol circle -outline black
  $g element configure line1 -weights y -styles { {pen1 $x $y} }


Regards,
Toby

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy