darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

yAxis minimum weird problem

Hello,

I have a simple application that renders a graph. yAxis represents the rank of a blog.

Check http://ratified.org/graph/rank_graph.php?blog_id=2 and then check http://ratified.org/graph/rank_graph.php?blog_id=142

My question is : why on first link the yAxis starts from value 1 and for the second link, the starting value is 0 ?

I have set the minimum value using min variable and also setExtremes() however i see the value is not set correctly, its set to 1 depending on the data series? I use highcharts 1.2.6.

What i want to accomplish is to set the minimum value on yAxis to 1.

If anybody can help me i will definetely appreciate!

Thanks.
Darie Nicolae
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: yAxis minimum weird problem

Hi Darie,

The startOnTick option is by default set to true, that's why one of the charts extends the yAxis to 0, the closest tick. To prevent this, set startOnTick to false.
Torstein Hønsi
CTO, Founder
Highsoft
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Hello,

Thanks for the quick answer. This fixed the problem however the starting point on yAxis its not 1.

If you check again http://ratified.org/graph/rank_graph.php?blog_id=142 you'll see it starts from value 100 ?

Is it possible to set the first value to show 1 always?

Regards,
Darie Nicolae
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: yAxis minimum weird problem

Currently you can't do that - Highcharts will only show values on the ticks.

Edit: you can cut off the axis and put a static label on for the number 1, using http://www.highcharts.com/ref/#labels.
Torstein Hønsi
CTO, Founder
Highsoft
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Hello,

How exactly i can set the static label? I have tried smth like following and it doesnt work. Do i set the label only for value 1 or i need to set all the values from yAxis as labels?

yAxis: {
labels: {
items: [1]
},
tickPixelInterval: 40,
startOnTick: false,
gridLineWidth: 1,
min: 1,
allowDecimals: false,
reversed: true,
title: {
text: 'Rank'
}
},

Regards,
Darie Nicolae
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Actually the code ive posted was wrong. If you check now i got this using the label :

http://ratified.org/graph/rank_graph.php?blog_id=142

However this looks a bit awful. I didnt thought its so hard to make the yAxis to start from value 1.

For min: 2, it starts from value two. For min: 1 it starts from 0.. whats the idea?:)

Regards,
Darie Nicolae
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Is it possible to make the yAxis first value to be 1 ?!

If yes, how i can do that ? (without static labels)
If not, why not?!

An answer will definetely help me so i can take a decision if I will still use highcharts or not.

Thanks.
User avatar
not
Posts: 342
Joined: Mon Jun 07, 2010 2:01 pm

Re: yAxis minimum weird problem

Hi @darie,

here you have an example of using the xAxis.min/max and plotOptions.series.pointStart.
You will find the description of these options at http://www.highcharts.com/ref/#xAxis and http://www.highcharts.com/ref/#plotOptions-series.

I hope it will bring you round to stay with highcharts :)
Maciej Piecha,
ex Highcharts Support Team
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Thanks for the response, however this will not work correctly.

Try to do the following simple thing:

remove max: 5 from yAxis and replace the series data with data: [400,400,200,4].

You will see the yAxis will start from 0 and not from 1 (even if min is 1).

However ive been lookin into the source code and ive hardcoded to put the tickPositions[0] = 1. (It starts from 1, but something else gets broken).

It seems its kind of impossible to make the minimum value to be 1 when you have series of data containing numbers like 100,200,300, etc.

Let me know if you can help me with this cause i just can't get it done and i dont want to give up on highcharts

Thanks!
User avatar
not
Posts: 342
Joined: Mon Jun 07, 2010 2:01 pm

Re: yAxis minimum weird problem

There is an option: yAxis.startOnTick which lets you omit the 0 tick on yAxis in your example.
Look at this: http://jsfiddle.net/rwNkk/
Maciej Piecha,
ex Highcharts Support Team
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Yes, thats true.

But check my script how it looks in the end trying startOnTick:

http://ratified.org/graph/rank_graph.php?blog_id=142

The yAxis doesn't show great this way, i mean theres no starting point (not really profesional). I am doing this for a guy as a project and he doesn't like that at all.

I think in the end i will be forced by the client to use other chart cause (i don't like too but it seems i've got no choice).
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

I would like also to show you this (maybe you can give me a hint).

I have hardcoded tickPositions[0] to be 1. This is what i get : http://ratified.org/graph/rank_graph2.php?blog_id=142

yAxis is good but the first column from xAxis (Jul 12) doesn't show up, (this happens if i set tickPositions[0] = 1).

Do you know maybe if i can get a fix for this?

Thanks
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: yAxis minimum weird problem

Try a conditional:

Code: Select all

if (!isXAxis) {
	tickPositions[0] = 1;
}
Torstein Hønsi
CTO, Founder
Highsoft
darie
Posts: 11
Joined: Tue Jul 13, 2010 4:25 pm

Re: yAxis minimum weird problem

Doh, i feel stupid.

http://ratified.org/graph/rank_graph.php?blog_id=142

Finally it shows perfect.

Thanks a lot for all the help and i really appreciate it! Maybe there should be a forcedMin setting in the future.
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Re: yAxis minimum weird problem

Maybe there should be a forcedMin setting in the future.
Actually I think what you want is an option to show a tick and a tick label for the minimum, regardless of whether it is a "round" number or not. In your case, the minimum is correct, you only missed the tick label.
Torstein Hønsi
CTO, Founder
Highsoft

Return to “Highcharts Usage”