Add slice to piechart
Function: Add slice to piechart
This action allows you to dynamically update a pie chart displayed in your application by adding a new segment, or "slice," to it. This is useful for visualizing new data points or categories in real-time without needing to recreate the entire chart.
Input
- UI element: The specific Pie Chart component on your page where you want to add a new slice. (Type: PART, Subtype: pie-chart)
- Code: A unique identifier for this new slice. This helps the system distinguish it from other slices. (Type: STRING)
- Name: The label or title that will be displayed for this new slice on the pie chart and its legend. (Type: STRING)
- Color: The visual color you want to assign to this new slice. You can use standard color names (e.g., "red", "blue") or hexadecimal color codes (e.g., "#FF0000" for red). (Type: STRING)
- Value: A numerical value that determines the size or proportion of this slice within the pie chart. The larger the value, the bigger the slice. (Type: NUMBER)
Output
This action directly updates the specified Pie Chart UI element on your application page. It does not produce any direct output that can be stored in a variable.
Execution Flow
Real-Life Examples
Example 1: Tracking Website Traffic Sources Imagine you have a pie chart showing the current sources of traffic to your website (e.g., Google, Social Media, Direct). A new marketing campaign starts generating traffic from a new source, "Email Newsletter." You want to immediately reflect this on your dashboard.
- Inputs:
- UI element:
Website Traffic Pie Chart - Code:
EMAIL_NEWSLETTER - Name:
Email Newsletter - Color:
#FFD700(Gold) - Value:
1500
- UI element:
- Result: A new slice labeled "Email Newsletter" with a gold color and a value of 1500 is added to the "Website Traffic Pie Chart," visually updating its proportions to include this new source.
Example 2: Monitoring Project Task Status You have a project management dashboard with a pie chart visualizing the status of tasks (e.g., "Completed," "In Progress," "Pending"). A new critical task category, "Blocked," emerges, and you want to add it to the chart.
- Inputs:
- UI element:
Project Status Pie Chart - Code:
BLOCKED_TASKS - Name:
Blocked - Color:
red - Value:
5
- UI element:
- Result: The "Project Status Pie Chart" now includes a new red slice labeled "Blocked," representing 5 tasks, providing an immediate visual update on the project's health.
Example 3: Analyzing Customer Feedback Categories Your customer service team uses a pie chart to categorize incoming feedback (e.g., "Bug Report," "Feature Request," "General Inquiry"). A new category, "Billing Issue," needs to be added to track specific customer concerns.
- Inputs:
- UI element:
Customer Feedback Pie Chart - Code:
BILLING_ISSUE - Name:
Billing Issue - Color:
#8A2BE2(Blue Violet) - Value:
25
- UI element:
- Result: The "Customer Feedback Pie Chart" is updated to include a new blue-violet slice labeled "Billing Issue," showing that 25 feedback items fall into this category.