Okay
  Public Ticket #3558771
Date Labels in charts
Closed

Comments

  • Anton Theunissen started the conversation

    I have a line chart that shows a line (and bandwidth) over the last 5 years, each week has a integer. The date labels are a mess in Highcharts, they seem randomly picked.
    Google renderer does a much better job, but doesn't support the area lines that I need for displaying the bandwidth.
    Since wpdatables is so feature-rich, I bought the lifetime version, supposing that the paid version would also support the smart date labeling, just like the basic, free Google Charts. 
    Unfortunately, I can't get the labels right, even in the Pro version that supports area charts with Highcharts. I only need quarterly labels. YYYY and single letters per month would also do. Even year-indicators would probably be acceptable. Can you advise? 

  •  1,826
    Miloš replied

    Hi Anton,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    If you need to change the Date Format displayed on the X axis in your Charts;

    For most of the Charts, they pick up what you set in the default Date Format in the Main Plugin settings, only the Google Charts have their own Date Format which can not be overridden from our end - but since in your case, you prefer how the Google Engine does it, then that part is irrelevant.

    So, for example, i did some small testing on our Demo Sandbox, if i take one of our Tables, and if i change the default Date Format in the Main Plugin settings - you can browse through all available Date Formats we got ( for the moment, we do not have single letters per month) :

    7746077638.png

    If we pick the 2005 (Y) format, this applies to a HighChart Line Chart/Area Chart on the X axis :

    8677240909.png

    We can also use our "Chart Grouping" option, if we need to group all the values with the same data label into one "series".

    7575583742.png

    Or, if we try another Date Format, like "Jul 2005 (Mon Y)", this applies to the Chart :

    2747736253.png

    Let me know if that helps, if you can find one of our currently available Date Formats in the Main Plugin Settings, which could work for your Use-Case?


    Or, if you have an idea what we need to add for a new Date Format in the future, you can leave a Development Suggestion.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Anton Theunissen replied

    Hello  Miloš

     I used the global date format setting Mon Y. Don't understand why sometimes uses full Month names are displayed anyway. 
    (I also wondered why this is a global setting because others charts may need dd-mm-yyyy. But that's for another thread). 

    Please take a look at this page. You'll see the difference between a chart that 'understands' Date labels and Highcharts, that had no clue and randomly picks labels.

    In the meantime I made some progress. I think something likt the code below would, but when I add it in the global Settings/Custom JS and CSS, nothing happens... Do I have to place it elsewhere? It's not responsive like the Google charts) but at least it should show year and quarters (jan apr jul sep). I hope you can help? As far as I can see, the grouping function has no use for this problem. 

    document.addEventListener('DOMContentLoaded', function() {
        var graphContainer = document.getElementById('kerncijfers');
        if (graphContainer) {
            // Check every half-second to see if the chart has been rendered
            var checkExist = setInterval(function() {
                var chart = graphContainer.querySelector('.highcharts-container');
                if (chart) {
                    chart.style.backgroundColor = 'red'; // Change 'red' to your desired color
                    clearInterval(checkExist); // Stop checking once the chart is found
                }
            }, 500);
        }
    });

  •  1,826
    Miloš replied

    Hi Anton,

    To begin, I want to extend my heartfelt apologies for the delayed reply, 

    which is due to an unexpectedly high volume of inquiries. 

    We truly value your patience during this period.

    -

    1. I am unable to reproduce/see the issue you described in terms of some Month names being displayed in full name on your first HighChart Area chart on your Page.

    I tried changing my browser in the Responsive View, and tried all possible device simulations for width and height;

    Then i manually set as much width as i can, while trying to set the height as low as possible, to achieve a wide aspect ratio, and still unable to see any issue.

    Here are some screenshots, as you can see, when i visit your Page, for me it always shows proper Date Format as Mon Y on the first HighChart.

    1514899582.png
    4997586205.png
    2871664318.png
    7377921400.png


    Can you let me know is there a specific aspect ratio we should try in order to see the HighCharts month labeling issue on the X axis, because we are unable to see it, or reproduce it on any of our Charts for the HighChart Engine ( or any other engine)?

    Or maybe you tried on a specific device/screen etc?

    If possible, can you please take some screenshots, or even better, a Video of your Screen so that we can see how it manifests on your end, and if you can share the specifications of the Device,  operating system, browser name and version, so our QA Team can check this out?

    -


    2. When it comes to adding a custom Chart Callback, yes, we had situations with some Users, depending on the WordPress configuration, i can't say for sure what is the root of the issue, but when they insert the Custom Script in our Main Plugin settings/Custom JS and CSS/Custom JS, something on the Site blocks it from running on front-end;

    So it is best to directly add your code as Custom HTML and wrap it inside a <script>...your code...</script> tag, then it should 'trigger' on front-end.

    Let me know if that helps.

    Kind Regards, 

    Miloš Jovanović
    [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

  •  1,826
    Miloš replied

    Hi Anton,

    Sorry, just forgot to add about the point #2, for adding a Custom Chart Callback, you can check out our Video example here.  It is for HighCharts, not the same Chart option, though, but just to see an example how it can be added directly on the Front-End Page to ensure it runs the script. 

    I hope it helps.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Anton Theunissen replied

    Hello Miloš,

    Some misunderstanding (I wasn't completely clear): The Chart "Google 5 quarters" Google Chart is showing full month names, not Highcharts, it apparently ignores the Global setting for shortened month names. Sorry for the confusion, it was just a sideline. 

    The main issue with Highcharts is that it randomly shows and hides labels, without prioritizing Year, Quarter or Month markers. See the attachment for how it works now. 

    1) it shows duplicate labels

    2) it randomly skips month names. Furthermore, a period of two months (jan-feb) has the same width as a period of three months (feb-apr). It's just sloppy. 

    Please see the attachment for screenshots. 

    The most simple solution for me would be to display the labels on jan apr jul oct. These mark the quarters of year and always fit. Ideally, it would be responsive, like in the Google Charts example, also on that page. Google even displays year and month gridlines when the width allows it! But for now, simply displaying the first month of eacht quarter would be OK.

    Are you sure that a JS on the page will work? I don't think the plugin sends all months to the browser. Some are simply skipped, that's why I figured a callback was needed, to intercept the output. I hoped to overwrite the quite dumb filtering of Highcharts Date labels with my preferred "quarter indicator month names".

    So: Jan 2019, Apr 2019, Jul 2019, Oct 2019, Jan 2020, Apr 2020, Jul 2020, Oct 2020 etc. That would be acceptable. 

    (I still wonder how you expect that all the charts on a website need the same Date formatting. Maybe I'm misunderstanding that feature.)

    Attached files:  wpdatatables-labels.png

  •  1,826
    Miloš replied


    Hi Anton,

    My apologies for taking so long to reply.

    We are trying to do some tests in the meantime to check all the details.

    -

    Some misunderstanding (I wasn't completely clear): The Chart "Google 5 quarters" Google Chart is showing full month names, not Highcharts, it apparently ignores the Global setting for shortened month names. Sorry for the confusion, it was just a sideline. 

    - Yes. The Google Charts Engine is the only one which ignores what we set in the Main Plugin Settings/Date Format.

    All other Chart Engines ( including HighCharts) follow what is set in the Main Plugin Settings/Date Format; only the Google Charts have their own 'logic' how the Date Formats are presented.

    I understand that is how you would prefer/ if all the other Chart Engines would 'override' and have the same Date Format logic as Google for the formatting of labels on X Axis, but for the time being, it is like this.

    -

    1. and 2 ;

    In regards to the duplicate labels and skipping some months/ thank you for the screenshot, i see what you mean.

    1841010651.png
    4875264632.png

    That is the default behaviour of the HighCharts engine.

    We use free libraries for chart engines, and they are limited as to what we can change from within the plugin's UI.


    3. When it comes to how the HighChart sorts and displays the values, in terms of seemingly skipping some/duplicating some, as in your example;

    And the question if i am sure your Custom Callback will work;

    I am not a developer and am not very familiar with all Custom Callbacks - i was just advising what you can try if your Callback does not trigger at all - in some situations we had Users where their Callback simply was not 'firing', like if they make a simple test to 'post' something in the JS Console on the Browser;

    Then they add it directly to the WP Page as a script, so it fired after that.

    -


    But i believe this issue is more related to the 'order' how you inserted your values in the Table versus how the Chart loads them on front-end.


    If i see it correctly, from the screenshots and the related URL - it seems you did not place the source Table's Shortcode on the same Page with the two HighCharts?

    I will elaborate a bit how our Charts load the Data in terms of sorting them on the X axis, so you can try, as a test, what happens if you set the source Table on the Page and activate "Follow table filtering", if that creates better sorting.

    -

    -

    Basically, the default sorting for a chart is going to be in the order of how you added the data in the cells of the table.

    So, it will not be able to follow the table's sorting if you only place the chart on the page,

    but if you place the table on the same page with the chart, and enable "Follow Table Filtering", 

    then the chart will follow any sorting/filtering you do on the table.

    Please check more about this feature here.

    -

    We also have a workaround if you need to completely hide the table from the page,

     so that the chart just follows sorting/filtering of the table without the table being visible.

    -

    Or if you wish to have only the chart with the table filters

    , but the table hidden, we also have a workaround for that with custom CSS.

    Here is how :


    As mentioned, by default, the charts will not follow any filtering from their source table if you just put the chart on its own on the page.

    But If you place the source table together with its chart on the same page,

    and activate " Follow Table filtering"  on the chart Wizard settings,  it is going to follow any filtering/sorting you do on the table.

    -

    Now, depending if you wish to hide the table and have a filtering for Charts, we can have two workarounds available.

    1. If you wish to hide the entire table along with table filters;

    you can add this CSS to the table's back-end settings/Customize/Custom CSS.

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

    This will completely hide the table from the page, but you can still pass the table shortcode with the chart, and you will get the "follow table filtering" effect on this chart.

    2. Or if you wish just to hide the table while leaving the filters with the chart,

    we would first need to disable the following in the table settings:

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

    5739555450.png

    Then, "Enable main search block"  and "show filters in a form above the table" from the Sorting and Filtering tab:

    7822122957.png

    Then, you can add this CSS in the table settings/Customize/Custom CSS:

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

    That will just leave the chart visible with the filters on the page,

    if you pass both table and chart shortcodes.


    Let me know if it turns out that the Charts were just not sorting the Data on X axis correctly and if adding the source Table with "Follow table filtering" fixed the issue?

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [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

  •  1,826
    Miloš replied

    Hi Anton,

    Sorry, i also forgot to add one more important detail about the rows loaded in Charts, depending on the Table type and Pagination.

    -

    The charts are being created based on tables. 

    If the table is server-side enabled, then only the rows shown in the table will be loaded on the chart.

    If the table is non-server-side, the chart will load all the rows, unless we enable "Follow table filtering" with the table on the same page.

    -

    Basically, if you have a Manual table; they have server-side automatically, enabled, we can't disable it.

    So you would have to make another SQL Query based table, to pull data out of the Manual Table;

    then you have to disable server-side processing for it;

    and disable "Follow table filtering" - then the chart will load all rows ( if needed).


    So depending if you wish your Chart to load all rows ( when a table has pagination) or not, you can configure your Table accordingly, with server-side option and toggling 'follow table filtering'.


    Let me know if that helps along with other details passed from previous reply.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Anton Theunissen replied

    Hello Miloš,

    This latest reply makes more sense than the previous one. Except that building my own SQL-query is what I expected the plug-in to do for me. Just as I expected 

    Google chart persists in its own date formatting for good reason: another one is non-existent. I seems that wpDatatablesandcharts offers NO handling of dates at all except for a basic string formatter. 

    (Besides that: the global feature of that "string-date formatting" is something I couldn't believe. Who would want a 6-weeks period x-axis with the same date formatting as a 6-year period? Do I need a new website to show a chart with another date granularity?)

    What I learned from you -very useful- is the idea of "follow table filtering". I didn't get that at first. But filtering and sorting will filter and sort the data as well - I just want to be able to show labels with days and/or weeks and/or months and/or years. I didn't see that feature in the Tables either and it would make no sense there anyway because every row needs a date. If you have a tutorial somewhere how to set up a Table in order to display just month labels on the chart (or quarter labels, whatever) please let me know. And I mean: Just one month label per month, not a month label on each day, but the data from all days.  

    In hindsight I don't think the plugin will be very useful for me. It does nice things but it seems unfinished in this regard. I'll play with the "follow table filter" but my hope is gone. I had already found a workable solution with Apex charts. I bought the plugin because it looked like Highcharts would fill in the holes. I guess it's too late for a refund now...

    Thanks for your help anyway, you really did your best, much appreciated! Your support was amazing, it's just that the software doesn't cut it.

    kr

    Anton. 


  •   Miloš replied privately
  •   Miloš replied privately
  • Anton Theunissen replied

    Hello Miloš,

    Thank you for your understanding. 

    Please leave the Google Date formatting as is! 

    I will add my wishes to the feature requests. 

    And thank you for the links (privately sent), we will try to make it work like that. If we don't succeed, I will also let you know - but it looks promising. 

    Kind regards,

    Anton

  •  1,826
    Miloš replied

    Hi Anton,

    You're welcome.

    (* Everything we advised about your licence and the refund option still stands, so let us know if you need it in the advised period, just open a private ticket, for security reasons on that subject, if it comes to that).


    We don't have any plans to change the Google chart engine formatting, so it should stay as it is.


    When it comes to the HighCharts, I will also send it in a public message, just in case if any other user might come across the ticket, for the same use-case of customizing the Date labels.


    This Post from the HighCharts Forum could be useful, where someone managed to only show Month Names as labels.

    They also made a live Demo, it seems to be perhaps what you are looking to achieve.

    9806282089.png

    Additional information and our custom chart callback examples :

    You can check out all the available chart engines and examples of wpDataCharts documentation here . 

    • Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. wpDataChart callbacks allow adding options that are available in Google Charts APIHighcharts API, and Chart.js API
    • All necessary resources are available in charts engines API (depends on which one you use). Every engine has a different approach to chart settings. In wpDataChart callbacks, you have to adopt those settings to the wpDataChart object (you can take a look at examples for each engine in our documentation, and also in the Support help center). A huge number of examples for any area of programming can be found on stackoverflow.com (typing your problem in google and at the end add "site: stackoverflow.com" and Google will search only that website). Also, a lot of examples of charts, chart settings, and customization can be found on jsffidle.net (typing in google for example "line chart highcharts jsffidle")
    • Please note that using hooks or wpDataTable and wpDataChart callbacks requires a certain level of programming skills and included support refers only to advice.


    And of course, if anything else comes up, don't hesitate to open new tickets.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Anton Theunissen replied

    Hello Miloš,

    For now I have a very acceptable Apex graph. I could 'trick' Apex with manual labels. 
    I later saw that Apex isn't one of the free options either, so I'll need the premium plugin version anyway!

    I hope that one of the renderers will add some better label options in the future. 

    The code to alter the X-axis labels seemed to have fixed positions for X-axis labels. Since we do weekly updates, adding a week every week, I did't really look into it further. The graph is quite acceptable as it is now. Thank you very much for your kind support!

  •  1,826
    Miloš replied


    Hi Anton,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    Thank you for this follow up.

    I am glad to see you found an acceptable Chart type from one of the Apex Charts and a way to 'manipulate it' as needed with manual tabels, that is great.


    You are right, to use the Apex Chart Engine, one of the premium licences is needed.

    It is not available in the Lite version.


    No problem, I am happy to advise, as much as our Support can cover.

    Our developers will also do their best to add some more/new Chart types in the future, I just can't promise an exact ETA on it.


    If anything else comes up, please don't hesitate to open new tickets.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [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

  • Anton Theunissen replied

    Hello Milos,

    Are you very busy? I submitted a ticket #3660341 two days ago, but had no response yet from the support team that is said to help with problems after the update.

    Maybe you can tell me if it’s a known problem?

    Kr

    Anton Theunissen

  •  1,826
    Miloš replied

    Hi Anton,

    My apologies for that, in the meantime we responded and I am happy to see that issue from the other ticket got resolved by our devs in our latest update.

    Thank you for your patience.

    Kind Regards, 

    Miloš Jovanović
    [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