Table of Contents

Class Chart

Namespace
PDFjet.NET
Assembly
PDFjet.dll

XY chart renderer for PDF pages. See Example_26.

public class Chart : IDrawable
Inheritance
Chart
Implements
Inherited Members

Constructors

Chart(Font, Font)

Creates an XY chart.

public Chart(Font f1, Font f2)

Parameters

f1 Font

font for the chart title.

f2 Font

font for axis titles and labels.

Methods

AddSeries(string)

Adds a series and returns it, to add its points and set its line and marker. A series without a stroke color has the next color of the palette. The legend lists the series that have a name.

public Series AddSeries(string name)

Parameters

name string

the series name, shown in the legend; empty for none.

Returns

Series

the new Series object.

DrawOn(Page)

Draws this chart on the specified page.

public float[] DrawOn(Page page)

Parameters

page Page

the page to draw on.

Returns

float[]

the bottom-right corner coordinates [x, y].

SetAltDescription(string)

Sets the alternate description of the chart, which a screen reader reads in a PDF/UA document, where the chart is a figure. The default is the title, or "Chart" without one. Describe what the chart shows.

public Chart SetAltDescription(string altDescription)

Parameters

altDescription string

the alternate description.

Returns

Chart

this Chart object.

SetAxisLineWidth(float)

Sets the width of the axis lines, along the left and the bottom sides of the plot area. The default is 0.5; 0 hides them.

public Chart SetAxisLineWidth(float width)

Parameters

width float

Returns

Chart

SetChartBorderWidth(float)

Sets the width of the outer chart border. A width of 0, the default, hides it.

public Chart SetChartBorderWidth(float width)

Parameters

width float

Returns

Chart

SetDrawHorizontalGridLines(bool)

Toggles drawing of horizontal grid lines.

public Chart SetDrawHorizontalGridLines(bool drawHorizontalGridLines)

Parameters

drawHorizontalGridLines bool

Returns

Chart

SetDrawLegend(bool)

Sets whether the legend is drawn. The legend lists the series that have a name, under the title, each with its line or its marker.

public Chart SetDrawLegend(bool drawLegend)

Parameters

drawLegend bool

true to draw the legend.

Returns

Chart

this Chart object.

SetDrawVerticalGridLines(bool)

Toggles drawing of vertical grid lines.

public Chart SetDrawVerticalGridLines(bool drawVerticalGridLines)

Parameters

drawVerticalGridLines bool

Returns

Chart

SetDrawXAxisLabels(bool)

Sets whether the x axis labels are drawn.

public Chart SetDrawXAxisLabels(bool drawXAxisLabels)

Parameters

drawXAxisLabels bool

Returns

Chart

SetDrawYAxisLabels(bool)

Toggles drawing of Y axis labels.

public Chart SetDrawYAxisLabels(bool drawYAxisLabels)

Parameters

drawYAxisLabels bool

Returns

Chart

SetGridLineColor(int)

Sets the color of the grid lines. The default is black. Color.transparent leaves it unchanged.

public Chart SetGridLineColor(int color)

Parameters

color int

the color as a 0xRRGGBB value, for example Color.lightgray.

Returns

Chart

this Chart object.

SetHorizontalGridLineDashPattern(string)

Sets the horizontal grid line dash pattern (e.g. "[1 1] 0").

public Chart SetHorizontalGridLineDashPattern(string pattern)

Parameters

pattern string

Returns

Chart

SetHorizontalGridLineWidth(float)

Sets the width of the horizontal grid lines. A width of 0 draws the thinnest line a viewer shows; SetDrawHorizontalGridLines(false) hides them.

public Chart SetHorizontalGridLineWidth(float width)

Parameters

width float

Returns

Chart

SetInnerBorderWidth(float)

Sets the width of the plot area border. A width of 0, the default, hides it.

public Chart SetInnerBorderWidth(float width)

Parameters

width float

Returns

Chart

SetLocation(float, float)

Sets the top-left position. Returns this for chaining.

public Chart SetLocation(float x, float y)

Parameters

x float
y float

Returns

Chart

SetMaximumFractionDigits(int)

Sets the maximum number of decimal places in the axis labels. The default is 2.

public Chart SetMaximumFractionDigits(int maxFractionDigits)

Parameters

maxFractionDigits int

Returns

Chart

SetMinimumFractionDigits(int)

Sets the minimum number of decimal places in the axis labels. The labels of an axis have at least the decimal places of its step, so an axis with a whole number step has whole number labels. The default is 0.

public Chart SetMinimumFractionDigits(int minFractionDigits)

Parameters

minFractionDigits int

Returns

Chart

SetSize(float, float)

Sets the chart dimensions.

public Chart SetSize(float w, float h)

Parameters

w float
h float

Returns

Chart

SetSubtitle(string)

Sets the subtitle, written in gray under the title in the second font.

public Chart SetSubtitle(string subtitle)

Parameters

subtitle string

the subtitle.

Returns

Chart

this Chart object.

SetTitle(string)

Sets the chart title.

public Chart SetTitle(string title)

Parameters

title string

Returns

Chart

SetVerticalGridLineDashPattern(string)

Sets the vertical grid line dash pattern (e.g. "[1 1] 0").

public Chart SetVerticalGridLineDashPattern(string pattern)

Parameters

pattern string

Returns

Chart

SetVerticalGridLineWidth(float)

Sets the width of the vertical grid lines. A width of 0 draws the thinnest line a viewer shows; SetDrawVerticalGridLines(false) hides them.

public Chart SetVerticalGridLineWidth(float width)

Parameters

width float

Returns

Chart

SetXAxisMinMax(float, float, int)

Sets the X axis range and its number of grid lines. With 0 grid lines, the default, the range is the range of the data rounded to "nice" values, and xMin and xMax are not used; a negative number is taken as 0.

public Chart SetXAxisMinMax(float xMin, float xMax, int xAxisGridLines)

Parameters

xMin float
xMax float
xAxisGridLines int

Returns

Chart

this Chart object.

SetXAxisTitle(string)

Sets the X axis title.

public Chart SetXAxisTitle(string title)

Parameters

title string

Returns

Chart

SetYAxisMinMax(float, float, int)

Sets the Y axis range and its number of grid lines. With 0 grid lines, the default, the range is the range of the data rounded to "nice" values, and yMin and yMax are not used; a negative number is taken as 0.

public Chart SetYAxisMinMax(float yMin, float yMax, int yAxisGridLines)

Parameters

yMin float
yMax float
yAxisGridLines int

Returns

Chart

this Chart object.

SetYAxisTitle(string)

Sets the Y axis title.

public Chart SetYAxisTitle(string title)

Parameters

title string

Returns

Chart