【问题标题】:How to set title of x-axis and y-axis name for amChart?如何为amChart设置x轴标题和y轴名称?
【发布时间】:2015-11-04 06:51:41
【问题描述】:

在 amChart 中,如何为图表的 X 轴和 Y 轴标题设置自定义名称(字符串)?

(横轴和纵轴)

var chart = AmCharts.makeChart( "chartdiv", {
  "type": "xy",
  "pathToImages": "http://www.amcharts.com/lib/3/images/",
  "dataProvider": chartData,
  "mouseWheelZoomEnabled": true,
  "graphs": [ {
    /*"bullet": "circle",
    "bulletSize": 8,*/
    "lineAlpha": 1,
    "lineThickness": 2,
    "fillAlphas": 0,
    "xField": "x",
    "yField": "y",
  } ],
} );

【问题讨论】:

    标签: javascript amcharts


    【解决方案1】:

    您可以为每个轴使用title 参数。不过,您需要将 valueAxes 定义添加到图表配置中。即使它们只包含title 参数。

    var chart = AmCharts.makeChart( "chartdiv", {
      "type": "xy",
      "pathToImages": "http://www.amcharts.com/lib/3/images/",
      "dataProvider": chartData,
      "mouseWheelZoomEnabled": true,
      "graphs": [ {
        /*"bullet": "circle",
        "bulletSize": 8,*/
        "lineAlpha": 1,
        "lineThickness": 2,
        "fillAlphas": 0,
        "xField": "x",
        "yField": "y",
      } ],
      "valueAxes": [ {
        "position": "left",
        "title": "Y axis"
      }, {
        "position": "bottom",
        "title": "X axis"
      } ]
    } );
    

    【讨论】:

      猜你喜欢
      • 2015-03-10
      • 1970-01-01
      • 2019-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 2021-07-29
      • 1970-01-01
      相关资源
      最近更新 更多