https://github.com/sochix/highcharts-export-client
Highcharts Export Server Client for .Net
https://github.com/sochix/highcharts-export-client
Last synced: 5 months ago
JSON representation
Highcharts Export Server Client for .Net
- Host: GitHub
- URL: https://github.com/sochix/highcharts-export-client
- Owner: sochix
- License: mit
- Created: 2016-01-27T12:37:09.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-28T15:34:49.000Z (about 9 years ago)
- Last Synced: 2025-11-02T00:14:40.008Z (8 months ago)
- Language: C#
- Homepage:
- Size: 28.3 KB
- Stars: 14
- Watchers: 1
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#highcharts-export-client
[](https://ci.appveyor.com/project/sochix/highcharts-export-client)
[](https://www.nuget.org/packages/highcharts-export-client/)
Highcharts-export-client is [highcharts-export-server](http://www.highcharts.com/docs/export-module/export-module-overview) API wrapper.
With help of this library you can generate fancy charts and export it to png, pdf or svg formats.
:star: If you :heart: library, please star it! :star:
[:uk: English tutorial](http://www.sochix.ru/using-highchart-js-on-a-server-side/)
[:ru: Russian tutorial](https://habrahabr.ru/post/279515/)

#Installation
Install via NuGet
```
PM > Install-Package highcharts-export-client
```
#Requirements
* In development, you can use default highcharts server [http://export.highcharts.com/](http://export.highcharts.com/).
* In production, library needs a server with installed [highcharts-export-server](http://www.highcharts.com/docs/export-module/setting-up-the-server). Basic installation steps described [here](http://www.highcharts.com/docs/export-module/setting-up-the-server) & [here](http://withr.me/set-up-highcharts-export-server-on-ubuntu-server-12-dot-04-step-by-step/).
#Usage
##Draw chart from Highchart Options

Options is a highchart options.
```
var client = new HighchartsClient(_highchartsServer);
var options = new
{
xAxis = new
{
categories = new[] { "Jan", "Feb", "Mar" }
},
series = new[]
{
new { data = new[] {29.9, 71.5, 106.4} }
}
};
var res = await client.GetChartImageFromOptionsAsync(JsonConvert.SerializeObject(options));
File.WriteAllBytes("__imageFromBytes_defaultSettings.png", res);
```
##Draw chart from SVG
To draw a chart from SVG file, use this method:
```
var res = await client.GetChartImageFromSvgAsync(_svg);
```
##Chart settings
You can pass settings to library constructor for controlling result file properties.
Full settings description see on [highcharts-export-server page](http://www.highcharts.com/docs/export-module/export-module-overview).
```
var settings = new HighchartsSetting
{
ExportImageType = "jpg",
ScaleFactor = 4,
ImageWidth = 1500,
ServerAddress = _highchartsServer
};
var client = new HighchartsClient(settings);
```
##Async mode
You can use library in async mode. In this mode, each call will return a link to image.
Image will be stored on the server for 15 minutes. See full documentation on [highcharts-export-server](http://www.highcharts.com/docs/export-module/export-module-overview).
```
var res = await client.GetChartImageLinkFromOptionsAsync(JsonConvert.SerializeObject(options));
```
#License
The MIT License
Copyright (c) 2016 Ilya Pirozhenko http://www.sochix.ru/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.