AssFace has asked for the wisdom of the Perl Monks concerning the following question:

I am interested in adding additional symbols to a graph that is coming out of GD::Graph. For instance, on a line that is going up and down over time, along that, I would want to place some shape (a triangle, square, circle, whatever) and be able to correlate it to that spot in the data.

So for instance, everytime that the time period is 89, put a circle down, and every time the value is 136, put a triangle there.

It doesn't have to be right on the line, it could be along the top of the data, as long as it is in the same position as that data point.

Have any of you tried this sort of thing? Any suggestions?

Thanks


-------------------------------------------------------------------
There are some odd things afoot now, in the Villa Straylight.

Replies are listed 'Best First'.
Re: Adding symbols to GD::Graph ??
by AssFace (Pilgrim) on Oct 09, 2003 at 18:08 UTC
    Okay, I guess the negative score on that should tell me something. If it is just another person that is intolerant of my name, that's fine - but in case it is due to the way I worded my question, I will rephrase it.

    I know how to use GD to create a polygon on an image in a given location. I know how to use GD::Graph to generate a graph given an array of data.

    What I'm currently having trouble puzzling out is if I want to put something on the graph, I imagine I would want to create a polygon object and then place it the coordinate location of the data point that I am interested in - but as far as I know, GD::Graph doesn't give that information.

    So does anyone have any ideas as to locating where to place an image on a graph that is coming from the output of GD::Graph?

    I personally feel the point system here is useless, I would much prefer the person wrote on here something like "yes, I read your post, and while I don't know the answer to your questiond, I don't like your username." or "I've read your post and this is far too easy for me, it has insulted my intelligence." - at least that way I know where to direct my energies in addressing the resolution to my question.


    -------------------------------------------------------------------
    There are some odd things afoot now, in the Villa Straylight.
Re: Adding symbols to GD::Graph ??
by AssFace (Pilgrim) on Oct 09, 2003 at 18:42 UTC
    In continuing a theme of talking to myself...

    It looks like the GD::Graph has a few experimental methods that might do what is desired here:
    $graph->get_hotspot($dataset, $point) Experimental: Return a coordinate specification for a point in a datas +et. Returns a list. If the point is not specified, returns a list of +array references for all points in the dataset. If the dataset is als +o not specified, returns a list of array references for each data set +. See "HOTSPOTS". $graph->get_feature_coordinates($feature_name) Experimental: Return a coordinate specification for a certain feature +in the chart. Currently, features that are defined are axes, the coor +dinates of the rectangle within the axes; x_label, y1_label and y2_la +bel, the labels printed along the axes, with y_label provided as an a +lias for y1_label; and title which is the title text box. See "HOTSPO +TS".

    Perhaps with that I can then get coordinates with which to pass to the polygon and then apply to the image.


    -------------------------------------------------------------------
    There are some odd things afoot now, in the Villa Straylight.
Re: Adding symbols to GD::Graph ??
by zentara (Archbishop) on Oct 10, 2003 at 15:24 UTC
    It sounds like you want to turn GD into a canvas, putting multiple images into it. Maybe you should look for a canvas method either from Tk, or maybe gtk. Tk::Zinc is made to do these kind of graphics merging on a canvas.