Mashup Builder and particularly
its premium version comes with many widgets grouped by type. This section focuses on three widgets, the Result Table, Pie Chart and Stacked Column Chart widgets.
You will find examples using other widgets throughout this guide.
Note:
Most chart
widgets come from the highcharts and highstock libraries, we recommend
reading their documentation on http://www.highcharts.com/
for advanced configuration (in the Javascript
tab of the chart widget properties).
This example shows how to display results in a Result
Table widget, and set it to refine document search.
In Mashup Builder, go to the search
page and select the Design view.
In the Widgets panel, expand the Results
Rendering group, and drag the Result Table
widget just above the Result List widget.
Click the Result table widget header.
The widget properties panel opens at the bottom of the screen.
On the Hit Config tab:
For Hit title, select Hit Metas > title from the Values contextual menu
on the left.
You will get ${entry.metas['title']}
For Hit URL, select Hit Metas > url from the Values contextual
menu on the left.
You will get ${entry.metas['url']!uh}
On the Hits metas tab, deselect Display
metas.
On the Hit facets tab, set the list of facets
to include as columns in the table. For example, we want to get three
columns displaying the File extension, the language, and the last modification
of each document.
For Facet list mode, select include.
In the Facet List field that displays,
select the facets to include in the Result Table, using the Values
contextual menu on the left. These must be separated by commas.
For example: Top/language, Top/classproperties/file_extension,Top/classproperties/lastmodifieddate
Select the Preview to check your configuration
changes.
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup UI application
should now have a search result page with a Result Table above the standard
result list. You can use this table to refine your document search.
Add a Pie Chart widget
In this example, we will add a Pie Chart
widget to refine on result segments.
This example is based on the set of documents located under the <INSTALLDIR>/docs/
directory.
Before you begin: This widget is available in Mashup Builder Premium
only.
In Mashup Builder, go to the index
page and select the Design view.
In the Widgets panel, expand the Visualizations
> Charts group, and drag the Pie Chart
widget to the last row of the canvas.
Click the Pie Chart widget header.
The widget properties panel opens at the bottom of the screen.
From the General tab, set up the pie chart to
launch a search with the corresponding refinement when you click a slice
of the pie.
Enter a Widget title, for example Document
Types.
In Facet, select the facet to refine on
from the Values contextual menu on the left, for
example Top/classproperties/file_extension to
refine on document file extensions.
From the Advanced tab, set the search page as
the page that will display the result corresponding to the slice selected
on the pie chart.
In Destination page on click select search.
In Max number of categories, increase
the default number if there are more than 5 categories (for example,
7). This is to avoid having an Other
category gathering all the categories that will not be displayed with
the default value.
If you want to customize the colors used by the pie chart, go to the
JavaScript tab and specify the HTML hexadecimal
codes of your favorite colors.
Uncomment the colors line by removing /*
and */
Specify your favorite colors. For example, for the 7 categories
we can define the following HTML colors: colors: ['#058DC7',
'#50B432', '#ED561B', '#FF9900', '#CC33CC', '#660099', '#FF00FF']
Select the Preview to check your configuration
changes.
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup UI application
should now have a Home (index) page that resembles the following screenshot.
You can refine your search by selecting a pie chart section, and view its related results only.
Add a Stacked Column Chart
This section gives several examples of Stacked Column Chart
widget configuration:
display multiple dimension in stacked bars
display both bars and lines
remove legends
add labels to the chart axes
Before you begin: This widget is available in
Mashup Builder Premium only.
Display multiple dimensions in stacked bars
This example is based on the sales sample database located under the <INSTALLDIR>/docs/sample_database directory.
Before you begin: We assume you have followed the “Connect to the database” and “Create a new class in the data model” sections of the
CloudView Getting Started Guide.
In the Administration Console, go to
Search Logics > Facets.
Click Add facet and:
For Name, enter multidim
For Type, select Multi-dimension.
Click Accept.
Add two dimensions to the multidim facet.
Facet
Sort by
store_city
Count
category
Count
Click Apply.
In Mashup Builder, drag the Stacked
Column Chart widget on a page.
Click the widget header.
The widget properties panel opens at the bottom of the screen.
On the General tab:
For Widget title, enter Multidim.
For Facet type, select multi_dimension.
For X, select multidim
from the Values contextual menu on the left.
Go to the JavaScript tab and uncomment the /*stacking:
'normal'*/ line, to get stacking: 'normal'
Note:
Press F11 to switch the code editor to fullscreen mode
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup Builder
application should now have a Chart that resembles the following screenshot.
Display both bars and lines
This example is based on the set of documents located under the <INSTALLDIR>/docs/
directory
In the Administration Console, go to
Search Logics > Facets.
Expand the file_extension facet and define the
following aggregations:
Id
Type
Expression
file_size_avg
AVG
document_file_size
file_size_min
Min
document_file_size
file_size_max
Max
document_file_size
Click Apply.
In Mashup Builder, select a page and then select
the Design view.
In the Widgets panel, select Visualizations
> Charts, and drag the Stacked Column Chart
widget on your page.
Click the widget header.
The widget properties panel opens at the bottom of the screen.
On the General tab:
For Widget title, enter Bars & Lines.
For X, select file_extension from the Values contextual
menu on the left .
For Y , create the following series:
Aggregation
Series type
Legend
file_size_avg
column
Avg file size
file_size_min
line
Min file size
file_size_max
line
Max file size
Select the Preview to check your configuration changes.
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup Builder
application should now have a Chart that resembles the following screenshot.
Remove the chart legend
This example is based on the set of documents located under
the <INSTALLDIR>/docs/ directory.
In Mashup Builder, drag the Stacked
Column Chart widget on a page.
Click the widget header.
The widget properties panel opens at the bottom of the screen.
On the General tab:
For Widget title, enter No Legend.
For Facet type, select normal.
For X, select file_extension
from the Values contextual menu on the left.
Go to the JavaScript tab and in the legend
node, set the enabled attribute to false.
Select the Preview to check your configuration
changes.
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup Builder
application should now have a Chart without legend, as shown in the following screenshot.
Add labels to the chart
axes
This example is based on the set of documents located under
the <INSTALLDIR>/docs/ directory.
In Mashup Builder, drag the Stacked
Column Chart widget on a page.
Click the widget header.
The widget properties panel opens at the bottom of the screen.
On the General tab:
For Widget title, enter Labels on
axes.
For Facet type, select normal.
For X, select file_extension
from the Values contextual menu on the left.
Go to the JavaScript tab and enter the labels
of your choice for the text attributes of the xAxis
and yAxis nodes.
Select the Preview to check your configuration
changes.
Click Apply.
To see your changes, go to
http://<HOSTNAME>:<BASEPORT+1>/mashup-builder.
Your Mashup Builder application
should now have a Chart with labels on axes, as shown in the following screenshot example.