All Apps and Add-ons

Sideview Utils Static Pulldown Pie charts

gnovak
Builder

I have 2 pie charts on a form and each one has a static pulldown menu for the amount of results displayed. (Example: 10 results, 20 results). This was created using SideView Utils.

However I'm noticing that the first pie charts drop down menu is changing BOTH pie charts. It's even changing the value in the second pie charts drop down when something is selected.

How do I separate both pie charts with their static menus? I want each pie chart to change when only the menu for that chart is changed.

Here is my code. Again I put it on pastebin because I cannot get the code to show up correctly using the code sample button on this form.

http://pastebin.com/cqfj41rc

1 Solution

sideview
SplunkTrust
SplunkTrust

1) It's not causing your immediate problem, but you've got a lot of autoRun="True" sprinkled all around, and it will be causing some problems you haven't found yet. It's natural to think that only certain modules (like Search) need an 'autoRun="True"' attribute. But they dont. Just put one single autoRun="true" way up at the highest point beneath which you want everything to run when the page loads, and delete the rest. The other ones are causing any number of evil problems and slowing down your view. And never put autoRun="False" anywhere because it will do nothing.

2) However the main problem that you're hitting is that your nesting was a little screwy. I cleaned up the indentation in the file and at that point it becomes a lot easier to read. If you do the same you'll see that your second Pulldown and its chart is simply nested inside the dropdown from the other panel. This looks completely unintentional.

Nesting in advanced XML is 100% about functionality. The layout falls out as a strange side effect of the layoutPanel attributes. But you really have to look at the nesting because that's telling the modules how you want them to work together. If you put anything inside a Pulldown module or really inside anything that the user can interact with, then when that interaction comes, the stuff you nested inside will always reload/rerun/change, etc... So the solution is to denest that inner panel so it's not all nested inside the panel before it. I think that all the modules on which you have layoutPanel="panel_rowN_colM", all those want to be at the same indentation level...

I would ordinarily take a stab at fixing it, but many of these panels are unnecessarily nested inside parts of eachother so I think you'll have to just go through again.

One recommendation I can give is that (assuming you have the latest Sideview Utils from http://sideviewapps.com/apps/sideview-utils ), there is something called the Sideview Editor. It's an authoring system for editing/creating/debugging advanced xml views without ever actually seeing the XML. Anyway you can also use this to clean up indentation of the XML files. If you edit anything at all in this view, like edit just one module, change nothing and submit the edit form, it'll clean up all your XML indentation but leave all sorts of niceties like module tags will have name attributes as the first attribute, and it wont mess with your whitespace and it'll CDATA html and search params.... etc. Anyway, I use it as a 2-second tool to clean up demon-possessed indentation. Note that it'll write the modified view to /local instead of default so you might have to look around to find it.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

Yea, the code-formatting buttons on answers itself dont really work. Nor does the 'preview' mode. You can however just ignore them both, indent any code you want to monospace-format with 4 spaces on each line, or for smaller one-liners just enclose the code in backticks, and it'll work fine. Again ignore the 'preview' stuff because it'll be making you think the 4 spaces aren't going to work.

0 Karma

sideview
SplunkTrust
SplunkTrust

1) It's not causing your immediate problem, but you've got a lot of autoRun="True" sprinkled all around, and it will be causing some problems you haven't found yet. It's natural to think that only certain modules (like Search) need an 'autoRun="True"' attribute. But they dont. Just put one single autoRun="true" way up at the highest point beneath which you want everything to run when the page loads, and delete the rest. The other ones are causing any number of evil problems and slowing down your view. And never put autoRun="False" anywhere because it will do nothing.

2) However the main problem that you're hitting is that your nesting was a little screwy. I cleaned up the indentation in the file and at that point it becomes a lot easier to read. If you do the same you'll see that your second Pulldown and its chart is simply nested inside the dropdown from the other panel. This looks completely unintentional.

Nesting in advanced XML is 100% about functionality. The layout falls out as a strange side effect of the layoutPanel attributes. But you really have to look at the nesting because that's telling the modules how you want them to work together. If you put anything inside a Pulldown module or really inside anything that the user can interact with, then when that interaction comes, the stuff you nested inside will always reload/rerun/change, etc... So the solution is to denest that inner panel so it's not all nested inside the panel before it. I think that all the modules on which you have layoutPanel="panel_rowN_colM", all those want to be at the same indentation level...

I would ordinarily take a stab at fixing it, but many of these panels are unnecessarily nested inside parts of eachother so I think you'll have to just go through again.

One recommendation I can give is that (assuming you have the latest Sideview Utils from http://sideviewapps.com/apps/sideview-utils ), there is something called the Sideview Editor. It's an authoring system for editing/creating/debugging advanced xml views without ever actually seeing the XML. Anyway you can also use this to clean up indentation of the XML files. If you edit anything at all in this view, like edit just one module, change nothing and submit the edit form, it'll clean up all your XML indentation but leave all sorts of niceties like module tags will have name attributes as the first attribute, and it wont mess with your whitespace and it'll CDATA html and search params.... etc. Anyway, I use it as a 2-second tool to clean up demon-possessed indentation. Note that it'll write the modified view to /local instead of default so you might have to look around to find it.

0 Karma

sideview
SplunkTrust
SplunkTrust

The Pager is probably there cause you had a Paginator there, which is probably from an earlier era when there was a SimpleResultsTable there instead of a chart. Sorry. Yes remove it. As for the problem you saw when you removed it, I'm betting you removed the Pager by deleting the <module name="Pager"> line, and then scrolling to the bottom of the file and removing one </module> tag. This is precisely what got you into the trouble in the first place. 😃 If you consider the indentation picture this creates, you just indented the entire next panel inside that one.

0 Karma

gnovak
Builder

This did actually work. Only thing is why is there a page module on the first pie chart? Tried removing paginator but it caused the second chart to autoload when the drop down menus loaded. weird? I also removed an extra "message" module I had at the top. I must have posted it twice in there.

0 Karma

sideview
SplunkTrust
SplunkTrust

OK. I used the "Reattach" mode in the Editor to denest the N separate panels from being inside eachother. For instance the second panel's config was below the paginator to the first panel. So even clicking a 'page 2' link in the first panel would reload the second panel. Likewise the third panel was downstream (ie nested inside) the paginator of the second panel.... and so on and so forth. The view is massively less indented now. And I cleaned up a lot of other things too. http://pastebin.com/fP9KYtAd

0 Karma

sideview
SplunkTrust
SplunkTrust

No worries. It seems completely opaque and insane until you get it. Read the "Framework intro" page a couple times if you haven't already (Key Techniques > Overview of the advanced xml). Then if you dont like denesting and de-intending XML (cause who does), you can always try your hand at using the Sideview Editor in "Reattach" mode. Let me see if I can just clean this up myself though and send it back.

0 Karma

gnovak
Builder

i understand what you mean, i'm just struggling how to fix it. I'm still a noob in a way i guess! I'm just happy I see charts and searches actually working! 🙂

0 Karma

sideview
SplunkTrust
SplunkTrust

OK. Basically the parts where you have the group and layoutPanel attributes. From that point, each of those modules should be at the same level, ie same indentation in the file once the indentation is cleaned up. Right now the way you have it the other panels are basically "downstream" from the pulldown in another panel, which is why they're having that dependent relationship. In a couple hours I can try and fix it for you going off of the XML you posted. It'll only take me 10 or 15mins probably and you'll see the difference. I'll also try and clean it up in general.

0 Karma

gnovak
Builder

i'm not sure what i'm supposed to be looking for...I tried something, moved some stuff around but it did not work. The fields in the drop down menus aren't sharing the same search so looking at some of the examples, i'm not sure.

0 Karma

sideview
SplunkTrust
SplunkTrust

And you followed my other comments about denesting the one part of the XML so it wasnt inside the Pulldowns? Can you repost the modified version on pasteBin?

0 Karma

gnovak
Builder

i did and still not working. Not sure why it's doing this. as soon as the filename menu populates the search kicks off and all the graphs load. here it is again. http://pastebin.com/skdUQehV

0 Karma

sideview
SplunkTrust
SplunkTrust

You have that autoRun="True" at the top. Then the autoRun="False" a bit lower. Then you have autoRun="True" on two Pulldown modules lower down. So 3 autoRun="True" and 1 autoRun="False". Delete them all except for the topmost autoRun="True" and the view will load the way you want. I really need to put something into Sideview Utils that prevents people from shooting themselves in the foot like this. I'll try and get that in soon.

0 Karma

gnovak
Builder

i think i see what you mean about my code. i'm cleaning it up

0 Karma

gnovak
Builder

I only have one autorun=true at this point and it's still not doing what I want it to. I already had a submit button at the top of the code and i did allowsoftsubmit=false and it still searched directly after the drop down menus were populated. I'm going to keep looking.

0 Karma

gnovak
Builder

I'll check that out

0 Karma

sideview
SplunkTrust
SplunkTrust

OK no problem. You'll want to put in a Button module after the controls you have at the top, but before the panels, such that the XML wiring the N panels is all nested inside the button. Then give the Button an 'allowSoftSubmit' param of False. But leave the autoRun="True" up at the top because you need that to drive the initial population of your dynamic Pulldowns up there. I hope this makes sense... It's an area in which I hope to still make improvements fwiw.

0 Karma

gnovak
Builder

I'll see about cleaning this up a bit

0 Karma

gnovak
Builder

actually for this form I don't want ANY searching to happen until the user selects what they want from the drop dowm menus and clicks "search" but I can't seem to figure out how to get this to happen

0 Karma
Get Updates on the Splunk Community!

Monitoring MariaDB and MySQL

In a previous post, we explored monitoring PostgreSQL and general best practices around which metrics to ...

Financial Services Industry Use Cases, ITSI Best Practices, and More New Articles ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Splunk Federated Analytics for Amazon Security Lake

Thursday, November 21, 2024  |  11AM PT / 2PM ET Register Now Join our session to see the technical ...