Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultBackgroundColors to use on plots. DefaultBackgroundColors = []string{ "rgba(255, 99, 132, 0.2)", "rgba(54, 162, 235, 0.2)", "rgba(255, 206, 86, 0.2)", "rgba(75, 192, 192, 0.2)", "rgba(153, 102, 255, 0.2)", "rgba(255, 159, 64, 0.2)", } DefaultBorderColors = []string{ "rgba(255, 99, 132, 1)", "rgba(54, 162, 235, 1)", "rgba(255, 206, 86, 1)", "rgba(75, 192, 192, 1)", "rgba(153, 102, 255, 1)", "rgba(255, 159, 64, 1)", } )
View Source
var SrcUrl = "https://cdn.jsdelivr.net/npm/chart.js@3.9.1/dist/chart.js"
SrcUrl is the default URL for the ChartJSUrl.js library. It can be changed to reflect where the notebook will pull it from.
Functions ¶
func UniqueSuffix ¶
func UniqueSuffix() string
UniqueSuffix returns are unique suffix for JavaScript variable names.
Types ¶
type LinePlot ¶
type LinePlot struct { Id string Data *LinePlotData ChartVar string DivId, CanvasId string JavascriptDisplayId string // Plot creation content. Content string // ChartJSUrl is set with SrcUrl. ChartJSUrl string // DivStyle is inlined in the enclosing `div` html tag. DivStyle string // CanvasStyle is inlined in the `canvas` html tag that holds the plot. CanvasStyle string }
LinePlot can build and dynamically update line plots.
func NewLinePlot ¶
func NewLinePlot(data *LinePlotData) *LinePlot
type LinePlotData ¶
type LinePlotData struct {
Title, Subtitle string
HasTwoAxis bool
Lines []*LineData
XTitle string
YTitle, Y2Title string
}
LinePlotData contains potentially multiple lines sharing the same X,Y axis.
func (*LinePlotData) AddPoint ¶
func (l *LinePlotData) AddPoint(lineIdx int, x, y float64)
Click to show internal directories.
Click to hide internal directories.