• Resolved mintynz

    (@mintynz)


    Hi,
    I’ve got the following in my functions.php:

    function m_chart_chart_args( $chart_options, $library ) {
    	$chart_options['yAxis']['max'] = 3500;
    	return $chart_options;
    }
    
    add_filter( 'm_chart_chart_args', 'filter_m_chart_chart_args', 10, 2 );
    

    but it doesn’t seem to be setting that maximum.

    I’m trying to make a series of charts all use the same scale for yAxis.

    What am I doing wrong?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author methnen

    (@methnen)

    Hey,

    First question, are you using Highcharts or Chart.js?

    Thread Starter mintynz

    (@mintynz)

    @methnen Currently using Highcharts.

    Plugin Author methnen

    (@methnen)

    Ah, well looking at the code again I see the problem.

    function m_chart_chart_args

    Should be:

    function filter_m_chart_chart_args

    The second argument of the filter call should be the full name of the function that should be called.

    So either changes he name of the function match or change the filter call to match the name of the function.

    • This reply was modified 5 years, 1 month ago by methnen.
    Plugin Author methnen

    (@methnen)

    Also I see you got that code snippet from the wiki. So the mistake is all my fault. I’ve fixed it on the wiki as well.

    Thread Starter mintynz

    (@mintynz)

    That seems to have sorted it!

    You might need to update the code here that I based it on – I think both examples under FILTER HOOKS need tweaking ??

    https://github.com/methnen/m-chart/wiki/Action-and-filter-hooks#m_chart_chart_args

    Plugin Author methnen

    (@methnen)

    Yep, already done. ??

    Thread Starter mintynz

    (@mintynz)

    So the mistake is all my fault.

    Haha… easy tiger! I did actually look at that exact thing and thought “Oh, maybe filter hooks work differently to action hooks”, so it was easily my fault for not backing myself!

    Really appreciate the quick response, and I’m just happy to help with tweaking things that will make it better for everyone in the future ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Set a yAxis maximum’ is closed to new replies.