Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

graph panel in 7.0 is missing setFieldConfig() method #328

Open
pdreker opened this issue May 2, 2021 · 3 comments
Open

graph panel in 7.0 is missing setFieldConfig() method #328

pdreker opened this issue May 2, 2021 · 3 comments

Comments

@pdreker
Copy link

pdreker commented May 2, 2021

In the generated code the graph panel has no obvious option to set the unit, as setFieldConfig is not there and trying to solve this another way did not get me what I wanted due to missing documentation how to set an axis for series with a unit configured...

In the end I just copied the setFieldConfig method from the stat panel (panel/stat.libsonnet) in 7.0 into the panel/graph.libsonnet file and it simply produces the necessary output.

As this is generated code I don't think providing a PR is of any use in this case.

@jan-xyz
Copy link

jan-xyz commented Jun 25, 2021

When initialising the graph panel you can provide the format directly in the constructor: https://grafana.github.io/grafonnet-lib/api-docs/#graphpanelnew

There is also formatY1 and formatY2 in case you use the left and right Y axis.

@pdreker
Copy link
Author

pdreker commented Jun 25, 2021

I am referring to the generated code, i.e. grafonnet-7.0.

@malcolmholmes
Copy link
Contributor

The source is in github.com/grafana/dashboard spec. You can make PRs there.

That codebase stimulated the development of a proper schema, managed by the Grafana team themselves. It'll take a while though, as there is a lot of catchup to do. Then it'll be possible to make a generator from that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants