All tql scripts must end with one of the sink functions.
The basic SINK function might be INSERT() which write the incoming records onto machbase-neo database. CHART() function can render various charts with incoming records. JSON() and CSV() encode incoming data into proper formats.
Makes the records of the result in CSV format. The values of the records become the fields of the CSV lines.
For example, if a record was {key: k, value:[v1,v2]}, it generates an CSV records as v1,v2.
tztz(name) time zone, default is tz('UTC')
timeformattimeformat(string) specify the format how represents datetime fields, default is timeformat('ns')
rownumrownum(boolean) adds rownum column
precisionprecision(int) specify precision of float fields, precision(-1) means no restriction, precision(0) converts to integer
headingheading(boolean) add fields names as the first row
delimiterdelimiter(string) specify fields separator other than the default comma(,).
nullValue() specify substitution string for the NULL value, default is nullValue('NULL').
Since v8.0.14
substituteNullsubstitute(string) specify substitution string for the NULL value, default is substituteNull('NULL'). (deprecated, replaced by nullValue())
Generates JSON results from the values of the records.
transposetranspose(boolean) transpose rows and columns, it is useful that specifying transpose(true) for the most of chart libraries.
tztz(name) time zone, default is tz('UTC').
timeformattimeformat(string) specify the format how represents datetime fields, default is timeformat('ns').
rownum *rownum(boolean)` adds rownum column.
precisionprecision(int) specify precision of float fields, precision(-1) means no restriction, precision(0) converts to integer.
rowsFlattenrowsFlatten(boolean) reduces the array dimension of the rows field in the JSON object. If JSON() has transpose(true) and rowsFlatten(true) together, it ignores rowsFlatten(true) and only transpose(true) affects on the result.
Since v8.0.12
rowsArrayrowsArray(boolean) produces JSON that contains only array of object for each record. The rowsArray(true) has higher priority than transpose(true) and rowsFlatten(true).
Since v8.0.12
FAKE(oscillator(freq(1.5,1.0),freq(1.0,0.7),range('now','3s','25ms')))// | 0 1
// +--> time value
// |
CHART(size("600px","400px"),chartOption({xAxis:{name:"T",type:"time"},yAxis:{name:"V"},legend:{show:true},tooltip:{show:true,trigger:"axis"},series:[{type:"scatter",name:"column[1]",data:column(0).map(function(t,idx){return[t,column(1)[idx]];})}]}))
CHART_LINE3D()
DEPRECATED: use CHART() instead.
Syntax: CHART_LINE3D()
Generates a 3D line chart in HTML format.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART_LINE3D(size('600px','600px'),lineWidth(2),gridSize(100,30,100),visualMap(-0.12,0.12))
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART(plugins("gl"),size('600px','600px'),chartOption({grid3D:{boxWidth:100,boxHeight:30,boxDepth:100},xAxis3D:{name:"x"},yAxis3D:{name:"y"},zAxis3D:{name:"z"},series:[{type:"line3D",lineStyle:{"width":2},data:column(0).map(function(x,idx){return[x,column(1)[idx],column(2)[idx]]})}],visualMap:{min:-0.12,max:0.12,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}}}))
CHART_BAR3D()
DEPRECATED: use CHART() instead.
Syntax: CHART_BAR3D()
Generates a 3D bar chart in HTML format.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART_BAR3D(size('600px','600px'),lineWidth(2),gridSize(100,30,100),visualMap(-0.12,0.12))
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART(plugins("gl"),size('600px','600px'),chartOption({grid3D:{boxWidth:100,boxHeight:30,boxDepth:100},xAxis3D:{name:"x"},yAxis3D:{name:"y"},zAxis3D:{name:"z"},series:[{type:"bar3D",data:column(0).map(function(x,idx){return[x,column(1)[idx],column(2)[idx]]})}],visualMap:{min:-0.12,max:0.12,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}}}))
CHART_SCATTER3D()
DEPRECATED: use CHART() instead.
Syntax: CHART_SCATTER3D()
Generates a 3D scatter chart in HTML format.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART_SCATTER3D(size('600px','600px'),lineWidth(2),gridSize(100,30,100),visualMap(-0.12,0.12))
FAKE(meshgrid(linspace(-1.0,1.0,100),linspace(-1.0,1.0,100)))// | 0 1
// +--> x y
// |
MAPVALUE(2,sin(10*(pow(value(0),2)+pow(value(1),2)))/10)// | 0 1 2
// +--> x y z
// |
CHART(plugins("gl"),size('600px','600px'),chartOption({grid3D:{boxWidth:100,boxHeight:30,boxDepth:100},xAxis3D:{name:"x"},yAxis3D:{name:"y"},zAxis3D:{name:"z"},series:[{type:"scatter3D",data:column(0).map(function(x,idx){return[x,column(1)[idx],column(2)[idx]]})}],visualMap:{min:-0.12,max:0.12,inRange:{color:["#313695","#4575b4","#74add1","#abd9e9","#e0f3f8","#ffffbf","#fee090","#fdae61","#f46d43","#d73027","#a50026"]}}}))
title()
DEPRECATED: use chartOption() with CHART() instead.
Syntax: title(label)
labelstring
subtitle()
DEPRECATED: use chartOption() with CHART() instead.
Syntax: subtitle(label)
labelstring
xAxis(), yAxis(), zAxis()
DEPRECATED: use chartOption() with CHART() instead.
Syntax: xAxis(idx, label [, type])
idxnumber index of column for the axis
labelstring label of the axis
typestring type fo the axis, available: 'time' and 'value', default is 'value' if not specified.
zAxis() is effective only with 3D chart
dataZoom()
DEPRECATED: use chartOption() with CHART() instead.