Add other parameter to the Frames in data source backend plugin

Hi everyone,
I am trying to develop a backend datasource plugin, I saw the Go sample code, to frame are added values and time.

	// create data frame response
	frame := data.NewFrame("response")

	// add the time dimension
	frame.Fields = append(frame.Fields,
		data.NewField("time", nil, []time.Time{query.TimeRange.From, query.TimeRange.To}),

	// add values
	frame.Fields = append(frame.Fields,
		data.NewField("values", nil, []int64{10, 20}),

I saw that there is a data structure called FieldConfig which contains various optional parameters to assign (for example max, min, unit…).
My question is: how do I assign these properties to the frame object?


You can assign a struct directly to the field config:

field := data.NewField("Field name", nil, values)
field.Config = &data.FieldConfig{Min: 0, Max: 10}
frame.Fields = append(frame.Fields, field)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.