Is it possible to get a filter value in JS Chart Creation?

Renato Marcello dos Reis shared this question 2 months ago
Answered

Hi guys,

I hope everything is fine with all of you.

I was asked if we can get a filter value during the creation of a JS chart.

I do know that we receive the options from the generateChart function, and from it, we can get the dataset using options.dataset.data. Is it possible to obtain some selected filter values as well? If positive, can you guys show me an example of how can be done?

Thanks in advance.

Regards,

Renato Marcello

Comments (4)

photo
1

Hi Renato,

Thanks for reaching out to support. That's a good question, some of these functions are in active development or have documentation hiding somewhere haha... let me look and ask around and get back to you on this.

Thanks,

Eric

photo
1

Hi Renato,

My colleague John is going to brief me on some of the functionality of generateChart tomorrow, and it sounds like this is achievable. Should have some good info for you soon!

Thanks,

Eric

photo
1

Hi Eric,

Thanks a lot for your help in this case.

I hope you manage to find out how to do this.

Regards,

Renato Marcello

photo
photo
1

Hi Renato,

Here's the Cliff Notes from the call -

They just need a report with a filter. If they choose a filter option and click apply, it shows up under appliedFilters.

But at the end of the day, they just need to do:

console.log(JSON.stringify(options.reportAPI.appliedFilters));

Once you do options.reportAPI, you are accessing the Reports API and its methods are available to you.


026f6ae4ec1c17d4b21f5591cb119218


Hope this helps!


Thanks,

Eric

photo
1

Hi Eric,

Thanks a lot for your help in this case. It seems like the answer I was looking for, however I did not try yet. I'm gonna put this into a test and I hope I can replicate in my code. Thanks once more.

Regards,

Renato Marcello

photo
photo
1

Hi Renato,

Thanks for the reply. Glad we could help! I'll go ahead and mark this question as Answered for now, but feel welcome to reply here if you have any follow ups.

Thanks,

Eric