This extension allows to define a custom form extension for drawing diagrams (with HighCharts engine) on the Work Item form.
General Information
- This extension supports loading of:
- a HighCharts macro from an external file (how to draw)
- the URL can be defined as a parameter or a hyperlink
- a HighCharts macro from a Work Item custom field
- data in CSV or LOG format from an external file (what to draw)
- the URL can be defined as a parameter or a hyperlink
- data in CSV format from a Work Item attachment or a custom field
- a file in LOG format and parsing its contents to convert the data to the CSV format with a Regex pattern
- a HighCharts macro from an external file (how to draw)
- Macro and data files may contain a Work Item ID in the path for loading the WI-specific data from an external source
- Macro and data files can be taken:
- from a local source (Polarion instance file system)
- externally (http/https)
How to install
- Copy the content of the form extension binaries (/bin) to the Polarion extensions folder
- e.g. C:\Polarion\polarion\extensions
- Restart the Polarion server
How to use
To activate the Form Extension go to the Form Configuration (any WI type) and add the following line:
<extension id="hc" label="MY_LABEL" hc_macro_url="URL" data_path_url="URL" pattern="PATTERN"
series="SERIE1,SERIE1,..." csv_data_id="CSV_ID" data_att_file_name="ATTACHMENT_FILE_NAME"
data_field_id="FIELD_ID"/>
Parameters:
- hc_macro_url - URL with a path to the file with the HighCharts macro
- Can be a local file or a remote resource - http(s)
- Note that if you like to use the CSV data then the macro should contain this line:
"data: {csv: document.getElementById('csv').innerHTML}" *
- hc_macro_field_id - Field ID with the HighCharts macro
- Field type: Multi-line plain text
- hc_macro_hyperlink_role - Hyperlink Role ID with an URL pointing to the file with the HighCharts macro
- data_att_file_name - Filename of the WI attachment with the CSV data to be used for the diagram
- data_field_id - Field ID with the CSV data to be used for the diagram
- Field type: Multi-line plain text
- data_path_url - URL with the path to the file with the CSV data file or file with the logs for parsing
- data_hyperlink_role - Hyperlink Role ID with the URL pointing to the file with the CSV data file or file with the logs for parsing
- pattern - Regex pattern for parsing the data file and creation of the CSV
- If the pattern is defined then the CSV data are created by parsing the data file with the given pattern
- series - Comma-separated list of series names for the UI
- csv_data_id - ID of the CSV array if different than the default one used in the HighCharts macro:
document.getElementById('csv')
- Change it in case you want to show several diagrams for one WI
- Note: The hc_macro_url and data_path_url parameters can contain %WI_ID% as a placeholder for the current WI's ID
- Note: The data can be loaded only from exactly one of the sources at once - attachment/field/external file
Samples:
- Loading the macro from an external file and the data from the WI attachment
<extension id="hc" label="HC Diagram" hc_macro_url="https://server/hc/bar.hc"
data_att_file_name="data.csv"/> - Loading the macro from a local file and the data from a WI custom field:
<extension id="hc" label="HC Diagram" hc_macro_url="file:///opt/polarion/shared/hc/bar.hc"
data_field_id="ddata"/> - Loading the macro from a custom field and the data from an external file defined in the WI Hyperlink:
<extension id="hc" label="HC Diagram" hc_macro_field_id="hc_macro"
data_hyperlink_role="csv_data_ref"/> - Loading the macro from a local file and the data from an external file in a LOG format with parsing for converting to the CSV format. The Data file name contains a WI ID:
<extension id="hi" label="HC Diagram" hc_macro_url="file:///C:/Polarion/shared/share/hc/area.hc"
data_path_url="https://server/hc/%WI_ID%.txt"
pattern="# Date : (.+) >> Summary : Tests (.+) Pass (.+) Fail (.+) Total coverage: (.+)"
series="Data,Failed,Passed"/> - Loading the macro from an external file that already contains the data (= no need for a separate data file):
<extension id="hc" label="HC Diagram 2"
hc_macro_url="https://polarionstg.advaoptical.com/icons/hc/line_with_data.hc"/> - Showing two diagrams for one WI:
<extension id="hc" label="HC Diagram" hc_macro_url="https://server/hc/bar.hc"
data_att_file_name="data.csv"/>
<extension id="hi" label="HC Diagram" hc_macro_url="https://server/hc/line2.hc"
data_att_file_name="data2.csv" csv_data_id="csv2"/>- Note: File line2.hc should contain:
document.getElementById('csv2')
- Note: File line2.hc should contain:
The Samples of the HighCharts macros and data files in CSV and LOG formats are available in the extension's distribution package in folder \samples.