VOOZH about

URL: https://www.nuget.org/packages/QuickChart/

⇱ NuGet Gallery | QuickChart 2.3.0




QuickChart 2.3.0

dotnet add package QuickChart --version 2.3.0
 
 
NuGet\Install-Package QuickChart -Version 2.3.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QuickChart" Version="2.3.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuickChart" Version="2.3.0" />
 
Directory.Packages.props
<PackageReference Include="QuickChart" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add QuickChart --version 2.3.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: QuickChart, 2.3.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package QuickChart@2.3.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=QuickChart&version=2.3.0
 
Install as a Cake Addin
#tool nuget:?package=QuickChart&version=2.3.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

quickchart-csharp

👁 Build Status
👁 Nuget

A C# client for the quickchart.io chart API.

Installation

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

PM> Install-Package QuickChart -Version 2.3.0

or

dotnet add package QuickChart --version 2.3.0

Usage

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:

Console.WriteLine(qc.GetUrl());
// https://quickchart.io/chart?c=%7B%22chart%22%3A+%7B%22type%22%3A+%22bar%22%2C+%22data%22%3A+%7B%22labels%22%3A+%5B%22Hello+world%22%2C+%22Test%22%5D%2C+%22datasets%22%3A+%5B%7B%22label%22%3A+%22Foo%22%2C+%22data%22%3A+%5B1%2C+2%5D%7D%5D%7D%7D%7D&w=600&h=300&bkg=%23ffffff&devicePixelRatio=2.0&f=png

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

Console.WriteLine(qc.GetShortUrl());
// https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401

The URLs will render an image of a chart:

<img src="https://quickchart.io/chart?c=%7B%22type%22%3A+%22bar%22%2C+%22data%22%3A+%7B%22labels%22%3A+%5B%22Hello+world%22%2C+%22Test%22%5D%2C+%22datasets%22%3A+%5B%7B%22label%22%3A+%22Foo%22%2C+%22data%22%3A+%5B1%2C+2%5D%7D%5D%7D%7D&w=600&h=300&bkg=%23ffffff&devicePixelRatio=2.0&f=png" width="500" />


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 (not required)

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 quickchart.io web service to create a fixed-length chart URL that displays the chart image. Returns a URL such as https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401.

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.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 is compatible.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on QuickChart:

Package Downloads
AutoTestExtras.Core

Automation test extension for API/Web/Mobile/Performance with enabled dotnet core support and other features. This package includes the AutoTestExtras framework assembly, which is referenced by your automation tests.

Aletheia.Bot

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 220,051 3/15/2022
2.2.0 18,537 11/7/2021
2.1.0 3,903 9/21/2021
2.0.0 10,480 12/24/2020
1.0.0 8,354 11/26/2020