File size: 6,635 Bytes
2336542
 
 
 
d0bf37a
 
637c7f1
2336542
 
 
 
 
 
 
 
 
637c7f1
 
2336542
 
 
637c7f1
2336542
 
637c7f1
 
2336542
637c7f1
 
2336542
 
 
637c7f1
 
 
2336542
637c7f1
2336542
 
637c7f1
 
 
 
 
 
 
 
 
 
 
2336542
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
637c7f1
 
 
 
 
 
 
 
 
 
2336542
637c7f1
 
 
 
2336542
 
 
 
 
637c7f1
 
 
 
84ee259
 
2336542
 
637c7f1
 
 
 
 
d0bf37a
 
 
 
 
215b074
 
 
d0bf37a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215b074
 
 
 
9a73cb0
215b074
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a73cb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0bf37a
 
 
215b074
637c7f1
 
 
 
 
 
 
 
 
2336542
 
637c7f1
 
 
 
 
 
 
 
 
 
2336542
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <!-- Add Plotly.js CDN in <head> -->
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
  <title>Report Viewer</title>
  <style>
    body {
      background-color: #041C32;
      color: #ECB365;
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 20px;
    }
    .container {
      margin: 20px auto;
      padding: 20px;
      background-color: #04293A;
      border-radius: 10px;
      text-align: center;
      max-width: 90%;
      box-shadow: 0px 0px 15px rgba(236, 179, 101, 0.3);
    }
    .toggle-buttons {
      margin-bottom: 20px;
    }
    .toggle-buttons a {
      padding: 10px 15px;
      background-color: #ECB365;
      color: #041C32;
      text-decoration: none;
      margin: 0 10px;
      border-radius: 5px;
      font-weight: bold;
    }
    .toggle-buttons a.active {
      background-color: #d69f50;
    }
    .pagination {
      margin-top: 15px;
    }
    .pagination a {
      padding: 8px 12px;
      background-color: #ECB365;
      color: #041C32;
      text-decoration: none;
      margin: 0 5px;
      border-radius: 5px;
    }
    .table-wrapper {
      overflow-x: auto;
      margin: auto;
      padding: 15px;
      background-color: #04293A;
      border-radius: 6px;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      color: #ECB365;
    }
    th, td {
      border: 1px solid #ECB365;
      padding: 10px;
      text-align: center;
    }
    th {
      background-color: #064663;
    }
    /* Improved Button Styling */
    .btn {
      display: inline-block;
      padding: 12px 20px;
      background-color: #ECB365;
      color: #041C32;
      text-decoration: none;
      margin: 10px 5px;
      border-radius: 6px;
      font-weight: bold;
      transition: background-color 0.3s ease;
    }
    .btn:hover {
      background-color: #d69f50;
    }
  </style>
</head>
<body>
  <div class="container">
    <!-- Toggle Buttons -->
    <div class="toggle-buttons">
      <a href="{{ url_for('report_view', report_type='pred', page=1) }}"
         class="{% if report_type == 'pred' %}active{% endif %}">Prediction Report</a>
      <!-- <a href="{{ url_for('report_view', report_type='class', page=1) }}"
         class="{% if report_type == 'class' %}active{% endif %}">Classification Analysis</a> -->
    </div>

    <!-- Report Table -->
    <div class="table-wrapper">
      {{ table_html | safe }}
    </div>

    <!-- Chart Section -->
    <div class="table-wrapper" style="margin-top: 30px;">
      <h2 style="color:#ECB365;">Makable Predicted & Diff vs EngCts</h2>
      <div id="line-chart" style="height: 400px;"></div>
    </div>

    <!-- Line Chart with Markers -->
    <!-- <script>
      const chartData = {{ chart_data | safe }};
      
      const trace1 = {
        x: chartData.EngCts,
        y: chartData.Makable_Predicted,
        type: 'scatter',
        mode: 'lines+markers',
        name: 'Makable_Predicted',
        line: { color: '#00BFFF' }
      };
    
      const trace2 = {
        x: chartData.EngCts,
        y: chartData.Makable_Diff,
        type: 'scatter',
        mode: 'lines+markers',
        name: 'Makable_Diff',
        line: { color: '#FF6347' }
      };
    
      const layout = {
        paper_bgcolor: "#04293A",
        plot_bgcolor: "#041C32",
        font: { color: "#ECB365" },
        xaxis: { title: "EngCts" },
        yaxis: { title: "Values" },
        margin: { t: 40, l: 50, r: 30, b: 50 }
      };
    
      Plotly.newPlot('line-chart', [trace1, trace2], layout);
    </script> -->

    <!-- Dot Chart with Markers -->
    <!-- <script>
      const chartData = {{ chart_data | safe }};
      
      const trace1 = {
        x: chartData.EngCts,
        y: chartData.Makable_Predicted,
        type: 'scatter',
        mode: 'markers',  // Changed here
        name: 'Makable_Predicted',
        marker: { color: '#00BFFF' }
      };
    
      const trace2 = {
        x: chartData.EngCts,
        y: chartData.Makable_Diff,
        type: 'scatter',
        mode: 'markers',  // Changed here
        name: 'Makable_Diff',
        marker: { color: '#FF6347' }
      };
    
      const layout = {
        paper_bgcolor: "#04293A",
        plot_bgcolor: "#041C32",
        font: { color: "#ECB365" },
        xaxis: { title: "EngCts" },
        yaxis: { title: "Values" },
        margin: { t: 40, l: 50, r: 30, b: 50 }
      };
    
      Plotly.newPlot('line-chart', [trace1, trace2], layout);
    </script> -->

    <!-- Dot Chart Fixed View -->
    <script>
      const chartData = {{ chart_data | safe }};
    
      const trace1 = {
        x: chartData.EngCts,
        y: chartData.Makable_Predicted,
        type: 'scatter',
        mode: 'markers',
        name: 'Makable_Predicted',
        marker: { color: '#00BFFF', size: 8 }
      };
    
      const trace2 = {
        x: chartData.EngCts,
        y: chartData.Makable_Diff,
        type: 'scatter',
        mode: 'markers',
        name: 'Makable_Diff',
        marker: { color: '#FF6347', size: 8 }
      };
    
      const layout = {
        paper_bgcolor: "#04293A",
        plot_bgcolor: "#041C32",
        font: { color: "#ECB365" },
        xaxis: {
          title: "EngCts",
          tickangle: 0
        },
        yaxis: {
          title: "Values",
          tickfont: {
            size: 10,
            color: "#ECB365"
          },
          automargin: true,           // 🔧 Add space for long labels
          tickmode: "auto",           // Let Plotly auto-decide tick values
          nticks: 10,                 // Reduce clutter
        },
        margin: { t: 40, l: 80, r: 30, b: 50 } // ⬅️ Increase left margin for Y-axis labels
      };
    
      Plotly.newPlot('line-chart', [trace1, trace2], layout);
    </script>


    <!-- Pagination Controls -->
    <div class="pagination">
      {% if has_prev %}
      <a href="{{ url_for('report_view', report_type=report_type, page=page-1) }}">Previous</a>
      {% endif %}
      <span>Page {{ page }}</span>
      {% if has_next %}
      <a href="{{ url_for('report_view', report_type=report_type, page=page+1) }}">Next</a>
      {% endif %}
    </div>

    <!-- Download and Navigation Buttons -->
    <div style="margin-top:20px;">
      {% if report_type == 'pred' %}
      <a href="{{ url_for('download_pred') }}" class="btn">Download Prediction CSV</a>
      {% else %}
      <a href="{{ url_for('download_class') }}" class="btn">Download Classification CSV</a>
      {% endif %}
      <a href="/" class="btn">Go Back</a>
    </div>
  </div>
</body>
</html>