title: $:/plugins/linonetwo/visualization-dashboard/tiddlywiki-ui/Template/PolarTagsHoursWeek
tags: $:/Tags/VisualizationDashboard/GaugeTemplate $:/Tags/VisualizationDashboard/BarChart
caption: <<lingo GaugeTemplate/PolarTagsHoursWeek/Caption $:/plugins/linonetwo/visualization-dashboard/language/>>
description: <<lingo GaugeTemplate/PolarTagsHoursWeek/Description $:/plugins/linonetwo/visualization-dashboard/language/>>
targetTiddler: 
color: #66ccff

\function hoursThisWeek()
  [all[tiddlers]field:calendarEntry[yes]in-tagtree-of:inclusive<currentTag>] :filter[get[startDate]compare:date:gteq<weekStartDate>compare:date:lteq<weekEndDate>] +[counthours[]]
\end

\procedure series()
[
  <$list filter="[{!!targetTiddler}enlist-input[]]" variable="currentTag">
    {
      value: <<hoursThisWeek>>,
      name: '<<currentTag>>',
      itemStyle: {
        color: '{{{[<currentTag>get[color]else{!!color}]}}}'
      }
    },
  </$list>
]
\end

<div style="height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;">
  <$wikify name="seriesText" text=<<series>>>
    <$echarts
      $height="100%"
      $text=```
        option = {
          series: {
            type: 'bar',
            data: $(seriesText)$.sort((a, b) => a.value - b.value),
            coordinateSystem: 'polar',
            label: {
              show: true,
              position: 'middle',
              formatter: '{b}: {c}'
            }
          },
          title: {
            text: '${[{!!description}]}$'
          },
          polar: {
            radius: [30, '80%']
          },
          radiusAxis: {
            type: 'category',
          },
          angleAxis: {
            max: Math.max(...$(seriesText)$.map(item => item.value)) + 1,
            startAngle: 75,
          },
          tooltip: {},
        };
    ```/>
  </$wikify>
</div>
