Printing

Overview

AnyChart Stock Component offers two options to print the chart, one of them is printing from the Context Menu:

And the second one allows to open print dialog using Java Script.

You can also define how chart is resized on the printed page.

to top

Resizing Modes

When chart is printed it is resized to occupy all the page space available, to do so it needs to be resized. You can defined the resizing mode in XML:

XML/JSON Syntax
Plain code
01 <?xml version="1.0" encoding="UTF-8"?>
02 <stock xmlns="http://anychart.com/products/stock/schemas/1.9.0/schema.xsd">
03   <utils>
04     <printing resizing_mode="Recalculate" />
05   </utils>
06 </stock>
01{
02  utils: {
03    printing: {
04      resizingMode: "Recalculate"
05    }
06  }
07}

Four resizing modes are available: Recalculate, Stretch, Fit and RecalculateByProportions.

Recalculate, Stretch, Fit

Recalculate, Stretch, Fit work in the way similar to the chart resizing modes with the same names: Chart Resizing Modes.

RecalculateByProportions

RecalculateByProportions mode is almost similar to Recalculate mode, but it makes chart always occupy the whole page and be resized into its proportions.

To understand the difference between the modes and see how the result looks like in the different modes - please proceed to the sample that allows to change the mode and instantly print to see the result.

to top

Printing the chart using JS API

If you'd like to create an external control to launch Printing dialog you should use Java Script API method: printChart(printingSettings), which launches printing dialog with the given printing settings.

Printing settings can be either a string with printing settings node xml:

or JS object with the similar structure:

If settings are not specified - method uses settings from initial chart settings or default.

Live Sample

All modes and calling printChart method with different settings are demonstrated in the live sample:

Online HTML/JavaScript Sample

 

to top