# Can I set arbitrary values for the minimum and maximum scale of the value axis?

Martynas Majeris -

Yes and no.

You can use valueAxis.minimum and maximum properties to set starting and ending value for your value axis.

However, those are just "suggestions". The chart will always struggle to adjust the scale of the value axis so that it displays "pretty" starting and ending values, as well as nice intermediate steps.

So if you set, say, the scale from 16 to 86. The chart most probably decide to go with the 10 and 90 instead.

Is there something I can do about it?

In a way, yes. You can increase the granularity of your value axis (by increasing its gridCount), so there are more steps and therefore smaller values can be used for start and end. Considering the above example you may do the following:

```var valueAxis = new AmCharts.ValueAxis();
valueAxis.autoGridCount = false;
valueAxis.gridCount = 50;
valueAxis.labelFrequency = 10; // since we increased the number of grid lines dramatically, let's make the label display only on each 10th of them```
Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

## Comments

• Nikolay Golub

It doesn't work for me. I just that values starts from 0.

I have this code:

var valuesAxis = new AmCharts.ValueAxis();

valuesAxis.axisColor = "#2d66bb";

valuesAxis.autoGridCount = false;

valuesAxis.integersOnly = false;

valuesAxis.gridCount = 100;

valuesAxis.minimum = 0;

valuesAxis.labelFrequency = 10;

Values are between 1 and 3.5. But amcharts ignores these options.

• Maciej Jaros

You nee to add the axis to the chart like so:

var valueAxis = new AmCharts.ValueAxis();

valueAxis.minimum = 0;

chart.addValueAxis(valueAxis);

Full code:

/**

* Bar chart.

*

* @param {Array} chartData [{title:"...", value:123}, ...]

* @param {String} containerId Container for the chart.

*/

this.bar = function(chartData, containerId) {

// SERIAL CHART

var chart = new AmCharts.AmSerialChart();

chart.pathToImages = "js/charts/amcharts/images/";

chart.dataProvider = chartData;

chart.categoryField = "title";

chart.colorField = "color";

chart.startDuration = 0;

chart.rotate = true;

// value-axis

var valueAxis = new AmCharts.ValueAxis();

valueAxis.minimum = 0;

chart.addValueAxis(valueAxis);

// column graph

var graph = new AmCharts.AmGraph();

graph.type = "column";

graph.title = "";

graph.valueField = "value";

graph.lineColor = colorScheme.start;

graph.lineAlpha = 0;

graph.fillAlphas = 0.85;

chart.addGraph(graph);

// WRITE

chart.write(containerId);

};

• Camilo Parra

Hi guys, I'm trying to set minimum with the minimum value of my dataset, but I don't know how. I have a bunch of graphics, since it displays the values in time for different stocks. So each time I call one stock it graphs its historic data. The problem is that all the graphs begins are rendered with the minimum value in 0. For example one of the graphics have values between 2800 and 3100. All the time the graph begins in 0 and ends in approximately 3500. The upper bound is OK, but I need to set the bottom to be in 2500 or something like that. It worked for me by setting the property valueAxis.minimum to 2500, but the problem is that the other stocks have different values, say between 20 and 1000, so I need to set the minimum value near the minimum dataset value. I don't know if I made myself clear.