<?php
    // session_start();
    // if(!isset($_SESSION['user']))
    // {
    //     header('location:index.php');
    // }
    include('config.php');
    // $user_name = $_SESSION['user'];
?>

<!DOCTYPE html>
<html lang="en" class="light-style customizer-hide">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
        <title>Dynata Dashboard</title>
        <meta name="description" content="" />
        <!-- Fonts -->
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
        <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Liter&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
        
        <link href="assets/css/main.d810cf0ae7f39f28f336.css" rel="stylesheet">
        <link href="assets/css/animate.css" rel="stylesheet">
        <link href="assets/css/animate.min.css" rel="stylesheet">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/css/bootstrap-multiselect.css">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
        <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/fontawesome.min.css" integrity="sha512-d0olNN35C6VLiulAobxYHZiXJmq+vl+BGIgAxQtD5+kqudro/xNMvv2yIHAciGHpExsIbKX3iLg+0B6d0k4+ZA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> -->
        <link rel="stylesheet" href="assets/select2/select2.min.css">
        <link rel="stylesheet" href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.css" />
        <script type="text/javascript" src="assets/scripts/jquery.min.js"></script>
        <link rel="stylesheet" href="assets/css/styleX.css">

        <style>
            body {
                font-family: "Open Sans", serif;
                font-size: 16px;
                color: #333;
            }
            h1, h2, h3, h4, h5, h6,input, button, select, optgroup, textarea {
                font-family: "Open Sans", serif;
                font-weight: bold;
                color: #000;
            }
            /* @font-face {
                font-family: 'Aptos';
                src: url('assets/fonts/aptos-font/Aptos-Regular.ttf') format('truetype');
                font-weight: normal;
                font-style: normal;
            }

            @font-face {
                font-family: 'Aptos';
                src: url('../fonts/Aptos-Bold.ttf') format('truetype');
                font-weight: bold;
                font-style: normal;
            }
            body {
                font-family: 'Aptos', sans-serif !important;
                font-size: 16px;
                color: #333;
            }

            h1, h2, h3, h4, h5, h6,input, button, select, optgroup, textarea {
                font-family: 'Aptos', sans-serif !important;
                font-weight: bold;
                color: #000;
            } */
            .top_col
            {
                max-width:100px !important;
            }
            .offscreen {
            position: absolute;
            top: -10000px;
            left: -10000px;
            visibility: hidden;
        }
        #ppt_frame
        {
            position: absolute;
            top: 0px;
            /* z-index: 999999; */
            width: 100%;
            height: 100%;
            display:none;
        }
        iframe
        {
            width: 100%;
            height: 100%;
        }
        .left-section, .right-section {
            max-height: 430px; /* Adjust height as needed */
            overflow-y: auto;
            overflow-x: hidden;
        }

        /* .pr2, .pr4 {
            padding-right: 15px;
        } */

        .cardBg {
            background-color: #FFFFFF; /* Adjust to match your theme */
            border: 1px solid #ddd;
            border-radius: 5px;
            padding: 5px;
        }
        .card-header>.nav {
            margin-left: 0rem !important;
            height: 100%;
            width: 100%;
        }
        .card-header {
            height: 2.5rem;
        }
        .nav-link {
            display: block;
            padding: .2rem 1rem;
        }
        .female_selected_shadow
        {
            filter: drop-shadow(0px 3px 7px #FF94D4);
        }
        .male_selected_shadow
        {
            filter: drop-shadow(0px 3px 7px #8BCAFF);
        }
        .selected_shadow
        {
            filter: drop-shadow(0px 0px 7px #000000);
        }
        .switchG {
            height: 32px;
            width: 210px;
            margin: 0px;
            background: #FFFFFF;
            border-radius: 32px;
            top: 6px;
            position: fixed;
            right: 317px;
            z-index: 100000;
            box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;

        }

        .switch-labelG {
            font-weight: bold;
            position: relative;
            z-index: 2;
            float: left;
            width: 70px;
            line-height: 32px;
            font-size: 12px;
            color: #676a6c;
            text-align: center;
            cursor: pointer;
            margin-bottom:0px;
        }

        .switch-inputG {
            display: none;
        }

        .switch-inputG:checked + .switch-labelG {
            color: #FFF;
            transition: 0.15s ease-out;
            transition-property: color, text-shadow;
        }

        .switch-inputG:checked + .switch-labelG-y ~ .switch-selectorG {
            transform: translateX(0%);
            background-color: #1AB394;
        }

        .switch-inputG:checked + .switch-labelG-i ~ .switch-selectorG {
            transform: translateX(200%);
            background-color: #1AB394;
        }

        .switch-inputG:checked + .switch-labelG-n ~ .switch-selectorG {
            transform: translateX(100%);
            background-color: #1AB394;
        }

        .switch-selectorG {
            position: absolute;
            z-index: 1;
            top: 0px;
            left: 0px;
            display: block;
            width: 70px;
            height: 32px;
            border-radius: 32px;
            background-color: #1ab394;
            transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
        }
        label {
    display: inline-block;
    margin-bottom: .5rem;
    font-size: 0.8rem;
    font-weight: 400;
}
.btn-group .btn {
    font-size: .7rem;
    font-weight: 500;
}
.vertical-nav-menu {
    margin: 0;
    padding: 0;
    position: relative;
    list-style: disc;
}
.vertical-nav-menu li a {
    height: auto !important;
}
.yesno_img
{
    height: 40px;
    width: 40px;
}
h6.img_txt {
    font-size: 0.7rem;
}
.cardShadow {
    /* box-shadow: none !important; */
    /* box-shadow: rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px; */
    box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px !important;
    /* box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; */
}

img.toggle_cat {
    height: 25px;
}
.app-header {
   
    z-index: 999;
    
}
ul.vertical-nav-menu > li.mm-active > ul.mm-show > li.mm-active.active > a[aria-expanded="true"] {
    background-color: #002060 !important;
    color: #FFFFFF !important;
    font-weight: 500 !important;
}
.scroll-section
{
    max-height: 100%; 
    overflow-y: auto;
    overflow-x: hidden;
}

.logo_div
{
    display: flex;
    justify-content: space-evenly;
    align-items: center;
}

.dynata_logo1
{
    height: 40px;
}

.dynata_logo2
{
    height: 70px;
}
.app-header__logo
{
    width: 5%;
}
.app-theme-white .app-footer .app-footer__inner, .app-theme-white .app-header {
    background-color: white !important;
}
.bottom_border_div {
    height: 1px;
    background-color: #E97132;
    border-radius: 50px;
    width: 90%;
    margin: 0px auto;
}
.custom_base {
    font-size: 0.6rem;
    text-align: right;
    padding-right: 5px;
}
.qno {
    letter-spacing: 0px;
    font-size: 0.6rem;
}
.app-header {
    height: 50px;
    display: flex;
    align-items: normal;
}

.app-header__content,.app-header-left,.app-header-right
{
    height: 100% !important;
}
.app-header__content
{
    padding:0px !important;
}
.app-header-left
{
    display: block !important;
    width:22%
}
.app-header-right
{
    width:100%;
    align-items: start !important;
    flex-direction: column !important;
}

.filterDiv
{
    display:flex;
    width:100%
}

.filterDiv2
{
    display:flex;
    width:100%
}

.allfilterSpace
{
    display: block;
    width: 83%;
}

.random1
{
    display:flex;
}

.random2
{
    display:flex;
    margin-left:230px;
}

.allbuttonSpace
{
    display:flex;
    width:15%
}

.overallbasediv
{
    text-align:center;
    margin-left:-16px;
    border-radius:5px;
    background-color:#002060;
    max-height:30px;
}
.heading_div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ashclassX
{
    margin-top: 10px
}

.ashiconX
{
    font-size:1.3rem;
    color:#002060;
}

.ashiconX2
{
    font-size:1.2rem;
    color:#002060;
}

.outer_li 
{
    margin-left: 2rem;
}

.nxt_head {
    margin-left: 0.5rem;
    font-weight:bold;
}

@media screen and (max-width: 1285px) and (max-height: 805px) {
    .ashiconX
    {
        font-size:1.1rem;
        color:#002060;
    }

    .ashiconX2
    {
        font-size:1.0rem;
        color:#002060;
    }
}
.custom-break {
    margin: -10px 0;
}

.addFD
{
    background-color:#ffe6cc !important;
}

.lowerBase
{
    color : #ff3333;
}

.highcharts-label > text
{
    font-weight: normal !important;
    font-size: 0.7rem !important;
}

.circle {
    background-color: #002060;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left:-8px;
}

        </style>
    </head>

    <body>
        <div class="app-container app-theme-white body-tN-shadow fixed-sidebar fixed-header" id="app-containerX">
            <div class="app-header" style="height:30px;background-color:#FFFFFF">
                <div class="app-header__content">
                    <div class="app-header-left">
                        <div class="logo_div" style="background-color:#FFFFFF">
                            <img class="dynata_logo1" src="assets/images/dynata_logo.png" alt="">
                            <img class="dynata_logo2" src="assets/images/dynata_logo2.png" alt="">
                        </div>
                        <div class="heading_div mt-3" style="background-color:#FFFFFF">
                            <button type="button" class="btn btn-sm btn-brand" onclick="tabSidebar()" style="height:30px;cursor:pointer;border:0px" id="openbtn" data-status="1">
                                <i class="fa fa-bars" style="font-size:1.3rem;color:#002060"></i>
                            </button>
                            <h4 style="text-align:center;font-weight:600;font-size:1.2rem;margin:0px auto"><span style="color:#002060">CONSUMPTION</span> <span style="color:#E97132;font-style: italic">TRENDS</span></h4>
                        </div>
                    </div>
                    <div class="app-header-right" style="padding-left:5px;background-color:#002060">
                        <div class="filterDiv">
                            <div class="allfilterSpace">
                                <div class="random1">
                                    <div class="ashclassX" style="margin-right:3px">
                                        <div style="margin-top:5px">
                                            <button type="button" class="btn btn-brandXXX2" style="background-color:white">
                                                <span class="circle">
                                                    <i class="fa fa-filter"></i>
                                                </span>
                                                <span>FILTER</span>
                                            </button>
                                        </div>
                                    </div>
                                    <div class="ashclassX">
                                        <div style="margin-top:5px">
                                            <button type="button" class="btn-transition btn btn-light btn-sm btn-brandXXX" onclick="flagConstruct()" style="background-color:#adebad" data-toggle="tooltip" data-placement="bottom" title="">
                                                Apply
                                            </button>
                                            <button type="button" class="btn-transition btn btn-light btn-sm btn-brandXXX" onclick="resetFilters()" style="background-color:#ff9999" data-toggle="tooltip" data-placement="bottom" title="">
                                                Reset
                                            </button>
                                        </div>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="quarter" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            <?php 
                                                foreach($quarter as $key => $value){
                                                    echo '<option value="'.($key+1).'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="country" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important" onchange="countryFX(this.id);">
                                            <?php 
                                                foreach($country as $key => $value){
                                                    echo '<option value="'.($key+1).'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="region" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="age" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            <?php 
                                                foreach($ageX as $key => $value){
                                                    echo '<option value="'.$key.'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="random2">
                                    <div class="ashclassX">
                                        <select id="gender" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            <?php 
                                                foreach($gender as $key => $value){
                                                    echo '<option value="'.($key+1).'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="HHI" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="halal" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            <?php 
                                                foreach($halal as $key => $value){
                                                    echo '<option value="'.($key+1).'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="ashclassX">
                                        <select id="race" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                        
                                        </select>
                                    </div>
                                    <div class="ashclassX" style="display:none">
                                        <select id="protienF" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                            <?php 
                                                foreach($PDC0labelX as $key => $value){
                                                    echo '<option value="'.($key+1).'" data-name="'.$value.'">'.$value.'</option>'; 
                                                }
                                            ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div style="width:2%"></div>
                            <div class="allbuttonSpace">
                                <div class="ashclassX">
                                    <div style="margin-top:5px">
                                        <button type="button" class="btn btn-sm btn-brand" data-value="Trends" onclick="trends(this);" style="height:30px;cursor:pointer;margin-bottom:5px;border:0px;background-color:white" id="trends_btn">
                                            <i class="fa fa-line-chart ashiconX"></i>
                                        </button>
                                        <button type="button" class="btn btn-sm btn-brand" data-value="Tbl" onclick="swapTable(this);" style="height:30px;cursor:pointer;margin-bottom:5px;border:0px;background-color:white" id="swap_tbl_btn">
                                            <i class="fa fa-table ashiconX"></i>
                                        </button>
                                        <button type="button" class="btn btn-sm btn-brand" onclick="exportExcelFlag();" style="height:30px;cursor:pointer;margin-bottom:5px;border:0px;background-color:white">
                                            <i class="fa fa-file-excel-o ashiconX2"></i>
                                        </button>
                                        <button type="button" class="btn btn-sm btn-brand" onclick="logout();" style="height:30px;cursor:pointer;margin-bottom:5px;border:0px;background-color:white">
                                            <i class="fa fa-power-off ashiconX2"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="filterDiv2">
                            <div id="filterdefination_overall_div" style="width:83%;border-radius: 5px;color:white">
                                <textarea class="paraX" style="height:auto;max-width:200px;word-wrap:break-word;display:none;color:#002060">Filters:All Selected</textarea>
                                <h6 class="mt-2 paraY" style="height:auto;color:#FFFFFF;font-size:0.8rem;font-weight:normal">Applied Filters:All Selected</h6>
                            </div>
                            <div style="width:2%"></div>
                            <div class="overallbasediv" style="width:15%">
                                <h6 class="ml-2 mt-2" style="height:auto;color:#FFFFFF;font-size:1rem;font-weight:normal">Sample Size:<span id="overallBase">517</span></h6>
                            </div>
                            <div id="filterdefination_trend_div" style="display:none">
                                <p class="ml-2 mt-3 paraYT" style="height:auto;color:#000000">Filters:All Selected</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div><!-- app-header div-->
            <div id="mySidebar" class="sidebar">
                <?php include("tabs.php"); ?>
            </div>
            <div class="app-main" id="main">
                <div class="splash">
                    <div class="splash-title">
                        <div class="spinner">

                        </div>
                    </div>
                </div>
                <div class="app-main__outer" style="background-color: #E4ECF3;">
                    <div class="app-main__inner" style="padding: 0px;padding-right:15px">
                        <div class="tab-content">
                            <div class="card cardXX pr3" style="background-color:#FFFFFF;display:none">
                                <div class="row">
                                    <div class="col-md-4">
                                        <h6 class="ml-2 mt-2"><b style="font-weight: 500;color:#000000" id="activetabname">Profiling | Overall Level Base</b></h6>
                                    </div>
                                    <div class="col-md-5" style="text-align:end">
                                    </div>
                                    
                                </div>
                            </div>
                            <div class="card cardXX pr3" style="background-color:#FFFFFF;">
                                <div class="row">
                                    <div class="col-lg-12 d-flex">
                                        
                                        <!-- <div style="display:flex;justify-content:end;flex-direction:column;align-items:center;margin-top: 10px" class="ml-2">
                                            <label for="editionDate"><b style="font-weight:500">Quarter</b></label>
                                            
                                        </div>
                                        <div style="display:flex;justify-content:end;flex-direction:column;align-items:center;margin-top: 10px">
                                            <label for="editionDate"><b style="font-weight:500">Quarter</b></label>
                                            
                                        </div> -->
                                        
                                        <!-- <div style="display:flex;justify-content:end;flex-direction:column;align-items:center;margin-top: 10px">
                                            <label for="editionDate" style="margin-bottom:0px"><b style="font-weight:500">Filter</b></label>
                                            <select id="zone9" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                                <?php 
                                                    // foreach($zone as $key => $value){
                                                    //     echo '<option value="'.$key.'" data-name="'.$value.'">'.$value.'</option>'; 
                                                    // }
                                                ?>
                                            </select>
                                        </div> -->
                                        <!-- <div style="display:flex;justify-content:end;flex-direction:column;align-items:center;margin-top: 10px">
                                            <label for="editionDate" style="margin-bottom:0px"><b style="font-weight:500">Filter</b></label>
                                            <select id="zone10" class="form-control" multiple="multiple" style="height:35px;font-size:0.8rem !important;border: 1px solid grey !important">
                                                <?php 
                                                    // foreach($zone as $key => $value){
                                                    //     echo '<option value="'.$key.'" data-name="'.$value.'">'.$value.'</option>'; 
                                                    // }
                                                ?>
                                            </select>
                                        </div> -->
                                    </div>
                                </div>
                            </div>
<!----------------------------------------------------- OUTER TAB START ------------------------------------------------------------------>

<!----------------------------------------------------- OUTER TAB 1 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane1 active" id="tab-eg7-0-0" role="tabpanel" data-status="active">
    <?php include "intro.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 1 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 2 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane2" id="tab-eg7-1-0" role="tabpanel" data-status="inactive">
    <?php include "method.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 2 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 3 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane3" id="tab-eg7-2-0" role="tabpanel" data-status="inactive">
    <?php include "CH.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 3 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 4 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane4" id="tab-eg7-3-0" role="tabpanel" data-status="inactive">
    <?php include "CM.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 4 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 5 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-0" role="tabpanel" data-status="inactive">
    <?php include "FD_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-1" role="tabpanel" data-status="inactive">
    <?php include "FD_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-2" role="tabpanel" data-status="inactive">
    <?php include "FD_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-3" role="tabpanel" data-status="inactive">
    <?php include "FD_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-4" role="tabpanel" data-status="inactive">
    <?php include "FD_5.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-5" role="tabpanel" data-status="inactive">
    <?php include "FD_6.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane5" id="tab-eg7-4-6" role="tabpanel" data-status="inactive">
    <?php include "FD_7.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 5 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 6 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane6" id="tab-eg7-5-0" role="tabpanel" data-status="inactive">
    <?php include "Y_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane6" id="tab-eg7-5-1" role="tabpanel" data-status="inactive">
    <?php include "Y_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane6" id="tab-eg7-5-2" role="tabpanel" data-status="inactive">
    <?php include "Y_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane6" id="tab-eg7-5-3" role="tabpanel" data-status="inactive">
    <?php include "Y_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane6" id="tab-eg7-5-4" role="tabpanel" data-status="inactive">
    <?php include "Y_5.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 6 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 7 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane7" id="tab-eg7-6-0" role="tabpanel" data-status="inactive">
    <?php include "MD_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane7" id="tab-eg7-6-1" role="tabpanel" data-status="inactive">
    <?php include "MD_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane7" id="tab-eg7-6-2" role="tabpanel" data-status="inactive">
    <?php include "MD_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane7" id="tab-eg7-6-3" role="tabpanel" data-status="inactive">
    <?php include "MD_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 7 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 8 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane8" id="tab-eg7-7-0" role="tabpanel" data-status="inactive">
    <?php include "CEM_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane8" id="tab-eg7-7-1" role="tabpanel" data-status="inactive">
    <?php include "CEM_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 8 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 9 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane9" id="tab-eg7-8-0" role="tabpanel" data-status="inactive">
    <?php include "PD_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane9" id="tab-eg7-8-1" role="tabpanel" data-status="inactive">
    <?php include "PD_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane9" id="tab-eg7-8-2" role="tabpanel" data-status="inactive">
    <?php include "PD_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane9" id="tab-eg7-8-3" role="tabpanel" data-status="inactive">
    <?php include "PD_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 9 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 10 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane10" id="tab-eg7-9-0" role="tabpanel" data-status="inactive">
    <?php include "AD_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 10 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 11 ---------------------------------------------------->

<div class="tab-pane custom-tab-pane11" id="tab-eg7-10-0" role="tabpanel" data-status="inactive">
    <?php include "CK_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 11 ---------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 12 --------------------------------------------------->

<div class="tab-pane custom-tab-pane12" id="tab-eg7-11-0" role="tabpanel" data-status="inactive">
    <?php include "SD_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane12" id="tab-eg7-11-1" role="tabpanel" data-status="inactive">
    <?php include "SD_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane12" id="tab-eg7-11-2" role="tabpanel" data-status="inactive">
    <?php include "SD_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 12 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 13 --------------------------------------------------->

<div class="tab-pane custom-tab-pane13" id="tab-eg7-12-0" role="tabpanel" data-status="inactive">
    <?php include "CL_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 13 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 14 --------------------------------------------------->

<div class="tab-pane custom-tab-pane14" id="tab-eg7-13-0" role="tabpanel" data-status="inactive">
    <?php include "BC_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane14" id="tab-eg7-13-1" role="tabpanel" data-status="inactive">
    <?php include "BC_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane14" id="tab-eg7-13-2" role="tabpanel" data-status="inactive">
    <?php include "BC_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane14" id="tab-eg7-13-3" role="tabpanel" data-status="inactive">
    <?php include "BC_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 14 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 15 --------------------------------------------------->

<div class="tab-pane custom-tab-pane15" id="tab-eg7-14-0" role="tabpanel" data-status="inactive">
    <?php include "CC_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane15" id="tab-eg7-14-1" role="tabpanel" data-status="inactive">
    <?php include "CC_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane15" id="tab-eg7-14-2" role="tabpanel" data-status="inactive">
    <?php include "CC_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane15" id="tab-eg7-14-3" role="tabpanel" data-status="inactive">
    <?php include "CC_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 15 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 16 --------------------------------------------------->

<div class="tab-pane custom-tab-pane16" id="tab-eg7-15-0" role="tabpanel" data-status="inactive">
    <?php include "BAR_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane16" id="tab-eg7-15-1" role="tabpanel" data-status="inactive">
    <?php include "BAR_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane16" id="tab-eg7-15-2" role="tabpanel" data-status="inactive">
    <?php include "BAR_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane16" id="tab-eg7-15-3" role="tabpanel" data-status="inactive">
    <?php include "BAR_4.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 16 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB 17 --------------------------------------------------->

<div class="tab-pane custom-tab-pane17" id="tab-eg7-16-0" role="tabpanel" data-status="inactive">
    <?php include "BB_1.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane17" id="tab-eg7-16-1" role="tabpanel" data-status="inactive">
    <?php include "BB_2.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<div class="tab-pane custom-tab-pane17" id="tab-eg7-16-2" role="tabpanel" data-status="inactive">
    <?php include "BB_3.php"; ?>
    <div class="footerX mt-1"></div>
</div>

<!----------------------------------------------------- OUTER TAB 17 --------------------------------------------------->

<!----------------------------------------------------- OUTER TAB END -------------------------------------------------------------------->
                        </div> <!-- tab-content -->
                    </div><!-- app-main inner-->
                </div><!-- app-main outer-->
            </div><!-- app-main div-->
        </div><!-- app-container div-->
        

        <div class="card animate__animated animate__fadeInDown" id="alert_div" style="display:none">
            <h6>Excel export is getting downloaded !!</h6>
        </div>
        <div class="card animate__animated animate__fadeInDown" id="alert_div2" style="display:none">
            <h6>Excel export is downloaded successfully !!</h6>
        </div>

        <div class="card animate__animated animate__fadeInDown" id="alert_div3" style="display:none">
            <h6>PPT export is getting downloaded !!</h6>
        </div>
        <div class="card animate__animated animate__fadeInDown" id="alert_div4" style="display:none">
            <h6>PPT export is downloaded successfully !!</h6>
        </div>

        <div id="mySidebar2" class="sidebar2">
            <a href="javascript:void(0)" class="closebtn" onclick="closeF()">×</a>
            <ul class="vertical-nav-menu mb-5" style="padding:0px 20px 20px 20px !important;font-family: "Open Sans", serif" id="filterX">
                <?php include('filter.php');?>
            </ul>
        </div>
        <!-- <div class="popup-btn" onclick="openF()" id="filter_div">
            <a href="javascript:void(0)">
                FILTERS
            </a>
        </div> -->
        <div class="switchG" id="category_toggle_1" style="display:none;">
            <input id="switch-y_ps" name="trippleG_p" type="radio" value="Y" class="switch-inputG" checked/>
            <label for="switch-y_ps" class="switch-labelG switch-labelG-y active" data-target="#tab-eg9-6" data-name="Shopper" onclick="innertabClick(event)" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Protien Drink">
                <img class="toggle_cat" src="assets/images/protein_drink.png" alt="">
            </label>
            <input id="switch-n_pns" name="trippleG_p" type="radio" value="N" class="switch-inputG"/>
            <label for="switch-n_pns" class="switch-labelG switch-labelG-n" data-target="#tab-eg9-7" data-name="Non-Shopper" onclick="innertabClick(event)" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Protien Shake">
                <img class="toggle_cat" src="assets/images/protein_shake.png" alt="">
            </label>
            <input id="switch-i_pc" name="trippleG_p" type="radio" value="I" class="switch-inputG"/>
            <label for="switch-i_pc" class="switch-labelG switch-labelG-i" data-target="#tab-eg9-63" data-name="Combine" onclick="innertabClick(event)" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Protien Powder">
                <img class="toggle_cat" src="assets/images/protein_powder.png" alt="">
            </label>
            <span class="switch-selectorG"></span>
        </div>
        <div id="frame" style="display:none">
            
        </div>
        
        <script type="text/javascript" src="assets/scripts/main.d810cf0ae7f39f28f336.js"></script>
        <script type="text/javascript" src="assets/select2/select2.min.js"></script>
        <script async defer src="https://buttons.github.io/buttons.js"></script>
        <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
	    <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
        <script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
        <script src="assets/wizard/js/jquery.steps.js"></script>
	    <script src="assets/wizard/js/main.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.15/js/bootstrap-multiselect.min.js.map"></script>

        <!-- <script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script>
        <script type="text/javascript" src="https://code.highcharts.com/modules/variable-pie.js"></script>
        <script type="text/javascript" src="https://code.highcharts.com/highcharts-more.js"></script>
        <script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js"></script>
        <script type="text/javascript" src="https://code.highcharts.com/modules/offline-exporting.js"></script>
        <script lang="javascript" src="https://cdn.sheetjs.com/xlsx-0.20.1/package/dist/xlsx.full.min.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/heatmap.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/pptxgenjs@3.3.1/dist/pptxgen.bundle.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/pptxgenjs/3.8.0/pptxgen.min.js"></script>
        <script src="https://code.highcharts.com/highcharts-more.js"></script>
        <script src="https://code.highcharts.com/maps/modules/map.js"></script>
        <script src="https://code.highcharts.com/maps/modules/exporting.js"></script> -->
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/highcharts.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/variable-pie.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/highcharts-more.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/exporting.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/offline-exporting.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/histogram-bellcurve.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/wordcloud.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/heatmap.js"></script>
        <script type="text/javascript" src="https://keresearch.in/demoDash/assets/code/modules/treemap.js"></script>

         <!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/linways/table-to-excel@v1.0.4/dist/tableToExcel.js"></script> -->
        <script>
            var condX = ``;
            var trendcondX = ``;
            var conX = ``;
            var filtercondX = ``;
            var trendsfiltercondX = ``;
            var protiencondX = ``;
            var overallBase = ``;
            var excelStatus = false;
            var trendStatus = false;
            var activetabid = 'tab-0-0';
            var currentID = 'tab-eg7-0-0';
            var dataOuter = '0';
            var dataInner = '0';
            var targetedHighchartContainer = $(`#tab-eg7-6 .overall_div_chart .chart_div .card > div`);
            var tblX = "w1";

            var statusArr = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
            
            var quarterTxt = [];
            var countryTxt = [];
            var regionTxt = [];
            var raceTxt = [];
            var HHITxt = [];
            var genderTxt = [];
            var ageTxt = [];
            var halalTxt = [];

            var protienFTxt = [];

            var protienFStatus1 = false;
            var protienFStatus2 = false;
            var protienFStatus3 = false;
            var protienFStatus4 = false;

            var colorPallet = [
                'rgba(33, 150, 243, 0.4)',  // Deep Blue
                'rgba(96, 125, 139, 0.4)',  // Blue Grey
                'rgba(54, 162, 235, 0.4)',  // Soft Blue
                'rgba(25, 118, 210, 0.4)',  // Medium Blue
                'rgba(21, 101, 192, 0.4)',  // Dark Blue
                'rgba(66, 165, 245, 0.4)',  // Light Blue
                'rgba(100, 181, 246, 0.4)', // Sky Blue
                'rgba(3, 169, 244, 0.4)',   // Cyan Blue
                'rgba(2, 136, 209, 0.4)',   // Ocean Blue
                'rgba(1, 87, 155, 0.4)',    // Navy Blue
                'rgba(0, 131, 143, 0.4)',   // Turquoise Blue
                'rgba(0, 172, 193, 0.4)',   // Aquamarine
                'rgba(77, 182, 172, 0.4)',  // Teal Blue
                'rgba(0, 191, 255, 0.4)',   // Electric Blue
                'rgba(70, 130, 180, 0.4)'   // Steel Blue
            ];
            var functionFlag = [
                [false],
                [false],
                [false],
                [false],
                [false,false,false,false,false,false,false],
                [false,false,false,false,false],
                [false,false,false,false],
                [false,false,false],
                [false,false,false,false],
                [false],
                [false],
                [false,false,false],
                [false],
                [false,false,false,false],
                [false,false,false,false],
                [false,false,false,false],
                [false,false,false]
            ];

            var allAjax = [
                [introAjax],
                [methodAjax],
                [firstAjax],
                [secondAjax],
                [thirdAjax, forthAjax, fifthAjax, sixthAjax, seventhAjax,eightthAjax,ninethAjax],
                [tenthAjax,eleventhAjax,twelvethAjax,thirteenthAjax,fourteenthAjax],
                [fifteenthAjax,sixteenthAjax,seventeenthAjax,eighteenthAjax],
                [nineteenthAjax,twentythAjax,twentyOnethAjax],
                [twentyTwothAjax,twentyThreethAjax,twentyFourthAjax,twentyFivethAjax],
                [twentySixthAjax],
                [twentySeventhAjax],
                [twentyEightthAjax,twentyNinethAjax,thirtythAjax],
                [thirtyOnethAjax],
                [thirtyTwothAjax,thirtyThreethAjax,thirtyFourthAjax,thirtyFivethAjax],
                [thirtySixthAjax,thirtySeventhAjax,thirtyEightthAjax,thirtyNinethAjax],
                [fortythAjax,fortyOnethAjax,fortyTwothAjax,fortyThreethAjax],
                [fortyFourthAjax,fortyFivethAjax,fortySixthAjax]
            ];

            var ajaxFlag = [
                false,
                false,
                false,
                false,
                false,false,false,false,false,false,false,
                false,false,false,false,false,
                false,false,false,false,
                false,false,false,
                false,false,false,false,
                false,
                false,
                false,false,false,
                false,
                false,false,false,false,
                false,false,false,false,
                false,false,false,false,
                false,false,false
            ];

            var quarterLabel = <?php echo json_encode($quarter); ?>;
            var countryLabel = <?php echo json_encode($country); ?>;
            var regionLabel = <?php echo json_encode($region); ?>;
            var ageLabel = <?php echo json_encode($age); ?>;
            var ageLabelX = <?php echo json_encode($ageX); ?>;
            var genderLabel = <?php echo json_encode($gender); ?>;
            var raceLabel = <?php echo json_encode($race); ?>;
            var HHILabel = <?php echo json_encode($HHIX); ?>;

            console.log(ageLabelX);
            // PD - Protien Label

            var PDC0label = <?php echo json_encode($PDC0labelX); ?>;
            var PDC1label = <?php echo json_encode($PDC1labelX); ?>;
            var PDC1alabel = <?php echo json_encode($PDC1alabelX); ?>;
            var PDC2label = <?php echo json_encode($PDC2labelX); ?>;
            var PDC5label = <?php echo json_encode($PDC5labelX); ?>;
            var PDC10label = <?php echo json_encode($PDC10labelX); ?>;
            var PDC6label = <?php echo json_encode($PDC6labelX); ?>;
            var PDC7label = <?php echo json_encode($PDC7labelX); ?>;
            var PDC3label = <?php echo json_encode($PDC3labelX); ?>;
            var PDC8label = <?php echo json_encode($PDC8labelX); ?>;
            var PDC9label = <?php echo json_encode($PDC9labelX); ?>;
            var PDC11label = <?php echo json_encode($PDC11labelX); ?>;
            var PDC16label = <?php echo json_encode($PDC16labelX); ?>;
            var PDC12label = <?php echo json_encode($PDC12labelX); ?>;
            var PDC15label = <?php echo json_encode($PDC15labelX); ?>;
            var PDC17_1label = <?php echo json_encode($PDC17_1labelX); ?>;
            var PDC20label = <?php echo json_encode($PDC20labelX); ?>;
            var PDC17label = <?php echo json_encode($PDC17labelX); ?>;
            var PDC18label = <?php echo json_encode($PDC18labelX); ?>;
            var PDC19label = <?php echo json_encode($PDC19labelX); ?>;

            // CM - Dairy Milk Label

            var CMC0label = <?php echo json_encode($CMC0labelX); ?>;
            var CMC2label = <?php echo json_encode($CMC2labelX); ?>;
            var CMC3label = <?php echo json_encode($CMC3labelX); ?>;
            var CMC4blabel = <?php echo json_encode($CMC4blabelX); ?>;
            var CMC5label = <?php echo json_encode($CMC5labelX); ?>;
            var CMC6label = <?php echo json_encode($CMC6labelX); ?>;
            var CMC7label = <?php echo json_encode($CMC7labelX); ?>;
            var CMC8label = <?php echo json_encode($CMC8labelX); ?>;
            var CMC9label = <?php echo json_encode($CMC9labelX); ?>;
            var CMC10label = <?php echo json_encode($CMC10labelX); ?>;
            var CMC11label = <?php echo json_encode($CMC11labelX); ?>;
            var CMC12label = <?php echo json_encode($CMC12labelX); ?>;
            var CMC15label = <?php echo json_encode($CMC15labelX); ?>;
            var CMC16label = <?php echo json_encode($CMC16labelX); ?>;
            var CMC17_1label = <?php echo json_encode($CMC17_1labelX); ?>;
            var CMC17label = <?php echo json_encode($CMC17labelX); ?>;
            var CMC18label = <?php echo json_encode($CMC18labelX); ?>;
            var CMC19label = <?php echo json_encode($CMC19labelX); ?>;
            var CMC20label = <?php echo json_encode($CMC20labelX); ?>;
            
            $(document).ready(function(){
                $(".splash").hide();
                $("#outer_0").addClass("mm-active");
                $("#outer_0 > a").addClass("outer_div");
                $("#outer_0 > ul > li:first").addClass("mm-active");
                $("#outer_0 > ul > li:first").addClass("active");
                $("#outer_0 > ul > li:first > a").attr("aria-expanded", "true");
                $("#outer_0 > ul > li:first > a").addClass("active");

                $(`#quarter`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Quarter`,
                    nSelectedText: `Quarter`,
                    allSelectedText: `Quarter`,
                    buttonText: function(options, select) {
                        return `Quarter`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#quarter option:selected`).length > 0) {
                            $(`#quarter`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#quarter`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#quarter`).multiselect('selectAll', false);
                $(`#quarter`).multiselect("deselectAll", false);
                $(`#quarter`).multiselect('updateButtonText');

                $(`#country`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Country`,
                    nSelectedText: `Country`,
                    allSelectedText: `Country`,
                    buttonText: function(options, select) {
                        return `Country`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#country option:selected`).length > 0) {
                            $(`#country`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#country`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#country`).multiselect('selectAll', false);
                $(`#country`).multiselect("deselectAll", false);
                $(`#country`).multiselect('updateButtonText');

                $(`#region`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Region`,
                    nSelectedText: `Region`,
                    allSelectedText: `Region`,
                    buttonText: function(options, select) {
                        return `Region`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#region option:selected`).length > 0) {
                            $(`#region`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#region`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#region`).multiselect('selectAll', false);
                $(`#region`).multiselect("deselectAll", false);
                $(`#region`).multiselect('updateButtonText');

                $(`#race`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Race`,
                    nSelectedText: `Race`,
                    allSelectedText: `Race`,
                    buttonText: function(options, select) {
                        return `Race`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#race option:selected`).length > 0) {
                            $(`#race`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#race`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#race`).multiselect('selectAll', false);
                $(`#race`).multiselect("deselectAll", false);
                $(`#race`).multiselect('updateButtonText');

                $(`#HHI`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Gross HHI`,
                    nSelectedText: `Gross HHI`,
                    allSelectedText: `Gross HHI`,
                    buttonText: function(options, select) {
                        return `Gross HHI`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#HHI option:selected`).length > 0) {
                            $(`#HHI`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#HHI`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#HHI`).multiselect('selectAll', false);
                $(`#HHI`).multiselect("deselectAll", false);
                $(`#HHI`).multiselect('updateButtonText');

                $(`#gender`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Gender`,
                    nSelectedText: `Gender`,
                    allSelectedText: `Gender`,
                    buttonText: function(options, select) {
                        return `Gender`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#gender option:selected`).length > 0) {
                            $(`#gender`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#gender`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#gender`).multiselect('selectAll', false);
                $(`#gender`).multiselect("deselectAll", false);
                $(`#gender`).multiselect('updateButtonText');

                $(`#age`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Age`,
                    nSelectedText: `Age`,
                    allSelectedText: `Age`,
                    buttonText: function(options, select) {
                        return `Age`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#age option:selected`).length > 0) {
                            $(`#age`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#age`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#age`).multiselect('selectAll', false);
                $(`#age`).multiselect("deselectAll", false);
                $(`#age`).multiselect('updateButtonText');

                $(`#halal`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Halal diet`,
                    nSelectedText: `Halal diet`,
                    allSelectedText: `Halal diet`,
                    buttonText: function(options, select) {
                        return `Halal diet`;
                    },
                    onChange: function(option, checked, select) {
                        if ($(`#halal option:selected`).length > 0) {
                            $(`#halal`).next('.btn-group').find('.multiselect').addClass("addFD");
                        } else {
                            $(`#halal`).next('.btn-group').find('.multiselect').removeClass("addFD");
                        }
                    }
                });
                $(`#halal`).multiselect('selectAll', false);
                $(`#halal`).multiselect("deselectAll", false);
                $(`#halal`).multiselect('updateButtonText');

                $(`#protienF`).multiselect({
                    includeSelectAllOption: true,
                    enableFiltering: false,
                    enableFullValueFiltering: false,
                    nonSelectedText: `Protien F`,
                    nSelectedText: `Protien F`,
                    allSelectedText: `Protien F`,
                    buttonText: function(options, select) {
                        return `Protien F`;
                    }
                });
                $(`#protienF`).multiselect('selectAll', false);
                $(`#protienF`).multiselect("deselectAll", false);
                $(`#protienF`).multiselect('updateButtonText');

                // $(".custom-tab-pane1").each(function(i,e){
                //     var status = $(this).data('status');
                //     statusArr[0].push(status);
                //     var classArr2 = []
                //     $(this).find(".row").each(function(i2,e2){
                //         classArr2 = [];
                //         $(this).find('table').addClass(`tblprofile_${i}`);
                //         classArr2.push(`tblprofile_${i}`);
                //     });
                //     classArr.push(classArr2);
                // });

                $(".custom-tab-pane1").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[0].push(status);
                });

                $(".custom-tab-pane2").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[1].push(status);
                });

                $(".custom-tab-pane3").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[2].push(status);
                });

                $(".custom-tab-pane4").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[3].push(status);
                });

                $(".custom-tab-pane5").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[4].push(status);
                });

                $(".custom-tab-pane6").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[5].push(status);
                });

                $(".custom-tab-pane7").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[6].push(status);
                });

                $(".custom-tab-pane8").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[7].push(status);
                });

                $(".custom-tab-pane9").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[8].push(status);
                });

                $(".custom-tab-pane10").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[9].push(status);
                });

                $(".custom-tab-pane11").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[10].push(status);
                });

                $(".custom-tab-pane12").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[11].push(status);
                });

                $(".custom-tab-pane13").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[12].push(status);
                });

                $(".custom-tab-pane14").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[13].push(status);
                });

                $(".custom-tab-pane15").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[14].push(status);
                });

                $(".custom-tab-pane16").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[15].push(status);
                });

                $(".custom-tab-pane17").each(function(i, e) {
                    var status = $(this).data('status');
                    statusArr[16].push(status);
                });

                console.log(statusArr);
            });
            $(window).on("load", function() {
                $("#outer_0").before(`<span class="nxt_head">OVERVIEW</span>`);
                $("#outer_2").before(`<span class="nxt_head">KEY FINDINGS</span>`);
                applyF();
                setTimeout(() => {
                    // document.body.style.zoom = "90%";
                    $(window).trigger('resize');
                }, 1000);
            });

            //=================================Tab Sidebar START============================================
            function openS()
            {
                var windowWidth = $(window).width();
                // var windowWidth2 = $("body").width();
                // console.log(`width:${windowWidth}`);
                // console.log(`width:${windowWidth2}`);
                // if(windowWidth<=1285)
                // {
                //     document.body.style.zoom = "90%";
                // }
                // console.log(`width:${windowWidth}`);
                // console.log(`width:${windowWidth2}`);
                var sidebarWidth = ((18/100)*windowWidth);
                var mainWidth = windowWidth-sidebarWidth;
                $("#mySidebar").css("width",sidebarWidth);  
                $("#mySidebar").css("min-width",sidebarWidth);
                $(".app-header-left").css("width",sidebarWidth); 
                $(".app-header-right").css("width",mainWidth);  
                $("#main").css("margin-left",sidebarWidth);
                setTimeout(() => {
                    var newWidth = $("#main").width();
                    newWidth = newWidth - 20 ;
                    if(trendStatus === false)
                    {
                        $(targetedHighchartContainer).each(function(){
                            var chart = $(this).highcharts();
                            if (chart)
                            {
                                chart.setSize(newWidth);
                            }
                        });
                    }
                    else
                    {
                        // $(targetedHighchartContainerT).each(function() {
                        //     var chart2 = $(this).highcharts();
                        //     if (chart2) {
                        //         chart2.setSize(newWidth, null, true);
                        //     }
                        // });
                    }
                }, 800);
            }

            function closeS()
            {
                var windowWidth = $(window).width();
                var sidebarWidth = ((0/100)*windowWidth);
                
                $("#mySidebar").css("width",sidebarWidth);
                $("#mySidebar").css("min-width",sidebarWidth);
                $("#main").css("margin-left",sidebarWidth);

                setTimeout(() => {
                    var newWidth = $("#main").width();
                    newWidth = newWidth - 20 ;
                    if(trendStatus === false)
                    {
                        $(targetedHighchartContainer).each(function(){
                            var chart = $(this).highcharts();
                            if (chart)
                            {
                                chart.setSize(newWidth);
                            }
                        });
                    }
                    else
                    {
                        // $(targetedHighchartContainerT).each(function() {
                        //     var chart2 = $(this).highcharts();
                        //     if (chart2) {
                        //         chart2.setSize(newWidth, null, true);
                        //     }
                        // });
                    }
                }, 800);
            }

            function tabSidebar()
            {
                var sidebardataStatus = $('#openbtn').attr("data-status");
                if(sidebardataStatus==1)
                {
                    $('#openbtn').attr('data-status', '2');
                    closeS();
                }
                else
                {
                    $('#openbtn').attr('data-status', '1');
                    openS();
                }
            }
            //=================================Tab Sidebar END============================================

            //=================================Logout Start============================================
                function logout() {
                    window.stop();
                    $.ajax({
                        url: "api/logout.php",
                        type: "POST",
                        data: {
                            'action': 'logout'
                        },
                        success: function(response) {
                            if (response == "success") {
                                window.location.href = "index.php";
                            }
                        }
                    })
                }
            //=================================Logout End============================================

            //=================================Resizing Chart Start============================================
                $(window).on("resize", function() {
                    openS();
                });
            //=================================Resizing Chart END============================================
            
            //=================================Filter Form START============================================
                function countryFX(idX)
                {
                    //debugger;
                    var valX = $(`#${idX}`).val();
                    
                    //var regionLabel2 = [];
                    var raceLabel2 = [];
                    var HHILabel2 = [];

                    valX.forEach(function(e,i,a){
                        debugger;
                        raceLabel2.push(raceLabel[parseInt(e)-1]);
                        HHILabel2.push(HHILabel[parseInt(e)-1]);
                    });
                    
                    var regionHTML = ``;
                    var raceHTML = ``;
                    var HHIHTML = ``;

                    console.log(valX);
                    if (valX.length == "1" && valX[0] == "1") {
                        // Do nothing if the array contains only 1
                    } else if (valX.includes("1")) {
                        regionLabel.forEach(function(e,i,a){
                            regionHTML += `<option value="${i+1}" data-name="${e}">${e}</option>`;
                        })
                    } else {
                        regionLabel.forEach(function(e,i,a){
                            regionHTML += `<option value="${i+1}" data-name="${e}">${e}</option>`;
                        })
                    }

                    if(raceLabel2.length!=0)
                    {
                        raceLabel2.forEach(function(e,i,a){
                            e.forEach(function(e2,i2,a2){
                                var counterX = i2+1;
                                if(e2=="Others")
                                {
                                    raceHTML += `<option value="98" data-name="${e2}">${e2}</option>`;
                                }
                                else
                                {
                                    raceHTML += `<option value="${counterX}" data-name="${e2}">${e2}</option>`;
                                }
                            })
                        })
                    }

                    if(HHILabel2.length!=0)
                    {
                        console.log(HHILabel2);
                        HHILabel2.forEach(function (e, i) {
                            Object.entries(e).forEach(function ([key, value], i2) {
                                var counterX = i2 + 1;
                                if (key <= 9) {
                                    HHIHTML += `<option value="${valX[i]}0${key}" data-name="${value}">${value}</option>`;
                                } else {
                                    HHIHTML += `<option value="${valX[i]}${key}" data-name="${value}">${value}</option>`;
                                }
                            });
                        });
                    }

                    $("#region").empty().append(regionHTML);
                    $("#race").empty().append(raceHTML);
                    $("#HHI").empty().append(HHIHTML);

                    $(`#region`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Region`,
                        nSelectedText: `Region`,
                        allSelectedText: `Region`,
                        buttonText: function(options, select) {
                            return `Region`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#region option:selected`).length > 0) {
                                $(`#region`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#region`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#region`).multiselect('selectAll', false);
                    $(`#region`).multiselect("deselectAll", false);
                    $(`#region`).multiselect('updateButtonText');
                    $("#region").multiselect('rebuild');
                    $("#region").change();

                    $(`#race`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Race`,
                        nSelectedText: `Race`,
                        allSelectedText: `Race`,
                        buttonText: function(options, select) {
                            return `Race`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#race option:selected`).length > 0) {
                                $(`#race`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#race`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#race`).multiselect('selectAll', false);
                    $(`#race`).multiselect("deselectAll", false);
                    $(`#race`).multiselect('updateButtonText');
                    $("#race").multiselect('rebuild');
                    $("#race").change();

                    $(`#HHI`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Gross HHI`,
                        nSelectedText: `Gross HHI`,
                        allSelectedText: `Gross HHI`,
                        buttonText: function(options, select) {
                            return `Gross HHI`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#HHI option:selected`).length > 0) {
                                $(`#HHI`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#HHI`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#HHI`).multiselect('selectAll', false);
                    $(`#HHI`).multiselect("deselectAll", false);
                    $(`#HHI`).multiselect('updateButtonText');
                    $("#HHI").multiselect('rebuild');
                    $("#HHI").change();
                }
            //=================================Filter Form END============================================

            //=================================Reset Filter START============================================
                function resetFilters()
                {
                    $("#region").empty();
                    $("#HHI").empty();
                    $("#race").empty();
                    
                    $(".splash").show();

                    $(`#quarter`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Quarter`,
                        nSelectedText: `Quarter`,
                        allSelectedText: `Quarter`,
                        buttonText: function(options, select) {
                            return `Quarter`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#quarter option:selected`).length > 0) {
                                $(`#quarter`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#quarter`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#quarter`).multiselect('selectAll', false);
                    $(`#quarter`).multiselect("deselectAll", false);
                    $(`#quarter`).multiselect('updateButtonText');

                    $(`#country`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Country`,
                        nSelectedText: `Country`,
                        allSelectedText: `Country`,
                        buttonText: function(options, select) {
                            return `Country`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#country option:selected`).length > 0) {
                                $(`#country`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#country`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#country`).multiselect('selectAll', false);
                    $(`#country`).multiselect("deselectAll", false);
                    $(`#country`).multiselect('updateButtonText');

                    $(`#region`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Region`,
                        nSelectedText: `Region`,
                        allSelectedText: `Region`,
                        buttonText: function(options, select) {
                            return `Region`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#region option:selected`).length > 0) {
                                $(`#region`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#region`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#region`).multiselect('selectAll', false);
                    $(`#region`).multiselect("deselectAll", false);
                    $(`#region`).multiselect('updateButtonText');

                    $(`#race`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Race`,
                        nSelectedText: `Race`,
                        allSelectedText: `Race`,
                        buttonText: function(options, select) {
                            return `Race`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#race option:selected`).length > 0) {
                                $(`#race`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#race`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#race`).multiselect('selectAll', false);
                    $(`#race`).multiselect("deselectAll", false);
                    $(`#race`).multiselect('updateButtonText');

                    $(`#HHI`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Gross HHI`,
                        nSelectedText: `Gross HHI`,
                        allSelectedText: `Gross HHI`,
                        buttonText: function(options, select) {
                            return `Gross HHI`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#HHI option:selected`).length > 0) {
                                $(`#HHI`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#HHI`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#HHI`).multiselect('selectAll', false);
                    $(`#HHI`).multiselect("deselectAll", false);
                    $(`#HHI`).multiselect('updateButtonText');

                    $(`#gender`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Gender`,
                        nSelectedText: `Gender`,
                        allSelectedText: `Gender`,
                        buttonText: function(options, select) {
                            return `Gender`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#gender option:selected`).length > 0) {
                                $(`#gender`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#gender`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#gender`).multiselect('selectAll', false);
                    $(`#gender`).multiselect("deselectAll", false);
                    $(`#gender`).multiselect('updateButtonText');

                    $(`#age`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Age`,
                        nSelectedText: `Age`,
                        allSelectedText: `Age`,
                        buttonText: function(options, select) {
                            return `Age`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#age option:selected`).length > 0) {
                                $(`#age`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#age`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#age`).multiselect('selectAll', false);
                    $(`#age`).multiselect("deselectAll", false);
                    $(`#age`).multiselect('updateButtonText');

                    $(`#halal`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Halal diet`,
                        nSelectedText: `Halal diet`,
                        allSelectedText: `Halal diet`,
                        buttonText: function(options, select) {
                            return `Halal diet`;
                        },
                        onChange: function(option, checked, select) {
                            if ($(`#halal option:selected`).length > 0) {
                                $(`#halal`).next('.btn-group').find('.multiselect').addClass("addFD");
                            } else {
                                $(`#halal`).next('.btn-group').find('.multiselect').removeClass("addFD");
                            }
                        }
                    });
                    $(`#halal`).multiselect('selectAll', false);
                    $(`#halal`).multiselect("deselectAll", false);
                    $(`#halal`).multiselect('updateButtonText');

                    $(`#protienF`).multiselect({
                        includeSelectAllOption: true,
                        enableFiltering: false,
                        enableFullValueFiltering: false,
                        nonSelectedText: `Protien F`,
                        nSelectedText: `Protien F`,
                        allSelectedText: `Protien F`,
                        buttonText: function(options, select) {
                            return `Protien F`;
                        }
                    });
                    $(`#protienF`).multiselect('selectAll', false);
                    $(`#protienF`).multiselect("deselectAll", false);
                    $(`#protienF`).multiselect('updateButtonText');


                    $(`#quarter`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#country`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#region`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#race`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#HHI`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#gender`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#age`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    $(`#halal`).next('.btn-group').find('.multiselect').removeClass("addFD");
                    
                    flagConstruct();
                    
                }

            //=================================Reset Filter END============================================

            //================================= Trends Swap Start============================================
                function trends(thisX)
                {
                    var getTxt = $(thisX).attr('data-value');
                    if(getTxt=="Trends")
                    {
                        $(".trends_div_chart").show();
                        $(".overall_div_chart").hide();
                        $(thisX).attr('data-value','Chart');
                        trendStatus = true;
                        $(thisX).empty().append(`<i class="fa fa-pie-chart fa-2x"></i>`);
                    }
                    else
                    {
                        $(".trends_div_chart").hide();
                        $(".overall_div_chart").show();
                        $(thisX).attr('data-value','Trends');
                        trendStatus = false;
                        $(thisX).empty().append(`<i class="fa fa-line-chart fa-2x"></i>`);
                    }
                }
            //================================= Trends Swap END============================================

            //=================================Tab Click Start============================================

            function tabClick(element)
            {
                debugger;
                $(".outer_li").each(function() {
                    $(this).find("a").removeClass("outer_div");
                });

                $(`#${element} > a`).addClass('outer_div');

                $(".targetA").each(function(){
                    $(this).attr('aria-expanded', 'false');
                    $(this).attr('aria-selected', 'false');
                    $(this).parent().removeClass('mm-active');
                    $(this).parent().removeClass('active');
                    $(this).removeClass('active');
                });
                $(window).trigger('resize');
            }

            function tabClick2(element)
            {
                ////debugger
                window.scrollTo(0, 0);
                const id = $(element).attr('id');
                dataOuter = $(element).attr('data-outer');
                dataInner = $(element).attr('data-inner');

                targetedHighchartContainer = $(`#tab-eg7-${dataOuter}-${dataInner} .overall_div_chart .chart_div .card .chartC2`);

                // if(trendStatus==true)
                // {
                //     $("#timeField").hide();
                //     $("#weekField").show();
                //     $("#weekdayField").show();
                //     $("#dateField").show();
                //     $("#filterdefination_overall_div").show();
                //     $("#filterdefination_trend_div").hide();
                //     $(".chart_div").show();
                //     $(".tbl_div").hide();
                //     $(".chart_divT").hide();

                //     trendStatus = false;
                // }

                // if(tableStatus==true)
                // {
                //     $("#data_type").hide();
                //     $("#data_type").next().hide();
                //     $("#trends_open_div").hide();
                //     $("#trends_close_div").hide();
                //     $("#swap_zero_btn").show();
                // }
                // else
                // {
                //     $("#data_type").show();
                //     $("#data_type").next().show();
                //     $("#trends_open_div").show();
                //     $("#trends_close_div").hide();
                //     $("#swap_zero_btn").hide();
                //     if(innerText=="NPS")
                //     {
                //         $("#data_type").hide();
                //         $("#data_type").next().hide();
                //     }
                //     else
                //     {
                //         $("#data_type").show();
                //         $("#data_type").next().show();
                //     }
                // }

                $(window).trigger('resize');

                
                statusArr[dataOuter][dataInner]="active";

                if(functionFlag[dataOuter][dataInner]===false)
                {
                    applyF();
                }
            }

            //=================================Tab Click END============================================

                // doughnutChart(doughnutData3,"pd_c0");
                // pieChart(pieData1,"pd_c10");
                // columnChart(columnData1,"pd_c3",PDC3label);
                // barChart(barData1,"pd_c8",PDC8label,30);
                // doughnutChart2(doughnut2Data7,"pd_c17_1",colorPallet[0]);
                // lineChart(lineData1,"pd_c2T");
                // stackbarChart(stackbarData1,"pd_c10T");
                // stackcolumnChart(stackcolumnData1,"pd_c6T");
                // heatChart(heatData1,"pd_c3T",PDC3label);

            //=================================Data Manipulation Start============================================
            function extractValues(array,valueArray,baseArray,countArray,valueType)
            {
                if(valueType=="Simple")
                {
                    array.forEach(function(e,i,a){
                        valueArray.push(e.percentage);
                        baseArray.push(e.bCount);
                        countArray.push(e.cCount);
                    });
                }
                else
                {
                    array.forEach(function(e,i,a){
                        var arrayV2 = [];
                        var arrayB2 = [];
                        var arrayC2 = [];
                        e.forEach(function(e2,i2,a2){
                            arrayV2.push(e2.percentage);
                            arrayB2.push(e2.bCount);
                            arrayC2.push(e2.cCount);
                        });
                        valueArray.push(arrayV2);
                        baseArray.push(arrayB2);
                        countArray.push(arrayC2);
                    });
                }
            }  

            function customizedArray(array,valueArray,labelArray,colorLabel,chartType,nameXX)
            {
                if(chartType=="Doughnut")
                {
                    array.forEach(function(e,i,a){
                        var valueE = {
                            name: labelArray[i],
                            y: e,
                            color: colorLabel[i]
                        };
                        valueArray.push(valueE);
                    });
                }
                else if(chartType=="StackBar")
                {
                    array.forEach(function(e,i,a){
                        var valueE = {
                            name: labelArray[i],
                            data: e,
                            color: colorLabel[i]
                        };
                        valueArray.push(valueE);
                    });
                }
                else if(chartType=="Line")
                {
                    array.forEach(function(e,i,a){
                        var valueE = {
                            name: labelArray[i],
                            data: e,
                        };
                        valueArray.push(valueE);
                    });
                }
                else if(chartType=="Bar")
                {
                    var valueE = {
                        name: nameXX,
                        data: array,
                    };
                    valueArray.push(valueE);
                }
                else if(chartType=="Heat")
                {
                    const result = array.flatMap((row, rowIndex) => 
                        row.map((value, colIndex) => [rowIndex, colIndex, value])
                    );
                    valueArray.push(result);
                }
                else if(chartType=="Bubble")
                {
                    array.forEach(function(e, i) {
                        var arrX = {
                            name: labelArray[i],
                            data: [],
                            marker: {
                                fillColor: radialColors[i]
                            }
                        };
                        e.forEach(function(e2, i2) {
                            var dataPoint = {
                                x: i2,
                                y: i,
                                z: e2
                            };
                            arrX.data.push(dataPoint);
                        });
                        valueArray.push(arrX);
                    });
                }
                else
                {
                    const dataX = airportName.map((airport, index) => ({
                        'hc-key': airportDataMap[airport],
                        value: array[index],
                        name: airport
                    }));

                    valueArray.push(dataX);
                }
                
            }

            function transposeData(data) 
            {
                return data[0].map((col, i) => data.map(row => row[i]));
            }

            function processBase(arr) 
            {
                const allSame = arr.every(element => element === arr[0]);
                if (allSame) {
                    return [arr[0]];
                } else {
                    return arr;
                }
            }

            function clickableSlice(divId, dataNameX, dropdownName, optionName, types, types2)
            {
                if(types2=="fresh")
                {
                    var option = $("#"+dropdownName+" option[data-name='" + optionName + "']");
                    if (option.is(':selected') === true) 
                    {
                        option.prop('selected', false);
                    } 
                    else 
                    {
                        option.prop('selected', true);
                    }
                    $("#"+dropdownName+"").multiselect('rebuild');
                    $("#"+dropdownName+"").change();

                    if(types=="charts")
                    {
                        debugger;
                        $(`[data-name="${dataNameX}"]`).each(function() {
                            var chart = $(this).highcharts();
                            if(chart) 
                            {
                                if(chart.options.chart.type=="pie")
                                {
                                    var sliceIndex = chart.series[0].data.findIndex(function(point) {
                                        return point.name === optionName;
                                    });

                                    if (sliceIndex !== -1) 
                                    {
                                        var selectedSlice = chart.series[0].data[sliceIndex];
                                        
                                        if (option.is(':selected')) 
                                        {
                                            selectedSlice.update({
                                                borderWidth: 3,
                                                borderColor: '#000000',
                                            });
                                        } 
                                        else 
                                        {
                                            selectedSlice.update({
                                                borderWidth: 1,
                                                borderColor: '#ccc',
                                            });
                                        }
                                    }
                                }
                                else
                                {
                                    var sliceIndex = chart.series[0].data.findIndex(function(point) {
                                        return point.category === optionName;
                                    });
                                    
                                    if (sliceIndex !== -1) 
                                    {
                                        var selectedSlice = chart.series[0].data[sliceIndex];
                                        
                                        if (option.is(':selected')) 
                                        {
                                            selectedSlice.update({
                                                borderWidth: 3,
                                                borderColor: '#000000',
                                            });
                                        } 
                                        else 
                                        {
                                            selectedSlice.update({
                                                borderWidth: 1,
                                                borderColor: '#ccc',
                                            });
                                        }
                                    }
                                }
                                
                            }
                        });
                    }
                    else
                    {
                        $(`[data-name="${dataNameX}"]`).each(function() {
                            if (option.is(':selected')) 
                            {
                                if(optionName=='Male')
                                {
                                    $(this).find("img").addClass('male_selected_shadow');
                                }
                                else if(optionName=='Female')
                                {
                                    $(this).find("img").addClass('female_selected_shadow');
                                }
                                else
                                {
                                    $(this).find("img").addClass('selected_shadow');
                                }
                            } 
                            else 
                            {
                                if(optionName=='Male')
                                {
                                    $(this).find("img").removeClass('male_selected_shadow');
                                }
                                else if(optionName=='Female')
                                {
                                    $(this).find("img").removeClass('female_selected_shadow');
                                }
                                else
                                {
                                    $(this).find("img").removeClass('selected_shadow');
                                }
                            }
                        });
                    }
                    flagConstruct();
                }
                else
                {
                    if(types=="charts")
                    {
                        debugger;
                        //dataNameX.forEach(function(e,i,a){
                            $(`[data-name="${dataNameX}"]`).each(function() {
                                var chart = $(this).highcharts();
                                if(chart) 
                                {
                                    if(chart.options.chart.type=="pie")
                                    {
                                        if(optionName.length==0)
                                        {
                                            chart.series[0].data.forEach(function(slice) {
                                                slice.update({
                                                    borderWidth: 1,
                                                    borderColor: '#ccc',
                                                });
                                            });
                                        }
                                        else
                                        {
                                            optionName.forEach(function(e,i,a){
                                                var option = $("#"+dropdownName+" option[data-name='" + e + "']");
                                                var sliceIndex = chart.series[0].data.findIndex(function(point) {
                                                    return point.name === e;
                                                });
                                                if (sliceIndex !== -1) 
                                                {
                                                    var selectedSlice = chart.series[0].data[sliceIndex];
                                                    
                                                    if (option.is(':selected')) 
                                                    {
                                                        selectedSlice.update({
                                                            borderWidth: 3,
                                                            borderColor: '#000000',
                                                        });
                                                    } 
                                                    else 
                                                    {
                                                        selectedSlice.update({
                                                            borderWidth: 1,
                                                            borderColor: '#ccc',
                                                        });
                                                    }
                                                }
                                            });
                                        }
                                    }
                                    else
                                    {
                                        optionName.forEach(function(e,i,a){
                                            var option = $("#"+dropdownName+" option[data-name='" + e + "']");
                                            var sliceIndex = chart.series[0].data.findIndex(function(point) {
                                                return point.category === e;
                                            });
                                            if (sliceIndex !== -1) 
                                            {
                                                var selectedSlice = chart.series[0].data[sliceIndex];
                                                
                                                if (option.is(':selected')) 
                                                {
                                                    selectedSlice.update({
                                                        borderWidth: 3,
                                                        borderColor: '#000000',
                                                    });
                                                } 
                                                else 
                                                {
                                                    selectedSlice.update({
                                                        borderWidth: 1,
                                                        borderColor: '#ccc',
                                                    });
                                                }
                                            }
                                        });
                                    }
                                }
                            });
                        //});
                    }
                    else
                    {
                        // var imgElement = $(divId).find(".gender_img")
                        // if (option.is(':selected')) 
                        // {
                        //     if(optionName=='Male')
                        //     {
                        //         imgElement.addClass('male_selected_shadow');
                        //     }
                        //     else
                        //     {
                        //         imgElement.addClass('female_selected_shadow');
                        //     }
                        // } 
                        // else 
                        // {
                        //     if(optionName=='Male')
                        //     {
                        //         imgElement.removeClass('male_selected_shadow');
                        //     }
                        //     else
                        //     {
                        //         imgElement.removeClass('female_selected_shadow');
                        //     }
                        // }
                    }
                }
            }

            function clickableSlice2()
            {
                var protienFLengthY = $("#protienF option:selected").length;
                
                if(protienFLengthY != 0)
                {
                    clickableSlice("XX","protienF_chart","protienF",protienFTxt,"charts","filters");
                }
                
            }
            //=================================Data Manipulation End============================================

            //=================================Flag Construct Start============================================

                function flagConstruct()
                {
                    statusArr = [
                        ["inactive"],
                        ["inactive"],
                        ["inactive"],
                        ["inactive"],
                        ["inactive","inactive","inactive","inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive"],
                        ["inactive","inactive","inactive","inactive"],
                        ["inactive"],
                        ["inactive"],
                        ["inactive","inactive","inactive"],
                        ["inactive"],
                        ["inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive","inactive"],
                        ["inactive","inactive","inactive"]
                    ];
                    
                    ajaxFlag = [
                        false,
                        false,
                        false,
                        false,
                        false,false,false,false,false,false,false,
                        false,false,false,false,false,
                        false,false,false,false,
                        false,false,false,
                        false,false,false,false,
                        false,
                        false,
                        false,false,false,
                        false,
                        false,false,false,false,
                        false,false,false,false,
                        false,false,false,false,
                        false,false,false
                    ];
                    
                    functionFlag = [
                        [false],
                        [false],
                        [false],
                        [false],
                        [false,false,false,false,false,false,false],
                        [false,false,false,false,false],
                        [false,false,false,false],
                        [false,false,false],
                        [false,false,false,false],
                        [false],
                        [false],
                        [false,false,false],
                        [false],
                        [false,false,false,false],
                        [false,false,false,false],
                        [false,false,false,false],
                        [false,false,false]
                    ];

                    statusArr[dataOuter][dataInner]="active";
                    
                    // functionFlagT = [
                    //     [],
                    //     [false, false, false, false, false, false, false, false, false, false],
                    //     [false, false, false, false, false, false, false, false, false, false, false, false],
                    //     [false, false, false, false, false, false]
                    // ];

                    applyF();
                }

            //=================================Flag Construct End============================================
            
            //=================================Apply Start============================================
                function applyF()
                {
                    $(".splash").show();
                    
                    condX = ``;
                    trendcondX = ``;
                    conX = ``;
                    filtercondX = ``;
                    trendsfiltercondX = ``;
                    protiencondX = ``

                    quarterTxt = [];
                    countryTxt = [];
                    regionTxt = [];
                    raceTxt = [];
                    HHITxt = [];
                    genderTxt = [];
                    ageTxt = [];
                    halalTxt = [];

                    protienFTxt = [];

                    var quarterLengthY = $("#quarter option:selected").length;
                    var countryLengthY = $("#country option:selected").length;
                    var regionLengthY = $("#region option:selected").length;
                    var raceLengthY = $("#race option:selected").length;
                    var HHILengthY = $("#HHI option:selected").length;
                    var genderLengthY = $("#gender option:selected").length;
                    var ageLengthY = $("#age option:selected").length;
                    var halalLengthY = $("#halal option:selected").length;

                    var quarterVal = $("#quarter").val();
                    var countryVal = $("#country").val();
                    var regionVal = $("#region").val();
                    var raceVal = $("#race").val();
                    var HHIVal = $("#HHI").val();
                    var genderVal = $("#gender").val();
                    var ageVal = $("#age").val();
                    var halalVal = $("#halal").val();

                    var selectedOptionsquarter = $("#quarter").find("option:selected");
                    selectedOptionsquarter.each(function () {
                        var dataNameValue = $(this).data("name");
                        quarterTxt.push(dataNameValue);
                    });

                    var selectedOptionscountry = $("#country").find("option:selected");
                    selectedOptionscountry.each(function () {
                        var dataNameValue = $(this).data("name");
                        countryTxt.push(dataNameValue);
                    });

                    var selectedOptionsregion = $("#region").find("option:selected");
                    selectedOptionsregion.each(function () {
                        var dataNameValue = $(this).data("name");
                        regionTxt.push(dataNameValue);
                    });

                    var selectedOptionsrace = $("#race").find("option:selected");
                    selectedOptionsrace.each(function () {
                        var dataNameValue = $(this).data("name");
                        raceTxt.push(dataNameValue);
                    });

                    var selectedOptionsHHI = $("#HHI").find("option:selected");
                    selectedOptionsHHI.each(function () {
                        var dataNameValue = $(this).data("name");
                        HHITxt.push(dataNameValue);
                    });

                    var selectedOptionsgender = $("#gender").find("option:selected");
                    selectedOptionsgender.each(function () {
                        var dataNameValue = $(this).data("name");
                        genderTxt.push(dataNameValue);
                    });

                    var selectedOptionsage = $("#age").find("option:selected");
                    selectedOptionsage.each(function () {
                        var dataNameValue = $(this).data("name");
                        ageTxt.push(dataNameValue);
                    });

                    var selectedOptionshalal = $("#halal").find("option:selected");
                    selectedOptionshalal.each(function () {
                        var dataNameValue = $(this).data("name");
                        halalTxt.push(dataNameValue);
                    });

                    if((quarterLengthY == 0) && (countryLengthY == 0) && (regionLengthY == 0) && (ageLengthY == 0) && (genderLengthY == 0) && (HHILengthY == 0) && (halalLengthY == 0) && (raceLengthY == 0)  )
                    {
                        conX = 1;
                    }
                    else
                    {
                        conX = 2;
                        protienFStatus1 = false;
                        protienFStatus2 = false;
                        protienFStatus3 = false;
                        protienFStatus4 = false;
                    }

                    if(conX==2)
                    {
                        filtercondX += `<b>Applied Filters</b>: `;

                        if(quarterLengthY != 0)
                        {
                            condX += `DQUARTER IN (${quarterVal}) AND `;
                            filtercondX += `<b>Quarter</b> = (${quarterTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Quarter</b> IN (${quarterTxt.join(", ")}) || `;
                        }

                        if(countryLengthY != 0)
                        {
                            condX += `S0 IN (${countryVal}) AND `;
                            filtercondX += `<b>Country</b> = (${countryTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Country</b> IN (${countryTxt.join(", ")}) || `;
                        }

                        if(regionLengthY != 0)
                        {
                            condX += `HCITY IN (${regionVal}) AND `;
                            filtercondX += `<b>Region</b> = (${regionTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Region</b> IN (${regionTxt.join(", ")}) || `;
                        }

                        if(ageLengthY != 0)
                        {
                            condX += `HAGE IN (${ageVal}) AND `;
                            filtercondX += `<b>Age</b> = (${ageTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Age</b> IN (${ageTxt.join(", ")}) || `;
                        }

                        if(genderLengthY != 0)
                        {
                            condX += `S4 IN (${genderVal}) AND `;
                            filtercondX += `<b>Gender</b> = (${genderTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Gender</b> IN (${genderTxt.join(", ")}) || `;
                        }

                        if(HHILengthY != 0)
                        {
                            condX += `S7 IN (${HHIVal}) AND `;
                            filtercondX += `<b>HHI</b> = (${HHITxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>HHI</b> IN (${HHITxt.join(", ")}) || `;
                        }

                        if(halalLengthY != 0)
                        {
                            condX += `S10 IN (${halalVal}) AND `;
                            filtercondX += `<b>Halal</b> = (${halalTxt.join(", ")}) || `;
                            trendsfiltercondX += `<b>Halal</b> IN (${halalTxt.join(", ")}) || `;
                        }

                        if(raceLengthY != 0)
                        {
                            if(countryVal==1)
                            {
                                condX += `S2xSG IN (${raceVal}) AND `;
                                filtercondX += `<b>Race</b> = (${raceTxt.join(", ")}) || `;
                                trendsfiltercondX += `<b>Race</b> IN (${raceTxt.join(", ")}) || `;
                            }
                            else if(countryVal==5)
                            {
                                condX += `S2xMY IN (${raceVal}) AND `;
                                filtercondX += `<b>Race</b> = (${raceTxt.join(", ")}) || `;
                                trendsfiltercondX += `<b>Race</b> IN (${raceTxt.join(", ")}) || `;
                            }
                            else if((countryVal==1) && (countryVal==5))
                            {
                                condX += `S2xSG IN (${raceVal}) AND `;
                                filtercondX += `<b>Race</b> = (${raceTxt.join(", ")}) || `;
                                trendsfiltercondX += `<b>Race</b> IN (${raceTxt.join(", ")}) || `;

                                condX += `S2xMY IN (${raceVal}) AND `;
                                filtercondX += `<b>Race</b> = (${raceTxt.join(", ")}) || `;
                                trendsfiltercondX += `<b>Race</b> IN (${raceTxt.join(", ")}) || `;
                            }
                        }
                    }
                    else
                    {
                        filtercondX += `<b>Applied Filters</b>: All Selected`;
                        trendsfiltercondX += `<b>Applied Filters</b>: All Selected`;
                    }
                    condX += ` 1=1`;
                    filtercondX = filtercondX.replace(/\|\| $/, '');
                    $(".paraY").empty().append(filtercondX);
                    console.log("condX");
                    console.log(condX);

                    var selectedOptionsprotienF = $("#protienF").find("option:selected");
                    selectedOptionsprotienF.each(function () {
                        var dataNameValue = $(this).data("name");
                        protienFTxt.push(dataNameValue);
                    });

                    var protienFLengthY = $("#protienF option:selected").length;
                    var protienFVal = $("#protienF").val();

                    if(protienFLengthY==0)
                    {
                        protiencondX += `1=1`;
                        $('div[data-name="protienF_chart"]').each(function () {
                            $(this).closest('.card').removeClass('addFD');
                        });
                        
                    }
                    else
                    {
                        debugger;
                        protiencondX += `PD_C0 IN (${protienFVal}) AND 1=1`;
                        $('div[data-name="protienF_chart"]').each(function () {
                            debugger;
                            $(this).closest('.card').addClass('addFD');
                        });
                        
                    }

                    fetchBase();

                    statusArr.forEach(function(e,i,a){
                        e.forEach(function(e2,i2,a2){
                            if(e2=="active")
                            {
                                if(trendStatus===false)
                                {
                                    if(functionFlag[i][i2]===false)
                                    {
                                        const selectedFunction = allAjax[i][i2];
                                        functionFlag[i][i2] = true;
                                        selectedFunction();
                                    }
                                    else{}
                                }
                                else
                                {
                                    if(functionFlagT[i][i2]===false)
                                    {
                                        const selectedFunction = trendsAjax[i][i2];
                                        functionFlagT[i][i2] = true;
                                        selectedFunction();
                                    }
                                }
                            }
                            else{}
                        });
                    });
                }
            //=================================Apply End============================================

            //=================================Ajax Start============================================

                function fetchBase()
                {
                    $.ajax({
                        url: "api/base.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            overallBase = data[0];
                            $("#overallBase").empty().append(overallBase);
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    })
                }

                function introAjax() {
                    $.ajax({
                        url: "api/introajax.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[0] = true;
                            $(".splash").hide();
                        }
                    })
                }

                function methodAjax() {
                    $.ajax({
                        url: "api/methodajax.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[1] = true;
                            $(".splash").hide();
                        }
                    })
                }

                function firstAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[2] = true;
                            $(".splash").hide();
                        }
                    })
                }

                function secondAjax() {
                    $.ajax({
                        url: "api/ajax2.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            console.log(data);
                            // var CMC0 = data['CM_C0'];
                            // var CMC2 = data['CM_C2'];
                            // var CMC3 = data['CM_C3'];
                            // var CMC4b = data['CM_C4b'];
                            // var CMC5 = data['CM_C5'];
                            // var CMC6 = data['CM_C6'];
                            // var CMC7 = data['CM_C7'];
                            // var CMC8 = data['CM_C8'];
                            // var CMC9 = data['CM_C9'];
                            // var CMC10 = data['CM_C10'];
                            // var CMC11 = data['CM_C11'];
                            // var CMC12 = data['CM_C12'];
                            // var CMC15 = data['CM_C15'];
                            // var CMC16 = data['CM_C16'];
                            // var CMC17 = data['CM_C17'];
                            // var CMC18 = data['CM_C18'];
                            // var CMC19 = data['CM_C19'];
                            // var CMC20 = data['CM_C20'];

                            // var CMC0V = [];
                            // var CMC0B = [];
                            // var CMC0C = [];
                            // var CMC0VX = [];

                            // var CMC2V = [];
                            // var CMC2B = [];
                            // var CMC2C = [];
                            // var CMC2VX = [];

                            // var CMC3V = [];
                            // var CMC3B = [];
                            // var CMC3C = [];
                            // var CMC3VX = [];

                            // var CMC4bV = [];
                            // var CMC4bB = [];
                            // var CMC4bC = [];
                            // var CMC4bVX = [];

                            // var CMC5V = [];
                            // var CMC5B = [];
                            // var CMC5C = [];
                            // var CMC5VX = [];

                            // var CMC6V = [];
                            // var CMC6B = [];
                            // var CMC6C = [];
                            // var CMC6VX = [];

                            // var CMC7V = [];
                            // var CMC7B = [];
                            // var CMC7C = [];
                            // var CMC7VX = [];

                            // var CMC8V = [];
                            // var CMC8B = [];
                            // var CMC8C = [];
                            // var CMC8VX = [];

                            // var CMC9V = [];
                            // var CMC9B = [];
                            // var CMC9C = [];
                            // var CMC9VX = [];

                            // var CMC10V = [];
                            // var CMC10B = [];
                            // var CMC10C = [];
                            // var CMC10VX = [];

                            // var CMC11V = [];
                            // var CMC11B = [];
                            // var CMC11C = [];
                            // var CMC11VX = [];

                            // var CMC12V = [];
                            // var CMC12B = [];
                            // var CMC12C = [];
                            // var CMC12VX = [];

                            // var CMC13V = [];
                            // var CMC13B = [];
                            // var CMC13C = [];
                            // var CMC13VX = [];

                            // var CMC14V = [];
                            // var CMC14B = [];
                            // var CMC14C = [];
                            // var CMC14VX = [];

                            // var CMC15V = [];
                            // var CMC15B = [];
                            // var CMC15C = [];
                            // var CMC15VX = [];

                            // var CMC16V = [];
                            // var CMC16B = [];
                            // var CMC16C = [];
                            // var CMC16VX = [];

                            // var CMC17V = [];
                            // var CMC17B = [];
                            // var CMC17C = [];
                            // var CMC17VX = [];

                            // var CMC18V = [];
                            // var CMC18B = [];
                            // var CMC18C = [];
                            // var CMC18VX = [];

                            // var CMC19V = [];
                            // var CMC19B = [];
                            // var CMC19C = [];
                            // var CMC19VX = [];

                            // var CMC20V = [];
                            // var CMC20B = [];
                            // var CMC20C = [];
                            // var CMC20VX = [];

                            // extractValues(CMC0,CMC0V,CMC0B,CMC0C,"Simple");
                            // customizedArray(CMC0V,CMC0VX,CMC0label,colorPallet,"Doughnut");
                            // doughnutChart2(CMC0VX,"cm1_c0","Food Service vs. Retail",295);
                            // var baseX = processBase(CMC0B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c0_base").empty().append(htmlB);

                            // extractValues(CMC2,CMC2V,CMC2B,CMC2C,"Simple");
                            // customizedArray(CMC2V,CMC2VX,CMC2label,colorPallet,"Doughnut");
                            // doughnutChart2(CMC2VX,"cm1_c2","Type of protein","auto");

                            // var baseX = processBase(CMC2B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c2_base").empty().append(htmlB);

                            // extractValues(CMC3,CMC3V,CMC3B,CMC3C,"Simple");
                            // var max = (Math.max(...CMC3V)+20);
                            // customizedArray(CMC3V,CMC3VX,CMC3label,colorPallet,"Bar");
                            // barChart(CMC3VX,"cm1_c3",CMC3label,max);

                            // var baseX = processBase(CMC3B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c3_base").empty().append(htmlB);

                            // extractValues(CMC4b,CMC4bV,CMC4bB,CMC4bC,"Simple");
                            // customizedArray(CMC4bV,CMC4bVX,CMC4blabel,colorPallet,"Doughnut");
                            // doughnutChart2(CMC4bVX,"cm1_c4b","Food Service vs. Retail",285);
                            // var baseX = processBase(CMC4bB);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c4b_base").empty().append(htmlB);

                            // extractValues(CMC5,CMC5V,CMC5B,CMC5C,"Simple");
                            // customizedArray(CMC5V,CMC5VX,CMC5label,colorPallet,"Doughnut");
                            // doughnutChart(CMC5VX,"cm1_c5","Category Consumed",300);

                            // var baseX = processBase(CMC5B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c5_base").empty().append(htmlB);

                            // extractValues(CMC6,CMC6V,CMC6B,CMC6C,"Simple");
                            // customizedArray(CMC6V,CMC6VX,CMC6label,colorPallet,"Doughnut");
                            // pieChart(CMC6VX,"cm1_c6","Type of Packaging","auto");

                            // var baseX = processBase(CMC6B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c6_base").empty().append(htmlB);

                            // extractValues(CMC7,CMC7V,CMC7B,CMC7C,"Simple");
                            // customizedArray(CMC7V,CMC7VX,CMC7label,colorPallet,"Doughnut");
                            // pieChart(CMC7VX,"cm1_c7","Type of Packaging","auto");

                            // var baseX = processBase(CMC7B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c7_base").empty().append(htmlB);

                            // extractValues(CMC8,CMC8V,CMC8B,CMC8C,"Simple");
                            // var max = (Math.max(...CMC8V)+20);
                            // customizedArray(CMC8V,CMC8VX,CMC8label,colorPallet,"Bar");
                            // barChart(CMC8VX,"cm1_c8",CMC8label,max);

                            // var baseX = processBase(CMC8B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c8_base").empty().append(htmlB);

                            // extractValues(CMC9,CMC9V,CMC9B,CMC9C,"Simple");
                            // var max = (Math.max(...CMC9V)+20);
                            // customizedArray(CMC9V,CMC9VX,CMC9label,colorPallet,"Bar");
                            // barChart(CMC9VX,"cm1_c9",CMC9label,max);

                            // var baseX = processBase(CMC9B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c9_base").empty().append(htmlB);

                            // extractValues(CMC10,CMC10V,CMC10B,CMC10C,"Simple");
                            // customizedArray(CMC10V,CMC10VX,CMC10label,colorPallet,"Doughnut");
                            // pieChart(CMC10VX,"cm1_c10","Way of consumption","auto");

                            // var baseX = processBase(CMC10B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c10_base").empty().append(htmlB);

                            // extractValues(CMC11,CMC11V,CMC11B,CMC11C,"Simple");
                            // var max = (Math.max(...CMC11V)+20);
                            // customizedArray(CMC11V,CMC11VX,CMC11label,colorPallet,"Bar");
                            // columnChart(CMC11VX,"cm1_c11",CMC11label,max);

                            // var baseX = processBase(CMC11B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c11_base").empty().append(htmlB);

                            // extractValues(CMC12,CMC12V,CMC12B,CMC12C,"Simple");
                            // var max = (Math.max(...CMC12V)+20);
                            // customizedArray(CMC12V,CMC12VX,CMC12label,colorPallet,"Bar");
                            // columnChart(CMC12VX,"cm1_c12",CMC12label,max);

                            // var baseX = processBase(CMC12B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c12_base").empty().append(htmlB);

                            // extractValues(CMC15,CMC15V,CMC15B,CMC15C,"Simple");
                            // CMC15V.forEach(function(e,i,a){
                            //     $(`#cm1_c15_${i+1}`).empty().append(`${e}%`);
                            // });

                            // var baseX = processBase(CMC15B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c15_base").empty().append(htmlB);

                            // extractValues(CMC16,CMC16V,CMC16B,CMC16C,"Simple");
                            // var max = (Math.max(...CMC16V)+20);
                            // customizedArray(CMC16V,CMC16VX,CMC16label,colorPallet,"Bar");
                            // barChart(CMC16VX,"cm1_c16",CMC16label,max);

                            // var baseX = processBase(CMC16B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e}`;
                            // });
                            // htmlB += `)`;
                            // $("#cm1_c16_base").empty().append(htmlB);

                            // extractValues(CMC17,CMC17V,CMC17B,CMC17C,"Simple");
                            // CMC17V.forEach(function(e,i,a){
                            //     doughnutChart3(e,`cm1_c17_${i+1}`,colorPallet[i])
                            // });

                            // var baseX = processBase(CMC17B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c17_base").empty().append(htmlB);

                            // extractValues(CMC18,CMC18V,CMC18B,CMC18C,"Simple");
                            // var max = (Math.max(...CMC18V)+20);
                            // customizedArray(CMC18V,CMC18VX,CMC18label,colorPallet,"Bar");
                            // barChart(CMC18VX,"cm1_c18",CMC18label,max);

                            // var baseX = processBase(CMC18B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c18_base").empty().append(htmlB);

                            // extractValues(CMC19,CMC19V,CMC19B,CMC19C,"Simple");
                            // var max = (Math.max(...CMC19V)+20);
                            // customizedArray(CMC19V,CMC19VX,CMC19label,colorPallet,"Bar");
                            // columnChart(CMC19VX,"cm1_c19",CMC19label,max);

                            // var baseX = processBase(CMC19B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c19_base").empty().append(htmlB);
                            
                            // extractValues(CMC20,CMC20V,CMC20B,CMC20C,"Simple");
                            // CMC20V.forEach(function(e,i,a){
                            //     $(`#cm1_c20_${i+1}`).empty().append(`${e}%`);
                            // });

                            // var baseX = processBase(CMC20B);
                            // var htmlB = ``;
                            // htmlB += `(Base=`;
                            // baseX.forEach(function(e,i,a){
                            //     htmlB += `${e})`;
                            // });
                            // $("#cm1_c20_base").empty().append(htmlB);
                        },
                        complete: function (data) {
                            ajaxFlag[3] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function thirdAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[4] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function forthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[5] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function fifthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[6] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function sixthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[7] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function seventhAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[8] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function eightthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[9] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function ninethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[10] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function tenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[11] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function eleventhAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[12] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twelvethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[13] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function thirteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[14] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function fourteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[15] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function fifteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[16] = true;
                            $(".splash").hide();
                        }
                    });
                }
                function sixteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[17] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function seventeenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[18] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function eighteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[19] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function nineteenthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[20] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentythAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[21] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentyOnethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[22] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentyTwothAjax() {
                    $.ajax({
                        url: "api/ajax22.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                            'protiencondX': protiencondX
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            console.log(data);
                            var PDC0 = data['PD_C0'];
                            var PDC1 = data['PD_C1'];
                            var PDC1a = data['PD_C1a'];
                            var PDC2 = data['PD_C2'];
                            var PDC3 = data['PD_C3'];
                            var PDC5 = data['PD_C5'];
                            var PDC6 = data['PD_C6'];
                            var PDC7 = data['PD_C7'];
                            var PDC8 = data['PD_C8'];
                            var PDC9 = data['PD_C9'];
                            var PDC10 = data['PD_C10'];
                            var PDC11 = data['PD_C11'];
                            var PDC12 = data['PD_C12'];
                            var PDC15 = data['PD_C15'];
                            var PDC16 = data['PD_C16'];
                            var PDC17 = data['PD_C17'];
                            var PDC18 = data['PD_C18'];
                            var PDC19 = data['PD_C19'];
                            var PDC20 = data['PD_C20'];

                            var PDC0V = [];
                            var PDC0B = [];
                            var PDC0C = [];
                            var PDC0VX = [];

                            var PDC1V = [];
                            var PDC1B = [];
                            var PDC1C = [];
                            var PDC1VX = [];

                            var PDC1aV = [];
                            var PDC1aB = [];
                            var PDC1aC = [];
                            var PDC1aVX = [];

                            var PDC2V = [];
                            var PDC2B = [];
                            var PDC2C = [];
                            var PDC2VX = [];

                            var PDC3V = [];
                            var PDC3B = [];
                            var PDC3C = [];
                            var PDC3VX = [];

                            var PDC4V = [];
                            var PDC4B = [];
                            var PDC4C = [];
                            var PDC4VX = [];

                            var PDC5V = [];
                            var PDC5B = [];
                            var PDC5C = [];
                            var PDC5VX = [];

                            var PDC6V = [];
                            var PDC6B = [];
                            var PDC6C = [];
                            var PDC6VX = [];

                            var PDC7V = [];
                            var PDC7B = [];
                            var PDC7C = [];
                            var PDC7VX = [];

                            var PDC8V = [];
                            var PDC8B = [];
                            var PDC8C = [];
                            var PDC8VX = [];

                            var PDC9V = [];
                            var PDC9B = [];
                            var PDC9C = [];
                            var PDC9VX = [];

                            var PDC10V = [];
                            var PDC10B = [];
                            var PDC10C = [];
                            var PDC10VX = [];

                            var PDC11V = [];
                            var PDC11B = [];
                            var PDC11C = [];
                            var PDC11VX = [];

                            var PDC12V = [];
                            var PDC12B = [];
                            var PDC12C = [];
                            var PDC12VX = [];

                            var PDC13V = [];
                            var PDC13B = [];
                            var PDC13C = [];
                            var PDC13VX = [];

                            var PDC14V = [];
                            var PDC14B = [];
                            var PDC14C = [];
                            var PDC14VX = [];

                            var PDC15V = [];
                            var PDC15B = [];
                            var PDC15C = [];
                            var PDC15VX = [];

                            var PDC16V = [];
                            var PDC16B = [];
                            var PDC16C = [];
                            var PDC16VX = [];

                            var PDC17V = [];
                            var PDC17B = [];
                            var PDC17C = [];
                            var PDC17VX = [];

                            var PDC18V = [];
                            var PDC18B = [];
                            var PDC18C = [];
                            var PDC18VX = [];

                            var PDC19V = [];
                            var PDC19B = [];
                            var PDC19C = [];
                            var PDC19VX = [];

                            var PDC20V = [];
                            var PDC20B = [];
                            var PDC20C = [];
                            var PDC20VX = [];

                            if(protienFStatus1==false)
                            {
                                extractValues(PDC0,PDC0V,PDC0B,PDC0C,"Simple");
                                customizedArray(PDC0V,PDC0VX,PDC0label,colorPallet,"Doughnut");
                                doughnutChartF(PDC0VX,"pd1_c0","Food Service vs. Retail",300,"protienF");
                                var baseX = processBase(PDC0B);
                                var htmlB = ``;
                                htmlB += `(Base=`;
                                baseX.forEach(function (e, i, a) {
                                    if (e < 30) {
                                        htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                    } else {
                                        htmlB += `${e})`;
                                    }
                                });

                                $("#pd1_c0_base").empty().append(htmlB);

                                var span = $('#pd1_c0_base');
                                var htmlContent = span.html();

                                if (htmlContent.includes('Low')) {
                                    var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                    span.html(updatedContent);
                                } else {
                                    var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                    span.html(cleanedContent); 
                                }
                            }
                            
                            extractValues(PDC1,PDC1V,PDC1B,PDC1C,"Simple");
                            customizedArray(PDC1V,PDC1VX,PDC1label,colorPallet,"Doughnut");
                            doughnutChart4(PDC1VX,"pd1_c1","Category Consumed",285);

                            var baseX = processBase(PDC1B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c1_base").empty().append(htmlB);

                            var span = $('#pd1_c1_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC1a,PDC1aV,PDC1aB,PDC1aC,"Simple");
                            customizedArray(PDC1aV,PDC1aVX,PDC1alabel,colorPallet,"Doughnut");
                            doughnutChart4(PDC1aVX,"pd1_c1a","Category Consumed",265);

                            var baseX = processBase(PDC1aB);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c1a_base").empty().append(htmlB);

                            var span = $('#pd1_c1a_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC2,PDC2V,PDC2B,PDC2C,"Simple");
                            customizedArray(PDC2V,PDC2VX,PDC2label,colorPallet,"Doughnut");
                            doughnutChart2(PDC2VX,"pd1_c2","Type of protein","auto");

                            var baseX = processBase(PDC2B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c2_base").empty().append(htmlB);

                            var span = $('#pd1_c2_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC5,PDC5V,PDC5B,PDC5C,"Simple");
                            customizedArray(PDC5V,PDC5VX,PDC5label,colorPallet,"Doughnut");
                            doughnutChart4(PDC5VX,"pd1_c5","Category Consumed",300);

                            var baseX = processBase(PDC5B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c5_base").empty().append(htmlB);

                            var span = $('#pd1_c5_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC3,PDC3V,PDC3B,PDC3C,"Simple");
                            var max = (Math.max(...PDC3V)+20);
                            customizedArray(PDC3V,PDC3VX,PDC3label,colorPallet,"Bar");
                            barChart(PDC3VX,"pd1_c3",PDC3label,max);

                            var baseX = processBase(PDC3B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c3_base").empty().append(htmlB);

                            var span = $('#pd1_c3_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC6,PDC6V,PDC6B,PDC6C,"Simple");
                            customizedArray(PDC6V,PDC6VX,PDC6label,colorPallet,"Doughnut");
                            pieChart(PDC6VX,"pd1_c6","Type of Packaging","auto");

                            var baseX = processBase(PDC6B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c6_base").empty().append(htmlB);

                            var span = $('#pd1_c6_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC7,PDC7V,PDC7B,PDC7C,"Simple");
                            customizedArray(PDC7V,PDC7VX,PDC7label,colorPallet,"Doughnut");
                            pieChart(PDC7VX,"pd1_c7","Type of Packaging","auto");

                            var baseX = processBase(PDC7B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c7_base").empty().append(htmlB);

                            var span = $('#pd1_c7_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC8,PDC8V,PDC8B,PDC8C,"Simple");
                            var max = (Math.max(...PDC8V)+20);
                            customizedArray(PDC8V,PDC8VX,PDC8label,colorPallet,"Bar");
                            barChart(PDC8VX,"pd1_c8",PDC8label,max);

                            var baseX = processBase(PDC8B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c8_base").empty().append(htmlB);

                            var span = $('#pd1_c8_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC9,PDC9V,PDC9B,PDC9C,"Simple");
                            var max = (Math.max(...PDC9V)+20);
                            customizedArray(PDC9V,PDC9VX,PDC9label,colorPallet,"Bar");
                            barChart(PDC9VX,"pd1_c9",PDC9label,max);

                            var baseX = processBase(PDC9B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c9_base").empty().append(htmlB);

                            var span = $('#pd1_c9_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC10,PDC10V,PDC10B,PDC10C,"Simple");
                            customizedArray(PDC10V,PDC10VX,PDC10label,colorPallet,"Doughnut");
                            pieChart(PDC10VX,"pd1_c10","Way of consumption","auto");

                            var baseX = processBase(PDC10B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c10_base").empty().append(htmlB);

                            var span = $('#pd1_c10_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC11,PDC11V,PDC11B,PDC11C,"Simple");
                            var max = (Math.max(...PDC11V)+20);
                            customizedArray(PDC11V,PDC11VX,PDC11label,colorPallet,"Bar");
                            columnChart(PDC11VX,"pd1_c11",PDC11label,max);

                            var baseX = processBase(PDC11B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c11_base").empty().append(htmlB);

                            var span = $('#pd1_c11_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC16,PDC16V,PDC16B,PDC16C,"Simple");
                            var max = (Math.max(...PDC16V)+20);
                            customizedArray(PDC16V,PDC16VX,PDC16label,colorPallet,"Bar");
                            barChart(PDC16VX,"pd1_c16",PDC16label,max);

                            var baseX = processBase(PDC16B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c16_base").empty().append(htmlB);

                            var span = $('#pd1_c16_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC12,PDC12V,PDC12B,PDC12C,"Simple");
                            var max = (Math.max(...PDC12V)+20);
                            customizedArray(PDC12V,PDC12VX,PDC12label,colorPallet,"Bar");
                            columnChart(PDC12VX,"pd1_c12",PDC12label,max);

                            var baseX = processBase(PDC12B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c12_base").empty().append(htmlB);

                            var span = $('#pd1_c12_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC15,PDC15V,PDC15B,PDC15C,"Simple");
                            PDC15V.forEach(function(e,i,a){
                                $(`#pd1_c15_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC15B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c15_base").empty().append(htmlB);

                            var span = $('#pd1_c15_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC20,PDC20V,PDC20B,PDC20C,"Simple");
                            PDC20V.forEach(function(e,i,a){
                                $(`#pd1_c20_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC20B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c20_base").empty().append(htmlB);

                            var span = $('#pd1_c20_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC17,PDC17V,PDC17B,PDC17C,"Simple");
                            PDC17V.forEach(function(e,i,a){
                                doughnutChart3(e,`pd1_c17_${i+1}`,colorPallet[i])
                            });

                            var baseX = processBase(PDC17B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c17_base").empty().append(htmlB);

                            var span = $('#pd1_c17_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC18,PDC18V,PDC18B,PDC18C,"Simple");
                            var max = (Math.max(...PDC18V)+20);
                            customizedArray(PDC18V,PDC18VX,PDC18label,colorPallet,"Bar");
                            barChart(PDC18VX,"pd1_c18",PDC18label,max);

                            var baseX = processBase(PDC18B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c18_base").empty().append(htmlB);

                            var span = $('#pd1_c18_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC19,PDC19V,PDC19B,PDC19C,"Simple");
                            var max = (Math.max(...PDC19V)+20);
                            customizedArray(PDC19V,PDC19VX,PDC19label,colorPallet,"Bar");
                            columnChart(PDC19VX,"pd1_c19",PDC19label,max);

                            var baseX = processBase(PDC19B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd1_c19_base").empty().append(htmlB);

                            var span = $('#pd1_c19_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }
                        },
                        complete: function (data) {
                            protienFStatus1 = true;
                            ajaxFlag[23] = true;
                            $(".splash").hide();
                            clickableSlice2();
                        }
                    });
                }

                function twentyThreethAjax() {
                    $.ajax({
                        url: "api/ajax23.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                            'protiencondX': protiencondX
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            console.log(data);
                            var PDC0 = data['PD_C0'];
                            var PDC1 = data['PD_C1'];
                            var PDC1a = data['PD_C1a'];
                            var PDC2 = data['PD_C2'];
                            var PDC3 = data['PD_C3'];
                            var PDC5 = data['PD_C5'];
                            var PDC6 = data['PD_C6'];
                            var PDC7 = data['PD_C7'];
                            var PDC8 = data['PD_C8'];
                            var PDC9 = data['PD_C9'];
                            var PDC10 = data['PD_C10'];
                            var PDC11 = data['PD_C11'];
                            var PDC12 = data['PD_C12'];
                            var PDC15 = data['PD_C15'];
                            var PDC16 = data['PD_C16'];
                            var PDC17 = data['PD_C17'];
                            var PDC18 = data['PD_C18'];
                            var PDC19 = data['PD_C19'];
                            var PDC20 = data['PD_C20'];

                            var PDC0V = [];
                            var PDC0B = [];
                            var PDC0C = [];
                            var PDC0VX = [];

                            var PDC1V = [];
                            var PDC1B = [];
                            var PDC1C = [];
                            var PDC1VX = [];

                            var PDC1aV = [];
                            var PDC1aB = [];
                            var PDC1aC = [];
                            var PDC1aVX = [];

                            var PDC2V = [];
                            var PDC2B = [];
                            var PDC2C = [];
                            var PDC2VX = [];

                            var PDC3V = [];
                            var PDC3B = [];
                            var PDC3C = [];
                            var PDC3VX = [];

                            var PDC4V = [];
                            var PDC4B = [];
                            var PDC4C = [];
                            var PDC4VX = [];

                            var PDC5V = [];
                            var PDC5B = [];
                            var PDC5C = [];
                            var PDC5VX = [];

                            var PDC6V = [];
                            var PDC6B = [];
                            var PDC6C = [];
                            var PDC6VX = [];

                            var PDC7V = [];
                            var PDC7B = [];
                            var PDC7C = [];
                            var PDC7VX = [];

                            var PDC8V = [];
                            var PDC8B = [];
                            var PDC8C = [];
                            var PDC8VX = [];

                            var PDC9V = [];
                            var PDC9B = [];
                            var PDC9C = [];
                            var PDC9VX = [];

                            var PDC10V = [];
                            var PDC10B = [];
                            var PDC10C = [];
                            var PDC10VX = [];

                            var PDC11V = [];
                            var PDC11B = [];
                            var PDC11C = [];
                            var PDC11VX = [];

                            var PDC12V = [];
                            var PDC12B = [];
                            var PDC12C = [];
                            var PDC12VX = [];

                            var PDC13V = [];
                            var PDC13B = [];
                            var PDC13C = [];
                            var PDC13VX = [];

                            var PDC14V = [];
                            var PDC14B = [];
                            var PDC14C = [];
                            var PDC14VX = [];

                            var PDC15V = [];
                            var PDC15B = [];
                            var PDC15C = [];
                            var PDC15VX = [];

                            var PDC16V = [];
                            var PDC16B = [];
                            var PDC16C = [];
                            var PDC16VX = [];

                            var PDC17V = [];
                            var PDC17B = [];
                            var PDC17C = [];
                            var PDC17VX = [];

                            var PDC18V = [];
                            var PDC18B = [];
                            var PDC18C = [];
                            var PDC18VX = [];

                            var PDC19V = [];
                            var PDC19B = [];
                            var PDC19C = [];
                            var PDC19VX = [];

                            var PDC20V = [];
                            var PDC20B = [];
                            var PDC20C = [];
                            var PDC20VX = [];

                            if(protienFStatus2==false)
                            {
                                extractValues(PDC0,PDC0V,PDC0B,PDC0C,"Simple");
                                customizedArray(PDC0V,PDC0VX,PDC0label,colorPallet,"Doughnut");
                                doughnutChartF(PDC0VX,"pd2_c0","Food Service vs. Retail",300,"protienF");
                                var baseX = processBase(PDC0B);
                                var htmlB = ``;
                                htmlB += `(Base=`;
                                baseX.forEach(function (e, i, a) {
                                    if (e < 30) {
                                        htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                    } else {
                                        htmlB += `${e})`;
                                    }
                                });

                                $("#pd2_c0_base").empty().append(htmlB);

                                var span = $('#pd2_c0_base');
                                var htmlContent = span.html();

                                if (htmlContent.includes('Low')) {
                                    var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                    span.html(updatedContent);
                                } else {
                                    var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                    span.html(cleanedContent); 
                                }
                            }
                            
                            extractValues(PDC1,PDC1V,PDC1B,PDC1C,"Simple");
                            customizedArray(PDC1V,PDC1VX,PDC1label,colorPallet,"Doughnut");
                            doughnutChart4(PDC1VX,"pd2_c1","Category Consumed",285);

                            var baseX = processBase(PDC1B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c1_base").empty().append(htmlB);

                            var span = $('#pd2_c1_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC1a,PDC1aV,PDC1aB,PDC1aC,"Simple");
                            customizedArray(PDC1aV,PDC1aVX,PDC1alabel,colorPallet,"Doughnut");
                            doughnutChart4(PDC1aVX,"pd2_c1a","Category Consumed",265);

                            var baseX = processBase(PDC1aB);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c1a_base").empty().append(htmlB);

                            var span = $('#pd2_c1a_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC2,PDC2V,PDC2B,PDC2C,"Simple");
                            customizedArray(PDC2V,PDC2VX,PDC2label,colorPallet,"Doughnut");
                            doughnutChart2(PDC2VX,"pd2_c2","Type of protein","auto");

                            var baseX = processBase(PDC2B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c2_base").empty().append(htmlB);

                            var span = $('#pd2_c2_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC5,PDC5V,PDC5B,PDC5C,"Simple");
                            customizedArray(PDC5V,PDC5VX,PDC5label,colorPallet,"Doughnut");
                            doughnutChart4(PDC5VX,"pd2_c5","Category Consumed",300);

                            var baseX = processBase(PDC5B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c5_base").empty().append(htmlB);

                            var span = $('#pd2_c5_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC3,PDC3V,PDC3B,PDC3C,"Simple");
                            var max = (Math.max(...PDC3V)+20);
                            customizedArray(PDC3V,PDC3VX,PDC3label,colorPallet,"Bar");
                            barChart(PDC3VX,"pd2_c3",PDC3label,max);

                            var baseX = processBase(PDC3B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c3_base").empty().append(htmlB);

                            var span = $('#pd2_c3_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC6,PDC6V,PDC6B,PDC6C,"Simple");
                            customizedArray(PDC6V,PDC6VX,PDC6label,colorPallet,"Doughnut");
                            pieChart(PDC6VX,"pd2_c6","Type of Packaging","auto");

                            var baseX = processBase(PDC6B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c6_base").empty().append(htmlB);

                            var span = $('#pd2_c6_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC7,PDC7V,PDC7B,PDC7C,"Simple");
                            customizedArray(PDC7V,PDC7VX,PDC7label,colorPallet,"Doughnut");
                            pieChart(PDC7VX,"pd2_c7","Type of Packaging","auto");

                            var baseX = processBase(PDC7B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c7_base").empty().append(htmlB);

                            var span = $('#pd2_c7_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC8,PDC8V,PDC8B,PDC8C,"Simple");
                            var max = (Math.max(...PDC8V)+20);
                            customizedArray(PDC8V,PDC8VX,PDC8label,colorPallet,"Bar");
                            barChart(PDC8VX,"pd2_c8",PDC8label,max);

                            var baseX = processBase(PDC8B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c8_base").empty().append(htmlB);

                            var span = $('#pd2_c8_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC9,PDC9V,PDC9B,PDC9C,"Simple");
                            var max = (Math.max(...PDC9V)+20);
                            customizedArray(PDC9V,PDC9VX,PDC9label,colorPallet,"Bar");
                            barChart(PDC9VX,"pd2_c9",PDC9label,max);

                            var baseX = processBase(PDC9B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c9_base").empty().append(htmlB);

                            var span = $('#pd2_c9_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC10,PDC10V,PDC10B,PDC10C,"Simple");
                            customizedArray(PDC10V,PDC10VX,PDC10label,colorPallet,"Doughnut");
                            pieChart(PDC10VX,"pd2_c10","Way of consumption","auto");

                            var baseX = processBase(PDC10B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c10_base").empty().append(htmlB);

                            var span = $('#pd2_c10_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC11,PDC11V,PDC11B,PDC11C,"Simple");
                            var max = (Math.max(...PDC11V)+20);
                            customizedArray(PDC11V,PDC11VX,PDC11label,colorPallet,"Bar");
                            columnChart(PDC11VX,"pd2_c11",PDC11label,max);

                            var baseX = processBase(PDC11B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c11_base").empty().append(htmlB);

                            var span = $('#pd2_c11_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC16,PDC16V,PDC16B,PDC16C,"Simple");
                            var max = (Math.max(...PDC16V)+20);
                            customizedArray(PDC16V,PDC16VX,PDC16label,colorPallet,"Bar");
                            barChart(PDC16VX,"pd2_c16",PDC16label,max);

                            var baseX = processBase(PDC16B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c16_base").empty().append(htmlB);

                            var span = $('#pd2_c16_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC12,PDC12V,PDC12B,PDC12C,"Simple");
                            var max = (Math.max(...PDC12V)+20);
                            customizedArray(PDC12V,PDC12VX,PDC12label,colorPallet,"Bar");
                            columnChart(PDC12VX,"pd2_c12",PDC12label,max);

                            var baseX = processBase(PDC12B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c12_base").empty().append(htmlB);

                            var span = $('#pd2_c12_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC15,PDC15V,PDC15B,PDC15C,"Simple");
                            PDC15V.forEach(function(e,i,a){
                                $(`#pd2_c15_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC15B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c15_base").empty().append(htmlB);

                            var span = $('#pd2_c15_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC20,PDC20V,PDC20B,PDC20C,"Simple");
                            PDC20V.forEach(function(e,i,a){
                                $(`#pd2_c20_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC20B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c20_base").empty().append(htmlB);

                            var span = $('#pd2_c20_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC17,PDC17V,PDC17B,PDC17C,"Simple");
                            PDC17V.forEach(function(e,i,a){
                                doughnutChart3(e,`pd2_c17_${i+1}`,colorPallet[i])
                            });

                            var baseX = processBase(PDC17B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c17_base").empty().append(htmlB);

                            var span = $('#pd2_c17_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC18,PDC18V,PDC18B,PDC18C,"Simple");
                            var max = (Math.max(...PDC18V)+20);
                            customizedArray(PDC18V,PDC18VX,PDC18label,colorPallet,"Bar");
                            barChart(PDC18VX,"pd2_c18",PDC18label,max);

                            var baseX = processBase(PDC18B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c18_base").empty().append(htmlB);

                            var span = $('#pd2_c18_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC19,PDC19V,PDC19B,PDC19C,"Simple");
                            var max = (Math.max(...PDC19V)+20);
                            customizedArray(PDC19V,PDC19VX,PDC19label,colorPallet,"Bar");
                            columnChart(PDC19VX,"pd2_c19",PDC19label,max);

                            var baseX = processBase(PDC19B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd2_c19_base").empty().append(htmlB);

                            var span = $('#pd2_c19_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }
                        },
                        complete: function (data) {
                            protienFStatus2 = true;
                            ajaxFlag[24] = true;
                            $(".splash").hide();
                            clickableSlice2();
                        }
                    });
                }

                function twentyFourthAjax() {
                    $.ajax({
                        url: "api/ajax24.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                            'protiencondX': protiencondX
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            console.log(data);
                            var PDC0 = data['PD_C0'];
                            var PDC1 = data['PD_C1'];
                            var PDC1a = data['PD_C1a'];
                            var PDC2 = data['PD_C2'];
                            var PDC3 = data['PD_C3'];
                            var PDC5 = data['PD_C5'];
                            var PDC6 = data['PD_C6'];
                            var PDC7 = data['PD_C7'];
                            var PDC8 = data['PD_C8'];
                            var PDC9 = data['PD_C9'];
                            var PDC10 = data['PD_C10'];
                            var PDC11 = data['PD_C11'];
                            var PDC12 = data['PD_C12'];
                            var PDC15 = data['PD_C15'];
                            var PDC16 = data['PD_C16'];
                            var PDC17 = data['PD_C17'];
                            var PDC18 = data['PD_C18'];
                            var PDC19 = data['PD_C19'];
                            var PDC20 = data['PD_C20'];

                            var PDC0V = [];
                            var PDC0B = [];
                            var PDC0C = [];
                            var PDC0VX = [];

                            var PDC1V = [];
                            var PDC1B = [];
                            var PDC1C = [];
                            var PDC1VX = [];

                            var PDC1aV = [];
                            var PDC1aB = [];
                            var PDC1aC = [];
                            var PDC1aVX = [];

                            var PDC2V = [];
                            var PDC2B = [];
                            var PDC2C = [];
                            var PDC2VX = [];

                            var PDC3V = [];
                            var PDC3B = [];
                            var PDC3C = [];
                            var PDC3VX = [];

                            var PDC4V = [];
                            var PDC4B = [];
                            var PDC4C = [];
                            var PDC4VX = [];

                            var PDC5V = [];
                            var PDC5B = [];
                            var PDC5C = [];
                            var PDC5VX = [];

                            var PDC6V = [];
                            var PDC6B = [];
                            var PDC6C = [];
                            var PDC6VX = [];

                            var PDC7V = [];
                            var PDC7B = [];
                            var PDC7C = [];
                            var PDC7VX = [];

                            var PDC8V = [];
                            var PDC8B = [];
                            var PDC8C = [];
                            var PDC8VX = [];

                            var PDC9V = [];
                            var PDC9B = [];
                            var PDC9C = [];
                            var PDC9VX = [];

                            var PDC10V = [];
                            var PDC10B = [];
                            var PDC10C = [];
                            var PDC10VX = [];

                            var PDC11V = [];
                            var PDC11B = [];
                            var PDC11C = [];
                            var PDC11VX = [];

                            var PDC12V = [];
                            var PDC12B = [];
                            var PDC12C = [];
                            var PDC12VX = [];

                            var PDC13V = [];
                            var PDC13B = [];
                            var PDC13C = [];
                            var PDC13VX = [];

                            var PDC14V = [];
                            var PDC14B = [];
                            var PDC14C = [];
                            var PDC14VX = [];

                            var PDC15V = [];
                            var PDC15B = [];
                            var PDC15C = [];
                            var PDC15VX = [];

                            var PDC16V = [];
                            var PDC16B = [];
                            var PDC16C = [];
                            var PDC16VX = [];

                            var PDC17V = [];
                            var PDC17B = [];
                            var PDC17C = [];
                            var PDC17VX = [];

                            var PDC18V = [];
                            var PDC18B = [];
                            var PDC18C = [];
                            var PDC18VX = [];

                            var PDC19V = [];
                            var PDC19B = [];
                            var PDC19C = [];
                            var PDC19VX = [];

                            var PDC20V = [];
                            var PDC20B = [];
                            var PDC20C = [];
                            var PDC20VX = [];

                            if(protienFStatus3==false)
                            {
                                extractValues(PDC0,PDC0V,PDC0B,PDC0C,"Simple");
                                customizedArray(PDC0V,PDC0VX,PDC0label,colorPallet,"Doughnut");
                                doughnutChartF(PDC0VX,"pd3_c0","Food Service vs. Retail",300,"protienF");
                                var baseX = processBase(PDC0B);
                                var htmlB = ``;
                                htmlB += `(Base=`;
                                baseX.forEach(function (e, i, a) {
                                    if (e < 30) {
                                        htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                    } else {
                                        htmlB += `${e})`;
                                    }
                                });

                                $("#pd3_c0_base").empty().append(htmlB);

                                var span = $('#pd3_c0_base');
                                var htmlContent = span.html();

                                if (htmlContent.includes('Low')) {
                                    var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                    span.html(updatedContent);
                                } else {
                                    var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                    span.html(cleanedContent); 
                                }
                            }
                            
                            extractValues(PDC1,PDC1V,PDC1B,PDC1C,"Simple");
                            customizedArray(PDC1V,PDC1VX,PDC1label,colorPallet,"Doughnut");
                            doughnutChart4(PDC1VX,"pd3_c1","Category Consumed",285);

                            var baseX = processBase(PDC1B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c1_base").empty().append(htmlB);

                            var span = $('#pd3_c1_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC1a,PDC1aV,PDC1aB,PDC1aC,"Simple");
                            customizedArray(PDC1aV,PDC1aVX,PDC1alabel,colorPallet,"Doughnut");
                            doughnutChart4(PDC1aVX,"pd3_c1a","Category Consumed",265);

                            var baseX = processBase(PDC1aB);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c1a_base").empty().append(htmlB);

                            var span = $('#pd3_c1a_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC2,PDC2V,PDC2B,PDC2C,"Simple");
                            customizedArray(PDC2V,PDC2VX,PDC2label,colorPallet,"Doughnut");
                            doughnutChart2(PDC2VX,"pd3_c2","Type of protein","auto");

                            var baseX = processBase(PDC2B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c2_base").empty().append(htmlB);

                            var span = $('#pd3_c2_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC5,PDC5V,PDC5B,PDC5C,"Simple");
                            customizedArray(PDC5V,PDC5VX,PDC5label,colorPallet,"Doughnut");
                            doughnutChart4(PDC5VX,"pd3_c5","Category Consumed",300);

                            var baseX = processBase(PDC5B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c5_base").empty().append(htmlB);

                            var span = $('#pd3_c5_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC3,PDC3V,PDC3B,PDC3C,"Simple");
                            var max = (Math.max(...PDC3V)+20);
                            customizedArray(PDC3V,PDC3VX,PDC3label,colorPallet,"Bar");
                            barChart(PDC3VX,"pd3_c3",PDC3label,max);

                            var baseX = processBase(PDC3B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c3_base").empty().append(htmlB);

                            var span = $('#pd3_c3_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC6,PDC6V,PDC6B,PDC6C,"Simple");
                            customizedArray(PDC6V,PDC6VX,PDC6label,colorPallet,"Doughnut");
                            pieChart(PDC6VX,"pd3_c6","Type of Packaging","auto");

                            var baseX = processBase(PDC6B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c6_base").empty().append(htmlB);

                            var span = $('#pd3_c6_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC7,PDC7V,PDC7B,PDC7C,"Simple");
                            customizedArray(PDC7V,PDC7VX,PDC7label,colorPallet,"Doughnut");
                            pieChart(PDC7VX,"pd3_c7","Type of Packaging","auto");

                            var baseX = processBase(PDC7B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c7_base").empty().append(htmlB);

                            var span = $('#pd3_c7_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC8,PDC8V,PDC8B,PDC8C,"Simple");
                            var max = (Math.max(...PDC8V)+20);
                            customizedArray(PDC8V,PDC8VX,PDC8label,colorPallet,"Bar");
                            barChart(PDC8VX,"pd3_c8",PDC8label,max);

                            var baseX = processBase(PDC8B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c8_base").empty().append(htmlB);

                            var span = $('#pd3_c8_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC9,PDC9V,PDC9B,PDC9C,"Simple");
                            var max = (Math.max(...PDC9V)+20);
                            customizedArray(PDC9V,PDC9VX,PDC9label,colorPallet,"Bar");
                            barChart(PDC9VX,"pd3_c9",PDC9label,max);

                            var baseX = processBase(PDC9B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c9_base").empty().append(htmlB);

                            var span = $('#pd3_c9_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC10,PDC10V,PDC10B,PDC10C,"Simple");
                            customizedArray(PDC10V,PDC10VX,PDC10label,colorPallet,"Doughnut");
                            pieChart(PDC10VX,"pd3_c10","Way of consumption","auto");

                            var baseX = processBase(PDC10B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c10_base").empty().append(htmlB);

                            var span = $('#pd3_c10_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC11,PDC11V,PDC11B,PDC11C,"Simple");
                            var max = (Math.max(...PDC11V)+20);
                            customizedArray(PDC11V,PDC11VX,PDC11label,colorPallet,"Bar");
                            columnChart(PDC11VX,"pd3_c11",PDC11label,max);

                            var baseX = processBase(PDC11B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c11_base").empty().append(htmlB);

                            var span = $('#pd3_c11_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC16,PDC16V,PDC16B,PDC16C,"Simple");
                            var max = (Math.max(...PDC16V)+20);
                            customizedArray(PDC16V,PDC16VX,PDC16label,colorPallet,"Bar");
                            barChart(PDC16VX,"pd3_c16",PDC16label,max);

                            var baseX = processBase(PDC16B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c16_base").empty().append(htmlB);

                            var span = $('#pd3_c16_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC12,PDC12V,PDC12B,PDC12C,"Simple");
                            var max = (Math.max(...PDC12V)+20);
                            customizedArray(PDC12V,PDC12VX,PDC12label,colorPallet,"Bar");
                            columnChart(PDC12VX,"pd3_c12",PDC12label,max);

                            var baseX = processBase(PDC12B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c12_base").empty().append(htmlB);

                            var span = $('#pd3_c12_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC15,PDC15V,PDC15B,PDC15C,"Simple");
                            PDC15V.forEach(function(e,i,a){
                                $(`#pd3_c15_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC15B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c15_base").empty().append(htmlB);

                            var span = $('#pd3_c15_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC20,PDC20V,PDC20B,PDC20C,"Simple");
                            PDC20V.forEach(function(e,i,a){
                                $(`#pd3_c20_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC20B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c20_base").empty().append(htmlB);

                            var span = $('#pd3_c20_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC17,PDC17V,PDC17B,PDC17C,"Simple");
                            PDC17V.forEach(function(e,i,a){
                                doughnutChart3(e,`pd3_c17_${i+1}`,colorPallet[i])
                            });

                            var baseX = processBase(PDC17B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c17_base").empty().append(htmlB);

                            var span = $('#pd3_c17_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC18,PDC18V,PDC18B,PDC18C,"Simple");
                            var max = (Math.max(...PDC18V)+20);
                            customizedArray(PDC18V,PDC18VX,PDC18label,colorPallet,"Bar");
                            barChart(PDC18VX,"pd3_c18",PDC18label,max);

                            var baseX = processBase(PDC18B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c18_base").empty().append(htmlB);

                            var span = $('#pd3_c18_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC19,PDC19V,PDC19B,PDC19C,"Simple");
                            var max = (Math.max(...PDC19V)+20);
                            customizedArray(PDC19V,PDC19VX,PDC19label,colorPallet,"Bar");
                            columnChart(PDC19VX,"pd3_c19",PDC19label,max);

                            var baseX = processBase(PDC19B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd3_c19_base").empty().append(htmlB);

                            var span = $('#pd3_c19_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }
                        },
                        complete: function (data) {
                            protienFStatus3 = true;
                            ajaxFlag[25] = true;
                            $(".splash").hide();
                            clickableSlice2();
                        }
                    });
                }

                function twentyFivethAjax() {
                    $.ajax({
                        url: "api/ajax25.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                            'tblX': tblX,
                            'protiencondX': protiencondX
                        },
                        success: function(response) {
                            var data = JSON.parse(response);
                            console.log(data);
                            var PDC0 = data['PD_C0'];
                            var PDC1 = data['PD_C1'];
                            var PDC1a = data['PD_C1a'];
                            var PDC2 = data['PD_C2'];
                            var PDC3 = data['PD_C3'];
                            var PDC5 = data['PD_C5'];
                            var PDC6 = data['PD_C6'];
                            var PDC7 = data['PD_C7'];
                            var PDC8 = data['PD_C8'];
                            var PDC9 = data['PD_C9'];
                            var PDC10 = data['PD_C10'];
                            var PDC11 = data['PD_C11'];
                            var PDC12 = data['PD_C12'];
                            var PDC15 = data['PD_C15'];
                            var PDC16 = data['PD_C16'];
                            var PDC17 = data['PD_C17'];
                            var PDC18 = data['PD_C18'];
                            var PDC19 = data['PD_C19'];
                            var PDC20 = data['PD_C20'];

                            var PDC0V = [];
                            var PDC0B = [];
                            var PDC0C = [];
                            var PDC0VX = [];

                            var PDC1V = [];
                            var PDC1B = [];
                            var PDC1C = [];
                            var PDC1VX = [];

                            var PDC1aV = [];
                            var PDC1aB = [];
                            var PDC1aC = [];
                            var PDC1aVX = [];

                            var PDC2V = [];
                            var PDC2B = [];
                            var PDC2C = [];
                            var PDC2VX = [];

                            var PDC3V = [];
                            var PDC3B = [];
                            var PDC3C = [];
                            var PDC3VX = [];

                            var PDC4V = [];
                            var PDC4B = [];
                            var PDC4C = [];
                            var PDC4VX = [];

                            var PDC5V = [];
                            var PDC5B = [];
                            var PDC5C = [];
                            var PDC5VX = [];

                            var PDC6V = [];
                            var PDC6B = [];
                            var PDC6C = [];
                            var PDC6VX = [];

                            var PDC7V = [];
                            var PDC7B = [];
                            var PDC7C = [];
                            var PDC7VX = [];

                            var PDC8V = [];
                            var PDC8B = [];
                            var PDC8C = [];
                            var PDC8VX = [];

                            var PDC9V = [];
                            var PDC9B = [];
                            var PDC9C = [];
                            var PDC9VX = [];

                            var PDC10V = [];
                            var PDC10B = [];
                            var PDC10C = [];
                            var PDC10VX = [];

                            var PDC11V = [];
                            var PDC11B = [];
                            var PDC11C = [];
                            var PDC11VX = [];

                            var PDC12V = [];
                            var PDC12B = [];
                            var PDC12C = [];
                            var PDC12VX = [];

                            var PDC13V = [];
                            var PDC13B = [];
                            var PDC13C = [];
                            var PDC13VX = [];

                            var PDC14V = [];
                            var PDC14B = [];
                            var PDC14C = [];
                            var PDC14VX = [];

                            var PDC15V = [];
                            var PDC15B = [];
                            var PDC15C = [];
                            var PDC15VX = [];

                            var PDC16V = [];
                            var PDC16B = [];
                            var PDC16C = [];
                            var PDC16VX = [];

                            var PDC17V = [];
                            var PDC17B = [];
                            var PDC17C = [];
                            var PDC17VX = [];

                            var PDC18V = [];
                            var PDC18B = [];
                            var PDC18C = [];
                            var PDC18VX = [];

                            var PDC19V = [];
                            var PDC19B = [];
                            var PDC19C = [];
                            var PDC19VX = [];

                            var PDC20V = [];
                            var PDC20B = [];
                            var PDC20C = [];
                            var PDC20VX = [];

                            if(protienFStatus4==false)
                            {
                                extractValues(PDC0,PDC0V,PDC0B,PDC0C,"Simple");
                                customizedArray(PDC0V,PDC0VX,PDC0label,colorPallet,"Doughnut");
                                doughnutChartF(PDC0VX,"pd4_c0","Food Service vs. Retail",300,"protienF");
                                var baseX = processBase(PDC0B);
                                var htmlB = ``;
                                htmlB += `(Base=`;
                                baseX.forEach(function (e, i, a) {
                                    if (e < 30) {
                                        htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                    } else {
                                        htmlB += `${e})`;
                                    }
                                });

                                $("#pd4_c0_base").empty().append(htmlB);

                                var span = $('#pd4_c0_base');
                                var htmlContent = span.html();

                                if (htmlContent.includes('Low')) {
                                    var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                    span.html(updatedContent);
                                } else {
                                    var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                    span.html(cleanedContent); 
                                }
                            }
                            
                            extractValues(PDC1,PDC1V,PDC1B,PDC1C,"Simple");
                            customizedArray(PDC1V,PDC1VX,PDC1label,colorPallet,"Doughnut");
                            doughnutChart4(PDC1VX,"pd4_c1","Category Consumed",285);

                            var baseX = processBase(PDC1B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c1_base").empty().append(htmlB);

                            var span = $('#pd4_c1_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC1a,PDC1aV,PDC1aB,PDC1aC,"Simple");
                            customizedArray(PDC1aV,PDC1aVX,PDC1alabel,colorPallet,"Doughnut");
                            doughnutChart4(PDC1aVX,"pd4_c1a","Category Consumed",265);

                            var baseX = processBase(PDC1aB);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c1a_base").empty().append(htmlB);

                            var span = $('#pd4_c1a_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC2,PDC2V,PDC2B,PDC2C,"Simple");
                            customizedArray(PDC2V,PDC2VX,PDC2label,colorPallet,"Doughnut");
                            doughnutChart2(PDC2VX,"pd4_c2","Type of protein","auto");

                            var baseX = processBase(PDC2B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c2_base").empty().append(htmlB);

                            var span = $('#pd4_c2_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC5,PDC5V,PDC5B,PDC5C,"Simple");
                            customizedArray(PDC5V,PDC5VX,PDC5label,colorPallet,"Doughnut");
                            doughnutChart4(PDC5VX,"pd4_c5","Category Consumed",300);

                            var baseX = processBase(PDC5B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c5_base").empty().append(htmlB);

                            var span = $('#pd4_c5_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC3,PDC3V,PDC3B,PDC3C,"Simple");
                            var max = (Math.max(...PDC3V)+20);
                            customizedArray(PDC3V,PDC3VX,PDC3label,colorPallet,"Bar");
                            barChart(PDC3VX,"pd4_c3",PDC3label,max);

                            var baseX = processBase(PDC3B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c3_base").empty().append(htmlB);

                            var span = $('#pd4_c3_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC6,PDC6V,PDC6B,PDC6C,"Simple");
                            customizedArray(PDC6V,PDC6VX,PDC6label,colorPallet,"Doughnut");
                            pieChart(PDC6VX,"pd4_c6","Type of Packaging","auto");

                            var baseX = processBase(PDC6B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c6_base").empty().append(htmlB);

                            var span = $('#pd4_c6_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC7,PDC7V,PDC7B,PDC7C,"Simple");
                            customizedArray(PDC7V,PDC7VX,PDC7label,colorPallet,"Doughnut");
                            pieChart(PDC7VX,"pd4_c7","Type of Packaging","auto");

                            var baseX = processBase(PDC7B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c7_base").empty().append(htmlB);

                            var span = $('#pd4_c7_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC8,PDC8V,PDC8B,PDC8C,"Simple");
                            var max = (Math.max(...PDC8V)+20);
                            customizedArray(PDC8V,PDC8VX,PDC8label,colorPallet,"Bar");
                            barChart(PDC8VX,"pd4_c8",PDC8label,max);

                            var baseX = processBase(PDC8B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c8_base").empty().append(htmlB);

                            var span = $('#pd4_c8_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC9,PDC9V,PDC9B,PDC9C,"Simple");
                            var max = (Math.max(...PDC9V)+20);
                            customizedArray(PDC9V,PDC9VX,PDC9label,colorPallet,"Bar");
                            barChart(PDC9VX,"pd4_c9",PDC9label,max);

                            var baseX = processBase(PDC9B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c9_base").empty().append(htmlB);

                            var span = $('#pd4_c9_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC10,PDC10V,PDC10B,PDC10C,"Simple");
                            customizedArray(PDC10V,PDC10VX,PDC10label,colorPallet,"Doughnut");
                            pieChart(PDC10VX,"pd4_c10","Way of consumption","auto");

                            var baseX = processBase(PDC10B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c10_base").empty().append(htmlB);

                            var span = $('#pd4_c10_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC11,PDC11V,PDC11B,PDC11C,"Simple");
                            var max = (Math.max(...PDC11V)+20);
                            customizedArray(PDC11V,PDC11VX,PDC11label,colorPallet,"Bar");
                            columnChart(PDC11VX,"pd4_c11",PDC11label,max);

                            var baseX = processBase(PDC11B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c11_base").empty().append(htmlB);

                            var span = $('#pd4_c11_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC16,PDC16V,PDC16B,PDC16C,"Simple");
                            var max = (Math.max(...PDC16V)+20);
                            customizedArray(PDC16V,PDC16VX,PDC16label,colorPallet,"Bar");
                            barChart(PDC16VX,"pd4_c16",PDC16label,max);

                            var baseX = processBase(PDC16B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c16_base").empty().append(htmlB);

                            var span = $('#pd4_c16_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC12,PDC12V,PDC12B,PDC12C,"Simple");
                            var max = (Math.max(...PDC12V)+20);
                            customizedArray(PDC12V,PDC12VX,PDC12label,colorPallet,"Bar");
                            columnChart(PDC12VX,"pd4_c12",PDC12label,max);

                            var baseX = processBase(PDC12B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c12_base").empty().append(htmlB);

                            var span = $('#pd4_c12_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC15,PDC15V,PDC15B,PDC15C,"Simple");
                            PDC15V.forEach(function(e,i,a){
                                $(`#pd4_c15_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC15B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c15_base").empty().append(htmlB);

                            var span = $('#pd4_c15_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC20,PDC20V,PDC20B,PDC20C,"Simple");
                            PDC20V.forEach(function(e,i,a){
                                $(`#pd4_c20_${i+1}`).empty().append(`${e}%`);
                            });

                            var baseX = processBase(PDC20B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c20_base").empty().append(htmlB);

                            var span = $('#pd4_c20_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC17,PDC17V,PDC17B,PDC17C,"Simple");
                            PDC17V.forEach(function(e,i,a){
                                doughnutChart3(e,`pd4_c17_${i+1}`,colorPallet[i])
                            });

                            var baseX = processBase(PDC17B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c17_base").empty().append(htmlB);

                            var span = $('#pd4_c17_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC18,PDC18V,PDC18B,PDC18C,"Simple");
                            var max = (Math.max(...PDC18V)+20);
                            customizedArray(PDC18V,PDC18VX,PDC18label,colorPallet,"Bar");
                            barChart(PDC18VX,"pd4_c18",PDC18label,max);

                            var baseX = processBase(PDC18B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c18_base").empty().append(htmlB);

                            var span = $('#pd4_c18_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }

                            extractValues(PDC19,PDC19V,PDC19B,PDC19C,"Simple");
                            var max = (Math.max(...PDC19V)+20);
                            customizedArray(PDC19V,PDC19VX,PDC19label,colorPallet,"Bar");
                            columnChart(PDC19VX,"pd4_c19",PDC19label,max);

                            var baseX = processBase(PDC19B);
                            var htmlB = ``;
                            htmlB += `(Base=`;
                            baseX.forEach(function (e, i, a) {
                                if (e < 30) {
                                    htmlB += `${e}<span class="lowerBase">*</span>, Low Base)`;
                                } else {
                                    htmlB += `${e})`;
                                }
                            });

                            $("#pd4_c19_base").empty().append(htmlB);

                            var span = $('#pd4_c19_base');
                            var htmlContent = span.html();

                            if (htmlContent.includes('Low')) {
                                var updatedContent = htmlContent.replace(/(\d+)/g, '<span class="lowerBase">$1</span>');
                                span.html(updatedContent);
                            } else {
                                var cleanedContent = htmlContent.replace(/<span class="lowerBase">(\d+)<\/span>/g, '$1');
                                span.html(cleanedContent); 
                            }
                        },
                        complete: function (data) {
                            protienFStatus4 = true;
                            ajaxFlag[26] = true;
                            $(".splash").hide();
                            clickableSlice2();
                        }
                    });
                }

                function twentySixthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[27] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentySeventhAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[28] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentyEightthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[29] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function twentyNinethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            ajaxFlag[30] = true;
                            $(".splash").hide();
                        }
                    });
                }

                function thirtythAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyOnethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyTwothAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyThreethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyFourthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyFivethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtySixthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtySeventhAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyEightthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function thirtyNinethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortythAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortyOnethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortyTwothAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortyThreethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortyFourthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortyFivethAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }

                function fortySixthAjax() {
                    $.ajax({
                        url: "api/ajax1.php",
                        type: "POST",
                        data: {
                            'condX': condX,
                            'conX': conX,
                        },
                        success: function(response) {
                            
                        },
                        complete: function (data) {
                            $(".splash").hide();
                        }
                    });
                }
            //=================================Ajax End============================================

            //=================================Chart Start============================================

            function doughnutChartF(lucifer,divId,seriesName,heightX,filterName)
            {
                Highcharts.chart(divId, {
                    chart: {
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans",
                        },
                        "backgroundColor": "transparent",
                        height: heightX
                    },
                    accessibility: {
                        point: {
                            valueSuffix: '%'
                        }
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: ''
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.y:.0f}%</b>'
                    },
                    legend: {
                        layout: 'horizontal',
                        align: 'center',
                        verticalAlign: 'bottom',
                        width: '100%',
                        itemStyle: {
                            width: '80%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: false,
                            dataLabels: {
                                enabled: true
                            },
                        },
                        series: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: [{
                                enabled: true,
                                formatter: function() {
                                    return this.y > 0 ? this.y.toFixed(0) + '%' : null;
                                },
                                distance: 5,
                                style: {
                                    fontSize: '0.85rem',
                                    color: '#000000',
                                    fontWeight: 'normal' 
                                }
                            }],
                            showInLegend: true,
                            point: {
                                events: {
                                    click: function() {
                                        var idX = this.series.chart.renderTo.id;
                                        console.log(idX);
                                        var dataNameX = $(`#${idX}`).data("name");
                                        var dropdownName = this.series.name.toLowerCase();
                                        var valueName = this.name;
                                        clickableSlice(idX, dataNameX, filterName, valueName, "charts", "fresh");
                                    }
                                }
                            }
                        }
                    },
                    // colors: ['#C07B60','#FA8D62','#2C626E','#B1DCD3','#74A9CE','#A6BCDB','#D0D0E7'],
                    series: [{
                        name: 'Perecentage',
                        colorByPoint: true,
                        innerSize: '85%',
                        data: lucifer
                    }],
                });
            }

            function doughnutChart(lucifer,divId,seriesName,heightX)
            {
                Highcharts.chart(divId, {
                    chart: {
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans",
                        },
                        "backgroundColor": "transparent",
                        height: heightX
                    },
                    accessibility: {
                        point: {
                            valueSuffix: '%'
                        }
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: ''
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.y:.0f}%</b>'
                    },
                    legend: {
                        layout: 'horizontal',
                        align: 'center',
                        verticalAlign: 'bottom',
                        width: '90%',
                        itemStyle: {
                            width: '80%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    plotOptions: {
                        pie: {
                            dataLabels: {
                                enabled: true
                            },
                        },
                        series: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            // borderRadius: 8,
                            dataLabels: [{
                                enabled: false,
                                distance: 20,
                                format: '{point.name}'
                            }, {
                                enabled: true,
                                formatter: function() {
                                    return this.y > 0 ? this.y.toFixed(0) + '%' : null;
                                },
                                distance: 5,
                                // format: '{point.percentage:.1f}%',
                                style: {
                                    fontSize: '0.85rem',
                                    color: '#000000',
                                }
                            }],
                            showInLegend: true,
                        }
                    },
                    // colors: ['#C07B60','#FA8D62','#2C626E','#B1DCD3','#74A9CE','#A6BCDB','#D0D0E7'],
                    series: [{
                        name: 'Perecentage',
                        colorByPoint: true,
                        innerSize: '85%',
                        data: lucifer
                    }],
                });
            }

            function doughnutChart2(lucifer,divId,seriesName,heightX)
            {
                Highcharts.chart(divId, {
                    chart: {
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans",
                        },
                        "backgroundColor": "transparent",
                        "height": heightX
                    },
                    accessibility: {
                        point: {
                            valueSuffix: '%'
                        }
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: ''
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.y:.0f}%</b>'
                    },
                    legend: {
                        layout: 'horizontal', 
                        verticalAlign: 'bottom',
                        itemStyle: {
                            // width: '50%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    plotOptions: {
                        pie: {
                            dataLabels: {
                                enabled: true
                            },
                            // colors: ['rgba(255, 99, 132, 0.5)', 'rgba(54, 162, 235, 0.5)', 'rgba(255, 206, 86, 0.5)', 'rgba(75, 192, 192, 0.5)'] // Transparent colors
                        },
                        series: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: [{
                                enabled: false,
                                distance: 20,
                                format: '{point.name}'
                            }, {
                                enabled: true,
                                formatter: function() {
                                    return this.y > 0 ? this.y.toFixed(0) + '%' : null;
                                },
                                distance: 5,
                                // format: '{point.percentage:.1f}%',
                                style: {
                                    fontSize: '0.85rem',
                                    color: '#000000'
                                }
                            }],
                            showInLegend: true,
                        }
                    },
                    // colors: ['#C07B60','#FA8D62','#2C626E','#B1DCD3','#74A9CE','#A6BCDB','#D0D0E7'],
                    series: [{
                        name: seriesName,
                        colorByPoint: true,
                        innerSize: '85%',
                        data: lucifer
                    }],
                });
            }
            
            function doughnutChart3(lucifer,id,color) {
                Highcharts.chart(id, {
                    chart: {
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: `<div style='font-size:0.9rem'><b>${lucifer}%</b></div>`,
                        align: "center",
                        verticalAlign: "middle",
                        style: {
                            "textAlign": "center"
                        },
                        y: 15,
                        useHTML: true
                    },
                    credits: {
                        enabled: false
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    series: [{
                        type: 'pie',
                        enableMouseTracking: false,
                        innerSize: '80%',
                        dataLabels: {
                            enabled: false
                        },
                        data: [{
                            y: lucifer,
                            color: color
                        }, {
                            y: 100 - lucifer,
                            color: '#e3e3e3'
                        }]
                    }]
                });
            }

            function doughnutChart4(lucifer,divId,seriesName,heightX)
            {
                Highcharts.chart(divId, {
                    chart: {
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans",
                        },
                        "backgroundColor": "transparent",
                        height: heightX
                    },
                    accessibility: {
                        point: {
                            valueSuffix: '%'
                        }
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    title: {
                        text: ''
                    },
                    subtitle: {
                        text: ''
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.y:.0f}%</b>'
                    },
                    legend: {
                        layout: 'horizontal',
                        align: 'center',
                        width: '100%',
                        verticalAlign: 'bottom',
                        itemStyle: {
                            width: '80%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    plotOptions: {
                        pie: {
                            dataLabels: {
                                enabled: true
                            },
                        },
                        series: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            // borderRadius: 8,
                            dataLabels: [{
                                enabled: false,
                                distance: 20,
                                format: '{point.name}'
                            }, {
                                enabled: true,
                                formatter: function() {
                                    return this.y > 0 ? this.y.toFixed(0) + '%' : null;
                                },
                                distance: 5,
                                // format: '{point.percentage:.1f}%',
                                style: {
                                    fontSize: '0.85rem',
                                    color: '#000000'
                                }
                            }],
                            showInLegend: true,
                        }
                    },
                    // colors: ['#C07B60','#FA8D62','#2C626E','#B1DCD3','#74A9CE','#A6BCDB','#D0D0E7'],
                    series: [{
                        name: 'Perecentage',
                        colorByPoint: true,
                        innerSize: '85%',
                        data: lucifer
                    }],
                });
            }

            function pieChart(lucifer,divId,heightX)
            {
                Highcharts.chart(divId, {
                    chart: {
                        plotShadow: false,
                        type: 'pie',
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                        height: heightX
                    },
                    title: {
                        text: '',
                        align: 'left'
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    tooltip: {
                        //pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                        valueSuffix: '%'
                    },
                    accessibility: {
                        point: {
                            valueSuffix: '%'
                        }
                    },
                    legend: {
                        layout: 'horizontal', 
                        verticalAlign: 'bottom',
                        itemStyle: {
                            // width: '50%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true
                            },
                            showInLegend: true
                        },
                        series: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            dataLabels: [{
                                enabled: false,
                                distance: 20,
                                format: '{point.name}'
                            }, {
                                enabled: true,
                                formatter: function() {
                                    return this.y > 0 ? this.y.toFixed(0) + '%' : null;
                                },
                                distance: 5,
                                // format: '{point.percentage:.1f}%',
                                style: {
                                    fontSize: '0.85rem',
                                    color: '#000000'
                                }
                            }],
                            showInLegend: true,
                        }
                    },
                    series: [{
                        name: 'Percentage',
                        colorByPoint: true,
                        data: lucifer
                    }]
                });
            }

            function columnChart(data,id,cat,max)
            {
                Highcharts.chart(id, {
                    chart: {
                        type: 'column',
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                    },
                    title: {
                        text: '',
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    xAxis: {
                        categories: cat,
                        gridLineWidth: 0,
                        // lineWidth: 0,
                        labels: {
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            },
                            rotation:0,
                        }
                    },
                    yAxis: {
                        min: 0,
                        max:max,
                        title: {
                            text: ''
                        },
                        gridLineWidth: 0,
                        minorGridLineWidth: 0,
                        alignTicks: false,
                        labels: {
                            enabled: false
                        },
                    },
                    tooltip: {
                        valueSuffix: ' %'
                    },
                    legend:
                    {
                        enabled:false
                    },
                    plotOptions: {
                        column: {
                            borderRadius: {
                                radius: 10,
                                where: 'all'
                            },
                            pointPadding: 0.2,
                            borderWidth: 0
                        },
                        series: {
                            colorByPoint: true,
                            pointWidth: 16,
                            cursor: 'pointer',
                            dataLabels: {
                                
                                enabled: true,
                                style: {
                                    textOutline: false,
                                    fontSize : "0.85rem",
                                    color: '#000000'
                                },
                                formatter: function() {
                                    if(this)
                                    {
                                        return this.y + "%";
                                    }
                                    
                                },
                            }
                        }
                    },
                    colors: colorPallet,
                    series: data
                });
            }

            function barChart(data,id,cat,max)
            {
                Highcharts.chart(id, {
                    chart: {
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                        type: 'bar',
                    },
                    title: {
                        text: '',
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    xAxis: {
                        categories: cat,
                        title: {
                            text: null
                        },
                        gridLineWidth: 0,
                        lineWidth: 0,
                        labels: {
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            }
                        }
                    },
                    yAxis: {
                        min: 0,
                        max: max,
                        title: {
                            text: '',
                            align: 'high'
                        },
                        labels: {
                            overflow: 'justify'
                        },
                        gridLineWidth: 0,
                        minorGridLineWidth: 0,
                        alignTicks: false,
                        labels: {
                            enabled: false
                        },
                    },
                    tooltip: {
                        valueSuffix: ''
                    },
                    plotOptions: {
                        bar: {
                            borderRadius: {
                                radius: 10,
                                where: 'all'
                            },
                            pointPadding: 0.2,
                            borderWidth: 0,
                        },
                        series: {
                            colorByPoint: true,
                            pointWidth: 16,
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true,
                                style: {
                                    textOutline: false,
                                    fontSize : "0.85rem",
                                    color: '#000000'
                                },
                                formatter: function() {
                                    if(this)
                                    {
                                        return this.y + "%";
                                    }
                                },
                            }
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    legend: {
                        enabled: false
                    },
                    colors: colorPallet,
                    series: data
                });
            }
            
            function lineChart(data,id)
            {
                Highcharts.chart(id, {
                    chart: {
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                    },
                    title: {
                        text: '',
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    yAxis: {
                        title: {
                            text: ''
                        },
                        gridLineWidth: 0,
                        minorGridLineWidth: 0,
                        alignTicks: false,
                        labels: {
                            enabled: false
                        }
                    },
                    credits: {
                        enabled: false
                    },
                    legend: {
                        layout: 'horizontal',
                        align: 'center',
                        verticalAlign: 'bottom',
                        itemStyle: {
                            width: '100%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        },
                        backgroundColor: Highcharts.defaultOptions.legend.backgroundColor || // theme
                            '#fff'
                    },
                    xAxis: {
                        labels: {
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            },
                            rotation:0,
                            useHTML: true,
                            padding:15,
                            height:10,
                            width:10,
                        },
                        categories: ["JFM’25","AMJ’25","JAS’25","OND’25","JFM’26","AMJ’26","JAS’26","OND’26"]
                    },
                    tooltip: {
                        shared: true,
                        split: false,
                        enabled: true,
                        pointFormat: '<span style="color:{point.color}">\u25CF</span> Percentage for {series.name}: <b>{point.y}%</b> <br/>',
                    },
                    plotOptions: {
                        series: {
                            stacking: 'normal',
                            cursor: 'pointer',
                            dataLabels: {
                                enabled: true,
                                color: '#000000',
                                formatter: function() {
                                    return (this.y)+"%";
                                },
                            },
                            label: {
                                connectorAllowed: false
                            },
                        }
                    },
                    series: data,
                });
            }
            function stackbarChart(data,id)
            {
                Highcharts.chart(id, {
                    chart: {
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                        type: 'bar'
                    },
                    title: {
                        text: ''
                    },
                    xAxis: {
                        categories: ["JFM’25","AMJ’25","JAS’25","OND’25","JFM’26","AMJ’26","JAS’26","OND’26"],
                        labels: {
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            },
                            rotation:0,
                            useHTML: true,
                        }
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    yAxis: {
                        min: 0,
                        title: {
                            text: ''
                        },
                        gridLineWidth: 0,
                        minorGridLineWidth: 0,
                        alignTicks: false,
                        labels: {
                            enabled: false
                        },
                    },
                    tooltip: {
                        valueSuffix: ' %'
                    },
                    credits: {
                        enabled: false
                    },
                    legend: {
                        reversed: true,
                        itemStyle: {
                            width: '100%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    plotOptions: {
                        series: {
                            stacking: 'normal',
                            dataLabels: {
                                enabled: true,
                                style: {
                                    textOutline: false,
                                    fontSize: '0.85rem',
                                    // color: '#000000'
                                },
                                formatter: function() {
                                    if(this)
                                    {
                                        return this.y + "%";
                                    }
                                    
                                }
                            }
                        }
                    },
                    colors:colorPallet,
                    series: data
                });
            }

            function stackcolumnChart(data,id)
            {
                Highcharts.chart(id, {
                    chart: {
                        style: {
                            fontFamily: "Open Sans"
                        },
                        "backgroundColor": "transparent",
                        type: 'column',
                    },
                    title: {
                        text: '',
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    xAxis: [{
                        categories: ["JFM’25","AMJ’25","JAS’25","OND’25","JFM’26","AMJ’26","JAS’26","OND’26"],
                        labels: {
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            },
                            rotation:0,
                            useHTML: true,
                        }
                    }],
                    yAxis: [{
                        min: 0,
                        title: {
                            text:''
                        },
                        gridLineWidth: 0,
                        minorGridLineWidth: 0,
                        alignTicks: false,
                        labels: {
                            enabled: false
                        },
                        stackLabels: {
                            textAlign: 'center',
                            enabled: false,
                            borderRadius: 5,
                            backgroundColor: '#333333',
                            borderWidth: 1,
                            borderColor: '#AAA',
                            y: -15,
                            align: 'center',
                            style: {
                                fontWeight: 'bold',
                                fontSize:'13px',
                                // shadow: false,
                                color: '#FFFFFF',
                            }
                        }
                    }],

                    tooltip: {
                        shared: true,
                        split: false,
                        enabled: true,
                        headerFormat: '<b>{point.x}</b><br/>',
                        pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}%</b> <br/>',
                    },
                    credits: {
                        enabled: false
                    },
                    legend: {
                        itemStyle: {
                            width: '100%',
                            fontSize: "0.7rem",
                            color: '#000000'
                        }
                    },
                    plotOptions: {
                        column: {
                            stacking: 'normal',

                        },
                        series: {
                            pointWidth: 56,
                            cursor: 'pointer',
                                style: {
                                    textOutline: false,
                                    fontSize : "14px"
                                },
                            dataLabels: {
                                style: {
                                    textOutline: false,
                                    fontSize: '0.85rem',
                                },

                                enabled: true,
                                style: {
                                    textOutline: false
                                },
                                formatter: function() {
                                    if(this)
                                    {
                                        return (this.y) + '%';
                                    }
                                    
                                },
                            }
                        }
                    },
                    colors:colorPallet,
                    series: data
                });
            }

            function heatChart(lucifer,id,cat2)
            {
                Highcharts.chart(id, {
                    chart: {
                        type: 'heatmap',
                        plotBorderWidth: 1
                    },
                    title: {
                        text: '',
                    },
                    navigation: {
                        buttonOptions: {
                            enabled: false
                        }
                    },
                    credits: {
                        enabled: false
                    },

                    xAxis: {
                       categories: ["JFM’25","AMJ’25","JAS’25","OND’25","JFM’26","AMJ’26","JAS’26","OND’26"],
                        labels: {
                            enabled: true,
                            style: {
                                fontSize: '10px',
                                color: '#000000'
                            },
                        }
                    },
                    // #70db70 - Green
                    yAxis: {
                        categories: cat2,
                        title: null,
                        reversed: true,
                        labels: {
                            enabled: true,
                            style: {
                                fontSize: '10px',
                                color: '#000000',
                            },
                        }
                    },

                    colorAxis: {
                        min: 0,
                        minColor: '#FFFFFF',
                        maxColor: '#6BC4FF'
                    },

                    legend: {
                        align: 'right',
                        layout: 'vertical',
                        margin: 0,
                        verticalAlign: 'top',
                        y: 25,
                        symbolHeight: 280,
                        enabled:false
                    },

                    tooltip: {
                        format: '<b>{series.xAxis.categories.(point.x)}</b><br>' +
                            '<b>{series.yAxis.categories.(point.y)} : {point.value}%</b>'
                    },

                    series: [{
                        name: 'Sales per employee',
                        borderColor: '#000000',
                        borderWidth: 1,
                        data: lucifer,
                        dataLabels: {
                            enabled: true,
                            color: '#000000',
                            style: {
                                textOutline: false,
                                fontSize : "0.85rem"
                            },
                            formatter: function () {
                                return this.point.value + '%';
                            }
                        }
                    }],

                    responsive: {
                        rules: [{
                            condition: {
                                maxWidth: 500
                            },
                            chartOptions: {
                                yAxis: {
                                    labels: {
                                        format: '{substr value 0 1}'
                                    }
                                }
                            }
                        }]
                    }

                });
            }
            //=================================Chart END============================================
        </script>
    </body>
</html>