The exportAs() method exports the Gantt Chart in the specified image format or as an Excel spreadsheet.
Declaration
DayPilot.Gantt.exportAs(format[, options]);Parameters
format("svg"|"png"|"jpeg" | "xksx") - output image formatoptions.area("viewport"|"full"|"range") - exported area; defaults to"viewport"options.dateFrom- start date (applies only toarea: "range")options.dateTo- end date (applies only toarea: "range")options.resourceFrom- start task (vertically, applies only toarea: "range")options.resourceTo- end task (vertically, applies only toarea: "range")options.quality- quality of the output JPEG image (applies only toformat: "jpeg"); defaults to0.92options.scale- output scale factor; defaults to1(use2for 200% size)
Return Value
Returns a DayPilot.Export object that provides the following methods:
toElement()- returns a DOM element with the image (<svg>or<img>)toHtml()- returns the image element as HTMLtoDataUri()- returns a data URI string (SVG or image data)toBlob()- returns aBlobobjectdownload(filename)- forces download of the imageprint()- prints the exported image using the browser print dialog
Example
const image = gantt.exportAs("png", {
area: "viewport",
scale: 2
});
image.download("gantt.png");See Also
Client-Side Image Export [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot