Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllChartTypes = []maps.Map{ { "name": "线图", "code": "line", "description": "使用线图展示数据", "instance": new(LineChart), }, { "name": "饼图", "code": "pie", "description": "使用饼图展示数据", "instance": new(PieChart), }, { "name": "HTML", "code": "html", "description": "使用HTML写一个图表", "instance": new(HTMLChart), }, { "name": "URL", "code": "url", "description": "引入一个外部的URL,要注意可能产生的安全问题", "instance": new(URLChart), }, { "name": "时钟", "code": "clock", "description": "使用时钟展示当前时间,时间格式可以类似于 Mon Jan 21 16:46:06 CST 2019、2019-01-02 03:04:95 或一个时间戳 1548060582", "instance": new(ClockChart), }, { "name": "Javascript", "code": "javascript", "description": "直接使用Javascript代码来写图表", "instance": new(JavascriptChart), }, }
View Source
var StatChartTypes = []maps.Map{ { "name": "线图", "code": "line", "description": "使用线图展示数据", "instance": new(LineChart), }, { "name": "饼图", "code": "pie", "description": "使用饼图展示数据", "instance": new(PieChart), }, { "name": "HTML", "code": "html", "description": "使用HTML写一个图表", "instance": new(HTMLChart), }, { "name": "URL", "code": "url", "description": "引入一个外部的URL,要注意可能产生的安全问题", "instance": new(URLChart), }, { "name": "时钟", "code": "clock", "description": "使用时钟展示当前时间,时间格式可以类似于 Mon Jan 21 16:46:06 CST 2019、2019-01-02 03:04:95 或一个时间戳 1548060582", "instance": new(ClockChart), }, { "name": "Javascript", "code": "javascript", "description": "直接使用Javascript代码来写图表", "instance": new(JavascriptChart), }, }
Functions ¶
Types ¶
type Chart ¶
type Chart struct { Id string `yaml:"id" json:"id"` On bool `yaml:"on" json:"on"` Name string `yaml:"name" json:"name"` Description string `yaml:"description" json:"description"` Columns uint8 `yaml:"columns" json:"columns"` // 列 Type string `yaml:"type" json:"type"` // 类型 Options map[string]interface{} `yaml:"options" json:"options"` // 选项 Requirements []string `yaml:"requirements" json:"requirements"` // 绘制chart需要的特征 }
Chart定义
type ChartInterface ¶
type ChartInterface interface {
AsJavascript(options map[string]interface{}) (code string, err error)
}
Chart接口
type ClockChart ¶
type ClockChart struct { }
时钟
func (*ClockChart) AsJavascript ¶
func (this *ClockChart) AsJavascript(options map[string]interface{}) (code string, err error)
type HTMLChart ¶
type HTMLChart struct {
HTML string `yaml:"html" json:"html"`
}
HTML Chart
func (*HTMLChart) AsJavascript ¶
type JavascriptChart ¶
type JavascriptChart struct {
Code string `yaml:"code" json:"code"`
}
Javascript
func (*JavascriptChart) AsJavascript ¶
func (this *JavascriptChart) AsJavascript(options map[string]interface{}) (code string, err error)
type LineChart ¶
type LineChart struct { Params []string Limit int }
线图
func (*LineChart) AsJavascript ¶
type URLChart ¶
type URLChart struct {
URL string `yaml:"url" json:"url"`
}
URL Chart
func (*URLChart) AsJavascript ¶
type Widget ¶
type Widget struct { Id string `yaml:"id" json:"id"` On bool `yaml:"on" json:"on"` Name string `yaml:"name" json:"name"` Code string `yaml:"code" json:"code"` Author string `yaml:"author" json:"author"` Version string `yaml:"version" json:"version"` Description string `yaml:"description" json:"description"` Charts []*Chart `yaml:"charts" json:"charts"` CreatedAt int64 `yaml:"createdAt" json:"createdAt"` // 添加时间,用来排序 }
Widget定义
Click to show internal directories.
Click to hide internal directories.