-<&|/l_unsafe, $m->scomp('Elements/SelectChartType', Name => 'ChartStyle', Default => $ChartStyle), $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $ARGS{Query}, Default => $PrimaryGroupBy)
-&>[_1] chart by [_2]</&><input type="submit" class="button" value="<%loc('Update Chart')%>" />
-</form>
+<&| /Widgets/TitleBox, title => loc('Group by'), class => "chart-group-by" &>
+<fieldset><legend><% loc('Group tickets by') %></legend>
+<& Elements/SelectGroupBy,
+ Name => 'GroupBy',
+ Query => $query{Query},
+ Default => $query{'GroupBy'}[0],
+ &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& Elements/SelectGroupBy,
+ Name => 'GroupBy',
+ Query => $query{Query},
+ Default => $query{'GroupBy'}[1] // q{},
+ ShowEmpty => 1,
+ &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& Elements/SelectGroupBy,
+ Name => 'GroupBy',
+ Query => $query{Query},
+ Default => $query{'GroupBy'}[2] // q{},
+ ShowEmpty => 1,
+ &>
+</fieldset>
+</&>
+
+<&| /Widgets/TitleBox, title => loc("Calculate"), class => "chart-calculate" &>
+
+<fieldset><legend><% loc('Calculate values of') %></legend>
+<& Elements/SelectChartFunction, Default => $query{'ChartFunction'}[0] &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& Elements/SelectChartFunction, Default => $query{'ChartFunction'}[1] // q{}, ShowEmpty => 1 &>
+</fieldset>
+<fieldset><legend><% loc('and then') %></legend>
+<& Elements/SelectChartFunction, Default => $query{'ChartFunction'}[2] // q{}, ShowEmpty => 1 &>
+</fieldset>
+