CSIT-1082: Trending: Display date on the x-axis 93/12593/3
authorTibor Frank <tifrank@cisco.com>
Wed, 16 May 2018 11:10:03 +0000 (13:10 +0200)
committerTibor Frank <tifrank@cisco.com>
Wed, 16 May 2018 11:37:42 +0000 (11:37 +0000)
Change-Id: I3f5bdb11222446a5c6016ab4ff57d909514c3ddc
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/tools/presentation/generator_CPTA.py
resources/tools/presentation/specification_CPTA.yaml

index cfd4c58..12ebd46 100644 (file)
@@ -227,8 +227,7 @@ def _generate_trending_traces(in_data, build_info, period, moving_win_size=10,
     :type show_trend_line: bool
     :type name: str
     :type color: str
-    :returns: Generated traces (list), the evaluated result (float) and the
-        first and last date.
+    :returns: Generated traces (list) and the evaluated result.
     :rtype: tuple(traces, result)
     """
 
@@ -285,6 +284,7 @@ def _generate_trending_traces(in_data, build_info, period, moving_win_size=10,
         line={
             "width": 1
         },
+        legendgroup=name,
         name="{name}-thput".format(name=name),
         marker={
             "size": 5,
@@ -345,11 +345,12 @@ def _generate_trending_traces(in_data, build_info, period, moving_win_size=10,
                 "width": 1,
                 "color": color,
             },
+            legendgroup=name,
             name='{name}-trend'.format(name=name)
         )
         traces.append(trace_trend)
 
-    return traces, results[-1], xaxis[0], xaxis[-1]
+    return traces, results[-1]
 
 
 def _generate_chart(traces, layout, file_name):
@@ -456,16 +457,15 @@ def _generate_all_charts(spec, input_data):
                                     format(test_name))
                     continue
                 test_name = test_name.split('.')[-1]
-                trace, result, first_date, last_date = \
-                    _generate_trending_traces(
-                        test_data,
-                        build_info=build_info,
-                        period=period,
-                        moving_win_size=win_size,
-                        fill_missing=True,
-                        use_first=False,
-                        name='-'.join(test_name.split('-')[3:-1]),
-                        color=COLORS[idx])
+                trace, result = _generate_trending_traces(
+                    test_data,
+                    build_info=build_info,
+                    period=period,
+                    moving_win_size=win_size,
+                    fill_missing=True,
+                    use_first=False,
+                    name='-'.join(test_name.split('-')[3:-1]),
+                    color=COLORS[idx])
                 traces.extend(trace)
                 results.append(result)
                 idx += 1
@@ -474,11 +474,6 @@ def _generate_all_charts(spec, input_data):
                 # Generate the chart:
                 chart["layout"]["xaxis"]["title"] = \
                     chart["layout"]["xaxis"]["title"].format(job=job_name)
-                delta = timedelta(days=30)
-                start = last_date - delta
-                start = first_date if start < first_date else start
-                chart["layout"]["xaxis"]["range"] = [str(start.date()),
-                                                     str(last_date.date())]
                 _generate_chart(traces,
                                 chart["layout"],
                                 file_name="{0}-{1}-{2}{3}".format(
index bba7d43..535096b 100644 (file)
   data-sets:
     plot-performance-trending:
       csit-vpp-perf-mrr-daily-master:
+#      - 15
+#      - 20
+#      - 25
+#      - 30
+#      - 35
+#      - 40
+#      - 45
+#      - 50
+#      - 55
+#      - 60
+#      - 65
+#      - 70
+#      - 75
+#      - 80
+#      - 85
+#      - 90
+#      - 95
         start: 15
         end: "lastCompletedBuild" # "lastSuccessfulBuild"  # take all from the 'start'
 
         showticklabels: True
         tickcolor: "rgb(238, 238, 238)"
         autotick: True
-        tickformat: "%m%d"
+        tickformat: "%m%d"
         rangeselector:
           buttons:
+          - count: 14
+            label: "2w"
+            step: "day"
+            stepmode: "backward"
           - count: 1
             label: "1m"
             step: "month"
             stepmode: "backward"
+          - count: 2
+            label: "2m"
+            step: "month"
+            stepmode: "backward"
           - count: 3
             label: "3m"
             step: "month"
             stepmode: "backward"
           - step: "all"
-        rangeslider: {}
+        rangeslider: {}
       margin:
         r: 20
-        b: 200
+        b: 200
         t: 5
         l: 70
       legend:
         orientation: "h"
-        traceorder: "normal"
-        y: -0.5
-#        tracegroupgap: 10
-#        bordercolor: "rgb(238, 238, 238)"
-#        borderwidth: 1
+        # y: -0.5
+        xanchor: "center"
+        traceorder: "normal"  # "grouped" does not work: bug https://github.com/plotly/plotly.js/issues/1913
+        tracegroupgap: 20
+        bordercolor: "rgb(238, 238, 238)"
+        # borderwidth: 1
       hoverlabel:
         namelength: -1
 
     extract: "output.xml"
   builds:
     csit-vpp-perf-mrr-daily-master:
+#    - 15
+#    - 20
+#    - 25
+#    - 30
+#    - 35
+#    - 40
+#    - 45
+#    - 50
+#    - 55
+#    - 60
+#    - 65
+#    - 70
+#    - 75
+#    - 80
+#    - 85
+#    - 90
+#    - 95
       start: 15
       end: "lastCompletedBuild"  # take all from the 'start'