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 8573827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:20:22+00:00 2026-06-11T19:20:22+00:00

I would like to align the x-axis labels and flush left to y-axis on

  • 0

I would like to align the x-axis labels and flush left to y-axis on the left and flush right on the right to y-axis in the chart shown below:

enter image description here

Here is the relevant code for x-axis and y-axes series:

var chart2 = new Highcharts.Chart({
  chart: {
    renderTo: 'discount_chart',
    type: 'line'
  },
  title: {
    text: "#{title_text_sense}"
  },
  xAxis: {
    title: { text: 'Price Range - $' },
    categories: #{price_array},
    showLastLabel: true,
  },
  yAxis: [{
    min: 0,
    type: 'linear',
    title: { text: 'Rate of Return - %' }
  },{
    min: 0,
    type: 'linear',
    title: { text: 'Disc. N.Rev./Invest.(ROI)' },
    opposite: true
  }],

Note that the variables are read from database so the price_array which is used to define the x-axis contains these values for this example:

[“$60.00″,”$70.00″,”$80.00″,”$90.00″,”$100.00”]

Is there a way to do this in HighCharts?

Thanks.

Bharat

  • 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-11T19:20:23+00:00Added an answer on June 11, 2026 at 7:20 pm

    Thanks for your time. I really appreciate it. But I figured this out. Here is a fork of my original jsFiddle link that posted. It does exactly what I want to do. Basically, I removed the categories option in xAxis and then used the custom label formatter for xAxis; it did the trick for me. Below is

    my Highcharts JavaScript code to do this:

    var x_labels = ["$60.00","$70.00","$80.00","$90.00","$100.00"];
    var chart2 = new Highcharts.Chart({
        chart: {
            renderTo: 'discount_chart',
            type: 'line'
        },
        title: {
            text: "Big Wells 2 Economic Sensitivity Plot"
        },
        xAxis: {
            title: {
                text: 'Price Range - $'
            },
            labels: {
                formatter: function() {
                    return x_labels[this.value];
                }
            },
            showLastLabel: true,
        },
        yAxis: [{
            min: 0,
            type: 'linear',
            title: {
                text: 'Rate of Return - %'
            }},
        {
            min: 0,
            type: 'linear',
            title: {
                text: 'Disc. N.Rev./Invest.(ROI)'
            },
            opposite: true}],
        tooltip: {
            formatter: function() {
                var seriesName = {
                    'Rate of Return': 'ROR',
                    'Return on Investment': 'ROI'
                }[this.series.name];
                return '<b>' + this.series.name + '</b><br/>Price = ' + x_labels[this.x] + ', ' + seriesName + ' = ' + (Math.round(this.y * 1000) / 1000);
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -20,
            y: 100,
            borderWidth: 0
        },
        plotOptions: {
            series: {
                marker: {
                    enabled: false,
                    states: {
                        hover: {
                            enabled: true
                        }
                    }
                }
            }
        },
        series: [{
            name: 'Rate of Return',
            color: 'red',
            data: [-4.608072102337354, -0.738803860865155, 4.653294970652549, 8.92228974293352, 14.025752639875485],
            pointStart: 0},
        {
            name: 'Return on Investment',
            color: 'blue',
            data: [0.5863077142857144, 0.7098245714285715, 0.8340802857142857, 0.9587922857142858, 1.083803],
            pointStart: 0,
            yAxis: 1}]
    });
    

    jSFiddle Demo of above code to fork:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to align the values shown on the right of the bar
in the code below, i would like to align the text in the content
I would like to have jQuery append a style=text-align: left; to all elements on
I would like to left-align a table with CSS, in a way similar to
I would like to align a few line of text about the colon in
Would like to know the c# code to actually retrieve the IP type: Static
I would like to align the label of my search widget with the input
Possible Duplicate: How to Vertically Align a Table in CSS I would like to
I would like to vertically align some text and an image in a CSS
I would like to align my container div to center vertically just like it

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.