I would like to have bar charts, pie charts etc.
regards
Mette
Denmark
The spreadsheet module has a macro recorder which could provide you with
hints on how to control it rather like what Lee Peedin has done with excel
(see http://pragmaticlee.safedataisp.net/ ).
Let us know how you get on.
Jon
"Mette Stephansen" <mm> wrote in message
news:42af118f$0$63660$edfa...@dread15.news.tele.dk...
There may be free libraries, utilities that you could control from Rexx, but you would have to
google for them.
If you are on Windows and have Excel, Jon pointed out a possibility.
If you do not have Excel or are not on a Windows platform, you may want to consider
[http://www.]OpenOffice.org, which is fully fledged, free, opensource and openplatform business
application suite, comparable and compatible to MS Office. If so, there is some technology
developing which would allow you to fully exploit all of the UNO interfaces, which one uses there
for scripting/automating.
Regards,
---rony
> there is some technology developing
>Regards,
>
>---rony
Do I sense that Rony is on a mission? Keep up the good work Rony -
looking forward to what you'll have to show us in Austin.
Lee
Well, definitely there is something cooking...
;)
Regards,
---rony
I have nothing for pie charts, but do have histograms, but that's not quite
what you want, most probably.
I've written a REXX program to do X,Y plotting (and also another
to do vertical and/or horizontal histograms). It essentially does
character plotting, like SAS did when you directed the output to an
old (paper) printer, it just places a plotting character (it
normally uses a round bullet --- 'f9'x under DOS, but any character
can be specified) at appropriate places on the screen, along with
a well-chosen grid and labeled end-points.
The $PLOT program was designed to be used with the handy-dandy,
slicer-dicer, all-in-one general purpose calculator program: $CALC.
The grid (under DOS and CMS) uses the true vertical bar and hyphen,
and the graph origin is a true junction (a cross or some other
appropriate "boxing" character, and in the example shown below,
it would be a left junction --- but a data point is overlaying
the (0,0) origin.
Here is a sample output from the command:
$CALC sind(iota(-180,180,5)) ;;; plot .F=sin_data.txt
where the .F= (additionaly) directs the output to a file. I
use ;;; to seperate options that can be specified for the $CALC
program, a sloppy way to do it, but easy to program for. You can
also specify the precision (DIGITS), format of the output, and
other such things).
The IOTA function just creates a range of numbers from -180 to
+180, incrementing by five. SIND is, of course, the SINE
functions whose argument(s) are in degrees. (My DOS window is
80 characters wide by 50 lines deep).
Most of $CALC functions accept multiple numbers. For instance:
$CALC sqrt(9 37 pi() e()**3 fact(9) prime(100))
will compute six square roots, including one for pi, the "e"
constant (2.71828...) cubed, 9!, and the 100th prime.
The 1 and -1 show the high and low values of the plot points, and
72 indicates the (73) data points plotted (plotting starts the
zero X asis, so to speak).
|1 .. ...
| .. ..
| . .
| . .
| . .
| . .
|
| . .
| . .
|
| . .
| . .
|
| . .
|
| . .
|
| . .
|
| . .
|
| . .
|0 72
.--------------------------------------.--------------------------------------.
|
|. .
|
| . .
|
| . .
|
| . .
|
| . .
| . .
|
| . .
|
| . .
| . .
|
| . .
| . .
| . .
| . .
| .. ..
|-1 .. ...
Here is the documentation for the $PLOT command (which the $CALC program
uses):
The $PLOT command/subroutine is used to display a plot of specified pairs of
numbers (X,Y coordinates), or plot a list of numbers (singularly), with either
the X or Y cordinates being implied, the default is 0 ---> n-1, the origin and
increment can be overridden.
+------------------------------------------------------------------------------+
| |
| + + |
| |numbers | + + + + + + |
| $PLOT |? | | CLearscreen| | COLORs| | COMMAs| |
| |?AUTHOR | |NOCLearscreen| |NOCOLORs| |NOCOMMAs| |
| |?FLOW | + + + + + + |
| |?SAMPLES| |
| + + + + + + |
| + + | 0 | | 1 | |
| | DUPs| |INDEXStart sss| |INDEXIncrement iii| |
| |NODUPs| |IStart sss| |IIncrement iii| |
| + + + + + + |
| |
| + + |
| + + |MINUSE nnn| + + + + |
| | LOGs| + + | NORMalize| |NOQuiet| |
| |NOLOGs| + + |NONORMalize| | Quiet| |
| + + |MAXUSE nnn| + + + + |
| + + |
| |
| + + + + |
| |PLOTSEQuential| | SCALing| |
| |PLOTSIMple | |NOSCALing| |
| |PLOTMULTiple | + + |
| + + |
| |
| + + + + |
| |SCREENWidth www| |SCREENDepth ddd| |
| |SCRWidth www | |SCRDepth ddd | |
| |SWidth www | |SDdepth ddd | |
| |WIDth www | |DEPth ddd | |
| + + + + |
| |
| + + |
| + + | SIMplechars | + + |
| | SHOWLABels| | SIMplecharacters| | SINGlevalues| |
| |NOSHOWLABels| |NOSIMplechars | |NOSINGlevalues| |
| + + |NOSIMplecharacters| + + |
| + + |
| |
| + + + + |
| |NOSWAPAXises| |XSINgles| XSIN| + + |
| | SWAPAXises| |YSINgles| YSIN| |.XXX=yyy| |
| + + + + + + |
| |
+------------------------------------------------------------------------------+
---where: (all arguments are optional can be specified in any order, and
all options and/or values can be in lower/upper/mixed case.
? shows this help file (press ESC to quit when viewing).
?AUTHOR shows the author of this program.
?FLOW shows the external execution flow of this program.
?SAMPLES shows some sample uses (press ESC to quit when viewing).
numbers are any number of valid REXX numbers seperated by blanks. They
may be intermixed with other options (see below). The numbers may
be seperated by commas to help pairing of X,Y coordinates (unless
the SINglevalues option is specified).
The numbers are assumed to be pairs of X,Y coordinates (the
default), or single values of the X or Y axis if the
SINglevalues option is specified. The SINX or SINY option
is used to specify which axis is be used for the single values.
CLearscreen will clear the terminal screen before any output is
shown on the terminal. The default is CLEARSCREEN
COLORs uses colors when displaying the plot.
NOCOLOrs doesn't use colors when displaying the plot.
The default is: COLORS (for DOS or CMS),
NOCOLORS (for all other systems).
COMMAs specifies to commas are to be inserted into the numbers shown
for the labels (if shown). The default is: COMMAs
NOCOMMAs doesn't insert commas into numbers being shown for labels.
DUPs allows duplicate data to be plotted. The default is: DUP
NODUPs doesn't plot duplicate data points.
INDEXStart sss
IStart sss where sss is a number that is used to set (start) the initial
value of X (the default) or Y if the SINglevalues option
is specified. The default is: INDEXStart 0
INDEXIncrement iii
IIcrement iii where iii is a number that is used to increment either the X
or Y value (starting at INDEXStart) if the SINglevalues
option is specified. The default is: INDEXIncrement 1
LOGs causes all normal (non-error) output (i.e., the plot) to be
logged (written to, or appended) to a file.
On CMS, the fileid is: $PLOT ANS A5
On TSO, the fileid is: $PLOT.ANS
On DOS, the fileid is: \temp\$PLOT.ANS -where temp is the
value of the TEMP environment var, if not found, TMP is used.
The default is: OLOGs
MINUSE nnn is the minimum number to be used in the plot. Any number
below this is ignored. There is no default.
MAXUSE nnn is the maximum number to be used in the plot. Any number
above this is ignored. There is no default.
NORMalize will normalize all the "numbers" specified. Any leading plus
signs are removed, including leading or trailing trivial zeros,
superflous decimal points, and exponentation.
The default is: NORMALIZE
Quiet indicates that no output is shown. The default is: NOQUIET
PLOTSIMple does a simple plot, with a point (ù) to show the datapoint. Any
plot point overlaying an another plot point simple shows one point.
The default is: PLOTSIMPLE
PLOTSEQuential each plot is plotted with a point (ù) followed by the number of
the data point, starting with 1. The default is: PLOTSIMPLE
PLOTMULTiple each plot is plotted with a point, unless another point has been
already plotted, in that case, the next point in the list is
used to show the data point. The point list is: úùOé ðþ±²*+
If the list is exausted, a plus sign (+) is used.
SCALing will scale the X and Y axis data points to the best fit on the
terminal screen. The default is: SCALing
NOSCALing won't scale the X and Y axis data points to the best fit on the
terminal screen. In effect, the NOSCALING option will preserve
the aspect of the X and Y values. The default is: SCALing
SCREENWidth www specifies the width of the terminal screen. If not specified
SCRWidth www or a value of 0 (zero) is specified, the screen width is
SWidth www obtained from the operating system.
WIDth www If not obtainable, a value of 80 is assumed.
Because of some terminal's behavior, the actual
width used is SCREENWIDTH - 1
SCREENDepth ddd specifies the depth of the terminal screen. If not specified
SCRDepth ddd or a value of 0 (zero) is specified, the screen depth is
SDepth ddd obtained from the operating system.
DEPth ddd If not obtainable, a value of 24 is assumed.
Because of certain operating systems, three lines
are assummed to be used for prompts, etc, so the
actual depth used is SCREENDEPTH - 3
SHOWLABels shows the values of the minimum and maximum values plotted,
including 0 (if it's on the plot). The default is: SHOWLABels
SIMplechars
SIMPLEcharacters translates extended characters to "simple" characters.
This option affects boxing characters and foreign non-Latin alphabet
characters in the month and day-of-week names.
The default is: NOSIMPLEcharacters
SINglevalues will cause the numbers specified to be plotted as single values
(instead of being plotted as X and Y coordinates).
The default is: NOSINGLEVALUES
NOSINglevalues will cause the numbers specified to be plotted as X and Y
coordinates. The default is: NOSINGLEVALUES
SWAPAXises will swap the data points so that:
all X points will plot on the Y axis, and
all Y points will plot on the X axis.
The default is: NOSWAPAXISIS
NOSWAPAXises won't swap the data points on each axises..
XSINgles will cause a sequence of generated numbers to be used for the X
coordinates starting at INDEXStart (normally 0) and
to be incremented by INDEXIcrement (normally 1) if the
SINGLEvalues option is specified. The default is: NOSINX
The Y axis numbers are taken from the specified list.
YSINgles will cause a sequence of generated numbers to be used for the Y
coordinates starting at INDEXStart (normally 0) and
to be incremented by INDEXIcrement (normally 1) if the
SINGLEvalues option is specified. The default is: NOSINY
The X axis numbers are taken from the specified list.
.XXX=yyy are any options to be used by the $T program (which is used to
display the histogram. Possible uses are to specify a color
(.C=color) for the histogram. For more info, issue: $H $T
*
The $CALC program is pretty hefty (it has a number of subroutines that are
used), along with various support programs such as $PLOT, $T, $ERR and the like.
I'm still trying to find a way to have the lot on a website somewhere so people
can download the program set and documentation. $CALC.HEL is kinda big,
almost 4,000 lines of text, not including the $CALC.SAM (sample uses of
$CALC) and also some rudamentary (logic) flow diagrams. ______________Gerard S.
No bar example? no pie example?
Interact with an existing app directly or by writing a macro such
an app can run, use a CLI one or draw your own? Typically I never
use the first approach mainly because of the huge overhead, I use a
CLI one when creating graphs with REXX and I use the draw your own
approach whenever I need to *extract* data from an existing graph.
When looks would be very important I may choose to use an existing
app, but the overhead must be acceptable then. It often isn't.
---
Rex
/* rexx code processing data files here */
---snip --
call lineout fileout,
'plotdata<-read.csv("'||well||'.csv",header=FALSE,as.is=TRUE)'
call lineout fileout, 'attach(plotdata)'
call lineout fileout, 'v1 <-as.numeric(as.vector(V1[3:length(V1)]))'
call lineout fileout, 'v2 <-as.character(V2[3:length(V2)])'
call lineout fileout, 'v3
<-as.numeric(as.vector('||V||'[3:length('||V3||')]))'
call lineout fileout, 'p3 <- ifelse(v3<0,2,1)'
call lineout fileout, 'v3 <- ifelse(v3<0,-v3/2,v3)'
-- four plots of distribution
call lineout fileout, 'par(mfrow=c(2,2))'
call lineout fileout,
'hist(v3,main="'||analyte||'--'||well||'",xlab="'||_units||'")'
call lineout fileout,
'qqnorm(v3,main="'||analyte||'--'||well||'",sub="Shapiro-Wilk: W='||W.1||',
p-value= '||p_value.1'")'
call lineout fileout, 'qqline(v3)'
call lineout fileout,
'hist(log(v3),main="log('||analyte||')--'||well||'",xlab="log('||_units||')"
)'
call lineout fileout,
'qqnorm(log(v3),main="log('||analyte||')--'||well||'",sub="Shapiro-Wilk:
W='||W.2||', p-value= '||p_value.2'")'
call lineout fileout, 'qqline(log(v3))'
-- snip --
'"c:\Program Files\R\rw1061\bin\rterm.exe" --no-save <'||fileout||'>
plotdata.out'
call lineout fileout
/* more rexx code follows */
"Mette Stephansen" <mm> wrote in message
news:42af118f$0$63660$edfa...@dread15.news.tele.dk...
I wrote the $CALC and $PLOT REXX programs before there was even
Windows, just DOS. It still runs under (native, bare-bones DOS if
you want. I also wrote it so it can be used on (VM) CMS, (MVS) TSO,
and DOS (and/or Windows), with no assumption of what operating
system is being used, or what applications existed.
I could've shown a vertical or horizontal bar chart (graph), but
they're pretty much self-explanatory. ____________________Gerard S.
> with no assumption of what operating system is being used, or what
> applications existed.
Well, you could have developed an app which output nowadays is in a
generic graphical file format. If you can write such a $CALC, you should
have the skills to do that? I fear the '1981' output isn't very useful,
not being what people are looking for anymore. Just my $0.02.
> I could've shown a vertical or horizontal bar chart (graph), but
> they're pretty much self-explanatory.
The pie chart isn't. :-)
---
|> with no assumption of what operating system is being used, or what
|> applications existed.
| Well, you could have developed an app which output nowadays is in a
| generic graphical file format. If you can write such a $CALC, you should
| have the skills to do that? I fear the '1981' output isn't very useful,
| not being what people are looking for anymore. Just my $0.02
Well, back then, there wasn't much that really supported graphics. IBM
2250's were rare, and 3279 even more so. Without terminals with graphic
capability, writing such an app would've been a waste of time and
effort since nobody could see the output. Even today, I wouldn't even
know how to begin such a task. The only cross-platform programs that
have done so are SAS and DISPLAY (to my knowledge), and those are both
BIG apps.
I do disagree, however, on your opinion on the usefullness of the
plotting output. I also can't speak on what people are looking for,
just myself. ___________________________________________________Gerard S.
You could try to drive gnuplot from REXX.
I havn't used it myself, but the homepage looks promising.
--
Bye/2
Meinolf
> I do disagree, however, on your opinion on the usefullness of
> the plotting output. I also can't speak on what people are
> looking for, just myself.
Well, in my opinion there was a relation between usefullness and
what people are looking for. In general, obviously. It wouldn't
apply to about any kind of REXX progress bar, where a sequence
of '/', '|', '\' and '-' still would be fine. I tend to use PCX
initially, and convert that later to e.g. a GIF or JPG file. OS
specific BMP files nowadays aren't even popular anymore, probably
due to the internet-thingy.
---
This appl. is what I'm looking for:
http://www.jfree.org/jfreechart/index.php
Can it be used with rexx, you thinnk?
regards
Mette
Lee
On 17 Jun 2005 01:48:43 -0700, mette...@hotmail.com (Mette
Definitely!
:)
Looks *very* impressive and it is great that it is in Java, see below!
As Lee pointed out there is an external Rexx function library which allows to address any Java
program or program that possesses a Java interface.
In the past few weeks quite a few changes/additions/reshapes took place and at the moment you could
use a version that is pre-compiled for the opensource and free ooRexx (http://www.ooRexx.org).
Using the ooRexx module "BSF.CLS" all of Java looks like ooRexx. You will be able to address any
Java (class) object from ooRexx as if it was an ooRexx (class) object. You'll send ooRexx messages
and they will get automagically dispatched such that the appropriate Java methods get invoked.
Whatever Java returns, ooRexx can deal with directly.
This new "Vienna version of BSF4Rexx" also allows you to address Java fields as if they were ooRexx
attributes: you'll send the name of a field and get its value back, and you can send it the name of
the field followed by the assignent operator followed by the new, desired value.
The nice thing about this technology is that you usually are *not* bothered with the need to type
cast or declare types as is the case in Java.
Point your browser to: <http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/dist.20050612/>. There are a few
textfiles there which you could study upfront. Also be warned, that it may be the case that little
additions/changes take place in which case you should look at newer distributions (you may want to
start out at: <http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/>). You *should* look at the samples and
test programs, they are small "nutshell" examples which should be self-explaining. (*Really* try
them out, so you learn and experience how easy it is to use bSF4Rexx.) All sample and testfiles
which contain the "oo" in their names are created with ooRexx. Comparing them to the classic Rexx
versoins you'll see that you can save a *lot* of code if you merely use the oo-syntax of ooRexx by
employing the message operator (a tilde, '~', also named 'twiddle' in the ooRexx documentatoin).
All ooRexx programs that you write with the Vienna version of BSF4Rexx should be openplatform, i.e.
if you develop your charting program using that interesting looking Java library, then your
solutions should run unchanged under Windows and Linux (and maybe under Macintosh in the near
future...). The same is true BTW for all of the supplied sample and test programs.
If you have any questions about this evolving techology, please post them here in this forum, such
that other "lurkers" who may be interested in it may learn some aspects of it.
And please, once you have your first plotting examples running with ooRexx, post one or two of them
here ase well, o.k.?
Regards,
---rony
P.S.: Another little hint: there is also an ooRexx module named "OOO.CLS" which allows easy access
to OpenOffice from ooRexx.
Yes it can - and it is not hard !
Attached are two examples i wrote.
They should be easy to understand, and to change to whatever you want to
display.
To execute the examples you need bsf4rexx, Java and JFreeChart
installed. bsf4rexx version 20050618 or newer is required.
bsf4rexx : http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/
To get JFreeChart to work, you need to copy jcommon-1.0.0-rc1.jar and
jfreechart-1.0.0-rc1.jar into JAVA-INSTALL-DIR/lib/ext/ or point to them
in your classpath.
Regards Åsmund
Jeg er fra Norge ja :)
Just installed a Java on my machine. I have tried to run the first script,
but it says:
/// Java-exception (RexxAndJava) occurred:
[method invocation failed: java.lang.reflect.InvocationTargetException
target exception: java.lang.ClassNotFou
ndException: org.jfree.chart.ChartFactory]
\\\
Exception in thread "main" org.apache.bsf.BSFException: "invoke": object
'Class.class' - method [forName], met
hod not found or error (exception) executing method!
at
org.rexxla.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:2280)
699 *-* call BSF "invoke", "Class.class", "FORNAME" , a.1
11 *-* .bsf~bsf.import("org.jfree.chart.ChartFactory","JChartFactory")
Error 40 running C:\Programmer\ooRexx\bsf4rexx\bin\chart.rex line 11:
Incorrect call to routine
Error 40.1: External routine "BSF" failed
It was a Java 1_5_0_03 from java.sun.com. I have added the java stuff to the
Path
What have I missed ?
Can you perhaps help me?
regards
Mette
"Mette Stephansen" <mm> skrev i en meddelelse
news:42b425e3$0$63690$edfa...@dread15.news.tele.dk...
> Hello Åsmond !
> Norway??? Denmark calling ....
>
> Thanks a lot - I will try it out as soon as I get an Java installed on
this
> PC, otherwise I'll have to wait until I get to my work PC.
> But it seems very easy indeed.
>
> My plan is to read data from Oracle (via RexxSQL - have tried and it
> works) - and the display various types of graphs in a dialog box.
>
> I have coded REXX for meny years on the main frame (VM/CMS until 4 years
> ago, when I changed job to a machine without Rexx (Siemens)). But I'm new
to
> all the oo stuff, so I'm very pleased that you took your time to make a
> working example for me :-)
>
> regards
> Mette
>
> "jjjoppe" <jjj...@start.no> skrev i en meddelelse
> news:a9eb9$42b40447$506cece8$12...@news.chello.at...
> --------------------------------------------------------------------------
--
> ----
>
>
> > /*
> >
> > Created by Ã.smund Realfsen, real...@gmx.net, 18.06.2005
> >
> > This example creates a 3d Pie using:
> >
> > - ooRexx : http://www.oorexx.org/
> > - Java : http://java.sun.com/
> > - bsf4rexx : http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/
> > - JFreeChart :http://www.jfree.org/jfreechart/
> >
> > */
> >
> >
> > fileName="simple3Dchart.jpg" -- output file
> >
> >
> > /* import classes */
> > .bsf~bsf.import("org.jfree.chart.ChartFactory","JChartFactory")
> > .bsf~bsf.import("org.jfree.chart.ChartUtilities","JChartUtilities")
> > .bsf~bsf.import("org.jfree.chart.JFreeChart","JFreeChart")
> >
>
.bsf~bsf.import("org.jfree.data.general.DefaultPieDataset","JDefaultPieDatas
> et")
> > .bsf~bsf.import("java.io.File","JFile")
> >
> >
> > /* create the dataset */
> > dataset=.JDefaultPieDataset~new()
> > dataset~setValue("Fish", 5) -- add the values
> > dataset~setValue("Bread", 7)
> > dataset~setValue("Cheese", 10)
> > dataset~setValue("Beer", 4)
> > dataset~setValue("Butter", 2)
> > dataset~setValue("Meat", 7)
> > dataset~setValue("Pasta", 3)
> >
> >
> >
> > /* generates the chart.. for explanation of the input, look at the
> JFreeChart API : http://www.jfree.org/jfreechart/javadoc/ */
> > chart=.JChartFactory~createPieChart3D("Generated from ooRexx, bsf4rexx,
> java and JFreeChart",dataset,true,true,false)
> >
> >
> >
> > chartFile=.JFile~new(fileName)
> > .JChartUtilities~saveChartAsJPEG(chartFile, chart, 800,500) -- save the
> file as JPG
> >
> > say "Chart generated and saved to file : "fileName
> >
> >
> > ::requires BSF.CLS -- all bsf4rexx scripts need this line
> >
> >
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > /*
> >
> > Created by Ã.smund Realfsen, real...@gmx.net, 18.06.2005
> >
> > This example creates a XY chart showing a sinus curve and a x^3 curve
> using:
> >
> > - ooRexx : http://www.oorexx.org/
> > - Java : http://java.sun.com/
> > - bsf4rexx : http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/
> > - JFreeChart :http://www.jfree.org/jfreechart/
> >
> > */
> >
> >
> > fileName="simpleXYchart.jpg" -- output file
> >
> >
> > /* import classes */
> > .bsf~bsf.import("org.jfree.chart.ChartFactory","JChartFactory")
> > .bsf~bsf.import("org.jfree.chart.ChartUtilities","JChartUtilities")
> > .bsf~bsf.import("org.jfree.chart.JFreeChart","JFreeChart")
> > .bsf~bsf.import("org.jfree.data.xy.XYSeries","JXYSeries")
> >
>
.bsf~bsf.import("org.jfree.data.xy.XYSeriesCollection","JXYSeriesCollection"
> )
> > .bsf~bsf.import("java.io.File","JFile")
> > .bsf~bsf.import("java.lang.Math","JMath")
> >
> >
> > /* create the data series */
> > sinusSeries=.JXYSeries~new("Sinius") -- create a dataserie for the sinus
> curve
> > i=-10
> > do until i=10
> > sinusSeries~add(i,(.JMath~sin(i)*800)) -- uses the java.lang.Math
> package to calculate sinus
> > i = i +0.1
> > end
> >
> >
> > x3Series=.JXYSeries~new("x^3") -- create a dataserie for x^3 curve
> > i=-10
> > do until i=10
> > x3Series~add(i,.JMath~pow(i,3)) -- uses the java.lang.Math package
to
> calculate sinus
> > i = i +0.1
> > end
> >
> >
> > dataset=.JXYSeriesCollection~new()
> > dataset~addSeries(sinusSeries) -- add siniusSeries to dataset
> > dataset~addSeries(x3Series) -- add x3Series to the dataset
> >
> > VERTICAL=bsf("getStaticValue", "org.jfree.chart.plot.PlotOrientation",
> "VERTICAL") -- this is how you get a value from a static field
> > HORIZONTAL=bsf("getStaticValue", "org.jfree.chart.plot.PlotOrientation",
> "HORIZONTAL") -- we don't use HORIZONTAL in this example
> >
> > /* generates the chart.. for explanation of the input, look at the
> JFreeChart API : http://www.jfree.org/jfreechart/javadoc/ */
> > chart=.JChartFactory~createXYLineChart("Generated from ooRexx, bsf4rexx,
> java and JFreeChart","X-axis","Y-axis",dataset,VERTICAL,true,true,false)
> >
> > chartFile=.JFile~new(fileName)
> > .JChartUtilities~saveChartAsJPEG(chartFile, chart, 800,500) -- save the
> file as JPG
> >
> >
> > say "Chart generated and saved to file : "fileName
> >
> >
> > ::requires BSF.CLS -- all bsf4rexx scripts need this line
> >
> >
> >
>
>
> Just installed a Java on my machine. I have tried to run the first script,
> but it says:
>
> /// Java-exception (RexxAndJava) occurred:
> [method invocation failed: java.lang.reflect.InvocationTargetException
> target exception: java.lang.ClassNotFou
> ndException: org.jfree.chart.ChartFactory]
> \\\
> Exception in thread "main" org.apache.bsf.BSFException: "invoke": object
> 'Class.class' - method [forName], met
> hod not found or error (exception) executing method!
> at
> org.rexxla.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:2280)
> 699 *-* call BSF "invoke", "Class.class", "FORNAME" , a.1
> 11 *-* .bsf~bsf.import("org.jfree.chart.ChartFactory","JChartFactory")
> Error 40 running C:\Programmer\ooRexx\bsf4rexx\bin\chart.rex line 11:
> Incorrect call to routine
> Error 40.1: External routine "BSF" failed
>
> It was a Java 1_5_0_03 from java.sun.com. I have added the java stuff to the
> Path
> What have I missed ?
Well, that looks *good*, indeed! You were able to install the needed Java support and the BSF4Rexx.dll!
The error you get indicates, that Java was not able to find the jar-archives where the Java class
"org.jfree.charg.ChartFactory" is located.
Have you followed the directions: "To get JFreeChart to work, you need to copy jcommon-1.0.0-rc1.jar
and jfreechart-1.0.0-rc1.jar into JAVA-INSTALL-DIR/lib/ext/ or point to them in your classpath." ?
Hmm, looking at the above path there may be a little error, you should copy those JFreeChart
jar-files ("jcommon-1.0.0-rc1.jar", "jfreechart-1.0.0-rc1.jar") to:
"JAVA-INSTALL-DIR/jre/lib/ext"
(note the "jre" directory in the above path).
An alternative would be to set CLASSPATH in your environment and add the full pathname (including
the jar-file name) to it.
Please let us know, whether that has helped.
Good luck!
---rony
Thanx .... I added the 2 jars specificly to my CLASSPATH, and I'm getting
closer :-) But still it's not working:
C:\Programmer\ooRexx\bsf4rexx\bin>chart.rex
Exception in thread "main" org.apache.bsf.BSFException: "invoke":
bean: [org.jfree.data.general.DefaultPieDataset@1]
method: [SETVALUE] not found!
Check method name or arguments (number and types):
arg # 1: [Fish] --> [Fish]
arg # 2: [5] --> [5]
at
org.rexxla.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:2251)
699 *-* call BSF "invoke", "org.jfree.data.general.DefaultPieDataset@1",
"SETVALUE" , a.1 , a.2
21 *-* dataset~setValue("Fish", 5)
Error 40 running C:\Programmer\ooRexx\bsf4rexx\bin\chart.rex line 21:
Incorrect call to routine
Error 40.1: External routine "BSF" failed
To me it seems that it has translated the setValue method to uppercase
(SETVALUE) ???????
Any ideas?
regards
Mette
"rony" <Rony.Fl...@wu-wien.ac.at> skrev i en meddelelse
news:d940s2$i1l$1...@trane.wu-wien.ac.at...
are you sure that you are using the zip-archive "BSF4Rexx.zip" in
<http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/dist.20050618tmp/> (note the date being 20050618)?
With that the program should work. You'll see the programs and the JPG-files at:
<http://wi.wu-wien.ac.at/rgf/rexx/bsf4rexx/dist.20050618tmp/test_JFreeChart/>.
> Thanx .... I added the 2 jars specificly to my CLASSPATH, and I'm getting
> closer :-) But still it's not working:
>
> C:\Programmer\ooRexx\bsf4rexx\bin>chart.rex
> Exception in thread "main" org.apache.bsf.BSFException: "invoke":
> bean: [org.jfree.data.general.DefaultPieDataset@1]
> method: [SETVALUE] not found!
> Check method name or arguments (number and types):
> arg # 1: [Fish] --> [Fish]
> arg # 2: [5] --> [5]
> at
> org.rexxla.bsf.engines.rexx.RexxAndJava.javaCallBSF(RexxAndJava.java:2251)
> 699 *-* call BSF "invoke", "org.jfree.data.general.DefaultPieDataset@1",
> "SETVALUE" , a.1 , a.2
> 21 *-* dataset~setValue("Fish", 5)
> Error 40 running C:\Programmer\ooRexx\bsf4rexx\bin\chart.rex line 21:
> Incorrect call to routine
> Error 40.1: External routine "BSF" failed
Well, you see quite a few infos on what has happened behind the curtain.
;)
> To me it seems that it has translated the setValue method to uppercase
> (SETVALUE) ???????
That's normal and does not make a difference (BSF4Rexx will figure out the right method with the
right spelling and the right arguments behind the covers) in this particular case.
Would think that you are not using BSF4Rexx.zip from "dist.20050618tmp".
Please let us know how you fare, o.k.?
Regards,
---rony
And heureka ... IT WORKS !!!!!
Thanks thanks a lot :-) Mange tak, in Danish !
Now i'm going to play with my Orcale Data at work (Tested and it works
fine!!!)... and try to get Dialog boxes to work ... so maybe I'll be back
again for som help.
regards
Mette
"rony" <Rony.Fl...@wu-wien.ac.at> skrev i en meddelelse
news:d94fjv$lps$1...@trane.wu-wien.ac.at...
great that it works now!
> And heureka ... IT WORKS !!!!!
:)
> Thanks thanks a lot :-) Mange tak, in Danish !
You are very welcome!
> Now i'm going to play with my Orcale Data at work (Tested and it works
> fine!!!)... and try to get Dialog boxes to work ... so maybe I'll be back
> again for som help.
Hmm, if you look at the samples that come with BSF4Rexx you could even use Java's awt or swing
classes to create GUIs. In such a case your Rexx program will be able to run on any platform that
has Java running. (We are talking here really about openplatform with a lot of opensource!)
Have fun,
---rony