Drawing a data chart

Problem

You want to draw a chart from CallWeb data and insert it in a questionnaire.

Solution

Use the calc_graph function in a CALCUL question.

Discussion

CallWeb uses the Highcharts JavaScript system to produce data charts. The calc_graph function provides an easy way to build these charts.

calc_graph can be callwed in a CALCUL question or in an <execute></execute> substitution. The call works this way:

    calc_graph ( option => value, option => value ); [note the use of the "=>" operator to separate option names from their values, and of commas to separate the option-value pairs.]

Here is the list of available options; only one is mandatory.

StatusOption name ValueDefault value
Mandatoryfield=>name of the question to chartNone
Optionaltype=>type of chart"bar" (no other type available at this time)
Optionalbreakdown=>name of the question acting as data breakdownNone
Optionalsubset_in_sql=>MySQL-syntax case selection expressionNone
Optional_proj=>CallWeb project name from which the data are drawnCurrent project
Optionalprint=>0 | no | non | 1 | oui | yesYes. The JavaScript code for displaying the chart can be saved in a variable: $mychart = calc_graph ( print => no, option => value, option => value );
Optionalmaxscale=>maximum numeric value depicted on the y-axisDetermined by Highcharts
Optionalmaxtitlelength=>maximum number of characters in the title256
Optionalmaxsubtitlelength=>maximum number of characters in the subtitle256
Optionalminwidth=>minimum width of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalmaxwidth=>maximum width of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalminheight=>minimum height of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalmaxheight=>maximum height of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts

Drawing a data chart

Problem

You want to draw a chart from CallWeb data and insert it in a questionnaire.

Solution

Use the calc_graph function in a CALCUL question.

Discussion

CallWeb uses the Highcharts JavaScript system to produce data charts. The calc_graph function provides an easy way to build these charts.

calc_graph can be callwed in a CALCUL question or in an <execute></execute> substitution. The call works this way:

    calc_graph ( option => value, option => value ); [note the use of the "=>" operator to separate option names from their values, and of commas to separate the option-value pairs.]

Here is the list of available options; only one is mandatory.

StatusOption name ValueDefault value
Mandatoryfield=>name of the question to chartNone
Optionaltype=>type of chart"bar" (no other type available at this time)
Optionalbreakdown=>name of the question acting as data breakdownNone
Optionalsubset_in_sql=>MySQL-syntax case selection expressionNone
Optional_proj=>CallWeb project name from which the data are drawnCurrent project
Optionalprint=>0 | no | non | 1 | oui | yesYes. The JavaScript code for displaying the chart can be saved in a variable: $mychart = calc_graph ( print => no, option => value, option => value );
Optionalmaxscale=>maximum numeric value depicted on the y-axisDetermined by Highcharts
Optionalmaxtitlelength=>maximum number of characters in the title256
Optionalmaxsubtitlelength=>maximum number of characters in the subtitle256
Optionalminwidth=>minimum width of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalmaxwidth=>maximum width of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalminheight=>minimum height of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts
Optionalmaxheight=>maximum height of the chart in pixels (px) or percentage of the page (%)Determined by Highcharts