BLUE FIT
$129.99 - $154.99
Price Range
Market Pulse
Success Rate: 25%
Median Price: $145.49
Active Listings: 0
Notice: We may earn a commission from eBay links; this does not affect how we present data and helps support the site.
7.810249675906654
Std Deviation
No recent sales data available
4
Avg Listings per Seller
Country |
Listings |
Percentage |
US |
8 |
100.00% |
// Chart initialization - optimized for immediate loading
document.addEventListener('DOMContentLoaded', function() {
// Initialize charts when DOM is ready
initCharts();
// Tab switching functionality
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', () => {
// Remove active class from all buttons and contents
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.classList.remove('active'));
// Add active class to clicked button
button.classList.add('active');
// Show corresponding content
const tabId = button.getAttribute('data-tab');
document.getElementById(`${tabId}-tab`).classList.add('active');
});
});
// Make the chart download buttons functional
const downloadButtons = document.querySelectorAll('.chart-action-button');
downloadButtons.forEach(button => {
button.addEventListener('click', function() {
// This is a placeholder - actual download functionality would be implemented here
if (this.title === 'Download Chart') {
alert('Download chart functionality would be implemented here');
} else if (this.title === 'View Fullscreen') {
alert('Fullscreen view functionality would be implemented here');
} else if (this.title === 'Download Data') {
alert('Download data functionality would be implemented here');
}
});
});
// Handle resizing charts when orientation changes
window.addEventListener('resize', function() {
// This will trigger a redraw of all charts if needed
const allCharts = document.querySelectorAll('canvas');
allCharts.forEach(canvas => {
if (canvas.chart) {
canvas.chart.resize();
}
});
});
});
function initCharts() {
try {
console.log("Initializing charts...");
// Status chart
var statusCtx = document.getElementById('statusChart');
if (statusCtx) {
console.log("Status chart canvas found");
new Chart(statusCtx, {
type: 'doughnut',
data: {
labels: ['Active', 'Sold', 'Unsold'],
datasets: [{
data: [0, 2, 6],
backgroundColor: ['#4CAF50', '#2196F3', '#F44336'],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
},
callbacks: {
label: function(context) {
const label = context.label || '';
const value = context.raw || 0;
const total = context.dataset.data.reduce((acc, data) => acc + data, 0);
const percentage = Math.round((value / total) * 100);
return `${label}: ${value.toLocaleString()} (${percentage}%)`;
}
}
}
}
}
});
console.log("Status chart initialized");
} else {
console.error("Status chart canvas not found");
}
// Condition chart
var conditionCtx = document.getElementById('conditionChart');
if (conditionCtx) {
console.log("Condition chart canvas found");
new Chart(conditionCtx, {
type: 'pie',
data: {
labels: ['New', 'Used', 'Refurbished'],
datasets: [{
data: [8, 0, 0],
backgroundColor: ['#4CAF50', '#FFC107', '#9C27B0'],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
},
callbacks: {
label: function(context) {
const label = context.label || '';
const value = context.raw || 0;
const total = context.dataset.data.reduce((acc, data) => acc + data, 0);
const percentage = Math.round((value / total) * 100);
return `${label}: ${value.toLocaleString()} (${percentage}%)`;
}
}
}
}
}
});
console.log("Condition chart initialized");
} else {
console.error("Condition chart canvas not found");
}
// Seller chart
var sellerCtx = document.getElementById('sellerChart');
if (sellerCtx) {
console.log("Seller chart canvas found");
// Seller data
var sellerLabels = [];
var sellerValues = [];
var sellerColors = ['#3671b0', '#4CAF50', '#FFC107', '#F44336', '#9C27B0', '#00BCD4', '#FF5722', '#795548'];
sellerLabels.push('michael_atw');
sellerValues.push(7);
sellerLabels.push('guitar-parts-and-pieces');
sellerValues.push(1);
new Chart(sellerCtx, {
type: 'bar',
data: {
labels: sellerLabels,
datasets: [{
label: 'Number of Listings',
data: sellerValues,
backgroundColor: sellerColors,
borderWidth: 0
}]
},
options: {
indexAxis: 'y', // Horizontal bar chart
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
beginAtZero: true,
title: {
display: true,
text: 'Number of Listings'
},
ticks: {
maxRotation: 0,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
},
y: {
title: {
display: false
},
ticks: {
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
}
}
}
}
});
console.log("Seller chart initialized");
} else {
console.error("Seller chart canvas not found");
}
// Country chart
var countryCtx = document.getElementById('countryChart');
if (countryCtx) {
console.log("Country chart canvas found");
// Country data
var countryLabels = [];
var countryValues = [];
var countryColors = ['#3671b0', '#4CAF50', '#FFC107', '#F44336', '#9C27B0', '#2196F3', '#FF9800', '#795548'];
countryLabels.push('US');
countryValues.push(8);
new Chart(countryCtx, {
type: 'bar',
data: {
labels: countryLabels,
datasets: [{
label: 'Number of Listings',
data: countryValues,
backgroundColor: countryColors,
borderWidth: 0
}]
},
options: {
indexAxis: 'y', // Horizontal bar chart
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
beginAtZero: true,
title: {
display: true,
text: 'Number of Listings'
},
ticks: {
maxRotation: 0,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
},
y: {
ticks: {
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
}
}
}
}
});
console.log("Country chart initialized");
} else {
console.error("Country chart canvas not found");
}
// Recent Sales Analysis chart
var recentSalesCtx = document.getElementById('recentSalesChart');
var noSalesDataElement = document.getElementById('noSalesData');
if (recentSalesCtx) {
console.log("Recent sales chart canvas found");
// Initialize the soldData array before using it
var soldData = [];
soldData.push({
title: 'Sadowsky MetroExpress IV 4-str...',
price: 129.99,
date: 'Mar 25'
});
soldData.push({
title: 'Sadowsky MetroExpress IV 4-str...',
price: 137.99,
date: 'Dec 9'
});
// Check if we have sold data to display
// Hide the "no data" message
if (noSalesDataElement) {
noSalesDataElement.style.display = 'none';
}
// Extract data for chart
var labels = soldData.map(function(item) { return item.date; });
var prices = soldData.map(function(item) { return item.price; });
var titles = soldData.map(function(item) { return item.title; });
new Chart(recentSalesCtx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Sale Price',
data: prices,
borderColor: '#4CAF50',
backgroundColor: 'rgba(76, 175, 80, 0.1)',
borderWidth: 2,
tension: 0.1,
fill: true,
pointBackgroundColor: '#4CAF50',
pointRadius: 5,
pointHoverRadius: 7
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Price ($)'
},
ticks: {
maxRotation: 0,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
},
x: {
title: {
display: true,
text: 'Sale Date'
},
ticks: {
maxRotation: 45,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
},
callbacks: {
title: function(tooltipItems) {
return titles[tooltipItems[0].dataIndex];
},
label: function(context) {
return '$' + context.raw.toFixed(2);
}
}
}
}
}
});
console.log("Recent sales chart initialized");
} else {
console.error("Recent sales chart canvas not found");
}
// Price distribution chart
var priceCtx = document.getElementById('priceChart');
if (priceCtx) {
console.log("Price chart canvas found");
// Calculate price ranges
var minPrice = 129.99;
var maxPrice = 154.99;
var range = maxPrice - minPrice;
var segments = 5;
var step = range / segments;
var priceLabels = [];
for (var i = 0; i < segments; i++) {
var start = minPrice + (step * i);
var end = start + step;
priceLabels.push('$' + start.toFixed(0) + ' - $' + end.toFixed(0));
}
// Use actual distribution data rather than mock data
// For now, we'll use a more representative distribution
var priceDistribution = [
1,
2,
3,
2,
0 ];
new Chart(priceCtx, {
type: 'bar',
data: {
labels: priceLabels,
datasets: [{
label: 'Number of Listings',
data: priceDistribution,
backgroundColor: '#3671b0',
borderColor: '#285483',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Number of Listings'
},
ticks: {
maxRotation: 0,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
},
x: {
title: {
display: true,
text: 'Price Range'
},
ticks: {
maxRotation: 45,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
}
}
}
}
});
console.log("Price chart initialized");
} else {
console.error("Price chart canvas not found");
}
// Pricing Overview Comparison chart
var pricingOverviewCtx = document.getElementById('pricingOverviewChart');
if (pricingOverviewCtx) {
console.log("Pricing overview chart canvas found");
new Chart(pricingOverviewCtx, {
type: 'bar',
data: {
labels: ['Average', 'Median', 'Highest', 'Lowest'],
datasets: [
{
label: 'All Listings',
data: [
144.99,
145.49,
154.99,
129.99 ],
backgroundColor: '#3671b0',
borderWidth: 0
},
{
label: 'Active',
data: [
148.657,
146.99,
154.99,
142.99 ],
backgroundColor: '#4CAF50',
borderWidth: 0
},
{
label: 'Sold',
data: [
133.99,
133.99,
137.99,
129.99 ],
backgroundColor: '#2196F3',
borderWidth: 0
},
{
label: 'Unsold',
data: [
148.657,
146.99,
154.99,
142.99 ],
backgroundColor: '#F44336',
borderWidth: 0
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
title: {
display: true,
text: 'Price ($)'
},
ticks: {
maxRotation: 0,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
},
x: {
title: {
display: true,
text: 'Price Metrics'
},
ticks: {
maxRotation: 45,
autoSkip: true,
font: {
size: function(context) {
var width = context.chart.width;
return width < 500 ? 10 : 12;
}
}
}
}
},
plugins: {
legend: {
display: false
},
tooltip: {
displayColors: false,
caretSize: 6,
bodyFont: {
size: 12
},
titleFont: {
size: 13
},
callbacks: {
label: function(context) {
return context.dataset.label + ': $' + context.raw.toFixed(2);
}
}
}
}
}
});
console.log("Pricing overview chart initialized");
} else {
console.error("Pricing overview chart canvas not found");
}
console.log("All charts initialized successfully");
} catch (error) {
console.error("Error initializing charts:", error);
}
}