Okay
  Public Ticket #2016163
Impossible to create simple chart
Closed

Comments

  • Christian Johansen started the conversation

    I am trying to make a standard line chart with values from a wpdatatable.

    The chart is not able to sort dates from the datatable correctly.

    Any help is appreciated. 

    Best Regards,

    Christian

  •  2,572
    Aleksandar replied

    Hello Christian.

    Thank you for your purchase.

    Can you, please, tell me if the column is a Date type column, or a string? Also, how was the table created?

    Did you enable "Follow table filtering" when you created the chart?

    A good point to note is that you have to set the date format to be the same in the source file (if you created the table from an external file), wpDataTables and WordPress settings.

    If you created the file from an external source, and if you don't have any sensitive data there, can you send it to me so I can test it locally? It should be sorting by date (by default) if you used the "date" type column.

    Best regards.

    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

  • Christian Johansen replied

    Hi Aleksandar,

    Thank you for the assistance. 

    I created everything manually in wordpress, I only exported it to excel file to test it.

    Anyway "Follow table filtering" was not enabled in my chart - and enabling it worked... for a while!

    Date format is the same in both wordpress and wpdatatables settings.


    As soon as I changed sorting from ascending to descending it stopped sorting the dates correctly again in the chart. 

    I have sent you a mail with the settings I use for the chart and date column.

    Side note: 

    Maybe you could also add a feature for choosing which side the graph should start from. I mean choose if the x-axis should start with the earliest date at 0 or the latest date at zero. (Which would affect which way the graph is skewed). 

    Now I can only control that by adjusting the order of the column in the corresponding data table.

  •   Aleksandar replied privately
  •   Christian Johansen replied privately
  •  2,572
    Aleksandar replied

    Hello Christian.

    When you're creating the chart, the displayed preview is pulling the data from the database, in the order you entered those values. So, that's why previews always displayed "wrong" - it displayed the results before you sorted the table by Date column.

    The second thing is that you added chart #3 which is created from table #18, but instead of table #18 you added table #7 when you created the page. That's why "Follow table filtering" didn't apply here:

    3646975249.png

    Also, the general settings of WordPress didn't have the same date format:

    3154506976.png

    I changed that to d/m/Y as well.

    I replaced the tables - from #7 to #18, and when you take a look at your page now it sorts normally.

    https://fiengineer.com/investments/

    Best regards.

    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

  • Christian Johansen replied

    Hi Aleksandar, 

    Thank you very much for your hard work and fast support.


    "The second thing is that you added chart #3 which is created from table #18, but instead of table #18 you added table #7 when you created the page. That's why "Follow table filtering" didn't apply here:"

    I created a separate data table because I did not want the "running total" column to be shown on the blog. 

    Do you have to post the data table which the graph corresponds to on the blog for the "Follow table filtering" to work? 

    Should be enough to just have created a data table which is not posted, where the chart can get its data from? 


    Best regards, Christian

  •  2,572
    Aleksandar replied

    You're welcome Christian.

    Glad I could help.

    If you want the charts to follow table filtering, then both the page and the chart need to be displayed on the same page. Also, if you want the filters to be shown, the table must be present as well.

    Now, there is a way to simply hide the table using CSS, leaving only the chart and the filters. Anyone who knows CSS will be able to still display the table if they were to inspect the page, and simply change the properties.

    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.

    I hope this helps.

    Best regards.

    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

  • Christian Johansen replied

    Thank you once again. This was very helpful. 

    Have a great day.

    Best regards, Christian

  •  2,572
    Aleksandar replied

    Thank you, Christian

    I'm glad I could help.

    Best regards.

    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