# * color: true|false. Default is true.
# * period: integer between 1 and 5. By default the index is defined by the dashboard variation select-box
# * style: light|normal|none. Default is normal (parenthesis + bold)
+ # * variation: true|false. Default is true.
#
# === Examples
# format_variation('ncloc')
return m.format_numeric_value(val)
end
- formatted_val= m.format_numeric_value(val, :variation => true)
+ variation = !options[:variation].nil? ? options[:variation] : true
+ formatted_val= m.format_numeric_value(val, :variation => variation)
css_class=''
if options[:color]||true
css_class='var'
end
case metric().val_type
- when Metric::VALUE_TYPE_INT
- number_with_precision(value(), :precision => 0)
- when Metric::VALUE_TYPE_FLOAT
- number_with_precision(value(), :precision => 1)
- when Metric::VALUE_TYPE_PERCENT
- number_to_percentage(value(), {:precision => 1})
- when Metric::VALUE_TYPE_MILLISEC
- millisecs_formatted_value( value() )
- when Metric::VALUE_TYPE_BOOLEAN
- value() == 1 ? 'Yes' : 'No'
- when Metric::VALUE_TYPE_LEVEL
- text_value
- when Metric::VALUE_TYPE_STRING
- text_value
- when Metric::VALUE_TYPE_RATING
- text_value || value.to_i.to_s
- else
- value().to_s
+ when Metric::VALUE_TYPE_INT
+ number_with_precision(value(), :precision => 0)
+ when Metric::VALUE_TYPE_FLOAT
+ number_with_precision(value(), :precision => 1)
+ when Metric::VALUE_TYPE_PERCENT
+ number_to_percentage(value(), {:precision => 1})
+ when Metric::VALUE_TYPE_MILLISEC
+ millisecs_formatted_value( value() )
+ when Metric::VALUE_TYPE_BOOLEAN
+ value() == 1 ? 'Yes' : 'No'
+ when Metric::VALUE_TYPE_LEVEL
+ text_value
+ when Metric::VALUE_TYPE_STRING
+ text_value
+ when Metric::VALUE_TYPE_RATING
+ text_value || value.to_i.to_s
+ else
+ value().to_s
end
end
end
case metric().val_type
- when Metric::VALUE_TYPE_INT
- number_with_precision(val, :precision => 0)
- when Metric::VALUE_TYPE_FLOAT
- number_with_precision(val, :precision => 1)
- when Metric::VALUE_TYPE_PERCENT
+ when Metric::VALUE_TYPE_INT
+ number_with_precision(val, :precision => 0)
+ when Metric::VALUE_TYPE_FLOAT
+ number_with_precision(val, :precision => 1)
+ when Metric::VALUE_TYPE_PERCENT
if (options[:variation]==true)
number_with_precision(val, :precision => 1)
else
number_to_percentage(val, {:precision => 1})
end
- when Metric::VALUE_TYPE_MILLISEC
- millisecs_formatted_value(val)
- else
- val.to_s
+ when Metric::VALUE_TYPE_MILLISEC
+ millisecs_formatted_value(val)
+ else
+ val.to_s
end
end