Reports API Brush and Series Selection

Lex Clay shared this question 49 days ago
Answered

Hi all,

Are the outputOptions available to the Report API available anywhere? The only output type option I can see any information for is the dataset.

Comments (1)

photo
1

Hi Lex,

Thanks for reaching out. Our Reports API Wiki page contains all the possible parameters you can utilize to display and interact with reports via API.

As it stands, registerOutputType(outputOptions,callback) only returns the dataset of a report, not the report itself.

I think perhaps the pertinent question here is: what specifically are you trying to accomplish?

I should note that embedding and integrating content via the API isn't something Support can assist much with. I'm happy to give tips and pointers where able, but setting this all up and writing scripts generally falls more in the realm of Consulting, so it may be worth it to reach out to your Account Manager to discuss the possibilities of speaking with a Consultant regarding all this. Nevertheless, please let me know what you're actually looking to do via the Reports API and we can take it from there.

Regards,

Mike

photo
1

Hi Mike,

The scripts et al for embedding & integrating I'm all good with (I'm an ex-YF Consultant & current YF Partner), it was purely an enquiry as to whether or not there were any other outputOptions in general that haven't yet been documented....the parameter being plural & all somewhat suggests there's a bit more to it..maybe that's in future releases.

With regards to specifics, the main driver for the enquiry is that with the exception of brushing, nearly every other report interaction has an API function. Because brushing doesn't trigger the underlying dataset of the report itself to change, there's no easy way to hook into that interaction. I've got around it (kinda) with a bunch of custom promises but it still has it's limitations when it comes to resetting the brushing action.

If you can raise it as an enhancement request that would be awesome...

TL;DR - Can you add an API function for the brushing functionality :)

photo
1

Hi Lex,

Thanks for your response. As far as I can tell, we do currently support brushing in the Js API (although I'm having a hard time finding external documentation for it). There's a task though that makes reference to this that would hopefully be useful for you. The following is from an enhancement task for "Calling the Report API brushing function now only requires the Mode and Values to brush."

You will need to create a script similar to the one below, then drop it into \appserver\webapps\ROOT of your instance.

Here's an example script:

<script src="http://localhost:8080/yellowfin80/JsAPI/v3"></script>;
<div id="report"></div>
<div id="dashboard"></div>
<script>
    //Load a report
    window.yellowfin.loadReportAPI().then(() => {
        window.yellowfin.reports.loadReport({ 
            reportId: "a5e910d6-7208-4cc9-8a52-7f0187130a03", //Insert your own UUID here
            dashboardId: 683792, //Id of dashboard this report is on
            element: document.querySelector('div#report') 
        }).then(reportAPI => { 
            window.reportAPI = reportAPI; //gain access to ReportState in the browser console using window.reportAPI;
        });
    });

    //Load a dashboard
    window.yellowfin.loadDashboardAPI().then(() => { 
        window.yellowfin.dashboards.loadDashboard({ 
            dashboardUUID: "1f797513-3fbb-4502-8e9a-b5827bef22d8", //Insert your own UUID here
            element: document.querySelector('div#dashboard') 
        }).then(dashboard => { 
            window.dashboard = dashboard; //gain access to DashboardsAPI in the browser console using window.dashboard
        });
    });
Once dropped, access the file by appending it to the url you access your instance from (eg. localhost:8080/<filename>.html)

To test brushing:

  1. Load a report that allows brushing
  2. In the browser console, enter window.reportAPI.brush(<brushType>, <Array of brushing values>)BrushType includes, "doBrushingInclude", "doBrushingExclude" or "doBrushingReset"The array could look like [["Buzz Adventures", "Big Foot Adventures"]], note the double brackets

To test Series Selection:

  1. Load a dashboard with a series selection (the tutorial Series Selection dashboard works well)
  2. In the browser console, enter window.dashboard.dashboardsAPI.reports.getReport(<reportUUID>).applySeriesSelection(<series>, <chartId>, <offset>)
  3. Inspecting one of the two bottom charts will get you a reportUUID you can use
  4. Series is an array of series to apply (eg ["1"]). Note, the series in the panel aren't necessarily in numerical order
  5. chartId can be any one of chartId, chartUUID or chartName
  6. offset is typically 0, unless the selected series requires scrolling to get to. Increases in increments of 200

Hopefully this helps! Please let me know if this appears to provide what you're looking for then if so, I will look more into trying to find where this documentation lies, and if it does not exist, request it be added.

Regards,

Mike

photo
1

Thanks Mike...this is actually pretty awesome and so very nearly almost perfect...


What I'm looking for is when a user uses the standard YF brushing function to keep/exclude/reset, we can hook into that call to perform custom actions (similar to the reportStart/reportComplete listeners)... It kinda sounds like it's almost there, with the reportAPI.brush..if there's a

reportAPI.brush.addListener(<brushType>, () => {

     //Do some cool stuff here

});
...or something similar, that would be like the best xmas present ever!

photo
1

Ahh I think I've found it..... reportAPI.brushing.mode and .type...I don't know why I didn't think of delving into the API myself earlier...too lazy I guess. Thank you for the pointer, if you hadn't have mentioned reportAPI.brush I wouldn't have even thought to output the API to the console

photo
1

Hi Lex,

Great! Happy to hear it. Consider it an xmas present then, haha. Please let me know if you require anything else here or if we're okay to close this case out, this considered.

As an additional note, I've also reached out in the relevant task regarding documentation for this, so that should be identified and/or forthcoming shortly.

Regards,

Mike

photo
1

Excellent. Yep, feel free to close it out..mate you have no idea how much of a game changer this is...

Please please bat someone over the head repeatedly about the documentation. In all seriousness, knowing this a couple of months ago would have probably saved over 100 man hours of development time....Oh and while you're at it...I have another ticket about how to use the new custom loaders through the JsAPI (the documentation for it :) ) cheers bud.

photo
1

Hi Lex,

Thanks for confirming. I'm sorry to hear so many man hours were lost! I will definitely continue to follow-up on the documentation for this (and your other ticket I'm about to reply to shortly). I agree it's very important.

Regards,

Mike

photo
1

Hi Lex,

"I received feedback from the dev team on this one:

While this task improved it somewhat, it is fairly likely that brushing is going to change in the JsAPI again as it is still very hard to use. So we didn't push any documentation for it, especially given that what brushing does is essentially filtering, which you can achieve by using the FIlter API."

Considering this info, I'm glad this worked for you!

Since this information itself came from an enhancement task to simplify all this, based on the information provided in response from dev team, I suspect there will be more enhancements to simplify all this coming down the line, at which point we will then have actual documentation.

Considering what I've sent here is the only information I have surrounding this, and since this is a public Question. I've just changed the title to reflect what's contained in this ticket, so that yourself and others can reference the info found here and I'll leave this set to Answered, but please don't hesitate to reach back out with any other questions should you have any.

Regards,

Mike

photo
1

Good call on changing the title.

photo
2

Hi Lex,

Thanks for your response. The API can interact with just about anything in the application - it's very flexible and complex, and largely intended for use by developers, so there's technically a lot that has the potential to be documented. I do agree in a case where there is a least some sort of example that can be public-facing, that it should be public-facing, but from what I can tell, all other API-related documentation I can find from internal tasks either already exists, or is on its way (we do have a dedicated Technical Writer), so hopefully this remains the exception!

I'm sure a more in-depth conversation went down than what I'm leading on here (if I had to guess, surrounding difficulty of actually supporting said functionality), but I digress, at least we now have an example for reference, and again, hopefully this remains an exception!

Regards,

Mike

photo