Названия в легенде графика сводного отчета

parent a4f2c92f
......@@ -95,8 +95,6 @@ $(document).ready(function(){
DateStat: function(dataLineChartStat) {
//console.log('AAA DateStat: ', dataLineChartStat);
//activeLines = ['shows', 'clicks', 'transactions', 'salemoney', 'admoney'];
//activeLine = 'shows';
if (dataLineChartStat.report == 'common') {
activeLines = ['Views', 'Clicks', 'Orders', 'OrderSum', 'AdMoney'];
activeLine = 'Views';
......@@ -122,8 +120,10 @@ $(document).ready(function(){
colors = {};
// Определяем названия в легенде:
var selectedCategoriesId = $.TableStat.CheckedCategories();
//console.log('AAA selectedCategoriesId = ', selectedCategoriesId);
var
selectedCategoriesId = $.TableStat.CheckedCategories(),
categoriesNames = $.TableStat.GetCategoriesNames();
// Скрываем график, если в таблице не выбраны категории:
if (selectedCategoriesId.length == 0) {
$(selectorGraphChartStat).hide();
......@@ -136,7 +136,7 @@ $(document).ready(function(){
var currentActiveLine = activeLines[i-1];
if (selectedCategoriesId.indexOf(currentActiveLine) > -1) {
dataColumnsTemp.push(['data'+i].concat(dataLineChartStat[currentActiveLine]));
names['data'+i] = currentActiveLine,
names['data'+i] = categoriesNames[currentActiveLine],
types['data'+i] = 'area-spline';
axes['data'+i] = 'y';
colors['data'+i] = colorsActiveLines[currentActiveLine];
......@@ -144,7 +144,6 @@ $(document).ready(function(){
}
//console.log('AAA dataColumnsTemp ', dataColumnsTemp);
//var chart = c3.generate({
chart = c3.generate({
bindto: selectorGraphChartStat,
data: {
......
......@@ -235,6 +235,15 @@ $(document).ready(function(){
});
return listCats;
},
// Определяем названия категорий в таблице:
GetCategoriesNames: function() {
var namesCats = {};
$('thead.metric.sortable th', $table).each(function(){
var $this = $(this);
namesCats[$this.data('id')] = $('b', $this).text();
});
return namesCats;
},
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment