TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Custom Chart

Last modified: 20 April 2023

In addition to statistic charts generated automatically by TeamCity on the Statistics tab, it is possible to configure your own statistical charts based on the set of statistic values provided by TeamCity or values reported from a build script. In the latter case you will need to configure your build script to report custom statistical data to TeamCity.

Note that since TeamCity 8.1, you can view statistics charts on the Build parameters page.

Displaying Custom Chart in TeamCity Web UI



To make TeamCity display a custom chart in the web UI, you need to update the dedicated configuration file:

  • For Project-level chart: < >/config/projects/< ProjectID >/pluginData/plugin-settings.xml

  • For Build Configuration-level chart: < >/config/main-config.xml

You can edit these files while the server is running, they will be automatically reloaded.

A statistics chart is added using the graph tag. See the examples below:

Custom project-level charts in plugin-settings.xml

Custom build configuration-level charts in main-config.xml

Note that when adding custom charts on the project level, the intermediate custom-graphs tag is required.

Tags Reference



<graph>: describes a single chart. It should contain one or more valueType subtags, which describe series of data shown in the chart.

<valueType>: describes a series of data shown on the chart. Each series is drawn with a separate color and you may choose one or another series using a filter.

Chart Dimensions



You can set the custom chart width/height in pixels using the width and height properties within the XML properties tag:

Chart Axis Settings



You can also customize the default axis settings for a chart via properties added withing the XML properties tag:

Supported properties:

Default Statistics Values Provided by TeamCity



The table below lists the predefined value providers that can be used to configure a custom chart. The values reported for each build differ depending on your build configuration settings.

Since TeamCity 8.1, you can view the all statistic values reported by the build on the Build Results|Parameters|Reported statistic values tab. For each of the values, a statistics chart is available on clicking the View Trend icon View trend.

Custom Build Metrics



If the predefined build metrics do not cover your needs, you can report custom metrics to TeamCity from your build script and use them to create a custom chart. There are two ways to report custom metrics to TeamCity:

Note that custom value keys should be unique and should not interfere with value keys predefined by TeamCity.