...

Package unichart

Overview ▾

func NewRenderer

func NewRenderer(cc *contentstream.ContentCreator, res *model.PdfPageResources) func(int, int) (render.Renderer, error)

NewRenderer returns a new unichart renderer instance creation function.

type Renderer

Renderer is a unichart renderer, used to draw chart components.

type Renderer struct {
    // contains filtered or unexported fields
}

func (*Renderer) ArcTo

func (r *Renderer) ArcTo(cx, cy int, rx, ry, startAngle, deltaAngle float64)

ArcTo draws an arc with a given center (`cx`, `cy`), a given set of radii (`rx`, `ry`), a `startAngle` and `deltaAngle` (in radians).

func (*Renderer) Circle

func (r *Renderer) Circle(radius float64, x, y int)

Circle draws a circle at the given coordinates, with a given radius.

func (*Renderer) ClearTextRotation

func (r *Renderer) ClearTextRotation()

ClearTextRotation clears rotation of the text.

func (*Renderer) Close

func (r *Renderer) Close()

Close finalizes a shape, closing the path.

func (*Renderer) Fill

func (r *Renderer) Fill()

Fill fills the current path.

func (*Renderer) FillStroke

func (r *Renderer) FillStroke()

FillStroke fills and strokes the current path.

func (*Renderer) GetDPI

func (r *Renderer) GetDPI() float64

GetDPI gets the DPI for the renderer.

func (*Renderer) LineTo

func (r *Renderer) LineTo(x, y int)

LineTo draws a line to the specified point, starting from the previous one.

func (*Renderer) MeasureText

func (r *Renderer) MeasureText(text string) render.Box

MeasureText measures the specified text.

func (*Renderer) MoveTo

func (r *Renderer) MoveTo(x, y int)

MoveTo moves the cursor to the specified point.

func (*Renderer) QuadCurveTo

func (r *Renderer) QuadCurveTo(cx, cy, x, y int)

QuadCurveTo draws a quad curve. `cx` and `cy` are the Bézier control points.

func (*Renderer) ResetStyle

func (r *Renderer) ResetStyle()

ResetStyle resets all the style related settings of the renderer.

func (*Renderer) Save

func (r *Renderer) Save(w io.Writer) error

Save saves the rendered data to the given writer.

func (*Renderer) SetClassName

func (r *Renderer) SetClassName(name string)

SetClassName sets the current class name.

func (*Renderer) SetDPI

func (r *Renderer) SetDPI(dpi float64)

SetDPI sets the DPI for the renderer.

func (*Renderer) SetFillColor

func (r *Renderer) SetFillColor(color color.Color)

SetFillColor sets the current fill color.

func (*Renderer) SetFont

func (r *Renderer) SetFont(font render.Font)

SetFont sets the current font.

func (*Renderer) SetFontColor

func (r *Renderer) SetFontColor(color color.Color)

SetFontColor sets the current font color.

func (*Renderer) SetFontSize

func (r *Renderer) SetFontSize(size float64)

SetFontSize sets the current font size.

func (*Renderer) SetStrokeColor

func (r *Renderer) SetStrokeColor(color color.Color)

SetStrokeColor sets the current stroke color.

func (*Renderer) SetStrokeDashArray

func (r *Renderer) SetStrokeDashArray(dashArray []float64)

SetStrokeDashArray sets the stroke dash array.

func (*Renderer) SetStrokeWidth

func (r *Renderer) SetStrokeWidth(width float64)

SetStrokeWidth sets the stroke width.

func (*Renderer) SetTextRotation

func (r *Renderer) SetTextRotation(radians float64)

SetTextRotation sets the rotation of the text.

func (*Renderer) Stroke

func (r *Renderer) Stroke()

Stroke strokes the current path.

func (*Renderer) Text

func (r *Renderer) Text(text string, x, y int)

Text draws a text chunk.