SDKs overview

Image-Charts offers a suite of Software Development Kits (SDKs) and community-contributed libraries designed to facilitate the programmatic generation of static chart images. These tools abstract the underlying HTTP API, allowing developers to construct chart URLs and retrieve images using native language constructs rather than manual string manipulation. The primary benefit of using an SDK is the simplification of parameter management, ensuring correct formatting and reducing the potential for errors in complex chart configurations. Image-Charts focuses on generating images for various use cases, including embedding charts in emails, server-side rendering, and static web content, where interactive JavaScript charting libraries may not be suitable or performant Image-Charts introduction.

The available SDKs and libraries support common programming languages, providing a streamlined developer experience. They typically handle URL encoding, parameter validation, and sometimes offer helper functions for common chart types or data formats. This approach enables developers to integrate static chart generation directly into their application logic, whether it's a backend service generating reports, a content management system creating dynamic images, or an email marketing platform personalizing visuals.

Official SDKs by language

Image-Charts maintains official SDKs for several popular programming languages, ensuring direct support and continuous updates synchronized with the core API. These SDKs are developed and maintained by the Image-Charts team, providing the most reliable and feature-complete integration options. Each SDK is designed to reflect the API's capabilities, allowing developers to specify chart type, data, colors, labels, and other visual attributes programmatically Image-Charts API reference. The following table outlines the key official SDKs:

Language Package Name Installation Command Maturity
JavaScript image-charts npm install image-charts or yarn add image-charts Stable
Python image-charts pip install image-charts Stable
Ruby image-charts gem install image-charts Stable
PHP image-charts/image-charts composer require image-charts/image-charts Stable
Go github.com/image-charts/image-charts-go go get github.com/image-charts/image-charts-go Stable

Installation

Installing Image-Charts SDKs typically involves using the standard package manager for each respective programming language. These package managers streamline the process of downloading the library and managing its dependencies. The following sections provide specific installation instructions for the officially supported SDKs.

JavaScript (Node.js & Browser)

For JavaScript environments, including Node.js applications and front-end browser builds, the SDK can be installed via npm or Yarn. This makes it compatible with modern JavaScript development workflows, including module bundlers like Webpack or Rollup.

npm install image-charts
# or
yarn add image-charts

Python

Python developers can install the Image-Charts SDK using pip, the standard package installer for Python. This integrates the library into Python projects, allowing access to its functions for chart generation.

pip install image-charts

Ruby

Ruby applications can incorporate the Image-Charts SDK by using RubyGems, Ruby's package manager. This provides access to the library's classes and methods within Ruby scripts and applications.

gem install image-charts

PHP

PHP projects typically use Composer for dependency management. The Image-Charts PHP SDK can be installed through Composer, making it available for use in web applications and backend scripts.

composer require image-charts/image-charts

Go

Go developers can fetch and install the Image-Charts Go library using the go get command, which retrieves the package from its Git repository and makes it available for import in Go projects.

go get github.com/image-charts/image-charts-go

Quickstart example

A quickstart example demonstrates the basic usage of an Image-Charts SDK to generate a simple chart. This example typically involves importing the library, creating a chart instance, configuring its properties, and then retrieving the generated image URL. The following Python example illustrates how to create a basic bar chart.

Python Example: Generating a Bar Chart

This Python snippet demonstrates how to use the image-charts SDK to generate a URL for a simple bar chart. The chart will display data points and be customized with colors and labels.

from image_charts import Chart

# Create a new Chart instance
chart = Chart()

# Set chart type (bar chart)
chart.cht = 'bvg'

# Set chart data
chart.chd = 'a:10,20,30,40,50'

# Set chart size
chart.chs = '700x150'

# Set chart colors
chart.chco = 'FF0000,00FF00,0000FF'

# Set chart title
chart.chtt = 'My Awesome Bar Chart'

# Set axis labels
chart.chxl = '0:|Jan|Feb|Mar|Apr|May'
chart.chxp = '0,50'

# Generate the chart URL
chart_url = chart.to_url()
print(f"Generated Chart URL: {chart_url}")

# In a web application, you would embed this URL in an <img> tag:
# <img src="{chart_url}" alt="Bar Chart">

This example initializes a Chart object, assigns various properties like chart type (cht), data (chd), size (chs), colors (chco), title (chtt), and axis labels (chxl, chxp). Finally, chart.to_url() generates the complete URL that, when accessed, returns the chart image. Similar patterns apply across other language SDKs, differing only in syntax and method naming conventions Image-Charts bar chart reference.

Community libraries

While Image-Charts provides official SDKs, the developer community also contributes libraries and wrappers that can extend support to additional languages or integrate with specific frameworks. These community-driven projects can offer alternative syntaxes, specialized features, or integrations not covered by the official offerings. Developers often create these libraries to address specific use cases or to provide a more idiomatic interface for a particular language or environment. For example, a community library might offer a wrapper specifically for a popular web framework, simplifying the process of embedding charts within templates.

It is important to note that community libraries may vary in terms of maintenance, feature completeness, and adherence to the latest API specifications. Developers considering a community library should review its documentation, recent activity, and community support before integrating it into production systems. Resources like GitHub and language-specific package repositories (e.g., PyPI, RubyGems) can be explored to discover community contributions. For instance, the broader ecosystem of static chart generation often involves tools that can export various chart types, such as those discussed within the context of data visualization on platforms like the Mozilla Developer Network Mozilla Developer Network Canvas API tutorial, which, while not a direct Image-Charts library, illustrates the general principles of programmatic image creation that community libraries might leverage or abstract.

Image-Charts's open API design encourages such contributions, allowing the developer community to innovate and build upon the core service. While no specific community libraries are officially endorsed or maintained by Image-Charts, their existence reflects the versatility and adaptability of the API for varied integration needs. When evaluating any third-party library, checking its compatibility with the current Image-Charts API version and the quality of its documentation is recommended.