sochix / highcharts-export-client

Highcharts Export Server Client for .Net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#highcharts-export-client

Build status NuGet version

Highcharts-export-client is highcharts-export-server 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:

🇬🇧 English tutorial 🇷🇺 Russian tutorial

Highchart chart

#Installation

Install via NuGet

PM > Install-Package highcharts-export-client

#Requirements

#Usage ##Draw chart from Highchart Options

Basic Chart

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.

	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.

	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.

About

Highcharts Export Server Client for .Net

License:MIT License


Languages

Language:C# 100.0%