server-side graph plotter ?

server-side graph plotter ?

Jurgis Pralgauskis -
回帖数:6
problem
Hello, it would be nice to have a script, which can generate a picture of function given via query string (more parameters could also go this way).
I'd like function syntax to be algebra-filter or general_programing_language_math style.
for example:    plot.php?f(x)=(sin(x))^2+exp(1/x)&x0=0&dx=0.2&n=250

I guess there are several tools around, just I hope some of you could point me some of the best ones, thanks in adwance 微笑
actually, gallery of function imagaes could be handled separately, then no big need to pass functions via query, I can just use link addresses of images, but I need them to be generated online..

What for
I think of making interactive exercises/test using some javascript (sth like here ). And it would make my life easier generating those plots (no need to upload images, etc.)
It would look similar to this (http://www.univie.ac.at/future.media/moe/galerie/fun1/fun1.html#graphenpf), but more light-weight.
回复Jurgis Pralgauskis

Re: server-side graph plotter ?

Bernard Boucher -
Hi Jurgis,
              you will find 2 examples here tested with Moodle. The first using jpgraph the orther a flash movie.

I hope it may help,

Bernard

回复Bernard Boucher

Re: server-side graph plotter ?

Jurgis Pralgauskis -

as for serverside plotters jpgraph is fine.

  • but still I need to make some function interpreter, for+eval might be enough.
  • WIMS seems to have some decision for this.
  • and I could also use www.quickmath.com , but I would risk to make problems with bandwith stealing or so..

I also found

回复Jurgis Pralgauskis

Re: server-side graph plotter ?

Bernard Boucher -
Hi Jurgis,
              I think that you answered yourself better that I didwink

For jpgraph I am not sure if I understand clearly your point, but it accept some form of parameters for its  function interpreter. In the example:

$f1 = 'cos($x)*$x';
$f = new FuncGenerator($f1);
list($xdata,$ydata) = $f->E(-1.2*M_PI,1.2*M_PI);

$f2 = '2*$x-3';
$f = new FuncGenerator($f2);
list($x2data,$y2data) = $f->E(-2,2);

$f1 and $f2 may be the results of query instead of  constants and with small modifications can be parameters like you ask in your first post.

Bye,

Bernard




回复Jurgis Pralgauskis

Re: server-side graph plotter ?

venkatesan iyengar -
Probably you can try ase chartdirector for php or ase chartdirector for perl (http://www.advsofteng.com). In the php edition, what you require is to create a php file containing your plot details and simply include the php file in to a <img> tag.
回复Jurgis Pralgauskis

Re: server-side graph plotter ?

Alan Cooper -
If you don't mind letting the client do a bit of work I have something which allows the quick insertion and editing of graphs illustrated at http://qpr.ca/moodle (login as 'guest1' with password 'guest1' and look at the quiz in the 'Demo' course).
This isn't exactly "server side" as it employs a java applet to do the graphing, and you may not like the slight delay in presentation as the applet loads, but it does provide the kind of editing capability you asked for, in that the equations for the graphs in both the question and answers just occur as applet parameters in plain text (in standard in-line notation with ^ for powers).
回复Jurgis Pralgauskis

Re: server-side graph plotter ?

Alan Cooper -
 If you don't mind letting the client do a bit of work I have something which allows the quick insertion and editing of graphs illustrated at http://qpr.ca/moodle (login as 'guest1' with password 'guest1' and look at the quiz in the 'Demo' course).
This isn't exactly "server side" as it employs a java applet to do the graphing, and you may not like the slight delay in presentation as the applet loads, but it does provide the kind of editing capability you asked for, in that the equations for the graphs in both the question and answers just occur as applet parameters in plain text (in standard in-line notation with ^ for powers).