我有一个XY图表,x轴从0到250,步长为50。

由于我的点之间用30隔开,因此我希望在网格和轴标签中的步长为30。

我想更改我的stepValueAxis属性,但是它是只读的。

我尝试设置"autoGridCount": false并增大"gridCount":在12,步长为20,在13,步长为50。有人说要更改labelFrequency,但是我看不到通过增大或减小其效果。

我怎么能得到这个?

最佳答案

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" : [],
                                },
                    });


希望这就是您想要的。.抱歉,上一次很着急,因此答案不清楚
javascript - Amchart XY x轴步长-LMLPHP

09-25 19:30