如何编辑 Amcharts X 轴?

How to edit the Amcharts X Axis?

我在使用以下库的 React 应用程序中使用 Amcharts amcharts3-react.

这是我的 Amcharts 配置:

export const arabicCharts = {
  "type": "serial",
  "theme": "light",
  "autoMarginOffset": 20,
  "graphs": [{
    "id": "g1",
    "balloonText": "[[value]]",
    "bullet": "diamond",
    "bulletBorderAlpha": 1,
    "bulletColor": "#FFFFFF",
    "hideBulletsCount": 50,
    "title": "red line",
    "valueField": "ay",
    "lineAlpha": 0.8,
    "lineThickness": 2,
    "lineColor": "#b0de09",
    "fillAlphas": 0,
    "useLineColorForBulletBorder": true
  }, {
    "id": "g2",
    "balloonText": "[[value]]",
    "bullet": "round",
    "bulletBorderAlpha": 1,
    "bulletColor": "#FFFFFF",
    "hideBulletsCount": 50,
    "title": "red line",
    "valueField": "by",
    "lineAlpha": 0.8,
    "lineThickness": 2,
    "lineColor": "#fcd202",
    "fillAlphas": 0,
    "useLineColorForBulletBorder": true
  }],
  "chartCursor": {
    "limitToGraph": "g1"
  },
  "categoryField": "date",
  "categoryAxis": {
    "parseDates": true,
    "axisColor": "#DADADA",
    "dashLength": 1,
    "minorGridEnabled": true
  },
  "valueAxes": [{
    "axisAlpha": 0,
    "position": "right",
  },{
    "axisAlpha": 1,
    "position": "bottom",
  }],
};

valueAxes 仅适用于 Y 轴通过添加他的标题。

为什么不应用于X轴? valueAxes second object 不工作。 谢谢

我已经在 Github 上回答了,但对于其他好奇的人(请注意,这与 AmCharts 3 有关):

AmCharts 3 中的系列图表只能有一个 horizontal/X 轴(如果设置了 rotate: true,则为 Y),并且该轴必须是类别轴,它不是完全数字的。您可以将第二个值轴设置为第二个 Y 轴(position: "left"position: "right"),但您还需要指定 ID 并将图表分配给它们,例如

graphs: [{
  // ...
  "valueAxis": "v1, //use right hand axis
}, {
  // ...
  valueAxis: "v2" //use left hand axis
}],
// ...
valueAxes: [{
  "position": "right",
  "id": "v1",
  // ...
}, {
  "position": "left",
  "id": "v2"
}]

如果您同时需要数字 X 轴和 Y 轴,请考虑改用 v3 的 XY 图表。