{"id":21879221,"url":"https://github.com/typpo/quickchart-java","last_synced_at":"2025-04-15T03:07:35.295Z","repository":{"id":45327701,"uuid":"316590051","full_name":"typpo/quickchart-java","owner":"typpo","description":"Java client for quickchart.io chart API","archived":false,"fork":false,"pushed_at":"2023-11-07T14:08:25.000Z","size":35,"stargazers_count":11,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T03:07:28.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-27T20:03:35.000Z","updated_at":"2024-11-19T18:06:00.000Z","dependencies_parsed_at":"2022-08-30T12:10:55.926Z","dependency_job_id":null,"html_url":"https://github.com/typpo/quickchart-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typpo%2Fquickchart-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typpo","download_url":"https://codeload.github.com/typpo/quickchart-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997079,"owners_count":21195799,"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":[],"created_at":"2024-11-28T08:15:37.746Z","updated_at":"2025-04-15T03:07:35.279Z","avatar_url":"https://github.com/typpo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"quickchart-java\n---\n[![Maven Central](http://img.shields.io/maven-central/v/io.quickchart/QuickChart.svg?style=flat)](https://mvnrepository.com/artifact/io.quickchart/QuickChart)\n\nA Java client for the QuickChart.io chart API.\n\n## Installation\n\nAdd QuickChart to your project (Java 6+).  The `io.quickchart` package is available on [Maven Central](https://search.maven.org/artifact/io.quickchart/QuickChart)\n\nMaven:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.quickchart\u003c/groupId\u003e\n    \u003cartifactId\u003eQuickChart\u003c/artifactId\u003e\n\u003c/dependency\u003e\n```\n\nGradle:\n```gradle\ndependencies {\n    implementation 'io.quickchart:Quickchart:VERSION'\n}\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```java\nimport io.quickchart.QuickChart;\n\n// ...\n\nQuickChart chart = new QuickChart();\nchart.setWidth(500);\nchart.setHeight(300);\nchart.setConfig(\"{\"\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```\n\nFor more details on configuring your chart, reference the [QuickChart documentation](https://quickchart.io/documentation/).\n\nUse `getUrl()` on your QuickChart object to get the encoded URL that renders your chart:\n\n```java\nSystem.out.println(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```java\nSystem.out.println(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\nSee [io.quickchart.examples](https://github.com/typpo/quickchart-java/tree/main/src/main/java/io/quickchart/examples) to see other example usage.\n\n---\n\n## Customizing your chart\n\nYou can set the following properties:\n\n### setConfig(String)\nThe Chart.js chart configuration.\n\n### setWidth(Integer)\nWidth of the chart image in pixels.  Defaults to 500\n\n### setHeight(Integer)\nHeight of the chart image  in pixels.  Defaults to 300\n\n### setBackgroundColor(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### setDevicePixelRatio(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### setVersion(String)\nThe Chart.js version of the chart.  See [QuickChart documentation](https://quickchart.io/documentation/#parameters) for default.\n\n### setKey(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### toBase64Url(): String\n\nReturns a string suitable for display as a base 64 url beginning with `data:image/png;base64,`\n\n## More examples\n\nCheck out the [io.quickchart.examples](https://github.com/typpo/quickchart-java/tree/main/src/main/java/io/quickchart/examples) to see other usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyppo%2Fquickchart-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyppo%2Fquickchart-java/lists"}