Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Build Status Nuget

A C# client for the chart API.


Use QuickChart/QuickChart.cs in this project, or install the QuickChart package from NuGet:

PM> Install-Package QuickChart -Version 2.1.0


dotnet add package QuickChart --version 2.1.0


This library provides a QuickChart namespace containing a Chart class. Import and instantiate it. Then set properties on it and specify a Chart.js config:

Chart qc = new Chart();

qc.Width = 500;
qc.Height = 300;
qc.Version = "2.9.4";
qc.Config = @"{
    type: 'bar',
    data: {
        labels: ['Q1', 'Q2', 'Q3', 'Q4'],
        datasets: [{
            label: 'Users',
            data: [50, 60, 70, 180]

Use GetUrl() on your QuickChart object to get the encoded URL that renders your chart:


If you have a long or complicated chart, use GetShortUrl() to get a fixed-length URL using the web service (note that these URLs only persist for a short time unless you have a subscription):


The URLs will render an image of a chart:

Customizing your chart

You can set the following properties:

Config: string

The actual Chart.js chart configuration.

Width: int

Width of the chart image in pixels. Defaults to 500

Height: int

Height of the chart image in pixels. Defaults to 300

BackgroundColor: string

The background color of the chart. Any valid HTML color works. Defaults to #ffffff (white). Also takes rgb, rgba, and hsl values.

DevicePixelRatio: double

The device pixel ratio of the chart. This will multiply the number of pixels by the value. This is usually used for retina displays. Defaults to 1.0.

Format: string

The output format of the chart. Defaults to "png"

Version: string

Chart.js version. See documentation for supported versions.

Key: string

API key (not required)

Creating chart URLs

There are a few ways to get a URL for your chart object.

GetUrl(): string

Returns a URL that will display the chart image when loaded.

GetShortUrl(): string

Uses the web service to create a fixed-length chart URL that displays the chart image. Returns a URL such as

Note that short URLs expire after a few days for users of the free service. You can subscribe to keep them around longer.

Other methods

ToFile(string path)

Write your chart to file.

ToByteArray(): byte[]

Returns an array of bytes representing your image.

More examples

Checkout the QuickChartExamples project to see other usage.


C# client for QuickChart chart API