Chart widgets use the Highcharts library. All attributes are JSON objects.
The attributes which can be set comprise:
Figure 198: Highcharts configuration options
General attributes:
localization
Allows to set localized (i.e. country-specific) values for the strings used as values in attributes. Please see section Localization of string values of attributes for a detailed explanation.
visible
Defines if the widget is displayed, true or false.
Highchart-specific attributes:
chart = "type:'column', pltShadow:false, backgroundColor:'#4dc245', height:
300";"items: [{html:'sometext', style: { left: '100px'; }}]"
labels = "items: [{html:'sometext', style: { left: '100px'; }}]"
The following example shows the widget TicketsInView and explains the logic of the associated Admin Tool script ticketsInViewDataWidget.groovy. For the entire script, please see the code block above (Configuration Script for Widgets). Here, the lines of code are set in relation to the GUI elements which they configure.
Figure 199: Chart widget example with script code
With charts of type funnel, funnel-like representations can be implemented as often used in sales funnels.
A funnel chart is implemented in the same way as other charts, only the sub-attribute type of the chart attribute has to be set to funnel. The following example shows a sales funnel chart implementation where fixed numbers are used in the script. Of course, in a real life implementation, these figures will have to be replaced by figures which are created dynamically from the current content of the database.
Figure 200: ConSol CM Web Client: Sales Funnel widget
The following script is used:
return [title: "{text: _('title')}",
chart: "{type: 'funnel', \
marginLeft: '50', \
marginRight: '150'}",
plotOptions: "{series:{ height: '90%', \
width: '85%', \
neckWidth: '20%', \
neckHeight: '20%', \
dataLabels: {enabled:'true', \
format: '<b>{point.name}</b> ({point.y:,.0f})', \
softConnector: 'true'}}}",
visible: "true",
series: "[{name: _('users'), \
data: [[_('visits') , 15654], \
[_('downloads'), 4064], \
[_('requests') , 1987]]}]",
localization: "de: {title: 'Vertriebstrichter', \
users: 'Individuelle Benutzer', \
visits: 'Seitenaufrufe', \
downloads: 'Downloads', \
requests: 'Anfrage Preisliste'}, \
en: {title: 'Salesfunnel', \
users: 'Unique users', \
visits: 'Page visits', \
downloads: 'Downloads', \
requests: 'Requests for price list'}"
]
Code example 10: Groovy script for the implementation of a sales funnel chart on the Web Client Dashboard (with fixed numbers as example)