michaeldmoore / michaeldmoore-multistat-panel

A smart table display panel with fixed, updating rows (or columns)
MIT License
57 stars 14 forks source link

Renaming columns in the legend: Transformations ignored #65

Open akannangara opened 3 years ago

akannangara commented 3 years ago

Hi @michaeldmoore ,

First of all, thank you for developing this plugin.

I have a question about renaming columns in the legend. I am unable to change the name assigned to a bar in the legend. Group and Column renaming options do not seem to work in my case - or I am not using them properly.

The situation: -Data is collected from ElasticSearch and grouped by a nominal category. (It is actually ordinal but that is not really relevant) -An extended stat metric is applied to collect the Sum and Count of a given attribute (and grouped by the category mentioned in the above bullet). For the query itself see Image 1. Image1

-This creates the table visible in Image2. Image2

-Using a Transform->Organize Fields, I've tried to rename the columns Sum and Count. These types of transformations work with other (similar) panels but is not stored/applied.

-Unfortunately, this is ignored when presenting the data (see Image3). Image3

Is there a way to rename these columns accordingly?

michaeldmoore commented 3 years ago

Interesting. I'm really busy now and for the next few weeks so I might not be able to get back to you on this very quickly.

In the meantime though, is there a way to rename the columns in the query itself (I don't know elasticsearch). Or as a column transformation or override in grafana itself (this seems to be the proper way for this kind of thing)

Good luck and I will look into this when I have the chance. Do update the issue though if you find a good work around. Cheers Michael Moore

On Wed, 14 Jul 2021 at 17:43, akannangara @.***> wrote:

Hi @michaeldmoore https://github.com/michaeldmoore ,

First of all, thank you for developing this plugin.

I have a question about renaming columns in the legend. I am unable to change the name assigned to a bar in the legend. Group and Column renaming options do not seem to work in my case - or I am not using them properly.

The situation: -Data is collected from ElasticSearch and grouped by a nominal category. (It is actually ordinal but that is not really relevant) -An extended stat metric is applied to collect the Sum and Count of a given attribute (and grouped by the category mentioned in the above bullet). For the query itself see Image 1. [image: Image1] https://user-images.githubusercontent.com/11178027/125651120-3f134978-72d7-4d55-a20d-5b21ad9b44d8.PNG

-This creates the table visible in Image2. [image: Image2] https://user-images.githubusercontent.com/11178027/125651118-0cd7f17c-e553-4563-ad01-d76b1984a29c.PNG

-Using a Transform->Organize Fields, I've tried to rename the columns Sum and Count. These types of transformations work with other (similar) panels but is not stored/applied.

-Unfortunately, this is ignored when presenting the data (see Image3). [image: Image3] https://user-images.githubusercontent.com/11178027/125651115-3d42132f-78a7-470d-b49d-1b1067e40353.PNG

Is there a way to rename these columns accordingly?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/65, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4NLLTTJEVO3VTJ7SHRKOTTXWWD3ANCNFSM5ALXF3ZA .

akannangara commented 3 years ago

@michaeldmoore ,

Thank you for the quick reply!

Unfortunately, I was unable to change the column name using the query or alias and grafana transformations were still ignored.

There is a work around though! When Inspecting the data there is a tab JSON that we can use to directly change the json data that is used to build the graph. inspect

Scrolling through the json data you will be able to find where the columns are defined. These have the attribute "col". Give the attribute "Name" in this object another name to change the name of column. new name

Don't forget to save your changes to the json by clicking Apply.