Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -1,50 +1,7 @@
|
|
| 1 |
$(document).ready(function() {
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
sendBtn.on('click', function() {
|
| 8 |
-
const userMessage = userInput.val();
|
| 9 |
-
if (userMessage) {
|
| 10 |
-
messagesDiv.append(`<div><strong>You:</strong> ${userMessage}</div>`);
|
| 11 |
-
userInput.val('');
|
| 12 |
-
generateChart(userMessage);
|
| 13 |
-
}
|
| 14 |
});
|
| 15 |
-
|
| 16 |
-
function generateChart(query) {
|
| 17 |
-
// Simulate AI response and chart generation
|
| 18 |
-
messagesDiv.append(`<div><strong>AI:</strong> Generating chart for "${query}"...</div>`);
|
| 19 |
-
|
| 20 |
-
// Simulated data for the chart
|
| 21 |
-
const labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July'];
|
| 22 |
-
const data = [65, 59, 80, 81, 56, 55, 40];
|
| 23 |
-
|
| 24 |
-
// Create the chart
|
| 25 |
-
const ctx = chartCanvas[0].getContext('2d');
|
| 26 |
-
const chart = new Chart(ctx, {
|
| 27 |
-
type: 'line',
|
| 28 |
-
data: {
|
| 29 |
-
labels: labels,
|
| 30 |
-
datasets: [{
|
| 31 |
-
label: 'Stock Trend',
|
| 32 |
-
data: data,
|
| 33 |
-
borderColor: 'rgba(75, 192, 192, 1)',
|
| 34 |
-
borderWidth: 2,
|
| 35 |
-
fill: false
|
| 36 |
-
}]
|
| 37 |
-
},
|
| 38 |
-
options: {
|
| 39 |
-
responsive: true,
|
| 40 |
-
scales: {
|
| 41 |
-
y: {
|
| 42 |
-
beginAtZero: true
|
| 43 |
-
}
|
| 44 |
-
}
|
| 45 |
-
}
|
| 46 |
-
});
|
| 47 |
-
|
| 48 |
-
chartCanvas.show();
|
| 49 |
-
}
|
| 50 |
});
|
|
|
|
| 1 |
$(document).ready(function() {
|
| 2 |
+
$('#contactForm').submit(function(e) {
|
| 3 |
+
e.preventDefault();
|
| 4 |
+
alert('Thank you for your message! We will get back to you shortly.');
|
| 5 |
+
$(this).trigger("reset"); // Reset the form after submission
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
});
|