[3798b7]: / client / src / components / Visualization.jsx

Download this file

278 lines (272 with data), 9.3 kB

  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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import React, { useEffect, useState } from "react";
import heatmapImage from "../assets/plots/heatmap.png";
import agePlot from "../assets/plots/age_plot.png";
import BMIPlot from "../assets/plots/BMI_plot.png";
import BloodPressurePlot from "../assets/plots/bp_plot.png";
import CF from "../assets/plots/cf.png";
import DPF from "../assets/plots/dpf_plot.png";
import glucose from "../assets/plots/glucose_plot.png";
import insulin from "../assets/plots/insulin.png";
import pregnancies from "../assets/plots/pregnancies.png";
import skin from "../assets/plots/skin.png";
import { IoClose } from "react-icons/io5";
import { FaDownload } from "react-icons/fa6";
import { motion } from "framer-motion";
const VisualizationPage = () => {
const [modalImage, setModalImage] = useState(null);
const openModel = (image) => {
setModalImage(image);
};
const closeModal = () => {
setModalImage(null);
};
useEffect(() => {
window.scrollTo(0, 0);
});
return (
<div className="container mx-auto py-8 text-center">
<motion.h1
initial={{ opacity: 0, x: -150 }}
whileInView={{ opacity: 1, x: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="text-3xl font-bold mb-6 text-indigo-600 text-center border-b-2 p-2"
>
Diabetes Visualization
</motion.h1>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{/* <div className="bg-gray-100 p-4 rounded-lg shadow-md">
<h2 className="text-xl font-bold mb-4 text-indigo-600">Correlation Heatmap</h2>
<img
src={heatmapImage}
alt="Correlation Heatmap"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(heatmapImage)}
/>
</div> */}
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">Age Plot</h2>
<img
src={agePlot}
alt="Glucose vs Blood Pressure"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(agePlot)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">BMI Plot</h2>
<img
src={BMIPlot}
alt="BMI vs Age"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(BMIPlot)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Blood Pressure Plot
</h2>
<img
src={BloodPressurePlot}
alt="Feature Importance"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(BloodPressurePlot)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Cystic Fibrosis Plot
</h2>
<img
src={CF}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(CF)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Diabetes Pedigree Function Plot
</h2>
<img
src={DPF}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(DPF)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Glucose Plot
</h2>
<img
src={glucose}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(glucose)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Insulin Plot
</h2>
<img
src={insulin}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(insulin)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">
Pregnancies Plot
</h2>
<img
src={pregnancies}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(pregnancies)}
/>
</motion.div>
<motion.div
initial={{ opacity: 0, y: 150 }}
whileInView={{ opacity: 1, y: 0 }}
viewport={{ once: true }}
transition={{
duration: 1,
type: "spring",
stiffness: 100,
delay: 0.5,
}}
className="bg-gray-100 p-4 rounded-lg shadow-md"
>
<h2 className="text-xl font-bold mb-4 text-indigo-600">Skin Plot</h2>
<img
src={skin}
alt="Residual Plot"
className="mx-auto w-full h-64 object-cover rounded-lg cursor-pointer"
onClick={() => openModel(skin)}
/>
</motion.div>
</div>
{modalImage && (
<div className="fixed top-0 left-0 w-full h-full bg-black bg-opacity-50 flex justify-center items-center z-50">
<div className="bg-white p-4 rounded-lg shadow-lg flex flex-col">
<div className="flex justify-end items-center">
<a href={modalImage} download>
<button className="p-2 bg-transparent text-red-500 hover:text-gray-800 focus:outline-none">
<FaDownload className="w-7 h-6" />
</button>
</a>
<button
className="p-2 bg-transparent text-red-500 hover:text-gray-800 focus:outline-none"
onClick={closeModal}
>
<IoClose className="w-9 h-9" />
</button>
</div>
<img
src={modalImage}
alt="Correlation Heatmap"
className="mx-auto w-full h-96 object-cover rounded-lg"
/>
</div>
</div>
)}
</div>
);
};
export default VisualizationPage;