Unable add ValueAxis property to Amchart stock graph

≯℡__Kan透↙ 提交于 2019-12-13 02:56:09

问题


I'm trying to add title to the first graph in a multiple stock graphs list. But it doesn't show up. Here is the code:

stockGraphs: [{
            id: "g1",
            valueField: "value",
            comparable: true,
            bullet: "round",
            valueAxis: [
            {
             title: "t1"
            }]
}]

Here is a demo


回答1:


As indicated in the documentation, the valueAxis property takes an id or a reference to the valueAxis object. You're trying to assign an array, which is way off.

You need to add an id to the valueAxes array inside your panel in your demo, then set the valueAxis property to the id as a string:

  valueAxes: [
    {
      id: "t1",
      title: "t1",
      maximum: 3000
    },{
      id: "t2",
      title: "t1",
      position: "right",
      maximum: 3000
    }
  ],
  stockGraphs: [
    {
      id: "g1",
      valueField: "value",
      comparable: true,
      bullet: "round",
      valueAxis: "t1"
    },{
      id: "g2",
      valueField: "value2dataset1",
      comparable: true,
      bullet: "round",
      valueAxis: "t2"
    }
  ],

Demo

I added a second value axis as assigning a value axis to a graph only helps if you need to display multiple value axes in a panel as all graphs will use the first value axis by default if it is not assigned.



来源:https://stackoverflow.com/questions/47668623/unable-add-valueaxis-property-to-amchart-stock-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!