<turbo-stream action="replace" target="tab-content"><template><turbo-frame id="tab-content">
  <div class="py-8 px-6">
    <h2 class="text-3xl font-bold mb-6">Demographics</h2>
    <p class="text-gray-600 mb-6">
    When attendees registered for the Job Fair at Fort Eustis, we asked them to let us know what fields they are interested in.
    The charts below provide a breakdown of those interests and other demographic information. <span class="font-bold italic">
    Skills and interests are based on currently registered candidates and are subject to change as additional attendees register.</span>
    </p>
    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
        <div class="flex flex-col justify-center items-center bg-white p-0 rounded-lg shadow" style="height: 350px;">
          <h3 class="text-lg font-semibold mb-2">Military Branch</h3>
          <div id="chart-1" style="height: 250px; width: 100%; text-align: center; color: #999; line-height: 250px; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">Loading...</div>
<script>
  (function() {
    if (document.documentElement.hasAttribute("data-turbolinks-preview")) return;
    if (document.documentElement.hasAttribute("data-turbo-preview")) return;

    var createChart = function() { new Chartkick["BarChart"]("chart-1", [["Army",48],["Air Force",13],["Navy",13],["Spouse",13],["Marines",9],["Coast Guard",4]], {"colors":["#377FC8FF"],"suffix":"%","legend":false,"ytitle":false}); };
    if ("Chartkick" in window) {
      createChart();
    } else {
      window.addEventListener("chartkick:load", createChart, true);
    }
  })();
</script>

        </div>

        <div class="flex flex-col justify-center items-center bg-white p-0 rounded-lg shadow" style="height: 350px;">
          <h3 class="text-lg font-semibold mb-2">Rank</h3>
          <div id="chart-2" style="height: 250px; width: 100%; text-align: center; color: #999; line-height: 250px; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">Loading...</div>
<script>
  (function() {
    if (document.documentElement.hasAttribute("data-turbolinks-preview")) return;
    if (document.documentElement.hasAttribute("data-turbo-preview")) return;

    var createChart = function() { new Chartkick["BarChart"]("chart-2", [["E-4",25],["E-6",15],["E-7",15],["E-8",15],["E-3",10],["E-5",10],["E-9",5],["O-3",5]], {"colors":["#377FC8FF"],"suffix":"%","legend":false,"ytitle":false}); };
    if ("Chartkick" in window) {
      createChart();
    } else {
      window.addEventListener("chartkick:load", createChart, true);
    }
  })();
</script>

        </div>

      <div class="flex flex-col justify-center items-center bg-white p-0 rounded-lg shadow" style="height: 350px;">
          <h3 class="text-lg font-semibold mb-2">Active Security Clearance</h3>
          <div id="chart-3" style="height: 120px; width: 100%; text-align: center; color: #999; line-height: 120px; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">Loading...</div>
<script>
  (function() {
    if (document.documentElement.hasAttribute("data-turbolinks-preview")) return;
    if (document.documentElement.hasAttribute("data-turbo-preview")) return;

    var createChart = function() { new Chartkick["BarChart"]("chart-3", [{"name":"Yes","data":[["Clearance",61]]},{"name":"No","data":[["Clearance",39]]}], {"colors":["#377FC8FF","#2D5074FF"],"stacked":true,"suffix":"%","legend":true,"max":100}); };
    if ("Chartkick" in window) {
      createChart();
    } else {
      window.addEventListener("chartkick:load", createChart, true);
    }
  })();
</script>


          <h3 class="text-lg font-semibold mt-4 mb-2">Security Clearance</h3>
          <div id="chart-4" style="height: 120px; width: 100%; text-align: center; color: #999; line-height: 120px; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">Loading...</div>
<script>
  (function() {
    if (document.documentElement.hasAttribute("data-turbolinks-preview")) return;
    if (document.documentElement.hasAttribute("data-turbo-preview")) return;

    var createChart = function() { new Chartkick["BarChart"]("chart-4", [["TS/SCI Clearance",67],["Secret Clearance",33]], {"colors":["#377FC8FF"],"suffix":"%","legend":false,"ytitle":false}); };
    if ("Chartkick" in window) {
      createChart();
    } else {
      window.addEventListener("chartkick:load", createChart, true);
    }
  })();
</script>

      </div>

        <div class="flex flex-col justify-center items-center bg-white p-2 rounded-lg shadow col-span-1 sm:col-span-2 lg:col-span-2" style="height: 300px">
          <h3 class="text-lg font-semibold mb-2">Top Categories of Interests and Previous Experience</h3>
      <div id="chart-5" style="height: 250px; width: 100%; text-align: center; color: #999; line-height: 250px; font-size: 14px; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, Arial, Helvetica, sans-serif;">Loading...</div>
<script>
  (function() {
    if (document.documentElement.hasAttribute("data-turbolinks-preview")) return;
    if (document.documentElement.hasAttribute("data-turbo-preview")) return;

    var createChart = function() { new Chartkick["BarChart"]("chart-5", [{"name":"Work Interests","data":[["Military-Other",13],["Administrative/Clerical/Support",26],["Project/Program Management",22],["Logistics-Transportation",22],["Management/Supervision",22]]},{"name":"Previous Work Experience","data":[["Military-Other",17],["Administrative/Clerical/Support",4],["Project/Program Management",4],["Logistics-Transportation",4],["Management/Supervision",0]]}], {"colors":["#377FC8FF","#2D5074FF"],"stacked":false,"suffix":"%","legend":true,"max":100,"discrete":true}); };
    if ("Chartkick" in window) {
      createChart();
    } else {
      window.addEventListener("chartkick:load", createChart, true);
    }
  })();
</script>

      </div>

      <div class="flex flex-col justify-start items-center bg-white p-4 shadow" style="height: 300px;">
        <h3 class="text-lg font-semibold mb-2">Top Skills</h3>
        <canvas id="skills-word-cloud" width="300" height="225"></canvas>
      </div>
    </div>
  </div>

  <script>
    function initializeWordCloud() {
      var skillsData = {};
      try {
            skillsData = {"Data analysis":3,"Curriculum Development":2,"Customer Service":2,"Incident Response":2,"Juniper Networking":2,"Personnel Management":2,"Public Speaking":2,"Quality Assurance":2,"Risk Assessment":2,"Stakeholder relations":2,"case management":2,"crisis management":2," Critical Thinking":1," operations":1,"17 years of Leadership and personnel Management":1,"ASE":1,"Acas":1,"Active life and health insurance in VA; Healthcare Industry experience":1,"Admininstrative":1,"Administrative":1,"Advance medical support assistant":1,"Advance medical support assistant ":1,"Azure ":1,"Back-End Web Development":1,"Behavior Based Safety":1,"Biochemistry":1,"Biometrics":1,"BlooP":1,"CNC Machining":1,"Call Center Management":1};
      } catch (error) {
        return;
      }

      if (typeof WordCloud !== 'undefined' && skillsData && Object.keys(skillsData).length > 0) {
        var wordList = Object.entries(skillsData).map(([skill, count]) => [skill, count]);
        var canvas = document.getElementById('skills-word-cloud');
        if (canvas) {
          try {
            WordCloud(canvas, {
              list: wordList,
              gridSize: 5,
              weightFactor: function (size) {
                return size * 15;
              },
              fontFamily: 'Arial, sans-serif',
              color: function(word, weight) {
                return weight > 5 ? '#377fc8' : '#6c757d';
              },
              rotateRatio: 0.5,
              rotationSteps: 2,
              backgroundColor: '#ffffff'
            });
          } catch (error) {
            console.error('Error loading Skills WordCloud:', error);
          }
        }
      }
    }

    initializeWordCloud();

    document.addEventListener('turbo:frame-load', function(event) {
      if (event.target.id === 'tab-content') {
        initializeWordCloud();
      }
    });
  </script>
</turbo-frame>
</template></turbo-stream>