Hello,
Using a dashboard, I have one visualization which is a data table.
I am trying to figure out if and how it is possible with Vega to load a specific column from the data table in order to use it with another data source.
Thank you!
I don't think using an output of a visualizations in another visualization is possible.
But you can always take in the source data and do the transformations you did in the data table in Vega. Then combine with another data source.
The transformations that in the data table are based on another filter input (Controls visualization)
Vega can accept filter controls also using %context%: true
.
So if you feed the same data source to Vega and then when that control filter is changed in the dashboard the data going to Vega will be filtered also. Which I think is what you were asking.
I am using a different data source in Vega.
The data source I am using in Vega doesn't contain the fields I filter on. That is why I want to collect data from a column in a data table.
In order to do that you need add the data source to Vega that goes to your data table or control (not sure which one you will need without seeing the data). You can use multiple data sources in Vega.
If you have both data sources going to Vega then you need to do some transformations based on your requirements. Your final data source will now contain the fields required to filter on.
Then I will have to ask, is it possible to dynamically update transformations in Vega based on applied input in the Controls visualization?
Correct. Using the link I posted above you can.
I am sorry, I was not specific enough.
My intention is:
When a filter for field 1 is selected,
then Vega joins data source 1 with data source 2 by field 1
If a filter for field 2 is selected, then Vega joins data source 1 with data source 2 by the selected field 2.
When you set a filter on a dashboard that filter can also be use on Vega, as discussed.
But you don't get to know which filter was selected in Vega. Just the end result. So being able to filter off that value wasn't possible unless you were able to determine which filter was passed.
Could be possible if you add a 3rd data source to Vega that feeds your control. Then "somehow" you can figure out which filter was selected based off the results and your new 3rd data source that included all your options.
I'll look at this sometime today to see if there is a better way but as of right now I just can't see it.
Thank you for the answer.
You're saying I'm getting the end result in Vega.
Is it possible to have %context% set to false but still get the results of a specific field to a certain data source?
Or, have %context% set to true, and get the results on a specific field from the dashboard, but not have it affect the Vega visualization?
Also, can you please elaborate on the 3rd data source solution? How would a data source feed the control?
Is it possible to have %context% set to false but still get the results of a specific field to a certain data source?
Not from the Dashboard. You would need to add another data source to Vega to get that value.
Or, have %context% set to true, and get the results on a specific field from the dashboard, but not have it affect the Vega visualization?
You can't pass data from Dashboard to Vega.
Also, can you please elaborate on the 3rd data source solution? How would a data source feed the control?
In Vega, Data is an array and you can make as many data sources as you want (I think).
It might be helpful to open Vega and then Inspect your Request and Response without a filter. Then add a filter in and look at it. The response is what you have access to for data.
Thank you for the response.
Not from the Dashboard. You would need to add another data source to Vega to get that value.
Assuming I go this way, how do I get the value?
Let's say, I am searching for top hits of field 1. By default, it shouldn't be a problem.
How do I get the top hits of field 1, after applying a filter to the dashboard, without it affecting the Vega visualization?
It might be helpful to open Vega and then Inspect your Request and Response without a filter. Then add a filter in and look at it. The response is what you have access to for data.
I understand that in this use case it is only for a specific filter, and not a dynamic filter based on user input? Would that be possible?
I understand that in this use case it is only for a specific filter, and not a dynamic filter based on user input? Would that be possible?
The static filter is just simulating what a dynamic filter would look like in the request/response. So it would be the same result.
How do I get the top hits of field 1, after applying a filter to the dashboard, without it affecting the Vega visualization?
If you made a second data source in Vega to get this data it won't effect anything at all unless you want it to. Your main data source is what drives your visualization from what it sounds like. Your new data source would just be to enhance or transform it.
I am not sure if this method would even work, never tried. I think though that all your issues would be solved if we actually made the filter data available in Vega so users can have more control.
Makes sense, thanks.
In this case, how can I dynamically add the filter used in the dashboard to my data source in Vega?
I do not know that it's possible. But I do know you have to have that data source that controls that filter also brought into Vega.
Then through Vega transformations combine the 2 data sources and attempt to figure out which filter was selected. I don't know if this is possible, just the only idea I have left.
But I do know you have to have that data source that controls that filter also brought into Vega.
How do I bring that data source into Vega?
There is an example on the documentation. Also check out the Vega documentation.
I was assuming you already was doing this so knew how. Data is an array also so you can bring in multiple data sets then reference them by name.
data: [
{
"name": "NAME"
},
{
"name": "NAME"
}
]
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.