{Where convertData can be any number of ";" delimited functions. The available functions are: Replace:{display_linechart convertData="func1(args); func2(args);" }}
convertData="replace(fields=field_ids, pattern=,with=);"TBD:
convertData="roundDate(round=hour|day|week|month|year);"TBD:
filterDate(one of month=0);TBD:
groupTime(field=field to group time on);Merge rows:
mergeRows(keyFields=f1_comma_f2, operator=count|sum|average, valueFields=);Add percent increase:
addPercentIncrease(replaceValues=false);Calculate # days to double:
doublingRate(fields=f1\\,f2, keyFields=f3);Add a fixed value:
addFixed(id=field_name, value=3700,type=double);TBD:
accum(fields=);TBD:
mean(fields=);Uniquify rows:
unique(groupFields=f1\\,f2,valueField=);Count uniques:
count(field=,sort=true);Unfurl:
unfurl(headerField=field to get header from,uniqueField=e.g. date,valueFields=);Rotate data:
rotateData(includeFields=true,includeDate=true,flipColumns=true);Prune where fields are all NaN:
prune(fields=);Scale and offset:
accum(scale=1,offset1=0,offset2=0,unit=,fields=); where we scale the value as: (value + offset1) * scale + offset2
{The derived function takes a field name and a function that is applied to each record in turn. A more complicated example is below. Here we are using a separately defined Javascript function to take a dataset that contains a "discharge" field which is cubic feet/second of water flow and calculate both a volume for each record time step as well as a running total. The display has a convertData attribute. This has a "fields" attribute which is a comma separated list of field names (note the escaped comma). If just one field you can also use a "field" attribute. This also has an optional "units" attribute. The function needs to be of the form: "return function_name(args)".{display_linechart fields="a_and_b" convertData="derived(field=a_and_b, function=return a+b)"}}
{To define the javascript you can include javascript inline with the "+javascript/-javascript" wiki tag. This gets called for every record. The args object contains:{display_linechart convertData="derived(fields=volume\,total_volume, units=acre feet\,acre feet, function=return calculateVolume(args));" entry=76c9e5a1-2875-4a08-9b45-d106e9b1f341 fields="volume,total_volume"}}
{ values:{}, recordIndex:rowIdx, record:record };Where:
+javascript function calculateVolume(args) { if(!args.lastDate) { //if first record then initialize date and total_volume args.lastDate = args.record.getDate(); args.total_volume = 0; return [0,0]; } //calculate the volume for this record let seconds = (args.record.getDate().getTime()-args.lastDate.getTime())/1000; args.lastDate = args.record.getDate(); let discharge = args.values['discharge']; if(isNaN(discharge)) return NaN; let volume = discharge*seconds/43560; args.total_volume+=volume; return [volume,args.total_volume]; } -javascript