Data not getting visualised as Graph

When i have a response of random value order. Grafana is not able to visualise in Graph

frame := data.NewFrame(“test”,
data.NewField(“time”, nil, []time.Time{}),
data.NewField(“value”, nil, []int64{}))

frame.AppendRow(query.TimeRange.To.Add(-3000*time.Second), int64(30))
frame.AppendRow(query.TimeRange.To.Add(-3500*time.Second), int64(25))
frame.AppendRow(query.TimeRange.To.Add(-3700*time.Second), int64(26))
frame.AppendRow(query.TimeRange.To.Add(-3800*time.Second), int64(27))

// // add the frames to the response
response.Frames = append(response.Frames, frame)

Error getting generated in the front end

time_series2.ts:301 Uncaught (in promise) TypeError: Cannot mix BigInt and other types, use explicit conversions
at e.value (time_series2.ts:301)
at e.value (graph.ts:457)
at e.value (graph.ts:107)
at l.emit (index.js:202)
at e.value (emitter.ts:27)
at t.value (panel_ctrl.ts:102)
at module.ts:240

Response of the query is successful

  1. A: {refId: “A”, series: null, tables: null, dataframes: [,…]}

Any help on this is appreciated

I don’t know much about what specific data types are allowable in the dataframe, but based on the error it looks like there’s a problem with the int64/BigInt type used here. Are you able to try using a regular number type, just to see if that fixes the error? Do you strictly need to use the int64 type here?

Hi @svetb these are the available field types which dataframe supports here

The conversion from int64 to BigInt is carried out by an internal package of grafana, i am not doing the conversion explicitly.

Yes, i need to use int64, because my values can go beyond the range of int32

Ok, thanks for clarifying. You’re clearly more familiar with this than I am.

I guess I’m not sure how the BigInt from the back-end get converted when passed to the TypeScript front-end - which may be more picky (and is generating the error). As the error says, are you potentially mixing BigInt and other types of data in a single DataFrame? I think my suggestion for how to try troubleshooting is potentially still valid (though probably not the final answer to your problem)

Anyway, I’m just stabbing in the dark here. Maybe someone else with a better understanding of the underlying machinery can pitch in.

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