If you want to customize the export more extensively, instead of the chart's exportChart method, use wijmo.exporter.exportChart to expose more settings. Here is an example of the method exporting a chart to Tiff format, suitable for faxing.
Note that in the receiver option, we call saveFile, which requires that you include the exportutils.js and FileSaver.js files in the same folder.
Copy Code | |
---|---|
$("#exportImage").button().click(function () { var type = $("#exporttype").val(); wijmo.exporter.exportChart({ serviceUrl: getServiceUrl(), chart: $("#wijcompositechart").data("wijmo-wijcompositechart"), exportFileType: wijmo.exporter.ExportFileType[type], fileName: $("#fileName").val(), receiver: saveFile }); }); |
chart: a wijchart object, e.g. $("#wijbarchart").data("wijmo-wijbarchart")
exportFileType: wijmo.exporter.ExportFileType
valid values: Pdf, Png, Jpg, Bmp, Gif and Tiff
fileName: the string to use as the file's name when you export it
pdf: PdfSetting. See Chart PDF Exports for details.
serviceUrl: the string path to the export service, for example http://localhost/C1ASPNETExportService/exportapi/chart. See Export Service Setup for details.
receiver: void. Customize response data handling.
data: any,
setting: ExportSetting
sender: void. Customize how you send request data to the service.
content: string,
setting: ExportSetting
contentType: string. Specifies the content type of the request.
application/json sends JSON-formatted request data to the service. You must also set the receiver when using this type.
application/x-www-form-urlencoded is the same, but does not require you to set the receiver.
width: Chart widget width in pixels. This option is required.
height: Chart widget height in pixels. This option is required.
widgetName: Chart widget name.
widgetOptions: Chart widget options. Use this option when the method is set to "Options" mode.
HTMLContent: Chart widget HTML markup. Use this option when the method is set to "Content" mode
method: wijmo.exporter.ExportFileType.ChartExportMethod.
valid values: Content and Options