Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Extending createLine Method Functionaliy?

32 views
Skip to first unread message

Paul Bodenstab

unread,
Aug 20, 2012, 9:24:48 PM8/20/12
to
Here is what I want to do:

Create a Perl/Tk graphing application that can plot graphs with
data line styles that are a subset of gnuplot line styles: lines, dots,
points, linepoints.

Problem description:

Tk::Canvas has no problems with plotting lines with optional stipple
patterns that connect each (x,y) pair using a createLine call but it cannot
'easily' plot lines with 'dots' or 'points', i.e. highlight only each (x,y)
pair with an 'on' pixel for 'dots' or a bitmap for 'points'. With dots or
points there is no plotted connecting line between successive (x,y) pairs.
It seems that the only way of implementing this functionality is to define
bitmaps for a one pixel 'dot' and multiple bitmaps for different styles of
'points' and then use createBitmap calls for each and every (x,y) pair!
This solution requires not only a paradigm shift by using a different
canvas type but it is also extremely slow when one needs to plot 100K+ (x,y)
pairs.

Possible Problem Solution:

Since the plotting of lines is very fast I think that the cleanest
solution to this problem would be to somehow extend the functionality of the
createLine method by adding a -bitmap option that would specify a bitmap to
be plotted at every (x,y) pair. This new option in combination with the
other available ones would allow a user to synthesize any of the line styles
described above.

So, is this solution possible? If so, can it be implemented by a
non object oriented perl/tk guru (like me)? Can this extension be done in
perl alone or does one have to get down to the C language level? Any pointers
to a possible solution are eagerly sought and will be welcomed!

wolfram...@gmail.com

unread,
Sep 6, 2012, 5:37:17 AM9/6/12
to
While not a direct answer to your question you may have a look at Tk::PlotDataset. It's less than perfect in many aspects (if you create anything better, please publish :-)) but has the nice feature of displaying dots on the graph's points (with attached Balloons displaying the point's coordinates), but only when you zoom in so that there is a small number of points currently displayed. Look for createOval() in "sub drawOneDatasetB()".
0 new messages