<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic HubDB Pie Chart Use Case in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384424#M19445</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using apexcharts.js to showcase data from HubDB in the form of a pie chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've successfully looped through all options within a HubDB column to define the pie chart categories/sections using:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        labels: [
        {% for choice in hubdb_table_column(2666166, 11).options %}
           '{{ choice.name }}',  
          {% endfor %}
        ],&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I now need to assign each category a value. If my multichoice hubdb column is "color" for example, I need to loop through the rows and return the count of rows for each color individually. Red, blue, green, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I would want a loop that returns the "count" of each column option, so it'd look something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;series: [44, 55, 13, 43, 22]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help in advance&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2020 21:54:49 GMT</pubDate>
    <dc:creator>cives</dc:creator>
    <dc:date>2020-11-05T21:54:49Z</dc:date>
    <item>
      <title>HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384424#M19445</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently using apexcharts.js to showcase data from HubDB in the form of a pie chart&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've successfully looped through all options within a HubDB column to define the pie chart categories/sections using:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        labels: [
        {% for choice in hubdb_table_column(2666166, 11).options %}
           '{{ choice.name }}',  
          {% endfor %}
        ],&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I now need to assign each category a value. If my multichoice hubdb column is "color" for example, I need to loop through the rows and return the count of rows for each color individually. Red, blue, green, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I would want a loop that returns the "count" of each column option, so it'd look something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;series: [44, 55, 13, 43, 22]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help in advance&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2020 21:54:49 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384424#M19445</guid>
      <dc:creator>cives</dc:creator>
      <dc:date>2020-11-05T21:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384655#M19455</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/122099"&gt;@cives&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First of all, would love to see your end result of this project!&lt;/P&gt;
&lt;P&gt;Secondly, I am going to introduce you to an HubDB expert &lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/91608"&gt;@alyssamwilie&lt;/a&gt; how would you go about this?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 16:52:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384655#M19455</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2020-11-06T16:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384671#M19458</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/122099"&gt;@cives&lt;/a&gt;&amp;nbsp;!&lt;BR /&gt;&lt;BR /&gt;I'd probably do something like this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// set a HubL array to hold the series' counts
{% set series = [] %}

// loop through the choices
{% for choice in hubdb_table_column(2666166, 11).options %}
  // create a query against your choice column checking for the choice name currently being looped
  {% set query = "&amp;lt;column name&amp;gt;__icontains="~choice.name %}

  // using the created query set a vairable to hold the filtered row array
  {% set rows = hubdb_table_rows(&amp;lt;tableId or name&amp;gt;, query) %}

  // append the length of the array to your series array
  {% do series.append(rows|length) %}
{% endfor %}

&amp;lt;script&amp;gt;
  // set your series variable
  series: {{ series }}
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 17:38:45 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384671#M19458</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-11-06T17:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384678#M19459</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;BR /&gt;&lt;BR /&gt;Just confirming — am I implementing your suggestion correctly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// set a HubL array to hold the series' counts
{% set series = [] %}

// loop through the choices
{% for choice in hubdb_table_column(2666166, 11).options %}
  // create a query against your choice column checking for the choice name currently being looped
  {% set query = "member_category__icontains="~choice.name %}

  // using the created query set a vairable to hold the filtered row array
  {% set rows = hubdb_table_rows('2666166', query) %}

  // append the length of the array to your series array
  {% do series.append(rows|length) %}
{% endfor %}


  // set your series variable
  series: {{ series }}


var options = {
  

          series: [{{ series }},],
          chart: {
          width: 380,
          type: 'pie',

        },
  theme: {
  monochrome: {
    enabled: true,
    color: '#2254fe',
    shadeTo: 'light',
    shadeIntensity: 0.65
  }
},
        labels: [
        {% for choice in hubdb_table_column(2666166, 11).options %}
           '{{ choice.name }}',  
          {% endfor %}
        ],
        responsive: [{
          breakpoint: 480,
          options: {
            chart: {
              width: 200
            },
            legend: {
              position: 'bottom'
            }
            
          }
        }]
        };

        var chart = new ApexCharts(document.querySelector("#member-pie"), options);
        chart.render();
      &lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 Nov 2020 17:53:43 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384678#M19459</guid>
      <dc:creator>cives</dc:creator>
      <dc:date>2020-11-06T17:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384793#M19465</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/122099"&gt;@cives&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;For this part :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  // set your series variable
  series: {{ series }}


var options = {
  

          series: [{{ series }},],
          chart: {
          width: 380,
          type: 'pie',

        },&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;It would just need to be :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;var options = {
  

          series: {{ series }},
          chart: {
          width: 380,
          type: 'pie',

        },&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;:&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 13:22:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384793#M19465</guid>
      <dc:creator>alyssamwilie</dc:creator>
      <dc:date>2020-11-07T13:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: HubDB Pie Chart Use Case</title>
      <link>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384795#M19467</link>
      <description>&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 13:56:58 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/HubDB-Pie-Chart-Use-Case/m-p/384795#M19467</guid>
      <dc:creator>cives</dc:creator>
      <dc:date>2020-11-07T13:56:58Z</dc:date>
    </item>
  </channel>
</rss>

