{"id":21879169,"url":"https://github.com/typpo/quickchart-csharp","last_synced_at":"2025-07-17T23:06:05.531Z","repository":{"id":43225234,"uuid":"316351756","full_name":"typpo/quickchart-csharp","owner":"typpo","description":"C# client for QuickChart chart API","archived":false,"fork":false,"pushed_at":"2023-09-22T04:14:22.000Z","size":43,"stargazers_count":18,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T03:39:34.497Z","etag":null,"topics":["chart-api","chartjs","charts"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typpo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-26T22:50:38.000Z","updated_at":"2024-11-09T18:21:04.000Z","dependencies_parsed_at":"2024-06-21T17:41:45.700Z","dependency_job_id":"2850d379-875c-4e54-ad25-9a371172b979","html_url":"https://github.com/typpo/quickchart-csharp","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.09090909090909094,"last_synced_commit":"491ab2d0ee5cd9b99569cb4d9ec0372c016212fe"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/typpo/quickchart-csharp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typpo","download_url":"https://codeload.github.com/typpo/quickchart-csharp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-csharp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265677306,"owners_count":23809944,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart-api","chartjs","charts"],"created_at":"2024-11-28T08:15:28.663Z","updated_at":"2025-07-17T23:06:05.482Z","avatar_url":"https://github.com/typpo.png","language":"C#","readme":"# quickchart-csharp\n\n[![Build Status](https://travis-ci.com/typpo/quickchart-csharp.svg?branch=main)](https://travis-ci.com/typpo/quickchart-csharp)\n[![Nuget](http://img.shields.io/nuget/v/QuickChart.svg?style=flat)](https://www.nuget.org/packages/QuickChart)\n\nA C# client for the [quickchart.io](https://quickchart.io/) chart API.\n\n## Installation\n\nUse `QuickChart/QuickChart.cs` in this project, or install the `QuickChart` package from [NuGet](https://www.nuget.org/packages/QuickChart):\n\n```\nPM\u003e Install-Package QuickChart -Version 2.1.0\n```\nor\n```\ndotnet add package QuickChart --version 2.1.0\n```\n---\n## Usage\n\nThis 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:\n\n```csharp\nChart qc = new Chart();\n\nqc.Width = 500;\nqc.Height = 300;\nqc.Version = \"2.9.4\";\nqc.Config = @\"{\n    type: 'bar',\n    data: {\n        labels: ['Q1', 'Q2', 'Q3', 'Q4'],\n        datasets: [{\n            label: 'Users',\n            data: [50, 60, 70, 180]\n        }]\n    }\n}\";\n```\n\nUse `GetUrl()` on your QuickChart object to get the encoded URL that renders your chart:\n\n```csharp\nConsole.WriteLine(qc.GetUrl());\n// 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\u0026w=600\u0026h=300\u0026bkg=%23ffffff\u0026devicePixelRatio=2.0\u0026f=png\n```\n\nIf 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):\n\n```csharp\nConsole.WriteLine(qc.GetShortUrl());\n// https://quickchart.io/chart/render/f-a1d3e804-dfea-442c-88b0-9801b9808401\n```\n\nThe URLs will render an image of a chart:\n\n\u003cimg 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\u0026w=600\u0026h=300\u0026bkg=%23ffffff\u0026devicePixelRatio=2.0\u0026f=png\" width=\"500\" /\u003e\n\n---\n\n### Customizing your chart\n\nYou can set the following properties:\n\n#### Config: string\nThe actual Chart.js chart configuration.\n\n#### Width: int\nWidth of the chart image in pixels.  Defaults to 500\n\n#### Height: int\nHeight of the chart image  in pixels.  Defaults to 300\n\n#### BackgroundColor: string\nThe background color of the chart. Any valid HTML color works. Defaults to #ffffff (white). Also takes rgb, rgba, and hsl values.\n\n#### DevicePixelRatio: double\nThe 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.\n\n#### Format: string\nThe output format of the chart. Defaults to \"png\"\n\n#### Version: string\nChart.js version.  See [documentation](https://quickchart.io/documentation/#parameters) for supported versions.\n\n#### Key: string\nAPI key (not required)\n\n---\n\n### Creating chart URLs\n\nThere are a few ways to get a URL for your chart object.\n\n#### GetUrl(): string\n\nReturns a URL that will display the chart image when loaded.\n\n#### GetShortUrl(): string\n\nUses 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`.\n\nNote 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.\n\n---\n\n#### Other methods\n\n#### ToFile(string path)\n\nWrite your chart to file.\n\n#### ToByteArray(): byte[]\n\nReturns an array of bytes representing your image.\n\n## More examples\n\nCheckout the `QuickChartExamples` project to see other usage.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyppo%2Fquickchart-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-csharp/lists"}