{% set nosidebar = True %} {% import "utils.html" as utils %} {% extends "layout.html" %} {% set components = [(ts.name, v4_url_for(".v4_recent_activity"))] %} {% block head %} {% endblock %} {% block title %}Graph{% endblock %} {# Add JS to initialize the graph. #} {% block onload %}init_page(){% endblock %} {% block javascript %} var test_suite_name = "{{ request.view_args.testsuite_name }}"; var db_name = "{{ request.view_args.get('db_name','') }}"; var graph_plots = {{graph_plots|tojson|safe}}; var metrics = {{metrics|tojson|safe}}; var legend = {{legend|tojson|safe}}; var options = {{options|tojson|safe}}; function init_graph() { // Add regressions var tmp_plots = plotly_update_graphplots(graph_plots); var graph_layout = { // title: 'Graph', hovermode: 'closest', showlegend: true, legend: { x: 0, y: -1.0, // yanchor: 'bottom', // size: 'top left', bgcolor: 'rgba(0,0,0,0)' }, margin: { l: 50, r: 0, t: 10, b: 0 }, height: 700 }; if (options.xaxis_date) { graph_layout['xaxis'] = {title: 'Date', type: 'date'}; } else { graph_layout['xaxis'] = {title: 'Order', type: 'category'}; } var xaxis_left = 0.0; var xaxis_right = 1.0; for (var i = 0; i < metrics.length; i++) { var yaxis = 'yaxis'; if (i > 0) yaxis += (i+1).toString(); graph_layout[yaxis] = {title: metrics[i]}; if (options.logarithmic_scale) { graph_layout[yaxis]['type'] = 'log'; graph_layout[yaxis]['autorange'] = true; } if (i > 0 ) { graph_layout[yaxis]['overlaying'] = 'y'; } if (i & 1) { graph_layout[yaxis]['side'] = 'right'; xaxis_right = 1 - 0.03 * i; graph_layout[yaxis]['position'] = xaxis_right; } else { xaxis_left = 0.03 * i; graph_layout[yaxis]['position'] = xaxis_left; } } graph_layout['xaxis']['domain'] = [xaxis_left, xaxis_right]; Plotly.newPlot('graph', tmp_plots, graph_layout); var graph = document.getElementById('graph'); graph.on('plotly_click', plotly_update_tooltip); graph.on('plotly_doubleclick', plotly_hide_tooltip); } function init_page() { if (!options.xaxis_date) { // First start the requests for regression data. legend.forEach(function(item, index) { if (item[4]) { // legend.url var yaxis_index = metrics.indexOf(item[2]); // legend.field_name var yaxis = ((yaxis_index == 0) ? "y" : ("y"+(yaxis_index + 1).toString())); $.getJSON(get_api_url("regression", db_name, test_suite_name, item[4]), function (data) { plotly_graph_regression_callback(data, index, item, yaxis, init_graph); } ); } }); } init_graph(); } {% endblock %} {% block sidebar %}

Controls

{% endblock %} {% block body %}

Graph

{% for name,value in request.args.items() %} {# {% if name.startswith('plot.') %} #} {# {% endif %} #} {% endfor %}
{% endblock %}