Добавил точность 2 знака для денежных полей в легенде графика

parent 155d0f44
......@@ -14,7 +14,8 @@ $(document).ready(function(){
chart,
categoriesNames,
selectedCategoriesId,
colorsActiveLines = $(selectorGraphChartStat).data('colors');
colorsActiveLines = $(selectorGraphChartStat).data('colors'),
currencyFields = ['admoney', 'salemoney', 'usdollarmoney', 'localmoney', 'AdMoney', 'OrderSum', 'Price'];
// Добавление впереди 0 у однозначных значений
function pad(number) {
......@@ -34,7 +35,8 @@ $(document).ready(function(){
function valueFormat(value, ratio, id)
{
var
currencyFields = ['admoney', 'salemoney', 'usdollarmoney', 'localmoney'],
indCat = parseInt(id.replace('data', '')),
activeLine = activeLines[indCat - 1],
isCurrencyValue = currencyFields.indexOf(activeLine) > -1,
format = (isCurrencyValue) ? d3.format(',.2f') : d3.format(',.0f');
......@@ -43,8 +45,12 @@ $(document).ready(function(){
return value.toFixed(accuracy);
}
if (isCurrencyValue) {
return format(value) + ' грн.';
} else {
return format(value);
}
}
function valueFormatTick(value)
{
......
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