render

package
v2.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModChart = "chart"
	ModPage  = "page"
	// EchartsInstancePrefix the default prefix for each echarts instance
	EchartsInstancePrefix = "goecharts_"
	// EchartsInstancePlaceholder a placeholder for types.FuncStr inject echarts instance
	EchartsInstancePlaceholder = "%MY_ECHARTS%"
)

Variables

This section is empty.

Functions

func MustTemplate

func MustTemplate(name string, contents []string) *template.Template

MustTemplate creates a new template with the given name and parsed contents.

Types

type BaseRender

type BaseRender struct{}

BaseRender the default implementation of Renderer, make it easier to extend Renderer for individual render function

func (*BaseRender) RenderContent

func (r *BaseRender) RenderContent() []byte

func (*BaseRender) RenderSnippet

func (r *BaseRender) RenderSnippet() ChartSnippet

type ChartSnippet

type ChartSnippet struct {
	Element string
	Script  string
	Option  string
}

type Renderer

type Renderer interface {
	Render(w io.Writer) error
	RenderContent() []byte
	RenderSnippet() ChartSnippet
}

Renderer Any kinds of charts have their render implementation and you can define your own render logic easily.

func NewChartRender

func NewChartRender(c interface{}, before ...func()) Renderer

NewChartRender returns a render implementation for Chart.

func NewPageRender

func NewPageRender(c interface{}, before ...func()) Renderer

NewPageRender returns a render implementation for Page.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL