Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7803495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:36:02+00:00 2026-06-02T01:36:02+00:00

If I create column chart that has values that are > 0 but much

  • 0

If I create column chart that has values that are > 0 but much closer in value to each other than they are to 0 then the chart generated will have columns that look almost identical. See this jsFiddle.

However if I change the chart type to a line then the resulting chart is much nicer because the min yAxis value is calculated to a non-zero value so that the distribution of the values on the chart is much more obvious.

I could manually set a min yAxis value but I need this to work for any set of data and so it needs to be calculated. How could I achieve the same thing for a column chart?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:36:05+00:00Added an answer on June 2, 2026 at 1:36 am

    I’ve found where Highcharts calculates the min value for line charts (at least for linear axes). It’s in the getTickPositions() function. Specifically these lines of code:

    // pad the values to get clear of the chart's edges
    if (!categories && !usePercentage && !isLinked && defined(min) && defined(max)) {
        length = (max - min) || 1;
        if (!defined(options.min) && !defined(userMin) && minPadding && (dataMin < 0 || !ignoreMinPadding)) {
            min -= length * minPadding;
        }
        if (!defined(options.max) && !defined(userMax)  && maxPadding && (dataMax > 0 || !ignoreMaxPadding)) {
            max += length * maxPadding;
        }
    }
    

    So it calculates the min as

    length = ([max data value] - [min data value]) || 1
    min = [min data value] - length * minPadding
    

    The default for minPadding on the yAxis is 0.05 so

    394.5 = 395 - ((405 - 395) * 0.05)
    

    394.5 is rounded when creating the tick positions so the end result is 390.

    What I’ve come up with so far is this. (The minPadding default on the yAxis doesn’t seem to be exposed so I’ve hardcoded it)

    var data = [400,405,395];
    
    Array.max = function( array ){
        return Math.max.apply( Math, array );
    };
    Array.min = function( array ){
        return Math.min.apply( Math, array );
    };
    
    var min = Array.min(data);
    var max = Array.max(data);
    
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container',
            defaultSeriesType: 'column'
        },
        yAxis: {
            min: min - ((max-min) * 0.05)
        },
        series: [{
            data: data
        }]
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a new column in a MYSQL table that has Fn
I am trying to create a column chart that renders a linear gradient which
I have a table that has a column named 'languages', but it has the
I have SQL table that has a varchar(8) column that occasionally has binary data
I have done fastload for table which has more than one column (I did
My page has a chart that is set up to display data that is
I'm using the Chart library in .Net 4.0 to create a stacked column chart
I am trying to create an Entity that has a byte[12] id in hibernate.
The column which defined with char type in a create table sentence is defined
I have the column DateTimeExpired, and I would like to create another column called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.