sdk
sdk copied to clipboard
edit pannel error: TypeError: Cannot read property 'length' of null
grafana version: 8.4.1 I create a dashboard and an empty timeseries pannel:
`board := sdk.NewBoard(d.DashName) board.Time.From = "now-15m" board.Time.To = "now"
panel := sdk.NewTimeseries("empty panel") panel.Editable = true
board.Panels = append(board.Panels, panel) dashRes, err := c.SetDashboard(ctx,*board, sdk.SetDashboardParams{ Overwrite: false, })`
after i create it , I can see it in grafana, but when i edit the pannel, failed:
I had a similar issue. It was missing TimeseriesOptions. Fixed it by adding some values, for example:
panel.TimeseriesPanel.Options = sdk.TimeseriesOptions{
Legend: sdk.TimeseriesLegendOptions{Calcs: []string{}, DisplayMode: "list", Placement: "bottom"},
Tooltip: sdk.TimeseriesTooltipOptions{Mode: "single"},
}