michaeldmoore / michaeldmoore-multistat-panel

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

Bug - Sorting on values does not work when grouping #18

Closed slygren closed 5 years ago

slygren commented 5 years ago

'Sort col' is not working if also 'Grouping' and 'Group sort by' are activated

michaeldmoore commented 5 years ago

I think it is working. When multiple groups are involved, each group is sorted separately, based on the values in the SortCol.

If you really think it is not working, send me the data you are looking at (copy and paste the JSON result set from the query examiner, for example) and some screen shots showing the settings and describe why you think it isn't sorting properly.

On Thu, Apr 11, 2019 at 1:58 PM Sture Lygren notifications@github.com wrote:

'Sort col' is not working if also 'Grouping' and 'Group sort by' are activated

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjVrm0k5SJcGg7XStPb6x-deFqmPG4Rks5vfyNZgaJpZM4cpbh- .

-- "That's not grey - I've just come from San Francisco with some flour in my hair"

slygren commented 5 years ago

Ok, here goes

My pandas data frame (using SimpleJSON)

result={ "type":"table", "columns":[{"text":"value","type":"string"}, {"text":"name","type":"string"}, {"text":"timestamp","type":"string"}, {"text":"section","type":"string"}, {"text":"index","type":"value"} ], "rows":[[x.value, x.section, int(x.timestamp), x.section.split('_')[0],tank_list.index(x.section)] for x in table.itertuples()] }

The result

{'columns': [{'text': 'value', 'type': 'string'}, {'text': 'name', 'type': 'string'}, {'text': 'timestamp', 'type': 'string'}, {'text': 'section', 'type': 'string'}, {'text': 'index', 'type': 'value'}], 'rows': [[65.7210769993701, 'east_2', 1555010413909, 'east', 7], [8.0740949008665, 'west_2', 1555010892867, 'west', 1], [5.67698834688321, 'west_4', 1555010928408, 'west', 3], [3.3478631385914994, 'center_1', 1555010932090, 'center', 4], [8.45657471898126, 'east_1', 1555010929634, 'east', 6], [112.8590108159346, 'west_1', 1555010858587, 'west', 0], [88.82950828855141, 'east_4', 1555010848789, 'east', 9], [9.05719188023755, 'east_3', 1555010880625, 'east', 8], [62.801827748780994, 'west_3', 1555010929634, 'west', 2], [20.261279587444, 'center_2', 1555010670961, 'center', 5]], 'type': 'table'}

The panel & configuration parts

Screenshot 2019-04-11 at 21 30 56 Screenshot 2019-04-11 at 21 31 42 Screenshot 2019-04-11 at 21 31 55

As you will see, I’m trying to use ‘index' number values for column sorting, as a means to overcome the fact that sorting ‘name’ strings was not working. Unfortunately - neither works if ‘Group Sort Order’ is also activated. Correct sorting is only realised if the latter part is deactivated.

On 11 Apr 2019, at 21:02, michaeldmoore notifications@github.com wrote:

I think it is working. When multiple groups are involved, each group is sorted separately, based on the values in the SortCol.

If you really think it is not working, send me the data you are looking at (copy and paste the JSON result set from the query examiner, for example) and some screen shots showing the settings and describe why you think it isn't sorting properly.

On Thu, Apr 11, 2019 at 1:58 PM Sture Lygren notifications@github.com wrote:

'Sort col' is not working if also 'Grouping' and 'Group sort by' are activated

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjVrm0k5SJcGg7XStPb6x-deFqmPG4Rks5vfyNZgaJpZM4cpbh- .

-- "That's not grey - I've just come from San Francisco with some flour in my hair" — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18#issuecomment-482254456, or mute the thread https://github.com/notifications/unsubscribe-auth/ANtBZ69v9HSTsjrpiuGZ1Xi2l4c-weJlks5vf4aqgaJpZM4cpbh-.

michaeldmoore commented 5 years ago

Thanks for this. I will try using your data and see what happens.

On Thu, Apr 11, 2019, 9:41 PM Sture Lygren notifications@github.com wrote:

Ok, here goes

My pandas data frame (using SimpleJSON)

result={ "type":"table", "columns":[{"text":"value","type":"string"}, {"text":"name","type":"string"}, {"text":"timestamp","type":"string"}, {"text":"section","type":"string"}, {"text":"index","type":"value"} ], "rows":[[x.value, x.section, int(x.timestamp), x.section.split('_')[0],tank_list.index(x.section)] for x in table.itertuples()] }

The result

{'columns': [{'text': 'value', 'type': 'string'}, {'text': 'name', 'type': 'string'}, {'text': 'timestamp', 'type': 'string'}, {'text': 'section', 'type': 'string'}, {'text': 'index', 'type': 'value'}], 'rows': [[65.7210769993701, 'east_2', 1555010413909, 'east', 7], [8.0740949008665, 'west_2', 1555010892867, 'west', 1], [5.67698834688321, 'west_4', 1555010928408, 'west', 3], [3.3478631385914994, 'center_1', 1555010932090, 'center', 4], [8.45657471898126, 'east_1', 1555010929634, 'east', 6], [112.8590108159346, 'west_1', 1555010858587, 'west', 0], [88.82950828855141, 'east_4', 1555010848789, 'east', 9], [9.05719188023755, 'east_3', 1555010880625, 'east', 8], [62.801827748780994, 'west_3', 1555010929634, 'west', 2], [20.261279587444, 'center_2', 1555010670961, 'center', 5]], 'type': 'table'}

The panel & configuration parts

As you will see, I’m trying to use ‘index' number values for column sorting, as a means to overcome the fact that sorting ‘name’ strings was not working. Unfortunately - neither works if ‘Group Sort Order’ is also activated. Correct sorting is only realised if the latter part is deactivated.

On 11 Apr 2019, at 21:02, michaeldmoore notifications@github.com wrote:

I think it is working. When multiple groups are involved, each group is sorted separately, based on the values in the SortCol.

If you really think it is not working, send me the data you are looking at (copy and paste the JSON result set from the query examiner, for example) and some screen shots showing the settings and describe why you think it isn't sorting properly.

On Thu, Apr 11, 2019 at 1:58 PM Sture Lygren notifications@github.com wrote:

'Sort col' is not working if also 'Grouping' and 'Group sort by' are activated

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18>, or mute the thread < https://github.com/notifications/unsubscribe-auth/ADjVrm0k5SJcGg7XStPb6x-deFqmPG4Rks5vfyNZgaJpZM4cpbh-

.

-- "That's not grey - I've just come from San Francisco with some flour in my hair" — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18#issuecomment-482254456>, or mute the thread < https://github.com/notifications/unsubscribe-auth/ANtBZ69v9HSTsjrpiuGZ1Xi2l4c-weJlks5vf4aqgaJpZM4cpbh- .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18#issuecomment-482277065, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjVri1BdJY2EIV-yqtniQfPVvAU_qiqks5vf4_XgaJpZM4cpbh- .

michaeldmoore commented 5 years ago

Finally got to looking at this - and yes, it was a bug.

Thanks for pointing it out. I entered an update request to the official Grafana plugin repository which should get applied in the next few days. Inthe meantime, the fixed version if available here: https://github.com/michaeldmoore/michaeldmoore-multistat-panel

Regards, MM

On Thu, Apr 11, 2019 at 9:41 PM Sture Lygren notifications@github.com wrote:

Ok, here goes

My pandas data frame (using SimpleJSON)

result={ "type":"table", "columns":[{"text":"value","type":"string"}, {"text":"name","type":"string"}, {"text":"timestamp","type":"string"}, {"text":"section","type":"string"}, {"text":"index","type":"value"} ], "rows":[[x.value, x.section, int(x.timestamp), x.section.split('_')[0],tank_list.index(x.section)] for x in table.itertuples()] }

The result

{'columns': [{'text': 'value', 'type': 'string'}, {'text': 'name', 'type': 'string'}, {'text': 'timestamp', 'type': 'string'}, {'text': 'section', 'type': 'string'}, {'text': 'index', 'type': 'value'}], 'rows': [[65.7210769993701, 'east_2', 1555010413909, 'east', 7], [8.0740949008665, 'west_2', 1555010892867, 'west', 1], [5.67698834688321, 'west_4', 1555010928408, 'west', 3], [3.3478631385914994, 'center_1', 1555010932090, 'center', 4], [8.45657471898126, 'east_1', 1555010929634, 'east', 6], [112.8590108159346, 'west_1', 1555010858587, 'west', 0], [88.82950828855141, 'east_4', 1555010848789, 'east', 9], [9.05719188023755, 'east_3', 1555010880625, 'east', 8], [62.801827748780994, 'west_3', 1555010929634, 'west', 2], [20.261279587444, 'center_2', 1555010670961, 'center', 5]], 'type': 'table'}

The panel & configuration parts

As you will see, I’m trying to use ‘index' number values for column sorting, as a means to overcome the fact that sorting ‘name’ strings was not working. Unfortunately - neither works if ‘Group Sort Order’ is also activated. Correct sorting is only realised if the latter part is deactivated.

On 11 Apr 2019, at 21:02, michaeldmoore notifications@github.com wrote:

I think it is working. When multiple groups are involved, each group is sorted separately, based on the values in the SortCol.

If you really think it is not working, send me the data you are looking at (copy and paste the JSON result set from the query examiner, for example) and some screen shots showing the settings and describe why you think it isn't sorting properly.

On Thu, Apr 11, 2019 at 1:58 PM Sture Lygren notifications@github.com wrote:

'Sort col' is not working if also 'Grouping' and 'Group sort by' are activated

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18>, or mute the thread < https://github.com/notifications/unsubscribe-auth/ADjVrm0k5SJcGg7XStPb6x-deFqmPG4Rks5vfyNZgaJpZM4cpbh-

.

-- "That's not grey - I've just come from San Francisco with some flour in my hair" — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18#issuecomment-482254456>, or mute the thread < https://github.com/notifications/unsubscribe-auth/ANtBZ69v9HSTsjrpiuGZ1Xi2l4c-weJlks5vf4aqgaJpZM4cpbh- .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/michaeldmoore/michaeldmoore-multistat-panel/issues/18#issuecomment-482277065, or mute the thread https://github.com/notifications/unsubscribe-auth/ADjVri1BdJY2EIV-yqtniQfPVvAU_qiqks5vf4_XgaJpZM4cpbh- .

-- "That's not grey - I've just come from San Francisco with some flour in my hair"