From 0a19efe865ef626ee4190d8abb292a713b7a960f Mon Sep 17 00:00:00 2001 From: Ian Webster Date: Thu, 26 Nov 2020 18:32:26 -0500 Subject: [PATCH] Update README.md --- README.md | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 02617b0..3591818 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,23 @@ # quickchart-csharp +[![Build Status](https://travis-ci.com/typpo/quickchart-csharp.svg?branch=master)](https://travis-ci.com/typpo/quickchart-csharp) +[![Nuget](http://img.shields.io/nuget/v/QuickChart.svg?style=flat)](https://www.nuget.org/packages/QuickChart) + A C# client for the [quickchart.io](https://quickchart.io/) chart API. -# Installation +## Installation -Use `QuickChart/QuickChart.cs` in this project, or install `QuickChart` through NuGet. +Use `QuickChart/QuickChart.cs` in this project, or install the `QuickChart` package: -# Usage +``` +PM> Install-Package QuickChart -Version 1.0.0 +``` +or +``` +dotnet add package QuickChart --version 1.0.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](https://chartjs.org) config: @@ -45,46 +56,49 @@ The URLs will render an image of a chart: -## Customizing your chart +### Customizing your chart You can set the following properties: -### Config: string +#### Config: string The actual Chart.js chart configuration. -### Width: int +#### Width: int Width of the chart image in pixels. Defaults to 500 -### Height: int +#### Height: int Height of the chart image in pixels. Defaults to 300 -### BackgroundColor: str +#### 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 +#### 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. -## Getting URLs +#### Key: string +API key (not required) + +### Creating chart URLs There are a few ways to get a URL for your chart object. -### GetUrl(): string +#### GetUrl(): string Returns a URL that will display the chart image when loaded. -### GetShortUrl(): string +#### 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](https://quickchart.io/pricing/) to keep them around longer. -## Other methods +#### Other methods -### ToFile(string path) +#### ToFile(string path) Write your chart to file. -### ToByteArray(): byte[] +#### ToByteArray(): byte[] Returns an array of bytes representing your image.