Okay
  Public Ticket #2591148
WpDataCharts
Closed

Comments

  • Lina Le Bon started the conversation

    Hi, Support team

    We have recently rolled our site wordwide, using your products, and it has been a success so far.

    I am now looking into incorporating some graphs and charts into a dashboard.

    Data user has access is driven/filtered by their logon/access parameters, and I am utilising placeholders in majority of the tables to accommodate that.

    I tried to create a chart, with an expectation that same placeholder filtering would work, but it does not seem to be the case. E.g. I base a chart on the table that is parametirised with placeholders. I try to pass var1 in shortcode to the chart, but it does not seem to get picked up, and placeholder value is defaulted.

    Am I missing something here/doing something wrong or is this feature not available?

    It would be disappointing if this is something that is not available, since it is a key advantage of your products - being able to base data to SQL database, and being able to parameterise it. I would not be able to use your charts without this option, which would be a real shame, having come so far.

    Kind regards, Lina

  • Lina Le Bon replied

    Just a note - Follow table filtering would not work for me, as each logon is restricted to their data only.

    I very much hope that this placeholder function on charts can be made available...

  •  2,507
    Aleksandar replied

    Hello Lina

    What are you using to pass the correct filter to the table? Are you using "Users see and edit only own data", or are you using placeholders?

    Either way, charts display what the table is displaying, so if you don't enable "Follow Table Filtering", the chart would show all data from the table. If you do enable it, both the chart and the table need to be on the same page in order for this to work.

    Basically, the chart is showing what the table is showing at any moment, when this feature is enabled. So, if you're filtering the table correctly, the chart will also be filtered correctly when both the table and the chart are on the same page.

    If there's something I missed, please provide me some screenshots, and further explain the issue.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Lina Le Bon replied

    Hi, Aleksandar

    Thank you for your reply. It is good to hear from you again.

    I am using place holders on the table. 

    select * FROM qadb_fact_spend_data
    where company_code = '%VAR1%'

    I normally pass VAR1 in shortcode to the table e.g

    [wpdatatable id=32 var1=BC001]

    So I was expecting I can pass the same to the chart - and it would pass it to the table

    [wpdatachart id=1 var1=BC001]

    But that does not seem to work. I don't necessarily want to display the table on the dashboard - just the chart based on that table.

    Is there a solution ? Thank you, Lina

    PS: I don't use "Users see and edit only own data" feature because data access model is more complex and I use my own mechanism.


  •  2,507
    Aleksandar replied

    Hello again Lina

    Unfortunately, charts can't see the placeholder, so including it in the shortcode will do nothing.

    So, the only way to make the chart display filtered data would be to use "Follow table filtering", and place both the table and the chart on the same page.

    If this is an acceptable approach in the end, we can provide some custom CSS with which you can hide the table, leaving only the chart on the page.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Lina Le Bon replied

    Thank you Alexander. You have confirmed what I was thinking to myself after your last reply - was actually about to try it out.

    Your css to hide the table would save me a bit of mucking about, and would be greatly appreciated. Thank you, Lina

  •  2,507
    Aleksandar replied

    You're welcome, Lina

    If you need to show the filters, a simple css like this would be enough:

    .wpdt-c .wpDataTables.wpDataTablesWrapper {
    display: none !important;
    }
    

    But if you need to show the filters, you would first need to disable the following in table settings:

    "Show X entries" drop-down; "Info Block" from Display tab:

    2852344743.png

    "Enable main search block" from Sorting and Filtering tab:

    3844294247.png

    And "Table Tools" from Table Tools tab:

    6988162559.png

    Then, you can hide the table, leaving the filters above the chart like this:

    <style>
    .wpdt-c .wpDataTablesWrapper table {
    display: none !important;
    }
    </style>
    [wpdatatable id=1]
    [wpdatachart id=1]
    

    And that's it. This is how you'd create a page where you'd have Chart #1 dependent on wpDataTable #1 so it follows filtering, and the table hidden using CSS.

    The screenshots are from an older version of wpDataTables, but they still apply.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Paul Wilson replied

    Hi Aleksander,

    Have there been any updates to allow the use of variables in shortcodes, so we don't have to render the table data to the page?

    Is there an filter or hook we can use to construct the data prior to rendering a chart?
    https://wpdatatables.com/documentation/information-for-developers/hooks/

    I was thinking that using this action would allow use to intecept the variable to be used in the table data fetch.
    wpdatatables_before_get_table_metadata( $tableId )
    OR 
    wpdatatables_get_ajax_data( $tableId )

    I'm also looking to utilise a single table of data that grows with a single chart which can show information based upon variables passed in. 

    SQL Table Data - SELECT * FROM groups WHERE wdt_id BETWEEN %VAR1& AND %VAR2%;

    Example Shortcodes = 
    [wpdatachart id=76 var1=15 var2=40]
    [wpdatachart id=76 var1=30 var2=55]

  •  2,507
    Aleksandar replied

    Hello Paul

    I'm sorry to disappoint you, but the charts can't accomplish this. They pull the data from the table, and only the table can be filtered as you described.

    I'll forward this suggestion to our developers, but I can't promise anything.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables