Add data set to Bar chart
Function: Add data set to Bar chart
This action allows you to add a new collection of data points, known as a "data set," to an existing Bar chart on your application page. This is useful for dynamically updating charts, adding new series, or displaying different categories of information within the same chart.
Input
- Bar chart UI element: The specific Bar chart on your page where you want to add the new data set. This is a required input.
- Code: A unique identifier (text) for this new data set. This helps you refer to or manage this specific data set later. This is a required input.
- Name: The display name (text) for this data set, which will typically appear in the chart's legend. This is a required input.
- Color: The color (text, e.g., a hex code like
#FF0000or a color name likeblue) that the bars for this data set will have in the chart. If not provided, the default color will be#6363a8(a shade of purple-blue). - Stack: A text value that allows you to group this data set with others to create a "stacked" bar chart. If multiple data sets have the same "Stack" value, their bars will be stacked on top of each other instead of appearing side-by-side.
- Points: A list of numbers (text) separated by semicolons (e.g.,
10;25;15;30). These numbers represent the heights of the bars for this data set. The bars will be drawn in the order you provide the numbers, with the chart automatically generating labels for the x-axis (first number = first bar, second number = second bar, and so on). This is a required input.
Output
This action does not produce a direct output value. Instead, it modifies the specified "Bar chart UI element" by adding the new data set to it, making the changes visible on your application page.
Execution Flow
Real-Life Examples
Example 1: Adding Monthly Sales Data
Imagine you have a Bar chart displaying quarterly sales, and you want to add a new data set for monthly sales figures for a specific product.
- Inputs:
- Bar chart UI element:
Sales_Performance_Chart(your existing Bar chart) - Code:
ProductA_MonthlySales - Name:
Product A Monthly Sales - Color:
#4CAF50(Green) - Stack: (Leave empty, as you want separate bars)
- Points:
1200;1500;1350;1600;1400;1750
- Bar chart UI element:
- Result: The
Sales_Performance_Chartwill now display a new series of green bars representing "Product A Monthly Sales" alongside any existing data, showing the sales figures for six consecutive months.
Example 2: Comparing Regional Performance with Stacking
You have a Bar chart showing total sales per region, and you want to add a new data set for "Online Sales" in each region, stacked on top of the existing "In-Store Sales" to show the total contribution.
- Inputs:
- Bar chart UI element:
Regional_Sales_Chart - Code:
OnlineSales_Q2 - Name:
Q2 Online Sales - Color:
#FFC107(Amber) - Stack:
Q2_TotalSales(This value should match the "Stack" value of your "In-Store Sales" data set if you want them stacked) - Points:
300;450;200;500(representing online sales for four regions)
- Bar chart UI element:
- Result: The
Regional_Sales_Chartwill update. For each region, the "Q2 Online Sales" bars will appear stacked directly on top of the "In-Store Sales" bars (assuming they share theQ2_TotalSalesstack value), visually representing the combined total sales for each region.
Example 3: Adding a New Product Category with Default Color
You're tracking customer feedback categories in a Bar chart, and a new category, "Feature Request," has been introduced. You want to add this to your chart without specifying a custom color.
- Inputs:
- Bar chart UI element:
Customer_Feedback_Chart - Code:
FeatureRequests - Name:
Feature Requests - Color: (Leave empty)
- Stack: (Leave empty)
- Points:
80;110;95
- Bar chart UI element:
- Result: The
Customer_Feedback_Chartwill now include a new series of bars labeled "Feature Requests." These bars will appear in the default color (#6363a8), showing the feedback counts for three periods.