add format file support (#2)

Co-authored-by: Long Ngo <long.ngo@vietgis.com.vn>
This commit is contained in:
Long Ngo 2021-09-21 22:17:33 +07:00 committed by GitHub
parent a9bbb90cdc
commit 67bed9519e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ namespace QuickChart
public int Width { get; set; } public int Width { get; set; }
public int Height { get; set; } public int Height { get; set; }
public double DevicePixelRatio { get; set; } public double DevicePixelRatio { get; set; }
public string Format {get;set;}
public string BackgroundColor { get; set; } public string BackgroundColor { get; set; }
public string Key { get; set; } public string Key { get; set; }
public string Config { get; set; } public string Config { get; set; }
@ -34,6 +35,7 @@ namespace QuickChart
Width = 500; Width = 500;
Height = 300; Height = 300;
DevicePixelRatio = 1.0; DevicePixelRatio = 1.0;
Format = "png";
BackgroundColor = "transparent"; BackgroundColor = "transparent";
Scheme = "https"; Scheme = "https";
@ -53,6 +55,7 @@ namespace QuickChart
builder.Append("&h=").Append(Height.ToString()); builder.Append("&h=").Append(Height.ToString());
builder.Append("&devicePixelRatio=").Append(DevicePixelRatio.ToString()); builder.Append("&devicePixelRatio=").Append(DevicePixelRatio.ToString());
builder.Append("&f=").Append(Format);
builder.Append("&bkg=").Append(Uri.EscapeDataString(BackgroundColor)); builder.Append("&bkg=").Append(Uri.EscapeDataString(BackgroundColor));
builder.Append("&c=").Append(Uri.EscapeDataString(Config)); builder.Append("&c=").Append(Uri.EscapeDataString(Config));
if (!string.IsNullOrEmpty(Key)) if (!string.IsNullOrEmpty(Key))
@ -79,6 +82,7 @@ namespace QuickChart
height = Height, height = Height,
backgroundColor = BackgroundColor, backgroundColor = BackgroundColor,
devicePixelRatio = DevicePixelRatio, devicePixelRatio = DevicePixelRatio,
format = Format,
chart = Config, chart = Config,
key = Key, key = Key,
}, options); }, options);
@ -116,6 +120,7 @@ namespace QuickChart
height = Height, height = Height,
backgroundColor = BackgroundColor, backgroundColor = BackgroundColor,
devicePixelRatio = DevicePixelRatio, devicePixelRatio = DevicePixelRatio,
format = Format,
chart = Config, chart = Config,
key = Key, key = Key,
}, options); }, options);