import ApexCharts from '../thirdparty/apexchartsWrapper.js'; document.addEventListener('DOMContentLoaded', function () { 'use strict'; /***************************************************************/ /* Subscription Dashboard Chart #subscription-chart */ /***************************************************************/ if (document.getElementById('subscription-chart')) { const categories = ['2025-01', '2025-02', '2025-03', '2025-04', '2025-05', '2025-06', '2025-07', '2025-08', '2025-09', '2025-10', '2025-11', '2025-12']; const visitsData = [23686, 30820, 59622, 146465, 78160, 79520, 36148, 48721, 158303, 155174, 104830, 86895]; const subscriptionsData = [1545, 1350, 1270, 1830, 1955, 1865, 2034, 2544, 1956, 2211, 1540, 1670]; const subscriptionChartOptions = { series: [ { name: 'Visits', type: 'area', data: visitsData }, { name: 'Subscriptions', type: 'line', data: subscriptionsData } ], chart: { height: 335, type: 'line', zoom: { enabled: false }, stacked: false, toolbar: { show: false }, fontFamily: 'inherit', parentHeightOffset: 0 }, colors: [ window.colorMap.bootstrapVars.bodyColor.rgba(0.1), // Visits (gray, area) window.colorMap.primary[400].hex // Subscriptions (teal, line) ], stroke: { width: [1, 2], curve: 'smooth', colors: [window.colorMap.bootstrapVars.bodyColor.rgba(0.8), window.colorMap.primary[400].hex], dashArray: [4, 0], // Visits dashed, Subscriptions solid }, fill: { type: ['solid', 'solid'], opacity: [0.15, 1], }, markers: { size: [3, 3], colors: [window.colorMap.bootstrapVars.bodyColor.rgba(0.7), window.colorMap.primary[600].hex], strokeColors: [window.colorMap.bootstrapVars.bodyColor.rgba(0.7), window.colorMap.primary[600].hex], strokeWidth: 2, hover: { sizeOffset: 2 } }, xaxis: { categories: categories, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '12px' } }, axisBorder: { show: false }, axisTicks: { show: false } }, yaxis: [ { seriesName: 'Visits', min: 20000, max: 170000, tickAmount: 6, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '12px' }, formatter: function (val) { return val.toLocaleString(); } } }, { seriesName: 'Subscriptions', opposite: true, min: 1200, max: 2700, tickAmount: 6, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '12px' }, formatter: function (val) { return val.toLocaleString(); } } } ], legend: { show: true, position: 'top', horizontalAlign: 'center', fontSize: '14px', fontFamily: 'inherit', labels: { colors: window.colorMap.bootstrapVars.bodyColor.hex }, markers: { width: 18, height: 6, radius: 2 }, itemMargin: { horizontal: 12, vertical: 0 } }, grid: { borderColor: window.colorMap.bootstrapVars.bodyColor.rgba(0.1), strokeDashArray: 3, yaxis: { lines: { show: true } }, xaxis: { lines: { show: false } } }, tooltip: { shared: true, intersect: false, theme: 'dark', y: [ { formatter: function (val) { return val.toLocaleString(); } }, { formatter: function (val) { return val.toLocaleString(); } } ] } }; const subscriptionChart = new ApexCharts( document.getElementById('subscription-chart'), subscriptionChartOptions ); subscriptionChart.render(); } /***************************************************************/ /* User Activity Chart #user-activity-chart */ /***************************************************************/ if (document.getElementById('user-activity-chart')) { const categories = ['Blogging', 'Videos', 'Ads', 'Comments', 'Shares', 'Likes', 'Funny']; const userActivityChartOptions = { series: [ { name: 'Morning', data: [65, 59, 90, 81, 56, 55, 40] }, { name: 'Night', data: [28, 48, 40, 19, 96, 27, 100] } ], chart: { height: 350, width: '100%', type: 'radar', toolbar: { show: false }, fontFamily: 'inherit', parentHeightOffset: 0, sparkline: { enabled: false }, margin: 0, padding: { top: -10, right: -10, bottom: -10, left: -10 } }, colors: [ window.colorMap.success[400].hex, // Morning (light purple) window.colorMap.primary[400].hex // Night (teal) ], stroke: { width: 0, colors: [window.colorMap.success[400].hex, window.colorMap.primary[400].hex] }, fill: { opacity: 0.2 }, markers: { size: 5, colors: [window.colorMap.success[400].hex, window.colorMap.primary[400].hex], strokeColors: '#fff', strokeWidth: 2, hover: { sizeOffset: 2 } }, xaxis: { categories: categories, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '10px' } } }, yaxis: { max: 100, tickAmount: 5, show: true, labels: { show: true, style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '10px' } } }, legend: { show: true, position: 'top', horizontalAlign: 'center', fontSize: '14px', fontFamily: 'inherit', labels: { colors: window.colorMap.bootstrapVars.bodyColor.hex }, markers: { width: 18, height: 6, radius: 2 }, itemMargin: { horizontal: 12, vertical: 0 } }, tooltip: { theme: 'dark', y: { formatter: function (val) { return val; } } }, grid: { borderColor: window.colorMap.bootstrapVars.bodyColor.rgba(0.1), strokeDashArray: 3 }, plotOptions: { radar: { size: undefined, offsetX: 0, offsetY: 0, padding: 0, polygons: { strokeColors: window.colorMap.bootstrapVars.bodyColor.rgba(0.1), connectorColors: window.colorMap.bootstrapVars.bodyColor.rgba(0.1), fill: { colors: undefined } } } } }; const userActivityChart = new ApexCharts( document.getElementById('user-activity-chart'), userActivityChartOptions ); userActivityChart.render(); } /***************************************************************/ /* Data Stream Chart #data-stream-chart */ /***************************************************************/ if (document.getElementById('data-stream-chart')) { const categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul']; const positiveData = [0, 25, 70, 85, 25, 0, 60]; const negativeData = [-45, -50, -30, -25, -60, -120, 0]; const dataStreamChartOptions = { series: [ { name: 'Positive', data: positiveData }, { name: 'Negative', data: negativeData } ], chart: { type: 'bar', height: 350, maxHeight: '100%', stacked: true, toolbar: { show: false }, fontFamily: 'inherit', parentHeightOffset: 0 }, colors: [ window.colorMap.success[400].hex, // Positive (teal) window.colorMap.primary[500].hex // Negative (blue) ], plotOptions: { bar: { columnWidth: '50%', borderRadius: 1 } }, dataLabels: { enabled: false }, xaxis: { categories: categories, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '12px' } }, axisBorder: { show: false }, axisTicks: { show: false } }, yaxis: { min: -150, max: 150, tickAmount: 6, labels: { style: { colors: window.colorMap.bootstrapVars.bodyColor.hex, fontSize: '12px' }, formatter: function (val) { return val; } } }, legend: { show: true, position: 'top', horizontalAlign: 'center', fontSize: '14px', fontFamily: 'inherit', labels: { colors: window.colorMap.bootstrapVars.bodyColor.hex }, markers: { width: 18, height: 6, radius: 2 }, itemMargin: { horizontal: 12, vertical: 0 } }, grid: { borderColor: window.colorMap.bootstrapVars.bodyColor.rgba(0.1), strokeDashArray: 3, yaxis: { lines: { show: true } }, xaxis: { lines: { show: true } } }, tooltip: { shared: true, intersect: false, theme: 'dark', y: { formatter: function (val) { return val; } } } }; const dataStreamChart = new ApexCharts( document.getElementById('data-stream-chart'), dataStreamChartOptions ); dataStreamChart.render(); } /***************************************************************/ /* Demographic Marketing Chart #demographic-marketing-chart */ /***************************************************************/ if (document.getElementById('demographic-marketing-chart')) { const countries = ['USA', 'Germany', 'Australia', 'Canada', 'France']; const data = [25, 30, 15, 10, 20]; // Percentages const demographicMarketingChartOptions = { series: data, chart: { type: 'pie', height: 350, maxHeight: '100%', toolbar: { show: false }, fontFamily: 'inherit', parentHeightOffset: 0 }, colors: [ window.colorMap.primary[100].hex, // USA (light purple) window.colorMap.primary[400].hex, // Germany (darker purple) window.colorMap.success[100].hex, // Australia (light blue) window.colorMap.success[300].hex, // Canada (light teal) window.colorMap.success[500].hex // France (teal) ], labels: countries, dataLabels: { enabled: false }, plotOptions: { pie: { donut: { size: '0%' } } }, legend: { position: 'bottom', horizontalAlign: 'center', fontSize: '14px', fontFamily: 'inherit', labels: { colors: window.colorMap.bootstrapVars.bodyColor.hex }, markers: { width: 12, height: 12, radius: 2 }, itemMargin: { horizontal: 10, vertical: 2 } }, tooltip: { theme: 'dark', y: { formatter: function (val) { return val + '%'; } }, style: { fontSize: '14px', fontFamily: 'inherit' }, custom: function ({ series, seriesIndex, dataPointIndex, w }) { const country = w.globals.labels[seriesIndex]; const value = series[seriesIndex]; return '
Define Custom Audience