Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts how to change x axis options

Tags:

highcharts

In Highcharts I want to change the default starting point from 0 to 1 is where can i find the option to change I have only data points so that are plotted on y axis and the x axis simply contain the default numbers ie 0,1,2, etc.. i want to change the starting point from 0 to 1

thanks in advance

like image 497
Abhijeet K Avatar asked Oct 16 '10 06:10

Abhijeet K


People also ask

How do I change the y axis values in Highcharts?

A simpler way to go about this is using the tickInterval attribute: yAxis: { title: { text: 'Percent' }, tickInterval: 10, labels: { formatter: function(){ return this. value + '%'; } } }, That will force your axis intervals to show up as you requested.

What is plot options in Highcharts?

The plotOptions is a wrapper object for config objects for each series type. The config objects for each series can also be overridden for each series item as given in the series array. Configuration options for the series are given in three levels. Options for all series in a chart are given in the plotOptions.

How do I change the width and height of a Highchart?

use chart. setSize(width, height, doAnimation = true); in your actual resize function to set the height and width dynamically.

How do I set margins in Highcharts?

Use the options marginTop , marginRight , marginBottom and marginLeft for shorthand setting of one option. By default there is no margin.


1 Answers

It's been a while since you've posted so I hope you've found your answer by now but I wanted to give you a response anyway.

You need to use the min option inside the X-Axis category. Read more about this here: http://api.highcharts.com/highcharts#xAxis

 xAxis: {
     min: 1,
     categories: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11']
 },

These options include the '0' as a category but the chart is drawn starting at the '1' position.

I put together a simple jsfiddle showing what you wanted to accomplish here: http://jsfiddle.net/L35DP/

like image 121
RoboKozo Avatar answered Sep 22 '22 05:09

RoboKozo