ChartDirector 7.1 (C++ Edition)

QChartViewer.setDPI


Usage

void setDPI(int dpi);

Description

Sets the DPI (scale factor) of the chart on the screen.

Due to historical reasons, in programming, the display is assumed to be 96dpi (dot per inch). Modern operating systems also allows using higher DPI. For example, on Windows 10, in "Settings / System / Display", it is possible set a display scale factor such as 150%, which corresponds to 144dpi.

If the application is configured as "not DPI aware", the OS will assume the application GUI is 96dpi. The operating system will then resize the application output before displaying it on the screen.

If the application is configured as "DPI aware", the OS will assume the application will resize its GUI to match the display DPI, and the OS will not resize the application output again.

QChartViewer will automatically detect if the application is "DPI aware" or not, and will automatically resize the chart to match the display DPI.

The setDPI method can be used to configure an alternative scale factor. For example, if the user code has already resized the chart, it is not necessary for the QChartViewer to resize the chart again. In this case, setDPI can be used to set the DPI to 96 to disable the QChartViewer from resizing the chart.

Arguments

ArgumentDefaultDescription
dpi(Mandatory)The DPI to display the chart on the screen. A value of 0 means the DPI will be automatically determined.

Return Value

None