@@ -249,7 +249,7 @@ <h4 class="text-xl font-bold dark:text-white">
249249 // Pull data from the backend
250250 const products = JSON . parse ( '{{ products | safe }}' ) ;
251251
252- function getSalesByCategoryOptions ( data ) {
252+ function getProductsBarChart ( data ) {
253253 return {
254254 colors : [ '#1A56DB' , '#FDBA8C' ] ,
255255 series : [ {
@@ -323,7 +323,7 @@ <h4 class="text-xl font-bold dark:text-white">
323323 } ;
324324 }
325325
326- const trafficByDeviceOptions = ( data ) => {
326+ const getProductsPieChart = ( data ) => {
327327 let trafficChannelsChartColors = { } ;
328328 if ( document . documentElement . classList . contains ( 'dark' ) ) {
329329 trafficChannelsChartColors = {
@@ -401,14 +401,14 @@ <h4 class="text-xl font-bold dark:text-white">
401401 } ;
402402
403403 ( async ( ) => {
404- const salesByCategoryChart = new ApexCharts ( document . getElementById ( 'sales-by-category' ) , getSalesByCategoryOptions ( products ) ) ;
405- salesByCategoryChart . render ( ) ;
404+ const productsBarChart = new ApexCharts ( document . getElementById ( 'sales-by-category' ) , getProductsBarChart ( products ) ) ;
405+ productsBarChart . render ( ) ;
406406
407- const trafficByDeviceChart = new ApexCharts ( document . getElementById ( 'traffic-by-device' ) , trafficByDeviceOptions ( products ) ) ;
408- trafficByDeviceChart . render ( ) ;
407+ const productsPieChart = new ApexCharts ( document . getElementById ( 'traffic-by-device' ) , getProductsPieChart ( products ) ) ;
408+ productsPieChart . render ( ) ;
409409
410410 document . addEventListener ( 'dark-mode' , function ( ) {
411- trafficByDeviceChart . updateOptions ( trafficByDeviceOptions ( products ) ) ;
411+ productsPieChart . updateOptions ( getProductsPieChart ( products ) ) ;
412412 } ) ;
413413 } ) ( ) ;
414414
0 commit comments