API reference

Jan Jezek edited this page Dec 14, 2017 · 29 revisions

This is a API reference for version v1.2.0.

WGL.init(numrec, url, divid)

Initialises the WebGLayer. The numrec specify the number of records, url specify the shader folder, divid specify the id of the div element for map rendering.

WGL.addHeatMapDimension(pts, name)

Adds a Heatmap to the dedicated div specified in WGL constructor. pts is an array of consecutive x and y coordinates specified in pixel coordinate system of zoom 0. See the tutorial how to prepare data for this. _name'_specify name to be able to refer to that later. Returns WGL.dimension.HeatMapDimension object.

WGL.addMapDimension(pts, themap);

Adds point symbol map. pts is an array of consecutive x and y coordinates specified in pixel coordinate system of zoom 0. See the tutorial how to prepare data for this. _name'_specify name to be able to refer to that later. Returns WGL.dimension.MapDimension object.

WGL.addPolyBrushFilter(dim,polybrush);

Register the polybrush filter so that the data can be filtered by polygons. The dim is the name of the visualization that hold the data that should be filtered. In most cases it identical with the name parameter specified in WGL.addMapDimension or WGL.addHeatMapDimension();

WGL.addExtentFilter();

Function enables to filter all the data that are out of the visible space;

WGL.addOrdinalHistDimension(datao);

Adds Ordinal dimension. datao looks like: {data: sev, domain: ['1','2','3'] , name: 'sev', type:'ordinal', label: 'accident servelity' }, where data is array of values, domain specify the ordinal values in the dataset.

WGL.addLinearFilter(datao, steps ,name)

Adds filter to the data object. The datao is the same as in WGL.addOrdinalHistDimension(datao). steps specifies the number of steps of the filter (for ordinal data most probably same as the number of elements in the domain). name specify the name of the filter for later use.

WGL.addLinearHistDimension(datao);

Adds linear dimemension. datao looks like: {data: hours, min:0, max:24, num_bins: 24, name: 'hours',type:'linear'}, where data is array of values, min and max specify the value range and num_bin the number of bins for aggregation.

StackedBarChart(datao, divid, xlabel, filterId);

Constructs the stacked bar chart (based on d3) with filters for the Ordinal or Linear dimension. datao is same as for WGL.addLinearHistDimension or WGL.addOrdinalHistDimension, _divid_is the id of div element, where the chart should be rendered, xlabel is label for x axis.

WGL.addCharts(charts);

adds the list of StackedBarChart object that will be updated on filter changes.

WGL.initFilters();

Initialize and apply all the filters for the first time.

WGL.filterDim(dimname, filter, filterId, dorendering);

Filters the dimension of the name dimname. filter is array of filters that should be applied. E.g. {0:[0,1], 1:[2,3]}, the filterId is the id of the filter and the dorendering is Boolean that indicates whether to re-render or not (default is true). In the case of spatial dimension the filter is a and array of triangles vertices that composes the spatial filter.

WGL.mcontroller.zoommove(zoom, topleft);

Renders the map for give zoom and topleft parametr. See tutorial tutorial for details.

WGL.getManager().updateMapSize();

Updates the size of the map. Usually triggered when the browser window is changed

WGL.mcontroller.resize();

Resize the map drawing area according the size of the map div.