ChartWidget

ChartWidget

Widget that shows a bar chart with grouped data fetched using WPS Aggregate

Constructor

new ChartWidget(config)

Source:
Parameters:
Name Type Description
config Object

Configuration object

Properties
Name Type Attributes Description
title String

Widget title

server String

URL of map server

namespace Object

Namespace object

Properties
Name Type Description
name String

Namespace to use

url String

Namespace URL

layerName String

Name of the layer to query

property String

Field to use in aggregate function

categories Object

Categories configuration

Properties
Name Type Description
property String

Property that defines the style to use

style.values Object

Object with possible values and their correspoding style

chart Object

Object with chart configuration

Properties
Name Type Attributes Default Description
type String

Chart type. Options: 'bar', 'pie' or 'doughnut'.

unit Object <optional>
'value'

Value to show. Options: 'value' or 'percentage'.

options Object <optional>

Object with chart options based on ChartJS. By default, the widget uses a bar chart without legend, Y axis nor gridlines.

format function <optional>

Function to parse and transform data fetched from server. This function should return a human friendly value as it will be shown as the widget current value.

Extends

Methods

(protected) format() → {Object}

Source:
Inherited From:

Processes the widget value and returns a human friendly version.

Returns:
  • Current widget value prepared to be shown
Type
Object

(protected) parseResponse(value)

Source:
Inherited From:

Parses data fetched from server and sets widget value to an easily readable format

Parameters:
Name Type Description
value Object

JSON data fetched from server

refresh()

Source:
Overrides:

Reloads the widget value using the formatted value.

render()

Source:

Renders the widget layout.