version 1.40, 2002/01/15 16:21:39
|
version 1.44, 2002/01/23 11:10:14
|
Line 29
|
Line 29
|
# 12/17 12/18 12/19 12/20 12/21 12/27 12/28 12/30 12/31 Matthew |
# 12/17 12/18 12/19 12/20 12/21 12/27 12/28 12/30 12/31 Matthew |
# 01/01/02 Matthew |
# 01/01/02 Matthew |
# 01/02 01/03 01/04 01/07 01/08 01/09 Matthew |
# 01/02 01/03 01/04 01/07 01/08 01/09 Matthew |
|
# 01/21 Matthew |
|
|
# Current issues |
|
# 1. Gnuplot is unable to vary the color or linestyle of <data> plots. |
|
# The key does not know this so it is misleading for the user. |
|
# Multiple <function>s can be plotted with varying line styles and |
|
# colors. |
|
# |
|
package Apache::lonplot; |
package Apache::lonplot; |
|
|
use strict; |
use strict; |
Line 380 sub start_key {
|
Line 375 sub start_key {
|
($token,$parstack,$safeeval,keys(%key_defaults)); |
($token,$parstack,$safeeval,keys(%key_defaults)); |
if ($constructtag) { |
if ($constructtag) { |
$result = &Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
$result.= &Apache::edit::handle_insert(); |
|
} |
} |
} |
} |
return $result; |
return $result; |
Line 413 sub start_title {
|
Line 407 sub start_title {
|
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $text=$$parser[-1]->get_text("/title"); |
my $text=$$parser[-1]->get_text("/title"); |
|
$result.=&Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
return $result; |
return $result; |
Line 444 sub start_xlabel {
|
Line 439 sub start_xlabel {
|
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $text=$$parser[-1]->get_text("/xlabel"); |
my $text=$$parser[-1]->get_text("/xlabel"); |
|
$result.=&Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
return $result; |
return $result; |
Line 476 sub start_ylabel {
|
Line 472 sub start_ylabel {
|
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $text=$$parser[-1]->get_text("/ylabel"); |
my $text=$$parser[-1]->get_text("/ylabel"); |
|
$result.=&Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
return $result; |
return $result; |
Line 511 sub start_label {
|
Line 508 sub start_label {
|
&Apache::edit::start_spanning_row(). |
&Apache::edit::start_spanning_row(). |
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $constructtag=&Apache::edit::get_new_args |
&Apache::edit::get_new_args |
($token,$parstack,$safeeval,keys(%label_defaults)); |
($token,$parstack,$safeeval,keys(%label_defaults)); |
if ($constructtag) { |
$result.=&Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
|
$result.= &Apache::edit::handle_insert(); |
|
} |
|
my $text=$$parser[-1]->get_text("/label"); |
my $text=$$parser[-1]->get_text("/label"); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
Line 588 sub start_function {
|
Line 582 sub start_function {
|
&Apache::edit::start_spanning_row(). |
&Apache::edit::start_spanning_row(). |
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
# Why do I do this? |
$result.=&Apache::edit::rebuild_tag($token); |
my $text=$$parser[-1]->get_text("/function"); |
my $text=$$parser[-1]->get_text("/function"); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
Line 663 sub start_data {
|
Line 657 sub start_data {
|
&Apache::edit::start_spanning_row(). |
&Apache::edit::start_spanning_row(). |
&Apache::edit::editfield('',$text,'',60,1); |
&Apache::edit::editfield('',$text,'',60,1); |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
|
$result.=&Apache::edit::rebuild_tag($token); |
my $text=$$parser[-1]->get_text("/data"); |
my $text=$$parser[-1]->get_text("/data"); |
$result.=&Apache::edit::modifiedfield($token); |
$result.=&Apache::edit::modifiedfield($token); |
} |
} |
Line 694 sub start_axis {
|
Line 689 sub start_axis {
|
($token,$parstack,$safeeval,keys(%axis_defaults)); |
($token,$parstack,$safeeval,keys(%axis_defaults)); |
if ($constructtag) { |
if ($constructtag) { |
$result = &Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
$result.= &Apache::edit::handle_insert(); |
|
} |
} |
} |
} |
return $result; |
return $result; |
Line 786 sub write_gnuplot_file {
|
Line 780 sub write_gnuplot_file {
|
if (%key) { |
if (%key) { |
$gnuplot_input .= 'set key '.$key{'pos'}.' '; |
$gnuplot_input .= 'set key '.$key{'pos'}.' '; |
if ($key{'title'} ne '') { |
if ($key{'title'} ne '') { |
$gnuplot_input .= 'title "'.$key{'title'}.'" '; |
$gnuplot_input .= 'title " '.$key{'title'}.'" '; |
} |
} |
$gnuplot_input .= ($key{'box'} eq 'on' ? 'box ' : 'nobox ').$/; |
$gnuplot_input .= ($key{'box'} eq 'on' ? 'box ' : 'nobox ').$/; |
} else { |
} else { |
Line 911 sub insert_plot {
|
Line 905 sub insert_plot {
|
} |
} |
$result .= ">\n"; |
$result .= ">\n"; |
# Add the components |
# Add the components |
$result .= &insert_key(); |
# $result .= &insert_key(); |
$result .= &insert_axis(); |
# $result .= &insert_axis(); |
$result .= &insert_title(); |
# $result .= &insert_title(); |
$result .= &insert_xlabel(); |
# $result .= &insert_xlabel(); |
$result .= &insert_ylabel(); |
# $result .= &insert_ylabel(); |
$result .= &insert_curve(); |
$result .= &insert_curve(); |
# close up the <plot> |
# close up the <plot> |
$result .= "</plot>\n"; |
$result .= "</plot>\n"; |
Line 959 sub insert_label {
|
Line 953 sub insert_label {
|
|
|
sub insert_curve { |
sub insert_curve { |
my $result; |
my $result; |
$result .= ' <curve '; |
$result .= "\n <curve "; |
foreach my $attr (keys(%curve_defaults)) { |
foreach my $attr (keys(%curve_defaults)) { |
$result .= ' '.$attr.'="'. |
$result .= ' '.$attr.'="'. |
$curve_defaults{$attr}->{'default'}."\"\n"; |
$curve_defaults{$attr}->{'default'}."\"\n"; |
} |
} |
$result .= " ></curve>\n"; |
$result .= " >\n"; |
|
$result .= &insert_data().&insert_data()."</curve>\n"; |
} |
} |
|
|
sub insert_function { |
sub insert_function { |