chartflow-express / script.js
lonestar108's picture
A really nice stock chart using trading views simple chart, enhanced with a top icon toolbar and a left hand icon toolbar just like tradingView
3d8e647 verified
document.addEventListener('DOMContentLoaded', () => {
// Sidebar button interactions
const sidebarButtons = document.querySelectorAll('.sidebar-btn');
sidebarButtons.forEach(button => {
button.addEventListener('click', () => {
sidebarButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
});
});
// Theme toggle functionality (could be expanded)
const themeToggle = document.createElement('button');
themeToggle.className = 'toolbar-btn ml-4';
themeToggle.innerHTML = '<i data-feather="moon"></i>';
document.querySelector('.bg-gray-800').appendChild(themeToggle);
themeToggle.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
feather.replace();
});
// Resize chart when window resizes
window.addEventListener('resize', () => {
if (window.TradingView) {
window.dispatchEvent(new Event('resize'));
}
});
});