Hey there, Awesome Customers!

Just a heads up: We'll be taking a breather to celebrate International Workers' Day (May 1st and 2nd - Wednesday and Thursday) and Orthodox Easter from Good Friday (May 3rd) through Easter Monday (May 6th). So, from May 1st to May 6th, our team will be off enjoying some well-deserved downtime.

During this time, our customer support will be running on a smaller crew, but don't worry! We'll still be around to help with any urgent matters, though it might take us a bit longer than usual to get back to you.

We'll be back in action at full throttle on May 7th (Tuesday), ready to tackle your questions and requests with gusto!

In the meantime, you can explore our documentation for Amelia and wpDataTables. You'll find loads of helpful resources, including articles and handy video tutorials on YouTube (Amelia's YouTube Channel and wpDataTables' YouTube Channel). These gems might just have the answers you're looking for while we're kicking back.

Thanks a bunch for your understanding and support!

Catch you on the flip side!

Warm regards,

TMS

Okay
  Public Ticket #3483717
logarithmic scale
Closed

Comments

  • Gurtner started the conversation

    Hello

    I need to make a graph with a logarithmic scale. 
    Do you have a procedure for this?
    I searched in the documentation, FAQ,, etc but I did not find it. Thank you for your help.

  •  1,692
    Miloš replied

    Hello,

    I will do my best to advise what you can try in order to achieve this with a custom callback.

    First, just to comment that a chart like this is not possible at the moment just with our built-in options.

    You can suggest this as a built-in feature for our developers, if you wish - and they will do their best, to add it in the future if possible.

    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.

    -

    At this time, maybe it can be done with a custom chart callback.

    If you wish, you can check our documentation about wpDataCharts callbacks

    • 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.

    -

    That being said, I recall another similar ticket where a user wanted to add an option to a Chart as 'logaritmic',

    so I will share what he did and he reported it was successful.

    -

    At first, the user's callback looked like this :

    <script type="text/javascript"> jQuery(window).on('load', function(){     if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }     wpDataChartsCallbacks[4] = function(obj){         obj.options.yAxis.type = 'logarithmic';         }   

      } }); </script>

    Then our devs checked it, and they fixed his code,

    there was one  "bracket" that was unneeded  " } "  in the code,  

    so the user had an error in the browser's Console;

    and the script was not applied.

    You can check in your browser Developer console if you try

    wpDataCharts[4].render_data.options.yAxis.type 

    It should say logarithmic,  if so that means it is being applied.

    Our devs are not sure if you need anything else regarding the visual/look,

    but you can find everything you need in our Documentation for developers here, 

    where our devs displayed the available hooks and parameters for them.

    -

    After that, the user was still not achieving the desired goal, but he came back and said this :

    I found the solution. The syntax for the callback should be

    obj.options.yAxis = {type:'logarithmic'};", not "obj.options.yAxis.type = 'logarithmic';".

    I've mplemented it for [wpdatachart id=6], and now I see what I expected to see in the webpage.

    -

    After this, another user came back, and commented : I implemented the syntax change in the front-end callback, so it now reads: [wpdatachart id=5]

    <script type="text/javascript"> jQuery(window).on('load',function(){      if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }      wpDataChartsCallbacks[5] = function(obj){     

         obj.options.xAxis = {

    type:'logarithmic' }; 

        } }); </script>

    This generates the correct logarithmic scaling, but now the X-axis series is ignored and only the row index of the data points are shown.   The data table has 10000 rows;  the series defining the X-axis ranges from 0.1 to 100.  So the ticks should start at 0.1 and go up to 100.  The tooltip also shows now that the X-axis series is just the row index.  (See attached.)   -

    4810735591.png

    Then he said this :

    By implementing this front-end callback, I was able to generate the correct plot: 


    <script type="text/javascript"> jQuery(window).on('load',function(){      if( typeof wpDataChartsCallbacks == 'undefined' ){ wpDataChartsCallbacks = {}; }      wpDataChartsCallbacks[5] = function(obj){          obj.options.plotOptions.series = {pointStart: .1, pointInterval: .01};         obj.options.xAxis = {type:'logarithmic' };     

    } }); </script>

    So the key thing is that a pointStart and interval must be specified. 

    This of course requires uniform spacing for the input series defining the X-axis.  

     -

    That is the best we have at the moment when it comes to custom examples and what another user managed to achieve, they said this worked for them. 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

  • Gurtner replied

    Thanks for the reply, I'll try your advice. Have a nice day

    André

  •  1,692
    Miloš replied

    Hello André,

    Just following up,

    No problem, i am happy to advise, we hope that our suggested custom example will work for you.

    Our developers will add more custom Chart Hook examples and Custom hook examples in general to our Documentation soon,

    so we hope that will help as well.

    Anything else that we could assist with, please don't hesitate to create 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