How can I show fixed xAxis scales

Is there any way I can set label on the horizontal scale with static values (not associated with data)?

e.g I had data for one year but for x scale label I want to show only 12 labels for each month, is there anyway to do that?

It’s posible to define template as follows:

xAxis:{
template:function(obj){
return “any value”;
}
},

But here obj is data object. For example obj.month returns month property of an object.

x-axis for vertical bar charts can be based only on properties of loaded objects, you can’t define some point on the scale for which data is not exists.

I have about 500 numbers of data to plot the chart. I did it.
I fixed the Y-scale as fixed (static)
yAxis:{
start:12,
step:1,
end:34
},
xAxis:{
title: ‘Age (Years)’,
lines:true
},
How can I do the same for X axis??. (Now it shows about 500 data getting overlapped in X-scale)

Please guide me.

You may set template for x-axis labels: some element you may return age property and empty string for others:

xAxis:{ title: 'Age (Years)', lines:true, template:function(obj){ if(obj.age%50==0) return obj.age; else return ""; } },

Thanks for the suggestion

Hi i do an array for controle the function
descripcion array position
0 = Active or inactive functionality
1= Max Separator
2= Counter

First do this global array

<script>
 var vXpar = new Array();
  vXpar[0]=1; vXpar[1]=4; vXpar[2]=0;

And them put in ur json structure

          xAxis:{ 
            title: 'Year',
            lines:true,
            template: function(obj){
              if(vXpar[0]>=1)
              { 
                  if(vXpar[2] == 0)
                  {
                     vXpar[2]++; 
                     return obj.peri;
                  }
                  else 
                  {  
                     vXpar[2]++;
                     if(vXpar[2] == vXpar[1])vXpar[2]=0;  
                     return ' ';
                  }
              }
              else return obj.peri;

            }
          },

prove changin the second position of array
like
vXpar[0]=1; vXpar[1]=3; vXpar[2]=0;
or
vXpar[0]=1; vXpar[1]=5; vXpar[2]=0;

Hi, please tell me How can i show X axis scales with step every 10 minutes if i load data from json in hh24:mi format …

Hi,

if for example the labels for xAxis are passed in “time” property of chart items, you may try to use the following:

xAxis:{ template:function(obj){ var t = obj.time; var minutes = parseInt(t.split(":")[1],10); if(minutes%10==0) return obj.time; else return ""; } },

Hi, tell me please can i show vertical lines on graf only for value
var minutes = parseInt(t.split(":")[1],10); but not for value “” ???

Hi,

Chart values should be numeric. Therefore, strings in hh24:mi format are not accepted. You need to convert them into numeric values. For example like so:

value:function(obj){ var arr = obj.time.split(":") return arr[0]*60+arr[1]*1 },

yAxis “template” can also be a function where you can return the desired values:

yAxis:{ template:function(value){ ... return ...; } }

thx