turbulence 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,123 @@
1
1
  <html>
2
- <head>
3
- <script src="treemap_data.js"></script>
4
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
5
- <script type="text/javascript">
6
- google.load("visualization", "1", {packages:["treemap"]});
7
- google.setOnLoadCallback(drawChart);
8
- function drawChart() {
9
- // Create and populate the data table.
10
- var data = google.visualization.arrayToDataTable(treemap_data);
11
-
12
- // Create and draw the visualization.
13
- var tree = new google.visualization.TreeMap(document.getElementById('chart_div'));
14
- tree.draw(data, {
15
- minColor: '#0d0',
16
- midColor: '#ddd',
17
- maxColor: '#f00',
18
- headerHeight: 15,
19
- fontColor: 'black',
20
- showScale: true,
21
- showTooltips: true});
2
+ <head>
3
+ <script src="jquery.min.js"></script>
4
+ <script src="highcharts.js"></script>
5
+ <script src="highcharts-heatmap.js"></script>
6
+ <script src="highcharts-treemap.js"></script>
7
+ <script src="treemap_data.js"></script>
8
+ <style>
9
+ body {
10
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
11
+ margin: 20px;
12
+ }
13
+ h1 {
14
+ font-size: 1.5em;
15
+ margin-bottom: 0.5em;
16
+ }
17
+ .legend {
18
+ display: flex;
19
+ gap: 30px;
20
+ margin-bottom: 15px;
21
+ font-size: 14px;
22
+ }
23
+ .legend-item {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: 8px;
27
+ }
28
+ .legend-icon {
29
+ width: 20px;
30
+ height: 20px;
31
+ border: 1px solid #ccc;
32
+ }
33
+ .legend-icon.size-large { width: 24px; height: 24px; background: #888; }
34
+ .legend-icon.size-small { width: 12px; height: 12px; background: #888; }
35
+ .color-gradient {
36
+ width: 80px;
37
+ height: 20px;
38
+ background: linear-gradient(to right, #0d0, #ddd, #f00);
39
+ }
40
+ .tip {
41
+ margin-top: 15px;
42
+ padding: 10px 15px;
43
+ background: #fffbe6;
44
+ border-left: 4px solid #f90;
45
+ font-size: 13px;
46
+ max-width: 900px;
47
+ }
48
+ </style>
49
+ <script>
50
+ $(document).ready(function() {
51
+ Highcharts.chart('container', {
52
+ chart: {
53
+ backgroundColor: '#fff'
54
+ },
55
+ colorAxis: {
56
+ stops: [
57
+ [0, '#0d0'],
58
+ [0.5, '#ddd'],
59
+ [1, '#f00']
60
+ ],
61
+ labels: {
62
+ enabled: false
63
+ }
64
+ },
65
+ title: {
66
+ text: null
67
+ },
68
+ tooltip: {
69
+ formatter: function() {
70
+ return '<b>' + this.point.name + '</b><br/>' +
71
+ 'churn: ' + this.point.value + '<br/>' +
72
+ 'complexity: ' + this.point.colorValue.toFixed(1);
73
+ }
74
+ },
75
+ series: [{
76
+ type: 'treemap',
77
+ layoutAlgorithm: 'squarified',
78
+ colorKey: 'colorValue',
79
+ data: treemap_data,
80
+ dataLabels: {
81
+ enabled: true,
82
+ style: {
83
+ textOverflow: 'ellipsis',
84
+ fontSize: '11px',
85
+ fontWeight: 'normal',
86
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
87
+ color: '#000',
88
+ textOutline: 'none'
22
89
  }
23
- </script>
24
- </head>
25
-
26
- <body>
27
- <div id="chart_div" style="width: 900px; height: 500px;"></div>
28
- </body>
29
- </html>
90
+ },
91
+ levels: [{
92
+ level: 1,
93
+ borderWidth: 2,
94
+ borderColor: '#fff'
95
+ }]
96
+ }]
97
+ });
98
+ });
99
+ </script>
100
+ </head>
101
+ <body>
102
+ <h1>Churn vs Complexity Treemap</h1>
103
+ <div class="legend">
104
+ <div class="legend-item">
105
+ <strong>Size</strong> = Churn (how often the file changes)
106
+ <span class="legend-icon size-large"></span>
107
+ <span style="font-size: 12px;">more</span>
108
+ <span class="legend-icon size-small"></span>
109
+ <span style="font-size: 12px;">less</span>
110
+ </div>
111
+ <div class="legend-item">
112
+ <strong>Color</strong> = Complexity
113
+ <div class="color-gradient"></div>
114
+ <span style="font-size: 12px;">low → high</span>
115
+ </div>
116
+ </div>
117
+ <div id="container" style="width: 900px; height: 500px;"></div>
118
+ <div class="tip">
119
+ <strong>Tip:</strong> Look for <strong>big red boxes</strong> — these are high-churn, high-complexity files and prime candidates for refactoring.
120
+ Hover over boxes to see details.
121
+ </div>
122
+ </body>
123
+ </html>
@@ -3,17 +3,37 @@
3
3
  <script src="jquery.min.js"></script>
4
4
  <script src="highcharts.js"></script>
5
5
  <script src="cc.js"></script>
6
+ <style>
7
+ body {
8
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
9
+ margin: 20px;
10
+ }
11
+ h1 {
12
+ font-size: 1.5em;
13
+ margin-bottom: 0.5em;
14
+ }
15
+ .tip {
16
+ margin-top: 15px;
17
+ padding: 10px 15px;
18
+ background: #fffbe6;
19
+ border-left: 4px solid #f90;
20
+ font-size: 13px;
21
+ max-width: 900px;
22
+ }
23
+ </style>
6
24
  <script>
7
25
  $(document).ready(function() {
8
26
  var chart = new Highcharts.Chart({
9
27
  chart: {
10
28
  renderTo: 'container',
11
29
  defaultSeriesType: 'scatter',
12
- zoomType: 'xy'
30
+ zoomType: 'xy',
31
+ backgroundColor: '#fff'
13
32
  },
14
33
  title: {
15
- text: 'Churn vs Complexity'
34
+ text: null
16
35
  },
36
+ colors: ['#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#DB843D', '#92A8CD', '#A47D7C', '#B5CA92'],
17
37
  xAxis: {
18
38
  title: {
19
39
  enabled: true,
@@ -21,6 +41,8 @@ $(document).ready(function() {
21
41
  },
22
42
  startOnTick: false,
23
43
  endOnTick: false,
44
+ minPadding: 0.02,
45
+ maxPadding: 0.02,
24
46
  labels: {enabled:false},
25
47
  lineWidth: 0,
26
48
  tickWidth: 0
@@ -31,6 +53,8 @@ $(document).ready(function() {
31
53
  },
32
54
  startOnTick: false,
33
55
  endOnTick: false,
56
+ minPadding: 0.02,
57
+ maxPadding: 0.05,
34
58
  labels: {enabled:false}
35
59
  },
36
60
  tooltip: {
@@ -47,16 +71,10 @@ $(document).ready(function() {
47
71
  states: {
48
72
  hover: {
49
73
  enabled: true,
74
+ radius: 7,
50
75
  lineColor: 'rgb(100,100,100)'
51
76
  }
52
77
  }
53
- },
54
- states: {
55
- hover: {
56
- marker: {
57
- enabled: false
58
- }
59
- }
60
78
  }
61
79
  }
62
80
  }
@@ -75,7 +93,11 @@ $(document).ready(function() {
75
93
  </script>
76
94
  </head>
77
95
  <body>
78
- <div id='container'>
79
- </div>
80
- </body>
96
+ <h1>Churn vs Complexity</h1>
97
+ <div id='container' style="width: 900px; height: 500px;"></div>
98
+ <div class="tip">
99
+ <strong>Tip:</strong> Files in the <strong>upper right</strong> (high churn + high complexity) are prime candidates for refactoring.
100
+ Click and drag to zoom, click the legend to toggle directories.
101
+ </div>
102
+ </body>
81
103
  </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbulence
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -155,6 +155,8 @@ files:
155
155
  - spec/turbulence/scm/perforce_spec.rb
156
156
  - spec/turbulence/turbulence_spec.rb
157
157
  - template/highchart_template.js.erb
158
+ - template/highcharts-heatmap.js
159
+ - template/highcharts-treemap.js
158
160
  - template/highcharts.js
159
161
  - template/jquery.min.js
160
162
  - template/treemap.html