-2

I want to print a "Polyline()" function in go lang with the set of coordinates:

x      y
300  250
400  350
250  600

I don't understand this structure:

Polyline(x []int, y []int, s ...string)

Please show how to carry about that polyline in GoLang

Elmo Huitz
  • 29
  • 6

1 Answers1

1

package svg

import "github.com/ajstarks/svgo"

Package svg generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (http://www.w3.org/TR/SVG11/). Output goes to the specified io.Writer.

func (*SVG) Polyline

func (svg *SVG) Polyline(x []int, y []int, s ...string)

Polyline draws connected lines between coordinates, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#PolylineElement

For example,

x := []int{300, 400, 250}
y := []int{250, 350, 600}
s := []string{`fill="none"`}
canvas.Polyline(x, y, s...)
peterSO
  • 158,998
  • 31
  • 281
  • 276