Skip to content
This repository has been archived by the owner. It is now read-only.
Go to file
Cannot retrieve contributors at this time
33 lines (24 sloc) 689 Bytes
package charts
import "bytes"
var charts map[string]ChartType
func sequence(types DataTypes) string {
var seq bytes.Buffer
for _, t := range types {
return seq.String()
func Detect(types DataTypes) ChartType {
if chart, ok := charts[sequence(types)]; ok {
return chart
return UnknownChart
func init() {
charts = make(map[string]ChartType)
charts[sequence(DataTypes{Text, Number})] = SimpleBar
charts[sequence(DataTypes{Number, Number})] = SimpleBar
charts[sequence(DataTypes{Time, Number})] = SimpleLine
charts[sequence(DataTypes{Text, Text, Number})] = GroupedBar
charts[sequence(DataTypes{Time, Text, Number})] = MultiLine
You can’t perform that action at this time.