title: How to display the aggregated sum value inside a pie chart with different color?
body: <p>I could get the value of each brand inside the pie chart by adjusting the radius, but I could not change the color without causing the whole pie chart to be black. I believe that I might need to transform for the sum of each brand, but getting the correct value in the correct position seems to be my main issue.</p>
  <p><a href="https://i.stack.imgur.com/PhGz9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PhGz9.png" alt="enter image description here" /></a></p>
  <pre><code>{
    &quot;$schema&quot;: &quot;https://vega.github.io/schema/vega-lite/v4.json&quot;,
    &quot;description&quot;: &quot;A simple pie chart with labels.&quot;,
    &quot;height&quot;: 500,
    &quot;width&quot;: 500,
    &quot;data&quot;: {
      &quot;values&quot;: [
        {&quot;date&quot;: &quot;4/15/2020&quot;, &quot;brand&quot;: &quot;Body Care&quot;, &quot;mentions&quot;: 8599},
        {&quot;date&quot;: &quot;4/7/2020&quot;, &quot;brand&quot;: &quot;Makeup&quot;, &quot;mentions&quot;: 9090},
        {&quot;date&quot;: &quot;6/29/2020&quot;, &quot;brand&quot;: &quot;Body Care&quot;, &quot;mentions&quot;: 4563},
        {&quot;date&quot;: &quot;11/7/2020&quot;, &quot;brand&quot;: &quot;Skincare&quot;, &quot;mentions&quot;: 3369},
        {&quot;date&quot;: &quot;10/10/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 7025},
        {&quot;date&quot;: &quot;10/25/2020&quot;, &quot;brand&quot;: &quot;Skincare&quot;, &quot;mentions&quot;: 3523},
        {&quot;date&quot;: &quot;2/21/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 7976},
        {&quot;date&quot;: &quot;3/2/2020&quot;, &quot;brand&quot;: &quot;Hair&quot;, &quot;mentions&quot;: 1463},
        {&quot;date&quot;: &quot;8/19/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 1912},
        {&quot;date&quot;: &quot;10/14/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 6804},
        {&quot;date&quot;: &quot;5/7/2020&quot;, &quot;brand&quot;: &quot;Makeup&quot;, &quot;mentions&quot;: 4264},
        {&quot;date&quot;: &quot;8/4/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 9007},
        {&quot;date&quot;: &quot;9/17/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 5876},
        {&quot;date&quot;: &quot;1/12/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 5675},
        {&quot;date&quot;: &quot;7/17/2020&quot;, &quot;brand&quot;: &quot;Skincare&quot;, &quot;mentions&quot;: 2555},
        {&quot;date&quot;: &quot;1/29/2020&quot;, &quot;brand&quot;: &quot;Body Care&quot;, &quot;mentions&quot;: 6824},
        {&quot;date&quot;: &quot;9/19/2020&quot;, &quot;brand&quot;: &quot;Hair&quot;, &quot;mentions&quot;: 3109},
        {&quot;date&quot;: &quot;2/4/2020&quot;, &quot;brand&quot;: &quot;Body Care&quot;, &quot;mentions&quot;: 5807},
        {&quot;date&quot;: &quot;4/15/2020&quot;, &quot;brand&quot;: &quot;Fragrance&quot;, &quot;mentions&quot;: 4999}
      ]
    },
    &quot;encoding&quot;: {
      &quot;theta&quot;: {
        &quot;field&quot;: &quot;mentions&quot;,
        &quot;type&quot;: &quot;quantitative&quot;,
        &quot;stack&quot;: true,
        &quot;aggregate&quot;: &quot;sum&quot;
      },
      &quot;color&quot;: {
        &quot;field&quot;: &quot;brand&quot;,
        &quot;type&quot;: &quot;nominal&quot;,
        &quot;legend&quot;: null,
        &quot;scale&quot;: {&quot;range&quot;: &quot;category&quot;}
      }
    },
    &quot;layer&quot;: [
      {&quot;mark&quot;: {&quot;type&quot;: &quot;arc&quot;, &quot;outerRadius&quot;: 200}},
      {
        &quot;mark&quot;: {&quot;type&quot;: &quot;text&quot;, &quot;radius&quot;: 250, &quot;fontSize&quot;: 16},
        &quot;encoding&quot;: {&quot;text&quot;: {&quot;field&quot;: &quot;brand&quot;, &quot;type&quot;: &quot;nominal&quot;}, &quot;color&quot;: {}}
      },
      {
        &quot;mark&quot;: {&quot;type&quot;: &quot;text&quot;, &quot;radius&quot;: 300, &quot;color&quot;: &quot;blue&quot;},
        &quot;encoding&quot;: {
          &quot;text&quot;: {
            &quot;field&quot;: &quot;mentions&quot;,
            &quot;type&quot;: &quot;quantitative&quot;,
            &quot;aggregate&quot;: &quot;sum&quot;
          },
          &quot;color&quot;: {&quot;field&quot;: &quot;brand&quot;, &quot;type&quot;: &quot;nominal&quot;}
        }
      }
    ],
    &quot;view&quot;: {&quot;stroke&quot;: null}
  }
  </code></pre>