cancel
Showing results for 
Search instead for 
Did you mean: 

KX Dashboards -- Can't Connect DropDown To Chart

planefan
Contributor

Hey Everyone, 

I've been playing around with Dashboards for a little bit and seem to always run into a problem getting a drop down list to connect with my chart.

In the View State for the drop down, I've got it setup for Default "sym" and Value "sym"

planefan_0-1649336057240.png

The Data for the chart appears to be setup properly (in accordance with the docus I've found).

planefan_1-1649336123180.png

And obviously I've check to verify that the data exists within the rootData table -- we're all good there. 

 

I've had this issue in the past and usually just give up, or resort to hardcoding the symbols and having to have multiple windows up at a time lol. I've gotta be doing something wrong here.

 

Thanks! 

6 REPLIES 6

planefan
Contributor

Why do I feel like it's because my table isn't keyed with sym? 

LeahS
Moderator Moderator
Moderator

Hello @planefan,

The root issue wouldn’t be related to whether or not table is keyed on sym. 
If the table is defined on the process, then it should be good. 

Just wondering, does that table have a column labelled sym with `sym in it? 

Thanks, 

Leah 

 

Yes, the table has a col "sym" with `sym in it

Here's the meta for the table:

planefan_0-1649441255999.png

In fact, when i query (within Dashboards): 

select from rootData where sym=`sym

works just fine. But when I try to run the query with the dropdown viewstate variable:

{[symbol] select from rootData where sym=symbol}
Comes up empty

Thanks for the additional information,

I'll do up an example on my side as soon as possible and will share the steps here. 

Kind regards,

Leah

Could the issue be related to my using a tickerplant and sub functions? The table I'm calling, rootData, isn't in my sym.q file -- it's just a table from a subfunction. 

 

Do I need to have the table format in sym.q to get the dropdown variable to work? 

emclaughlin1
Moderator Moderator
Moderator

Hi @planefan,

As long as rootData is defined on the process it shouldn't be an issue.
Using the following example, my rootData is defined on the process with the following meta and data

emclaughlin1_0-1650381474346.png

Then via the dashboard, within the dropdown datasource I am selecting the distinct symbols from this table

emclaughlin1_1-1650381560108.png

Then within the widget configuration, I set the viewstate for Selected Value to be selectedSym

emclaughlin1_2-1650381635478.png

This has no default and is of type symbol

emclaughlin1_3-1650381670453.png

Within the datasource mapping section, I am mapping the column sym for the dropdown.
This means the options the dropdown shows will be values from the column sym.
When I select one, it will map to the viewstate selectedSym

emclaughlin1_4-1650381713192.png

For example, when I select a from the dropdown:

emclaughlin1_5-1650381801343.png

With the dropdown setting up and mapping to the viewstate, this viewstate can now be fed into the datasource for the chart
For example, I have created a data grid which uses a datasource "exampleChart". This takes in the symbol and selects from rootData where the sym column matches the symbol selected from the dropdown.
This datasource looks like the following:
(Notice the viewstate being passed in is the same one the selected value in the dropdown maps to)

emclaughlin1_6-1650382157688.png

Within my function, if the passed in viewstate is empty, I return nothing from rootData. If it is not null, I return the rows from rootData where the symbol matches

Kind Regards,
Eoghan