Okay
  Public Ticket #1982862
x axis ticks
Closed

Comments

  • Andreas started the conversation

    Hi,

    you did a great job with wpDataCharts. I have one question

    I am using chart.js rendering. Area Chart. The data consists of only two columns: Date and float.

    there is one row for each date, as default the x axis shows some dates. Not all because it will be too much. Is there a way to show only the name of the months? (ticks.auto instead of ticks.data)

    Or is there a workaround by using another column, just to be used for x-axis?

    Thanks for any help or pointer

    Andreas

     

  • Andreas replied

    HI there,

    I tried to use a callback :

    https://wpdatatables.com/documentation/information-for-developers/wpdatacharts-callbacks/

    this is how they say callback would work

    jQuery(window).load(function(){
    console.log(123);
        if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }
        wpDataChartsCallbacks[3] = function(obj){
            obj.options.options.scales.yAxes[0].display = false;
            obj.options.options.scales.xAxes[0].display = false;
     console.log(345);   }
    });

    I have tried to insert this in the settings, but it doesn't execute, if i try in the console directly it doesn't work either.


    xAxes: [{
                        type: 'time',
                        time: {
                            unit: 'month'
                        }
                    }]

    I am attaching a simple dataset, so easy to reproduce.

    Any help would be greatly appreciated

    Andreas

  •  2,572
    Aleksandar replied

    Hello Andreas.

    Thank you for your purchase.

    I am sorry to disappoint you, but what you're trying to achieve isn't possible in this way. Using type: 'time' requires moments.js file which is not included in wpDataCharts.

    The callback you tried to use probably doesn't go through because there is either a space, a paragraph or something similar that displays the error in the console and doesn't display the chart properly. You can't use the properties of the object the way you would like, but instead have to adjust them to our object.

    You can always debug it and see what's in our object.

    • Please note that using hooks or wpdatatable and wpdatachart callbacks requires certain level of programming skills and included support refers only to advises.

    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