admin at FlexibleLearning.com
Sat May 5 04:11:10 EDT 2012
ChartMaker uses the 'keyValue pairs' syntax (in the form "Key=Value"), of
which any, some or all can be passed as parameters like this...
get CMBarChart("ChartSize=500,300","Values=[list of
values]","Categories=[list of categories]")
The app first applies all the defaults in an internal array. It then parses
any specified keyValue parameters to update the array that is then used to
create the chart. The keyValues are finally stored in the chart for later
use. Once the app's initial parsing scheme is written is it relatively
straightforward to modify it with new keyValue pairs.
The advantage of this method is that the order of the parameters is
irrelevant and their contents can be optionally passed as variables for
The main downside of passing parameters is the engine's limits on total
parameter string length. If too much data is passed, the engine simply
truncates the data to the maximum length it can handle.
If the amount of data does exceed the engine's parameter-passing limit, then
the data elements have to be iteratively set directly (e.g. set the uValues
of group "Chart1" to [a very large dataset]). I personally find this a more
cumbersome syntax than the keyValue syntax but it does mean there are
limits. For ChartMaker, the limits are about 15,000 data points (depending
on overall string length, of course).
ChartMaker is available from www.FlexibleLearning.com/chartmaker
Peter Haworth wrote:
I seem to recall somewhere in the dim distant past that some languages have
a syntax where function and procedure calls can have named parameters
rather than positional ones.
function doIT p1,p2,p3,p4,p5,p6,p7,p8,p9,p10
put doIT("abc",p3="xyz", p10="def") into tVar
When functions have a large number of possible parameters but not all of
them are required, this is a great way to avoid having to count commas in
the calls to them.
I don;t think LC has any such syntax built in but wondering if anyone has
tried to implement something similar?
lcSQL Software <http://www.lcsql.com>
More information about the Use-livecode