<?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>Question Re: Pie Chart using R visualization in SAP Analytics Cloud in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/pie-chart-using-r-visualization-in-sap-analytics-cloud/qaa-p/14222618#M4926901</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for sharing your work and the nice example with R-Visualization, especially the Pie Chart. It is always good to see such creative use of SAC features. Just a small note: this type of detailed write-up will get better visibility if published in the Blog section rather than Q&amp;amp;A, since blogs are the right place for such informative content. Appreciate your contribution and looking forward to more such posts.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Sep 2025 14:59:06 GMT</pubDate>
    <dc:creator>RajuRam</dc:creator>
    <dc:date>2025-09-19T14:59:06Z</dc:date>
    <item>
      <title>Pie Chart using R visualization in SAP Analytics Cloud</title>
      <link>https://community.sap.com/t5/technology-q-a/pie-chart-using-r-visualization-in-sap-analytics-cloud/qaq-p/13951291</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In SAP Analytics Cloud, traditional charts are highly effective for most use cases. However, there are times when we need to push the boundaries and create something truly unique. This is where custom R visualizations come into play, offering a powerful way to go beyond standard capabilities.&lt;/P&gt;&lt;P&gt;Our goal was straightforward: we wanted to create a clean, interactive pie chart without the traditional lines pointing to the values, while also enhancing the overall presentation.&lt;/P&gt;&lt;P&gt;In this blog, we’ll walk you through the process of designing an interactive pie chart using R visualizations in SAP Analytics Cloud&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 1: Creating a Widget&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Click on Insert-&amp;gt;Others -&amp;gt; R visualization&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tharunbalaji_0-1732734245620.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/196230iD2BDDFE8BD7BC1E2/image-size/medium?v=v2&amp;amp;px=400" alt="tharunbalaji_0-1732734245620.png" title="tharunbalaji_0-1732734245620.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 2: Choosing the model &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Click on ‘Add Input data’ on the right pane and choose the model which you are going to build and the corresponding measures and dimensions and click on Ok Button.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tharunbalaji_1-1732734320085.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/196231i4CAD315DBB530E63/image-size/medium?v=v2&amp;amp;px=400" alt="tharunbalaji_1-1732734320085.png" title="tharunbalaji_1-1732734320085.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 3: Writing the R Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Click on ‘add script’ and you will get the below window where you can write your R scripts&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tharunbalaji_2-1732734351207.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/196232i7AAC589484165268/image-size/medium?v=v2&amp;amp;px=400" alt="tharunbalaji_2-1732734351207.png" title="tharunbalaji_2-1732734351207.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tharunbalaji_3-1732734358014.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/196233i66CEAA458AB4F6B5/image-size/medium?v=v2&amp;amp;px=400" alt="tharunbalaji_3-1732734358014.png" title="tharunbalaji_3-1732734358014.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 4: Scripting using R &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Write the scripts, click on 'Execute' button to preview and finally click apply&lt;/P&gt;&lt;P&gt;library(plotly)&lt;/P&gt;&lt;P&gt;library(dplyr)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;# Create the data frame&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;df = data.frame(&lt;/P&gt;&lt;P&gt;&amp;nbsp; product = MD_Test_Model$’Dimension 1’,&lt;/P&gt;&lt;P&gt;&amp;nbsp; val1 = MD_Test_Mode$’Test Calculation’)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: After typing the model followed by $, when you press ‘Ctrl’ + Space, it lets you to choose the respective dimension/measure&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;# Summarize &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;df &amp;lt;- df %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp; group_by(product) %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp; summarise(val1 = sum(val1)) %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp; arrange(desc(val1)) %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp; mutate(percentage = val1 / sum(val1) * 100) &lt;STRONG&gt;# Calculate percentage for hover info&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;# Define custom colors for the pie chart&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;custom_colors &amp;lt;- c(&lt;/P&gt;&lt;P&gt;&amp;nbsp; "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",&lt;/P&gt;&lt;P&gt;&amp;nbsp; "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;# Creating the&amp;nbsp; pie chart&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;plot_ly(df, labels = ~product, values = ~val1, type = 'pie',&lt;/P&gt;&lt;P&gt;&amp;nbsp; textinfo = 'percent',&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Shows percentages on the pie slices&lt;/P&gt;&lt;P&gt;&amp;nbsp; hoverinfo = 'text',&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Customizes hover information&lt;/P&gt;&lt;P&gt;&amp;nbsp; text = ~paste("Value: ", val1, "&amp;lt;br&amp;gt;", "Percentage: ", round(percentage, 1), "%"), # Hover text&lt;/P&gt;&lt;P&gt;&amp;nbsp; marker = list(colors = custom_colors) # Applies custom colors&lt;/P&gt;&lt;P&gt;) %&amp;gt;%&lt;/P&gt;&lt;P&gt;&amp;nbsp; layout(title = "Title",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; margin=list(l=10,r=30,t=30,b=10),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; legend = list(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; orientation = "h",&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Places the legend horizontally&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = 0.5,y=1.45, &amp;nbsp;xanchor = "center",&amp;nbsp; # Centers the legend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; font = list(size = 8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Adjusts font size of the legend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tharunbalaji_0-1732825105652.png"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/196616i90D2D6FFAE17FB87/image-dimensions/579x268?v=v2" alt="tharunbalaji_0-1732825105652.png" title="tharunbalaji_0-1732825105652.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The Pie Chart is Created&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 03:46:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/pie-chart-using-r-visualization-in-sap-analytics-cloud/qaq-p/13951291</guid>
      <dc:creator>tharunbalaji</dc:creator>
      <dc:date>2024-12-09T03:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Pie Chart using R visualization in SAP Analytics Cloud</title>
      <link>https://community.sap.com/t5/technology-q-a/pie-chart-using-r-visualization-in-sap-analytics-cloud/qaa-p/14222618#M4926901</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you for sharing your work and the nice example with R-Visualization, especially the Pie Chart. It is always good to see such creative use of SAC features. Just a small note: this type of detailed write-up will get better visibility if published in the Blog section rather than Q&amp;amp;A, since blogs are the right place for such informative content. Appreciate your contribution and looking forward to more such posts.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Sep 2025 14:59:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/pie-chart-using-r-visualization-in-sap-analytics-cloud/qaa-p/14222618#M4926901</guid>
      <dc:creator>RajuRam</dc:creator>
      <dc:date>2025-09-19T14:59:06Z</dc:date>
    </item>
  </channel>
</rss>

