charts

package module
v0.0.0-...-b8776a4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 9 Imported by: 0

README

Go svg charts

A golang library for pure SVG charts.

Credits

The maps are based on the work of MapSVG.

The original map is available here under the Creative Commons Attribution 4.0 International license.

Installation

go get https://git.trankiloubilou.fr/fabien/charts

Roadmap

Chart types
  • Line charts
  • Bar charts
  • Treemap
  • Pie chart
  • Stacked area chart
  • Bubble chart
  • Geographic map
  • Radar chart
  • Heat map
Features
  • Interactivity with css
  • Automatic color
  • logarithmique scale
  • number/date format
  • export to svg
  • export to png

Examples

Line chart

line chart line chart

Bar chart

bar chart

Tree map

treemap

Pie chart

pie chart

area chart

pie chart pie chart bezier

heat map

Heat map

Geographic map

Geo map

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultColorScheme = ColorScheme{
	Foreground:      "#000",
	Background:      "#fff",
	LightAxisColor:  "#eee",
	DarkerAxisColor: "#777",
	ColorPalette:    defaultColorPalette,
}

Functions

func GetAvailableMaps

func GetAvailableMaps() []string

Types

type AeraChart

type AeraChart struct {
	Dimension
	// contains filtered or unexported fields
}

func NewAreaChart

func NewAreaChart(
	width int,
	height int,
	xaxis []string,
	series []string,
	data [][]float64,
) *AeraChart

func (*AeraChart) RenderSVG

func (ac *AeraChart) RenderSVG(w io.Writer) error

func (*AeraChart) SetBezier

func (ac *AeraChart) SetBezier(isBezier bool) *AeraChart

func (*AeraChart) SetColorDcheme

func (ac *AeraChart) SetColorDcheme(colorScheme *ColorScheme) *AeraChart

func (*AeraChart) SetHorizontalLines

func (ac *AeraChart) SetHorizontalLines(horizontalLines int) *AeraChart

func (*AeraChart) SetInteractive

func (ac *AeraChart) SetInteractive(interactive bool) *AeraChart

func (*AeraChart) SetNumberFormat

func (ac *AeraChart) SetNumberFormat(numberFormat string) *AeraChart

func (*AeraChart) SetShowMarkers

func (ac *AeraChart) SetShowMarkers(showMarkers bool) *AeraChart

func (*AeraChart) SetShowValue

func (ac *AeraChart) SetShowValue(showValues bool) *AeraChart

func (*AeraChart) SetXaxisLegend

func (ac *AeraChart) SetXaxisLegend(xaxisLegend string) *AeraChart

func (*AeraChart) SetYaxisLegend

func (ac *AeraChart) SetYaxisLegend(yaxisLegend string) *AeraChart

type BarChart

type BarChart struct {
	Dimension
	// contains filtered or unexported fields
}

func NewBarChart

func NewBarChart(
	width int,
	height int,
	xaxis []string,
	series []string,
	data [][]float64,
) *BarChart

func (*BarChart) RenderSVG

func (bc *BarChart) RenderSVG(w io.Writer) error

func (*BarChart) SetColorDcheme

func (bc *BarChart) SetColorDcheme(colorScheme *ColorScheme) *BarChart

func (*BarChart) SetHorizontalLines

func (bc *BarChart) SetHorizontalLines(horizontalLines int) *BarChart

func (*BarChart) SetInteractive

func (bc *BarChart) SetInteractive(interactive bool) *BarChart

func (*BarChart) SetNumberFormat

func (bc *BarChart) SetNumberFormat(numberFormat string) *BarChart

func (*BarChart) SetShowValue

func (bc *BarChart) SetShowValue(showValues bool) *BarChart

func (*BarChart) SetShowZero

func (bc *BarChart) SetShowZero(showZero bool) *BarChart

func (*BarChart) SetXaxisLegend

func (bc *BarChart) SetXaxisLegend(xaxisLegend string) *BarChart

func (*BarChart) SetYaxisLegend

func (bc *BarChart) SetYaxisLegend(yaxisLegend string) *BarChart

type BezierPoint

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

type ColorPalette

type ColorPalette func(i int) string

type ColorScheme

type ColorScheme struct {
	Foreground      string
	Background      string
	LightAxisColor  string
	DarkerAxisColor string
	ColorPalette    ColorPalette
}

type Dimension

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

type GeoMap

type GeoMap struct {
	Dimension
	// contains filtered or unexported fields
}

func NewGeoMap

func NewGeoMap(
	mapName string,
	data map[string]float64,
) *GeoMap

func (*GeoMap) RenderSVG

func (gm *GeoMap) RenderSVG(w io.Writer) error

func (*GeoMap) SetColorDcheme

func (gm *GeoMap) SetColorDcheme(colorScheme *ColorScheme) *GeoMap

func (*GeoMap) SetInteractive

func (gm *GeoMap) SetInteractive(interactive bool) *GeoMap

func (*GeoMap) SetNumberFormat

func (gm *GeoMap) SetNumberFormat(numberFormat string) *GeoMap

func (*GeoMap) SetShowValue

func (gm *GeoMap) SetShowValue(showValues bool) *GeoMap

type HeatMap

type HeatMap struct {
	Dimension
	// contains filtered or unexported fields
}

func NewHeatMap

func NewHeatMap(
	width int,
	height int,
	xaxis []string,
	yaxis []string,
	data [][]float64,
) *HeatMap

func (*HeatMap) RenderSVG

func (hm *HeatMap) RenderSVG(w io.Writer) error

func (*HeatMap) SetColorDcheme

func (hm *HeatMap) SetColorDcheme(colorScheme *ColorScheme) *HeatMap

func (*HeatMap) SetInteractive

func (hm *HeatMap) SetInteractive(interactive bool) *HeatMap

func (*HeatMap) SetNumberFormat

func (hm *HeatMap) SetNumberFormat(numberFormat string) *HeatMap

func (*HeatMap) SetShowValue

func (hm *HeatMap) SetShowValue(showValues bool) *HeatMap

func (*HeatMap) SetXaxisLegend

func (hm *HeatMap) SetXaxisLegend(xaxisLegend string) *HeatMap

func (*HeatMap) SetYaxisLegend

func (hm *HeatMap) SetYaxisLegend(yaxisLegend string) *HeatMap

type LineChart

type LineChart struct {
	Dimension
	// contains filtered or unexported fields
}

func NewLineChart

func NewLineChart(
	width int,
	height int,
	xaxis []string,
	series []string,
	data [][]float64,
) *LineChart

func (*LineChart) RenderSVG

func (l *LineChart) RenderSVG(w io.Writer) error

func (*LineChart) SetBezier

func (l *LineChart) SetBezier(isBezier bool) *LineChart

func (*LineChart) SetColorDcheme

func (l *LineChart) SetColorDcheme(colorScheme *ColorScheme) *LineChart

func (*LineChart) SetHorizontalLines

func (l *LineChart) SetHorizontalLines(horizontalLines int) *LineChart

func (*LineChart) SetInteractive

func (l *LineChart) SetInteractive(interactive bool) *LineChart

func (*LineChart) SetNumberFormat

func (l *LineChart) SetNumberFormat(numberFormat string) *LineChart

func (*LineChart) SetShowMarkers

func (l *LineChart) SetShowMarkers(showMarkers bool) *LineChart

func (*LineChart) SetShowValue

func (l *LineChart) SetShowValue(showValues bool) *LineChart

func (*LineChart) SetXaxisLegend

func (l *LineChart) SetXaxisLegend(xaxisLegend string) *LineChart

func (*LineChart) SetYaxisLegend

func (l *LineChart) SetYaxisLegend(yaxisLegend string) *LineChart

type Node

type Node struct {
	XMLName xml.Name
	Attrs   []xml.Attr `xml:",any,attr"`
	Content []byte     `xml:",innerxml"`
	Nodes   []Node     `xml:",any"`
}

type PieChart

type PieChart struct {
	Dimension
	// contains filtered or unexported fields
}

func NewPieChart

func NewPieChart(
	width int,
	height int,
	series []string,
	data []float64,
) *PieChart

func (*PieChart) RenderSVG

func (pc *PieChart) RenderSVG(w io.Writer) error

func (*PieChart) SetColorDcheme

func (pc *PieChart) SetColorDcheme(colorScheme *ColorScheme) *PieChart

func (*PieChart) SetInteractive

func (pc *PieChart) SetInteractive(interactive bool) *PieChart

func (*PieChart) SetNumberFormat

func (pc *PieChart) SetNumberFormat(numberFormat string) *PieChart

func (*PieChart) SetShowValue

func (pc *PieChart) SetShowValue(showValues bool) *PieChart

type TreemapChart

type TreemapChart struct {
	Dimension
	// contains filtered or unexported fields
}

func NewTreemapChart

func NewTreemapChart(
	width int,
	height int,
	series []string,
	data []float64,
) *TreemapChart

func (*TreemapChart) RenderSVG

func (tm *TreemapChart) RenderSVG(w io.Writer) error

func (*TreemapChart) SetColorDcheme

func (tm *TreemapChart) SetColorDcheme(colorScheme *ColorScheme) *TreemapChart

func (*TreemapChart) SetInteractive

func (tm *TreemapChart) SetInteractive(interactive bool) *TreemapChart

func (*TreemapChart) SetNumberFormat

func (tm *TreemapChart) SetNumberFormat(numberFormat string) *TreemapChart

func (*TreemapChart) SetShowValue

func (tm *TreemapChart) SetShowValue(showValues bool) *TreemapChart

Jump to

Keyboard shortcuts

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