0
votes

I have a XY amcharts graph which x-axis go from 0 to 250, with a step of 50.

Since my points are separated with 30, I would like to have a step of 30 in the grid and in the axis labels.

I would like to change the step property of my ValueAxis, but it is read-only.

I tried to set "autoGridCount": false and to increase "gridCount" : at 12, step is 20, at 13, step is 50. Some say to change labelFrequency, but I saw no effect by increasing or decreasing it.

How could I get this ?

2
If I get you right, this could help you out. I'm not familiar with all the changes since then, so this might be out of date. - gerric

2 Answers

2
votes
var chart = AmCharts.makeChart("chartdiv", {

                      "type": "xy",
                      "dataProvider": json, 
                      "autoMargins": true,
                      "autoMarginOffset" : 10,      //Space left from axis labels/title to the chart's outside border, if autoMargins set to true.          
                      "valueAxes":
                      [                                         
                          {
                            "id":"my_y",
                            "minorGridEnabled" : true,
                            "title":"Y AXIS",
                            "autoGridCount": false,
                            "position": "left",
                            "tickLength":0,
                            "minimum":0,
                            "maximum":240,                          
                            "gridCount": 32, 
                            "labelFrequency" : 1.5,
                            "gridColor":"black",    // center y axis
                            "gridAlpha":0.50,       // grids visibily strength
                            "axisAlpha":0,          // default axis at right hidden
                          }, 
                          {
                            "id":"my_x",    
                            "minorGridEnabled" : true,                      
                            "title":"X AXIS",
                            "autoGridCount": false, 
                            "position": "bottom",                       
                            "tickLength":0,
                            // "gridThickness": 0.25,                           
                            "minimum": 0,
                            "maximum":240,
                            "gridCount": 32,

                            "labelFrequency" : 1.5,
                            "gridColor":"black",    // center x axis
                            "gridAlpha":0.50,       // grids visibily strength                  
                            "axisAlpha":0,          // default axis at bottom hidden
                            "strictGridCount" : true,
                          },                  
                      ],
                      "borderAlpha" : 0,    // opacity border of chart
                      "startDuration": 0,   // animation , 0 = no animation

                      "legend":[{                       
                        "useGraphSettings": false,
                        "verticalGap":0,
                      }],
                      "graphs": 
                      [                              
                          {
                            "id":"g1",

                            // "valueAxis": "v1",
                            "lineColor": "#FF6600",
                            // "bullet": "round",
                            "bulletBorderThickness": 1,
                            "hideBulletsCount": 30,
                            "animationDuration":0,
                            "bullet": "circle",
                            "colorField":"mycolor",
                            "valueField": "value",
                            "xField": "x",
                            "yField": "y",
                            "fillAlphas": 0,    // 0 to avoid creating filled polygon with bullets, default = 0
                            "bulletBorderAlpha": 0,
                            "minBulletSize": 30,
                            "maxBulletSize": 30,
                            "labelText":"[[x]]",
                            "labelPosition":"inside",
                            "markerType" : "none",
                            "switchable":false,
                          }, 

                      ],
                      "marginLeft": 20,
                      "marginBottom": 20,

                      "listeners": [
                              {
                                "event": "drawn",
                                "method": addLegendLabel
                              },                              
                              ],
                      "export": {
                                  "enabled": true,
                                  "menu" : [],  
                                },
                    }); 

Hope this is what you wanted.. sorry was in a hurry last time hence the unclear answer enter image description here

-1
votes

For me gridCount works. This is in my axis-

"autoGridCount": false, 
"minimum":-100,
"maximum":100
"gridCount": 21,

it gives a step of 10