1. Create a report that summarizes data, such as opportunities, and include a chart
2. Display report's chart in a Dashlet
3. Enable the "Show Title" checkbox
4. Click button to save chart settings and display dashlet
Result:
The title on the chart will show the text in the field next to the "show title" field, but the associated total value will not refresh or update accordingly to reflect the data in the report.
1. Create a report that summarizes data, such as opportunities, and include a chart
2. Display report's chart in a Dashlet
3. Enable the "Show Title" checkbox
4. Click button to save chart settings and display dashlet
Result:
The title on the chart will show the text in the field next to the "show title" field, but the associated total value will not refresh or update accordingly to reflect the data in the report.
clients/base/views/saved-reports-chart]$ vi saved-reports-chart.js
and fixed it (non-upgrade safe of course)
in setChartParams the title is not updated when the page is loaded the update flag is not set so it uses the _.defaults to set the additional parameters but the title is already set, so it's not updated.
See bold below:
setChartParams: function(serverData, update) {
// only called by bindDataChange when the report id is changed in config panel
if (!serverData.reportData || !serverData.chartData) {
if (!this.meta.config && this.chartField) {
this.chartField.displayNoData(true);
}
return;
}
update = _.isUndefined(update) ? false : update;
var data = serverData.reportData,
properties = serverData.chartData.properties[0],
params = this.getDefaultSettings(),
barType = this._getBarType(properties.type),
defaults = {
label: data.name,
chart_type: properties.type,
report_title: properties.title,
show_legend: properties.legend === 'on' ? true : false,
stacked: barType === 'stacked' || barType === 'basic' ? true : false,
x_axis_label: this._getXaxisLabel(data),
y_axis_label: this._getYaxisLabel(data)
};
// defaults has the correct title with the right total
// override settings when new report is selected
if (update) {
_.extend(params, defaults);
} else {
_.defaults(params, defaults);
// the next line is added by me :) and updates the total on the chart
params.report_title = defaults.report_title;
}
// the params don't have the updated title unless I set it
// persist the chart settings for use by SugarCharts
this.reportData.set({
rawChartParams: params
});
// update the settings model for use by chart field
this.settings.set(params);
// toggle display of chart display option controls based on chart type
this._toggleChartFields();
// set the title of the dashlet to the report title
this.$('[name="label"]').val(this.settings.get('label'));
},
HTH
FrancescaS