Adds height and width support to the Plot Publisher

Height and width are supported by the Plot Plugin today but
not made available in the Publisher.  This adds support for
both with the same defaults that exist in the plugin.

This allows users to configure a height and width as desired.

Change-Id: I1846e73d2fc3f6a9f651646b74cd3af6f85aee6d
This commit is contained in:
Drew Rothstein 2016-11-13 09:32:21 -08:00
parent e47f9629bc
commit dff22236d4
8 changed files with 68 additions and 0 deletions

View File

@ -3973,6 +3973,8 @@ def plot(registry, xml_parent, data):
:arg str title: title for the graph (default '')
:arg str yaxis: title of Y axis (default '')
:arg int width: the width of the plot in pixels (default 750)
:arg int height: the height of the plot in pixels (default 450)
:arg str group: name of the group to which the plot belongs (required)
:arg int num-builds: number of builds to plot across
(default plot all builds)
@ -4050,6 +4052,8 @@ def plot(registry, xml_parent, data):
plugin = XML.SubElement(plots, 'hudson.plugins.plot.Plot')
XML.SubElement(plugin, 'title').text = plot.get('title', '')
XML.SubElement(plugin, 'yaxis').text = plot['yaxis']
XML.SubElement(plugin, 'width').text = str(plot.get('width', '750'))
XML.SubElement(plugin, 'height').text = str(plot.get('height', '450'))
XML.SubElement(plugin, 'csvFileName').text = \
plot.get('csv-file-name', '%s.csv' % random.randrange(2 << 32))
topseries = XML.SubElement(plugin, 'series')

View File

@ -6,6 +6,8 @@
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<width>750</width>
<height>450</height>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.CSVSeries>

View File

@ -6,6 +6,8 @@
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<width>750</width>
<height>450</height>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.PropertiesSeries>

View File

@ -6,6 +6,8 @@
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<width>750</width>
<height>450</height>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.XMLSeries>

View File

@ -6,6 +6,8 @@
<hudson.plugins.plot.Plot>
<title>MyPlot</title>
<yaxis>Y</yaxis>
<width>750</width>
<height>450</height>
<csvFileName>myplot.csv</csvFileName>
<series>
<hudson.plugins.plot.PropertiesSeries>
@ -33,6 +35,8 @@
<hudson.plugins.plot.Plot>
<title>MyPlot2</title>
<yaxis>Y</yaxis>
<width>750</width>
<height>450</height>
<csvFileName>myplot2.csv</csvFileName>
<series>
<hudson.plugins.plot.XMLSeries>

View File

@ -6,6 +6,8 @@
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<width>750</width>
<height>450</height>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.CSVSeries>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.plot.PlotPublisher>
<plots>
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<width>900</width>
<height>1000</height>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.CSVSeries>
<file>data.csv</file>
<inclusionFlag>OFF</inclusionFlag>
<exclusionValues/>
<url/>
<displayTableFlag>false</displayTableFlag>
<fileType>csv</fileType>
</hudson.plugins.plot.CSVSeries>
</series>
<group>bench</group>
<useDescr>false</useDescr>
<exclZero>false</exclZero>
<logarithmic>false</logarithmic>
<keepRecords>true</keepRecords>
<numBuilds/>
<style>line</style>
</hudson.plugins.plot.Plot>
</plots>
</hudson.plugins.plot.PlotPublisher>
</publishers>
</project>

View File

@ -0,0 +1,19 @@
publishers:
- plot:
- title: 'Sample graph'
yaxis: ''
width: 900
height: 1000
csv-file-name: 'persisted.csv'
group: 'bench'
numbuilds: '1'
style: 'line'
use-description: false
keep-records: true
series:
- file: 'data.csv'
label: ''
url: ''
format: 'csv'
display-table: false
inclusion-flag: 'off'