Menu

Marquee style plot

2012-02-10
2012-09-07
  • chuck lidderdale

    I want to display seismic traces - live. I have a program that reads my data
    file and create a graph but 1/20 second later there is a new sample to add to
    the right side of the trace and the older sample needs to be pushed off the
    left. Is there any way to do that? Thanks

     
  • lbayuk

    lbayuk - 2012-02-11

    I can't see how that would be possible. PHPlot uses GD for its graphics, and
    GD makes a complete image file and delivers it. There is no dynamic update
    capability within an image (in GD, or PNG, JPEG, etc.)

    Even if you could make a new image for each point (and I think it would be
    hard to maintain 20 per second), the refresh would probably be too annoying.
    If you were talking about a new point every 10 seconds or so, then refreshing
    to a new plot might be feasible.

    Is there something I'm missing about how this could work?

     
  • chuck lidderdale

    ... one can only hope ...

    I've been playing with a for (;;) loop but haven't been able to get it to
    work. array_pop, array_push, redraw. No happyness... I would appreciate any
    suggestions, javascript, C, RPG-2, etc See: qcn.stanford.edu as to the reason.
    - their code doesn't work on X86_64 Linux. Anyhow Thanks and if you have an
    Ah-Ha at 2 AM let me know.

     
  • chuck lidderdale

    Question: Is there a way to rerun the phplot script and tell it not to erase
    the screen first? I can cause it to rerun with <meta refresh="" 0...=""> but the
    graph is there, it reruns, the screen is blanked and the new graph show up.
    Graph, huge blink, graph, huge blink...

     
  • chuck lidderdale

    Kind of got it working.

    prog1: <meta refresh="" 0="" self=""> echo "";

    trace2: is a phplot program, mysql, select * from sensor where time > 60
    seconds ago

    which is 1200 points but break at 1000. it's - a - little - jerky - but - it -
    works.

     
  • lbayuk

    lbayuk - 2012-02-11

    (Your latest came across while I was writing this, but here it is anyway...)

    Re: refresh without blanking, yes it can be done, I have seen it on many
    sites, but it isn't something I'm familiar with. I think it involves using
    Javascript to load the new image (without displaying it), then when it is done
    loading, the image source in the displayed page is changed to point to the new
    image object. This switch happens quick enough that there is no blanking. But
    I'm really guessing here.

    Another guess is that to really do what you want through a web browser would
    require a Java or Flash applet, where you can update graphics without
    reloading an image. But again this isn't anything I've ever done.

     
  • chuck lidderdale

    I may have another method. marquee of several images and the init testing
    looks promising. Cept fer one thing I can't figure out. I need the graph to be
    naked - well semi naked. No Y axis labels and zero padding for the borders.

    I'm getting when I want ------v^-v^^v-----v^-v^^v--v^-v^^v-----v^-v^^v--. Hope
    that idea/graphics comes across. I'm sure there is a way to say YLables none.

    Thanks

     
  • lbayuk

    lbayuk - 2012-02-13

    (No, sorry, I didn't get that at all: "I'm getting when I want ------v^-v^^v
    -----v^-v^^v--v^-v^^v-----v^-v^^v--." - I do not know what that is supposed to
    mean.)

    Sure, you can produce a 'bare' plot. I used that with the Using Truecolor to
    make a histogram
    example in the manual, except I kept the border around it.
    There is no one master control that turns everything off, however, so you have
    to do each feature separately. Here is some code that turns everything off
    except the plot lines themselves:

    $plot->SetDrawXAxis(False);
    $plot->SetDrawYAxis(False);
    $plot->SetXDataLabelPos('none');
    $plot->SetXTickLabelPos('none');
    $plot->SetYTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->SetYTickPos('none');
    $plot->SetDrawXGrid(False);
    $plot->SetDrawYGrid(False);
    $plot->SetPlotBorderType('none');
    
     
  • lbayuk

    lbayuk - 2012-02-13

    I forgot the part where you asked about zero padding for the borders.

    If you have no title, axis labels, or ticks, PHPlot doesn't need to leave room
    outside the plot area for them, but it still puts a 5 pixel border around the
    plot so features don't run up to the edge. You get rid of that by setting all
    4 plot area margins to zero:

    $plot->SetMarginsPixels(0, 0, 0, 0, 0);
    

    While that pushes the plot area out to the image edges, it doesn't mean the
    plotted features go right to the edge. That will be determined by the world to
    device coordinate mapping. If you need to change that too, you use
    SetPlotAreaWorld - but you will have to know your data range.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.