sdk icon indicating copy to clipboard operation
sdk copied to clipboard

edit pannel error: TypeError: Cannot read property 'length' of null

Open ruanben opened this issue 2 years ago • 1 comments

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: image

ruanben avatar Apr 01 '22 07:04 ruanben

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"},
}

mhodovaniuk avatar Apr 22 '22 09:04 mhodovaniuk