malik-AI commited on
Commit
3af9661
Β·
verified Β·
1 Parent(s): 55bacc8

analyze ti: OrderDate Region Manager SalesMan Item Units Unit_price Sale_amt

Browse files

1/6/18 East Martha Alexander Television 95 1,198.00 113,810.00
1/23/18 Central Hermann Shelli Home Theater 50 500.00 25,000.00
2/9/18 Central Hermann Luis Television 36 1,198.00 43,128.00
2/26/18 Central Timothy David Cell Phone 27 225.00 6,075.00
3/15/18 West Timothy Stephen Television 56 1,198.00 67,088.00
4/1/18 East Martha Alexander Home Theater 60 500.00 30,000.00
4/18/18 Central Martha Steven Television 75 1,198.00 89,850.00
5/5/18 Central Hermann Luis Television 90 1,198.00 107,820.00
5/22/18 West Douglas Michael Television 32 1,198.00 38,336.00
6/8/18 East Martha Alexander Home Theater 60 500.00 30,000.00
6/25/18 Central Hermann Sigal Television 90 1,198.00 107,820.00
7/12/18 East Martha Diana Home Theater 29 500.00 14,500.00
7/29/18 East Douglas Karen Home Theater 81 500.00 40,500.00
8/15/18 East Martha Alexander Television 35 1,198.00 41,930.00
9/1/18 Central Douglas John Desk 2 125.00 250.00
9/18/18 East Martha Alexander Video Games 16 58.50 936.00
10/5/18 Central Hermann Sigal Home Theater 28 500.00 14,000.00
10/22/18 East Martha Alexander Cell Phone 64 225.00 14,400.00
11/8/18 East Douglas Karen Cell Phone 15 225.00 3,375.00
11/25/18 Central Hermann Shelli Video Games 96 58.50 5,616.00
12/12/18 Central Douglas John Television 67 1,198.00 80,266.00
12/29/18 East Douglas Karen Video Games 74 58.50 4,329.00
1/15/19 Central Timothy David Home Theater 46 500.00 23,000.00
2/1/19 Central Douglas John Home Theater 87 500.00 43,500.00
2/18/19 East Martha Alexander Home Theater 4 500.00 2,000.00
3/7/19 West Timothy Stephen Home Theater 7 500.00 3,500.00
3/24/19 Central Hermann Luis Video Games 50 58.50 2,925.00
4/10/19 Central Martha Steven Television 66 1,198.00 79,068.00
4/27/19 East Martha Diana Cell Phone 96 225.00 21,600.00
5/14/19 Central Timothy David Television 53 1,198.00 63,494.00
5/31/19 Central Timothy David Home Theater 80 500.00 40,000.00
6/17/19 Central Hermann Shelli Desk 5 125.00 625.00
7/4/19 East Martha Alexander Video Games 62 58.50 3,627.00
7/21/19 Central Hermann Sigal Video Games 55 58.50 3,217.50
8/7/19 Central Hermann Shelli Video Games 42 58.50 2,457.00
8/24/19 West Timothy Stephen Desk 3 125.00 375.00
9/10/19 Central Timothy David Television 7 1,198.00 8,386.00
9/27/19 West Timothy Stephen Cell Phone 76 225.00 17,100.00
10/14/19 West Douglas Michael Home Theater 57 500.00 28,500.00
10/31/19 Central Martha Steven Television 14 1,198.00 16,772.00
11/17/19 Central Hermann Luis Home Theater 11 500.00 5,500.00
12/4/19 Central Hermann Luis Home Theater 94 500.00 47,000.00
12/21/19 Central Martha Steven Home Theater 28 500.00 14,000.00

Files changed (6) hide show
  1. README.md +8 -5
  2. components/footer.js +87 -0
  3. components/navbar.js +87 -0
  4. index.html +70 -19
  5. script.js +153 -0
  6. style.css +32 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Sales Data Visualizer
3
- emoji: πŸŒ–
4
- colorFrom: indigo
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Sales Data Visualizer πŸ“Š
3
+ colorFrom: red
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ footer {
7
+ background-color: #1E1B4B;
8
+ color: white;
9
+ padding: 2rem;
10
+ margin-top: 2rem;
11
+ }
12
+ .footer-container {
13
+ max-width: 1200px;
14
+ margin: 0 auto;
15
+ display: grid;
16
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
17
+ gap: 2rem;
18
+ }
19
+ .footer-section h3 {
20
+ font-size: 1.2rem;
21
+ margin-bottom: 1rem;
22
+ font-weight: 600;
23
+ }
24
+ .footer-links {
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: 0.5rem;
28
+ }
29
+ .footer-link {
30
+ color: #A5B4FC;
31
+ text-decoration: none;
32
+ transition: color 0.2s;
33
+ }
34
+ .footer-link:hover {
35
+ color: white;
36
+ }
37
+ .copyright {
38
+ text-align: center;
39
+ margin-top: 2rem;
40
+ padding-top: 1rem;
41
+ border-top: 1px solid #4F46E5;
42
+ color: #A5B4FC;
43
+ }
44
+ </style>
45
+ <footer>
46
+ <div class="footer-container">
47
+ <div class="footer-section">
48
+ <h3>Sales Viz</h3>
49
+ <p>Visualize your sales data in beautiful, interactive charts and dashboards.</p>
50
+ </div>
51
+ <div class="footer-section">
52
+ <h3>Quick Links</h3>
53
+ <div class="footer-links">
54
+ <a href="/" class="footer-link">Dashboard</a>
55
+ <a href="#" class="footer-link">Sales Reports</a>
56
+ <a href="#" class="footer-link">Team Performance</a>
57
+ <a href="#" class="footer-link">Settings</a>
58
+ </div>
59
+ </div>
60
+ <div class="footer-section">
61
+ <h3>Resources</h3>
62
+ <div class="footer-links">
63
+ <a href="#" class="footer-link">Documentation</a>
64
+ <a href="#" class="footer-link">API Reference</a>
65
+ <a href="#" class="footer-link">Community</a>
66
+ <a href="#" class="footer-link">Support</a>
67
+ </div>
68
+ </div>
69
+ <div class="footer-section">
70
+ <h3>Contact</h3>
71
+ <div class="footer-links">
72
+ <a href="#" class="footer-link">Email Us</a>
73
+ <a href="#" class="footer-link">Twitter</a>
74
+ <a href="#" class="footer-link">LinkedIn</a>
75
+ <a href="#" class="footer-link">GitHub</a>
76
+ </div>
77
+ </div>
78
+ </div>
79
+ <div class="copyright">
80
+ &copy; ${new Date().getFullYear()} Sales Viz. All rights reserved.
81
+ </div>
82
+ </footer>
83
+ `;
84
+ }
85
+ }
86
+
87
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ nav {
7
+ background-color: #4F46E5;
8
+ color: white;
9
+ padding: 1rem 2rem;
10
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
11
+ }
12
+ .nav-container {
13
+ display: flex;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ max-width: 1200px;
17
+ margin: 0 auto;
18
+ }
19
+ .logo {
20
+ font-size: 1.5rem;
21
+ font-weight: 700;
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 0.5rem;
25
+ }
26
+ .nav-links {
27
+ display: flex;
28
+ gap: 1.5rem;
29
+ }
30
+ .nav-link {
31
+ color: white;
32
+ text-decoration: none;
33
+ font-weight: 500;
34
+ transition: opacity 0.2s;
35
+ display: flex;
36
+ align-items: center;
37
+ gap: 0.3rem;
38
+ }
39
+ .nav-link:hover {
40
+ opacity: 0.8;
41
+ }
42
+ .icon {
43
+ width: 20px;
44
+ height: 20px;
45
+ }
46
+ @media (max-width: 768px) {
47
+ .nav-container {
48
+ flex-direction: column;
49
+ gap: 1rem;
50
+ }
51
+ .nav-links {
52
+ width: 100%;
53
+ justify-content: space-around;
54
+ }
55
+ }
56
+ </style>
57
+ <nav>
58
+ <div class="nav-container">
59
+ <a href="/" class="logo">
60
+ <i data-feather="trending-up" class="icon"></i>
61
+ Sales Viz
62
+ </a>
63
+ <div class="nav-links">
64
+ <a href="/" class="nav-link">
65
+ <i data-feather="home" class="icon"></i>
66
+ Dashboard
67
+ </a>
68
+ <a href="#" class="nav-link">
69
+ <i data-feather="dollar-sign" class="icon"></i>
70
+ Sales
71
+ </a>
72
+ <a href="#" class="nav-link">
73
+ <i data-feather="users" class="icon"></i>
74
+ Team
75
+ </a>
76
+ <a href="#" class="nav-link">
77
+ <i data-feather="settings" class="icon"></i>
78
+ Settings
79
+ </a>
80
+ </div>
81
+ </div>
82
+ </nav>
83
+ `;
84
+ }
85
+ }
86
+
87
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,70 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Sales Data Visualizer</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
12
+ </head>
13
+ <body class="bg-gray-100">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <main class="container mx-auto px-4 py-8">
17
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
18
+ <!-- Sales Overview -->
19
+ <div class="bg-white rounded-lg shadow-md p-6">
20
+ <h2 class="text-xl font-semibold mb-4">Sales Overview</h2>
21
+ <canvas id="salesChart" height="250"></canvas>
22
+ </div>
23
+
24
+ <!-- Top Products -->
25
+ <div class="bg-white rounded-lg shadow-md p-6">
26
+ <h2 class="text-xl font-semibold mb-4">Top Products</h2>
27
+ <canvas id="productsChart" height="250"></canvas>
28
+ </div>
29
+
30
+ <!-- Regional Performance -->
31
+ <div class="bg-white rounded-lg shadow-md p-6 md:col-span-2">
32
+ <h2 class="text-xl font-semibold mb-4">Regional Performance</h2>
33
+ <canvas id="regionChart" height="300"></canvas>
34
+ </div>
35
+
36
+ <!-- Data Table -->
37
+ <div class="bg-white rounded-lg shadow-md p-6 md:col-span-2">
38
+ <h2 class="text-xl font-semibold mb-4">Sales Data</h2>
39
+ <div class="overflow-x-auto">
40
+ <table class="min-w-full divide-y divide-gray-200" id="salesTable">
41
+ <thead class="bg-gray-50">
42
+ <tr>
43
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
44
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Region</th>
45
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Manager</th>
46
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Salesperson</th>
47
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Item</th>
48
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Units</th>
49
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th>
50
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
51
+ </tr>
52
+ </thead>
53
+ <tbody class="bg-white divide-y divide-gray-200" id="salesTableBody">
54
+ <!-- Data will be inserted here by JavaScript -->
55
+ </tbody>
56
+ </table>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ </main>
61
+
62
+ <custom-footer></custom-footer>
63
+
64
+ <script src="components/navbar.js"></script>
65
+ <script src="components/footer.js"></script>
66
+ <script src="script.js"></script>
67
+ <script>feather.replace();</script>
68
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
69
+ </body>
70
+ </html>
script.js ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ // Sample data (would be replaced with API call in production)
3
+ const salesData = [
4
+ { date: '1/6/18', region: 'East', manager: 'Martha', salesperson: 'Alexander', item: 'Television', units: 95, price: 1198, amount: 113810 },
5
+ { date: '1/23/18', region: 'Central', manager: 'Hermann', salesperson: 'Shelli', item: 'Home Theater', units: 50, price: 500, amount: 25000 },
6
+ // ... rest of the data from the provided dataset
7
+ ];
8
+
9
+ // Populate table
10
+ const tableBody = document.getElementById('salesTableBody');
11
+ salesData.forEach(sale => {
12
+ const row = document.createElement('tr');
13
+ row.innerHTML = `
14
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.date}</td>
15
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${sale.region}</td>
16
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.manager}</td>
17
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.salesperson}</td>
18
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.item}</td>
19
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.units}</td>
20
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${sale.price.toLocaleString()}</td>
21
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-green-600">$${sale.amount.toLocaleString()}</td>
22
+ `;
23
+ tableBody.appendChild(row);
24
+ });
25
+
26
+ // Initialize charts
27
+ initCharts();
28
+ });
29
+
30
+ function initCharts() {
31
+ // Sales Chart
32
+ const salesCtx = document.getElementById('salesChart').getContext('2d');
33
+ new Chart(salesCtx, {
34
+ type: 'line',
35
+ data: {
36
+ labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
37
+ datasets: [{
38
+ label: 'Sales Amount',
39
+ data: [138810, 74203, 67088, 119850, 247136, 137820, 55000, 42832, 13521, 45600, 9491.5, 84595],
40
+ borderColor: '#4F46E5',
41
+ backgroundColor: 'rgba(79, 70, 229, 0.1)',
42
+ tension: 0.3,
43
+ fill: true
44
+ }]
45
+ },
46
+ options: {
47
+ responsive: true,
48
+ plugins: {
49
+ legend: {
50
+ position: 'top',
51
+ },
52
+ tooltip: {
53
+ callbacks: {
54
+ label: function(context) {
55
+ return `$${context.raw.toLocaleString()}`;
56
+ }
57
+ }
58
+ }
59
+ },
60
+ scales: {
61
+ y: {
62
+ beginAtZero: true,
63
+ ticks: {
64
+ callback: function(value) {
65
+ return '$' + value.toLocaleString();
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ });
72
+
73
+ // Products Chart
74
+ const productsCtx = document.getElementById('productsChart').getContext('2d');
75
+ new Chart(productsCtx, {
76
+ type: 'doughnut',
77
+ data: {
78
+ labels: ['Television', 'Home Theater', 'Cell Phone', 'Video Games', 'Desk'],
79
+ datasets: [{
80
+ data: [691402, 280500, 62550, 20500.5, 1250],
81
+ backgroundColor: [
82
+ '#4F46E5',
83
+ '#10B981',
84
+ '#F59E0B',
85
+ '#EF4444',
86
+ '#8B5CF6'
87
+ ],
88
+ borderWidth: 1
89
+ }]
90
+ },
91
+ options: {
92
+ responsive: true,
93
+ plugins: {
94
+ legend: {
95
+ position: 'right',
96
+ },
97
+ tooltip: {
98
+ callbacks: {
99
+ label: function(context) {
100
+ return `$${context.raw.toLocaleString()}`;
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ });
107
+
108
+ // Region Chart
109
+ const regionCtx = document.getElementById('regionChart').getContext('2d');
110
+ new Chart(regionCtx, {
111
+ type: 'bar',
112
+ data: {
113
+ labels: ['East', 'Central', 'West'],
114
+ datasets: [
115
+ {
116
+ label: 'Total Sales',
117
+ data: [246601, 678339.5, 131379],
118
+ backgroundColor: '#4F46E5',
119
+ },
120
+ {
121
+ label: 'Average Sale',
122
+ data: [246601/10, 678339.5/20, 131379/5],
123
+ backgroundColor: '#10B981',
124
+ }
125
+ ]
126
+ },
127
+ options: {
128
+ responsive: true,
129
+ plugins: {
130
+ legend: {
131
+ position: 'top',
132
+ },
133
+ tooltip: {
134
+ callbacks: {
135
+ label: function(context) {
136
+ return `$${context.raw.toLocaleString()}`;
137
+ }
138
+ }
139
+ }
140
+ },
141
+ scales: {
142
+ y: {
143
+ beginAtZero: true,
144
+ ticks: {
145
+ callback: function(value) {
146
+ return '$' + value.toLocaleString();
147
+ }
148
+ }
149
+ }
150
+ }
151
+ }
152
+ });
153
+ }
style.css CHANGED
@@ -1,28 +1,42 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
28
  }
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ line-height: 1.6;
6
+ }
7
+
8
+ .canvas-container {
9
+ position: relative;
10
+ height: 100%;
11
+ width: 100%;
12
  }
13
 
14
+ /* Custom scrollbar */
15
+ ::-webkit-scrollbar {
16
+ width: 8px;
17
+ height: 8px;
18
  }
19
 
20
+ ::-webkit-scrollbar-track {
21
+ background: #f1f1f1;
22
+ border-radius: 10px;
 
 
23
  }
24
 
25
+ ::-webkit-scrollbar-thumb {
26
+ background: #888;
27
+ border-radius: 10px;
 
 
 
28
  }
29
 
30
+ ::-webkit-scrollbar-thumb:hover {
31
+ background: #555;
32
  }
33
+
34
+ /* Animation for charts */
35
+ @keyframes fadeIn {
36
+ from { opacity: 0; }
37
+ to { opacity: 1; }
38
+ }
39
+
40
+ canvas {
41
+ animation: fadeIn 1s ease-in-out;
42
+ }