KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Solutions Analyst widget in Dash

  • Analyst widget in Dash

    Posted by simon_watson_sj on March 27, 2022 at 12:00 am

    Hi Team,

    I use Grammar of Graphics (GoG) in the Analyst widget in Dash for both a project at my work (where I am on the KX platform) and for a project at home where I use KX Dashboards Direct with Developer. I find GoG to be a real gem – super configurable and forgiving of large datasets. I also figured out that if I use dash controls to save variables back to the server, I can use those standard Dash controls to manipulate GoG visualisations. However, although that means I can get controls to send data into GoG, I have been completely unsuccessful in getting variables out from GoG.

    For instance, if I click on a chart, I understand there should  be the functionality to save that click location to view state in the ‘selected value’ control on the widget. I could then use this to drive other processes outside of the GoG visualisation.

    Does anyone know if this functionality is working on both KX Dashboards Direct (the standalone KX Dash implementation for use with Developer) and the KX Platform implementation of Dash? If so, do you have an example (or examples if the Dash versions differ in approach)? I know there are instructions on the widget but I have been unable to assign anything to a viewstate whether I use a dictionary or a symbol. My hope would be I could run your provided example, understand it and then adapt it to my use cases.

    Thanks and regards,

    Simon

    simon_watson_sj replied 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • davidcrossey

    Member
    March 28, 2022 at 12:00 am

    Hi Simon,

    Interesting question.

    From looking over Analyst Visual – KX Dashboards I don’t think the internals of the GoG are exposed  such that they could be mapped to other viewstates, however hopefully the Community can clarify

    Cheers,

    David

  • khurley

    Member
    March 30, 2022 at 12:00 am

    Hi Simon,

     

    I was doing similar recently and made an example dashboard as a reference, attached in GG-Click-ViewState-Test.json

     

    Its a very simple example with an Analyst Visual Plot and a Data Grid.

    Clicking a point on the Analyst Visual Plot populates the Data Grid with details of the clicked point.

     

    Note: Enabling passing a viewstate depends on using .qp.s.onclick in your GoG code, details on that here: https://code.kx.com/developer/libraries/grammar-of-graphics-layer-settings/#qpsonclick

     

    Some quick notes I made as reference when getting the click + view state functionality to work. Also found as comments in the dashboard:

    // NOTES: // - .qp.s.onclick is used to select the row of data based on the point that is clicked. // - In dashboards we need a dictionary with two keys: //    1. `viewstate - This is what we use to pass values into our "Selected Viewstate". NOTE: Must be of type list. //    2. `tooltip - This is the values used in the tooltip when you click a point. Passing x as the value for this ensures you produce the full row of data in the tooltip

     

     

    Any questions let me know.

     

    Cheers,

    Kevin

     

     

  • simon_watson_sj

    Member
    April 1, 2022 at 12:00 am

    Hey Kevin,

    Thanks so much for this – exactly what I was looking for. With this capability, GoG is a great way of generating visualisations if a ‘server side’ approach works for you.

    Simon

Log in to reply.