示例#1
0
func NewChartFromTimeFloatPairWithTitle(title string, inputList []TimeFloatPair) kmgBootstrap.Panel {
	var body kmgView.HtmlRenderer
	if len(inputList) > 1 {
		body = CreateLineFromTimeFloatPair(inputList)
	} else {
		out := fmt.Sprintf("共 %d 条数据\n", len(inputList))
		for _, pair := range inputList {
			out += kmgTime.DefaultFormat(pair.X) + " : " + kmgStrconv.FormatFloat(pair.Y) + " \n"
		}
		body = kmgBootstrap.Pre(out)
	}
	return kmgBootstrap.Panel{
		Title: title + " 共 " + kmgStrconv.FormatInt(len(inputList)) + " 条数据",
		Body:  body,
	}
}
示例#2
0
文件: form.go 项目: keysonZZZ/kmg
func (f InputVerticalInt) HtmlRender() string {
	if f.ShowName == "" {
		f.ShowName = f.Name
	}
	return InputWrapVertical{
		ShowName: f.ShowName,
		Comment:  f.Comment,
		Need:     f.Need,
		Body: Input{
			Type:     "number",
			Name:     f.Name,
			Value:    kmgStrconv.FormatInt(f.Value),
			ReadOnly: f.ReadOnly,
		},
	}.HtmlRender()
}