plain

package
v0.0.0-...-fd80043 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package plain exposes functions for rendering vertical projections of treemaps

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Image

func Image(tree *treemap.Block, width, height float64) (image.Image, error)

Image returns an image of the tree using a vertincal projection of the treemap

func NewGIF

func NewGIF(tree *treemap.Block, width, height float64) (io.WriterTo, error)

NewGIF returns the image of the received tree encoded as a GIF

Example
encoder, err := NewGIF(block, 1024, 768)
if err != nil {
	fmt.Println(err.Error())
}
buf := new(bytes.Buffer)
fmt.Println(encoder.WriteTo(buf))
fmt.Println(ioutil.WriteFile("../docs/plain.gif", buf.Bytes(), 0644))
Output:

44119 <nil>
<nil>

func NewJPEG

func NewJPEG(tree *treemap.Block, width, height float64) (io.WriterTo, error)

NewJPEG returns the image of the received tree encoded as a JPEG

Example
encoder, err := NewJPEG(block, 1024, 768)
if err != nil {
	fmt.Println(err.Error())
}
buf := new(bytes.Buffer)
fmt.Println(encoder.WriteTo(buf))
fmt.Println(ioutil.WriteFile("../docs/plain.jpg", buf.Bytes(), 0644))
Output:

59797 <nil>
<nil>

func NewPNG

func NewPNG(tree *treemap.Block, width, height float64) (io.WriterTo, error)

NewPNG returns the image of the received tree encoded as a PNG

Example
encoder, err := NewPNG(block, 1024, 768)
if err != nil {
	fmt.Println(err.Error())
}
buf := new(bytes.Buffer)
fmt.Println(encoder.WriteTo(buf))
fmt.Println(ioutil.WriteFile("../docs/plain.png", buf.Bytes(), 0644))
Output:

6350 <nil>
<nil>

Types

This section is empty.

Jump to

Keyboard shortcuts

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