[[Property:title|Metric Definition Panel]]
[[Property:weight|2]]
[[Property:uuid|5a778f15-cefe-182d-a296-545ee77d3028]]
In the metric definition panel, you can do the following: 
*  Manage user-defined metrics, such as defining new metrics and modify or remove existing ones. Metrics with a small lock in their icons are predefined metrics which cannot be changed or remvoed 
*  Import metrics from other systems 
*  Backup user-defined metrics 


The following figure shows the layout of the metric definition panel:

[[Image:interface6|Metric definition panel]]  


Let's have a look at the buttons in the main toolbar which is highlighted in the following figure:


[[Image:interface7|Main toolbar buttons]]  


[[Image:metrics-tool--new-metric-icon|New metric]]  New metric
Use this button to create a new metric. First you need to select a metric type (basic, linear or ratio) and then you may need to select a unit (only for basic and linear metrics). Once a metric is created, its unit cannot be changed.


[[Image:metrics-tool--new-document-icon|Clone metric]]  Clone selected metric to a new metric
If you want to define a new metric but the new metric is quite similar to an existing one, then you can use this button to simplify your work: just clone an existing one and do the modifications.


[[Image:metrics-tool--general-remove-icon|Remove metric]]  Remove metric
Remove current selected metric. This button will be insensitive when the current selected metric is a predefined metric.


[[Image:metrics-tool--general-save-icon|Save metric]]  Save metric
To make your newly defined or modified metric take effect, you need to save it first. This button will be insensitive when the current selected metric is a predefined metric.


[[Image:metrics-tool--command-send-to-external-editor-icon|External editor]]  Open user-defined metric file in external editor
Metrics are stored in XML format, and this button opens the XML file of user-defined metrics in a an external editor which can be specified in the preferences.


[[Image:metrics-tool--general-open-icon|Reload metrics]]  Reload metrics
This button reloads all metrics including predefined and user-defined metrics. It's useful when you modify the metric XML file in an external editor and want the changes to have an effect without restarting EiffelStudio.


[[Image:metrics-tool--metric-export-to-file-icon|import]]  Import metrics
This button opens a dialog to backup or import metrics.


==Define New Metrics==

To define a new metric, you need to choose the metric type and unit (for basic metric and linear metric). The following figure shows how to choose metric type and unit:

[[Image:interface8|Choose metric type]]  

The following figure shows a new basic class metric:

[[Image:interface9|basic metric]]  

When defining basic metrics, you can press <code>CTRL</code>+<code>Space</code> in a cell in the criterion column (the first column in "definition" area) to get a list of all applicable criteria. You can also type "and" or "or" in that cell to get criterion connectors. And you can put "not" in front of a criterion name to get its negation. After typing the criterion name and hitting enter, if the criterion needs further setup, the property cell of that criterion will be highlighted. For domain criterion such as ancestor_is, caller_is, you can pick an item and drop it into this property cell.

The following figure shows a new linear feature metric:

[[Image:interface10|linear metric]]  

For every metric referenced in a linear metric, you need to specify a coefficient. You can pick a metric and drop it into a cell of the "Metrics" column in the "Metric Definition" area.

The following figure shows a new ratio metric:

[[Image:interface11|ratio metric]]  

For the numerator or denominator metric, you need to specify a coefficient. When the denominator part evaluates to zero, the result of the ratio metric will be "Undefined". You can pick a metric and drop it into the numerator or denominator metric area.

==Import Metrics==

In order to reuse metrics defined in a different system, you need to import them into current system. The following figure shows how to import metrics:

[[Image:interface12|Import metrics]]  

==Backup User-defined Metrics==

The following figure shows how to back user-defined metrics:

[[Image:interface13|Backup metrics]]  




