kendoSparkline
Namespace: Wisej.Web.Ext.Kendo
Assembly: Wisej.Web.Ext.Kendo (4.1.0.0)
The Kendo UI Sparkline is a very small chart that is drawn without axes, coordinates, legends, titles, or other chart-specific elements.
- C#
- VB.NET
public class kendoSparkline : kendoBase
Public Class kendoSparkline
Inherits kendoBase
Constructors
kendoSparkline()
Constructs a new instance of the kendoSparkline class.
Example:
The following example creates a column sparkline and assigns its values through the Options property.
var sparkline = new kendoSparkline();
sparkline.Options.type = "column";
sparkline.Options.data = new[] { 12, 15, 9, 18, 21, 17 };
sparkline.Size = new Size(120, 30);
this.Controls.Add(sparkline);
kendoSparkline(options)
Constructs a new instance of the kendoSparkline class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates an area sparkline with a formatted tooltip.
var sparkline = new kendoSparkline(new
{
type = "area",
data = new[] { 71, 70, 69, 68, 65, 60, 55, 55, 50, 52 },
tooltip = new { format = "{0} %" }
});
sparkline.Size = new Size(160, 40);
this.Controls.Add(sparkline);
Methods
ExportPDFAsync()
Asynchronously exports the sparkline to PDF by calling the exportPDF function of the widget in the browser.
Returns: Task<String>. A task that represents the asynchronous operation. Its result is the value returned by the client exportPDF function.
The function is called on the Wisej client component that hosts the Kendo widget, and the client script of kendoSparkline does not define it: register a WidgetFunction named exportPDF that calls the exportPDF method of the Kendo widget (this.widget), as shown in the example.
Example:
The following example registers the client function and downloads the exported PDF. The Kendo exportPDF method returns the PDF as a base64-encoded data URI.
this.kendoSparkline1.WidgetFunctions = new[]
{
new kendoBase.WidgetFunction { Name = "exportPDF", Source = "return this.widget.exportPDF();" }
};
// later, in an async event handler:
string dataUri = await this.kendoSparkline1.ExportPDFAsync();
var bytes = Convert.FromBase64String(dataUri.Substring(dataUri.IndexOf(',') + 1));
Application.Download(new MemoryStream(bytes), "sparkline.pdf");