0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

Chart → Doughnut Chart

AI-generated

Overview

This node provides a utility to generate doughnut charts based on user-supplied data points and labels. It is useful for visualizing proportional data distributions in a circular chart with segments representing different categories. Common scenarios include displaying sales distribution by product category, budget allocation, or survey results.

The node accepts arrays of numerical data and corresponding labels, along with customization options such as colors, border width, chart dimensions, and title. It can output the generated chart either as an image binary or as a URL pointing to the chart image.

Properties

Name Meaning
Data Points An array of numbers representing the values for each segment of the doughnut chart.
Labels An array of strings labeling each segment corresponding to the data points.
Chart Title A string specifying the title displayed on the chart.
Background Color The background color of the chart image, specified as a hex color code (e.g., #ffffff).
Segment Colors An array of hex color codes defining the fill colors for each segment in the doughnut chart.
Border Colors An array of hex color codes defining the border colors for each segment.
Border Width A number indicating the width (in pixels) of the borders around each segment.
Return as URL Boolean flag to determine if the output should be a URL to the chart image instead of binary.
File Name Optional string to specify the filename for the generated chart image (e.g., chart.png).
Width Width of the chart image in pixels.
Height Height of the chart image in pixels.

Output

The node outputs JSON data containing the generated doughnut chart. Depending on the "Return as URL" property:

  • If false, the output includes the chart image as binary data suitable for further processing or saving.
  • If true, the output contains a URL string pointing to the hosted chart image.

The exact JSON structure typically includes fields like:

{
  "json": {
    "chartUrl": "https://...",
    "fileName": "doughnut-chart.png"
  },
  "binary": {
    "data": {
      "data": "<base64-encoded-image-data>",
      "mimeType": "image/png"
    }
  }
}

(if returning binary)

or

{
  "json": {
    "url": "https://..."
  }
}

(if returning URL)

Dependencies

  • Requires an API key credential for authentication with the external chart generation service at https://prod.0codekit.com.
  • The node sends a POST request to /generate/chart/doughnut endpoint with the chart parameters.
  • No additional environment variables are needed beyond the API key credential configuration.

Troubleshooting

  • Invalid Data or Labels: Ensure that the "Data Points" and "Labels" arrays have the same length and contain valid entries. Mismatched lengths or invalid JSON will cause errors.
  • Authentication Errors: Verify that the API key credential is correctly configured and has necessary permissions.
  • Color Format Issues: Colors must be valid hex codes; incorrect formats may result in rendering errors or default colors.
  • Image Size Limits: Extremely large width or height values might cause failures or slow responses.
  • Network Issues: Since the node relies on an external API, network connectivity problems can cause timeouts or failures.

Common error messages usually indicate invalid input parameters or authentication failures. Reviewing the input properties and credential setup typically resolves these issues.

Links and References

Discussion