sonicboom
sonicboom

Reputation: 5028

HighCharts trouble with the x axis

I want the x axis of a HighChart to represent the Real Line.

Suppose I am modelling the constant function f(x) = 2 on the domain -3 <= x <= 3, where x is an integer.

I can do this by using the following chart as a series in HighCharts - [ 2, 2, 2, 2, 2, 2, 2 ]

However the x axis shows up in HighCharts as 1, 2, 3, 4, 5, 6, 7 - which makes sense as I never set any stipulations on the x axis!

So I then set the min and max of the axis to -3 and +3 respectively, thinking this would shift the function onto the correct domain.

The x axis now shows up as -3, -2, -1, 0, 1, 2, 3 - however the function still gets plotted over x = 1 to x = 7.

So how do I get the data to plot over the desired domain - -3 <= x <= 3?

Upvotes: 1

Views: 105

Answers (1)

Anto Jurković
Anto Jurković

Reputation: 11258

You can use pointStart to define x starting point:

    plotOptions: {
        series: {
            pointStart: -3
        }
    },

See example at jsfiddle

Upvotes: 1

Related Questions